Computer Organisation PDF
Document Details
Uploaded by Deleted User
Tags
Summary
This document provides an overview of computer organization, covering topics such as different hardware components, instruction formats, Harvard and von Neumann architectures, and different types of number systems. It also touches on concepts such as addressing modes, instruction cycles, and different CPU components for the user to reference.
Full Transcript
## Computer Organisation ### What is Computer Organisation? - It is defined as the study of different hardware components of a computer system that are interconnected and organised properly. The entire fact is called **Computer Organisation**. ### What is the Modern Existing Process? - We know t...
## Computer Organisation ### What is Computer Organisation? - It is defined as the study of different hardware components of a computer system that are interconnected and organised properly. The entire fact is called **Computer Organisation**. ### What is the Modern Existing Process? - We know that the modern existing process (i.e. 13th generation Intel CPU, Windows 11) consist of the current operating system and CPU that is operating on 64 bits. It can be said that it can be transformed from any component to another component. ### Distinguishing Between Data, Information, and Instruction - Data is nothing but a raw value. It may be numerical or categorical. - Information means meaningful data. - Instructions are every line of the code on the command or system instruction. ### How the System Will Recognise Instruction? - The system will recognise instruction through the following format: - **OP:** Instruction format. - **Code:** Operational codes. - **Operand:** Data. - **Addressing:** Addressing modes. ### Every Instruction has Their Corresponding Op Code - Every instruction has their corresponding Op Code. i.e. it needs to be decoded and then the system will come to know what type of instruction it is. After that, the system needs to get the data or operand. This is why operand address is there in the instruction format. Afterward, the system will try to get the value from A and B. It will be determined by addressing mode. ### von Neumann Machine - In a von Neumann machine, data and instruction are stored in the same memory. - Data, instruction, and memory are interconnected. - The output goes to the input, and the input goes to the output. ### Harvard Architecture - In Harvard architecture, data and instruction are stored in separate memory. - Instruction and memory are interconnected. - The output goes to the input, and the input goes to the output. ### The First Architecture - The first architecture was proposed by John Von Neumann. Here, data as well as instruction will be kept in the same memory block. - This concept is also called Stored Program Concept. - When CPU requires instruction, it will directly fetch from memory but CPU requires data as well as instruction. - There will be collision sometimes. - This concept is called Von Neumann Bottleneck. ### To Overcome From Von Neumann Bottleneck, Harvard Architecture - To overcome from Von Neumann Bottleneck, Harvard architecture was proposed. Here, there will be two different memory modules, one for instruction data, and one for data memory. When CPU requires instruction, it will fetch from instruction memory, else it will fetch from data memory. ### Register in CPU - The fastest unit located inside the CPU. There are two kinds of registers available. - **General Purpose Registers:** One of the kinds of registers available. - **Special Purpose Registers:** One of the kinds of registers available. - Some examples of special purpose registers are: - **Program Counter (PC):** Holds the address of the next instruction to be executed. - **Stack Pointer (SP):** Stack pointer. ### Instruction Format - Instruction format has three components: - **Op Code:** Type of instruction. - **Address of Operand:** Address of operand. - **Addressing Mode:** Addressing mode. ### Instruction Format Always Varies From Processor to Processor - Instruction format always varies from processor to processor. ### Initial Step Sequence - In the initial step sequence, the counter has been initialized with value zero (0). The address of the first instruction is under PC. The address from PC will be transferred to AR, and the address from PC will be transferred to IR. Then, PC will be simultaneously incremented by 1. ### Process of Decoding - At T2, the instruction will be decoded. It will be checked for the value inside the addressing mode. If it is zero, then there would be a memory reference, else it will be a register reference. Then the system will check the value of AM (addressing mode). If it is zero, then the operand value directly will be fetched from memory, else it will be fetched from the register. ### The Last Instruction - Finally, the instruction will be executed, and it will be written back to either memory or register. ### Number System - There are different kinds of number systems. They include: - **Binary:** 0, 1. Base 2. - **Octal:** 0-7. Base 8. - **Decimal:** 0-9. Base 10. - **Hexadecimal:** 0-9, A-F. Base 16. - Radix contains the base of the number system ### Converting From Decimal - There are different ways to convert decimal numbers into other number systems. - **Decimal to Binary:** Divide the decimal number by 2 repeatedly until the quotient is 0. Then, write down the remainders in reverse order. - **Decimal to Octal:** Divide the decimal number by 8 repeatedly until the quotient is 0. Then, write down the remainders in reverse order. - **Decimal to Hexadecimal:** Divide the decimal number by 16 repeatedly until the quotient is 0. Then, write down the remainders in reverse order. ### Converting From Other Number Systems - Here is how to convert from other number systems to decimal. - **Binary to Decimal:** Multiply each digit of the binary number by its corresponding power of 2, and then add the results. - **Octal to Decimal:** Multiply each digit of the octal number by its corresponding power of 8, and then add the results. - **Hexadecimal to Decimal:** Multiply each digit of the hexadecimal number by its corresponding the power of 16, and then add the results. ### Converting Other Number Systems to Non-Decimal - There are different ways to convert from other number systems to non-decimal systems. - **Octal to Binary:** For each digit in the octal number, convert it to its binary equivalent. - **Hexadecimal to Octal:** Convert each digit of the hexadecimal number to its equivalent binary number. ### ShortCut Method - There is a shortcut to convert binary to decimal numbers. ### Booth's Multiplication Algorithm - This algorithm is used to multiply signed integers. - **Start:** - Quotient (Q1) = 0. - Multiplicand (B) = B. - Multiplier (Q) = Q. - Sequence Counter (SC) = number of bits in multiplier. - **Steps:** - If (Q0, Q1) = 01, then A <- A + B - If (Q0, Q1) = 10, then A <- A - B - Shift A, Q right by 1 bit - SC <- SC - 1 - **Repeat** the steps above until SC = 0. - **Stop**: When SC is 0. ### Instruction Cycle - The instruction cycle consists of five stages: - **Instruction Fetch:** The instruction is fetched from memory. - **Instruction Decode:** The instruction is decoded. - **Operand Fetch:** Operand is fetched from memory. - **Execute:** The instruction is executed. - **Write Back:** The result of the execution is written back to memory. ### Addressing Modes - **Immediate Addressing:** The operand is an immediate value. - **Register Direct Addressing:** The operand is the content of a register. - **Register Indirect Addressing:** The operand is the content of a memory location whose address is stored in a register. - **Memory Direct Addressing:** The operand is the content of a memory location. - **Memory Indirect Addressing:** The operand is the content of a memory location whose address is stored in a memory location. - **Relative Addressing:** The operand is the content of a memory location whose address is relative to the current program counter. ### Classification of Instructions - Three types of instructions are classified. - **Three Address Instruction:** It is called three address instruction when the three times memory referencing is occurring for any instruction. - **Two Address Instruction:** It is called the two address instruction when the two times memory referencing is occurring for any instruction. - **One Address Instruction:** It is called one address instruction when the one time memory referencing is occurring for any instruction. ### CPU Bound Instruction - Every instruction of any program is, by default, a CPU bound instruction, because not every instruction is also I/O bound because microprocessors programs follow I/O. ### Arithmetic and Logic Unit (ALU) - It performs arithmetic and logic operations. - A 32-bit ALU is made up of 32 1-bit ALUs, which are interconnected in parallel. - The output of each 1-bit ALU is connected to a multiplexer and the output of the multiplexer is used to generate the final result. ### Ripple Carry Adder - A ripple carry adder is a simple and efficient way to add multiple bit numbers. It works by cascading full adders in a chain. The output of the carry bit from the previous full adder is used as the input carry bit to the next full adder. - The carry bit is rippled through each adder. - It is known as a ripple carry adder because the carry bit ripples through the adder bits. ### CPU Architecture - The CPU architecture defines the structure of the CPU. It includes the components of the CPU and how they are interconnected. - The diagram provides information about how data is processed inside a CPU: - **ALU**: The arithmetic and logic unit (ALU) performs all the arithmetic and logic operations. - **Accumulator:** It stores the result of the operation performed by the ALU. - **Instruction Register (IR):** This is a temporary register to temporarily hold the instruction being decoded or executed. - **Program Counter (PC):** Keeps track of the next instruction to be executed. - **Memory Data Register (MDR):** A buffer for data being transferred between the CPU and the memory. - **Memory Address Register (MAR):** A register that stores the address of the memory location being accessed. - **Control Unit:** The control unit controls the entire CPU, including the ALU, the registers, and the memory. It also manages the instruction cycle. - **Serial I/O Controller:** The serial input/output (I/O) controller connects the CPU to the serial devices. - **Stack Pointer:** The pointer to the stack. - **Interrupt Controller:** It handles interrupts. - **Timer:** Generates and holds timing information. ### Control Unit - The **control unit** generates control signals to perform various operations inside the CPU. - It does this by interpreting the instructions from the instruction register (IR). - Without the control unit, the CPU can't do anything. ### Micro-Programmed Control Unit - The control unit can be implemented using different techniques. One of these techniques is **microprogramming**. - Microprogramming is a technique that can be used to design control units for computers. - Each instruction is broken down into simpler micro-instructions. - The micro-program is a sequence of micro-instructions. - **Advantages:** - It's more flexible than hardwired control. - This method allows the control unit to be easily modified. ### Memory Organisation - In general, memory organisation can be divided into two parts. - **Memory Hierarchy:** - This includes the different levels of memory that the CPU can access. - It reflects the speed and size relationships of memory. - The hierarchy is: - **Registers:** The fastest type of memory. - **Cache:** A smaller, fast memory that stores frequently accessed data. - **Main Memory:** The largest and slowest type of memory. - **Secondary Storage:** The slowest and largest storage. This is where the data is stored permanently. - **Memory Classification:** - **Read-Only Memory (ROM):** Data can only be read, not written. - **Read/Write Memory (RAM):** Data can be both read and written. ### Types of RAM - There are two types of RAM: - **Dynamic RAM (DRAM):** DRAM uses capacitors to store information and a refresh circuit is needed to replenish the data in the capacitors. - **Static RAM (SRAM):** SRAM uses latches to hold data. It is faster than DRAM but less density. ### Connecting RAM and ROM - The CPU can access both RAM and ROM. - **Accessing RAM:** - The number of address lines required to access a RAM chip will depend on its size. - For a 128x8 KB (1024 bytes) RAM chip, you will need 7 address lines. - **Accessing ROM:** - The number of address lines needed for a ROM chip will depend on its size. - For a 512 x 8 KB (4096 bytes) ROM chip, you will need 12 address lines. ### Memory Organization Diagram - The diagram demonstrates the connection between a CPU, a RAM chip, and a ROM chip. - CPU address lines are 16 bits, allowing for a 64 KB address space. - RAM (128 x 8 KB) requires 7 address lines. - ROM (512 x 8 KB) requires 12 address lines. - The address lines are connected to decoders. - The output of each decoder is connected to the corresponding memory chip's address pins. ### Parallel Processing Architecture - This architecture allows for the processing of multiple instructions simultaneously. - In **multiprogramming**, multiple programs are loaded into memory. The CPU switches between the programs to utilize the available processing time efficiently. The programs run concurrently, allowing for better resource utilization. ### Multi-Core Architecture - Today, the CPU can also have multiple cores. - This means the CPU has more processing power. - Each core independently executes instructions. ### Instruction Pipeline - This technique allows multiple stages of instruction execution to overlap. This leads to significant improvements in performance. - The overlap is achieved by breaking down the instruction cycle into multiple stages. Each stage is responsible for a specific task. - For example, the first stage fetches the next instruction while the second stage decodes the current instruction. - This overlap makes instruction execution faster. ### Micro-Programmed Control Unit Explained - Micro-programmed control units use a set of microinstructions to control the CPU. The microinstructions define the sequence of steps that the CPU must take to execute each instruction. - The micro-instructions are stored in a memory called the control memory. - The control unit reads the micro-instructions from the control memory and executes them. To execute an instruction, it generates control signals to different components of the CPU, such as the ALU and registers. ### Micro-Programmed Vs. Hardwired Control Unit - The micro-programmed control unit provides flexibility as it can easily be modified. This can be done by changing the micro-program in the control memory. It's easier to modify the software than to change the hardware. - The Hardwired control unit is made up of logic circuits, so it is faster.