Computer Organization and Architecture Notes
UNIT-I: Syllabus
- Digital Computers:
- Introduction
- Block diagram of a digital computer
- Definition of Computer Organization, Computer Design, & Computer Architecture
- Register Transfer Language & Micro operations:
- Register Transfer Language
- Register Transfer Bus & Memory Transfers
- Arithmetic micro operations
- Logic micro operations
- Shift micro-operations
- Arithmetic logic shift unit
- Basic Computer Organization and Design:
- Instruction codes
- Computer registers
- Computer Instructions
- Timing and control
- Instruction cycle
- Memory Reference Instructions
- Input-output and Interrupt
CS304 PC: Computer Organization & Architecture
- Course Objectives:
- Introduce computer organization of basic digital computer architectural concepts.
- Begin with basic organization, design, & programming of a simple digital computer & introduces simple register transfer language to specify various computer operations.
- Topics include computer arithmetic, instruction set design, microprogrammed control unit, pipelining of vector processing, memory organization, I/O systems, & multiprocessors.
- Course Outcomes:
- Understand the basics of instruction sets & their impact on processor design.
- Demonstrate an understanding of the design of the functional Units of a digital computer system.
- Evaluate cost performance & design trade-offs in designing & constructing a computer processor, including memory.
- Design a pipeline for consistent execution of instructions with minimum hazards.
- Recognize & manipulate representations of numbers stored in digital computers.
UNIT-I Principles of Digital Computers
- Computer Definition:
- An electronic device capable of:
- Accepting data
- Processing data according to given instructions
- Storing data
- Presenting and communicating data over networks
- An electronic device capable of:
- Two broad classes of computers based on input data:
- Analog computers
- Digital computers
- Analog Computers:
- Electronic devices capable of accepting data in analog or time-varying form for processing.
- Digital Computers:
- A digital system that performs various computational tasks.
- An electronic device capable of accepting data in digital form for processing.
- Uses the binary number system, which has two digits: 0 and 1.
- A binary digit is called a bit.
- Information is represented in digital computers in groups of bits.
- Computer System Functional Entities:
- Hardware
- Software
Computer Hardware and Software
- Hardware:
- Electronic components & electro-mechanical devices that comprise the physical entity of the device.
- Major parts:
- CPU (Central Processing Unit)
- RAM (Random Access Memory)
- I/O (Input-Output) devices
- Software:
- Instructions & data that the computer manipulates to perform various data-processing tasks.
- Program: A sequence of instructions for the computer.
- Database: Data that is manipulated by the program.
- Block diagram of a digital computer components:
- CPU
- RAM
- I/O devices
Computer Hardware Details
- Hardware Parts:
- CPU (Central Processing Unit):
- Arithmetic and Logic Unit (ALU) for manipulating data
- Registers for storing data
- Control circuits for fetching and executing instructions
- RAM (Random Access Memory):
- Storage for instructions & data.
- Any location in memory can be accessed at random within a fixed interval of time.
- Input & Output Processor (IOP):
- Electronic circuits for communicating and controlling the transfer of information between the computer and the outside world.
- Input & output devices include keyboards, printers, terminals, magnetic disk drives, & other devices.
- CPU (Central Processing Unit):
- Computer Organization:
- Concerned with how the hardware components operate & are connected to form the computer system.
Computer Design and Architecture
- Computer Design:
- Concerned with the hardware design of the computer.
- Determines what hardware should be used and how the parts should be connected.
- Computer Architecture:
- Concerned with the structure and behavior of the computer as seen by the user.
- Specifies the various functional modules such as processors, memories, & structuring them together into a computer system.
- Register Transfer Language and Micro operations:
Register Transfer Language (RTL)
- Digital system design uses a modular approach.
- Modules are constructed from digital components like registers, decoders, and control logic.
- Modules are interconnected with common data & control paths to form a digital computer system.
- Micro operations:
- Operations are executed on data stored in registers.
- The result of the operation may replace the previous binary information of a register or may be transferred to another register.
- Examples of micro operations: shift, count, clear, etc.
- Internal hardware organization of a digital computer is defined by specifying:
- The set of registers it contains and their function.
- The sequence of microoperations performed on the binary information stored in the registers.
- The control that initiates the sequence of micro-operations.
- Register Transfer Language:
- Symbolic notation used to describe the micro-operation transfers among registers.
- A system for expressing in symbolic form the micro operation sequences among the registers of a digital Module.
Register Transfer Details
- Computer registers are defined by capital letters to denote the function of the register.
- Memory Address Register (MAR):
- The register that holds an address for a memory unit.
- Other register designations:
- PC (Program Counter)
- IR (Instruction Register)
- R1 (Processor register)
- Information transfer from one register to another is designated in symbolic form by means of a replacement operator.
- :
- Denotes a transfer of the content of register R1 into register R2.
- Control function:
- A Boolean variable that is equal to '1' or '0'.
- If then
- The transfer operation is executed by the hardware only if .
Control Circuit and Bus Transfers
- Control Circuit:
- Includes a control function , registers and , and a clock.
- Bus and Memory Transfers:
- A more efficient way for transferring information between registers in a multiple-register configuration is a common bus system.
- Bus structure: A set of common lines, one for each bit of a register, through which binary Information is transferred one at a time.
- One way of constructing a common bus system is with multiplexers.
Bus System with Multiplexers
- Multiplexers are used to construct a common bus system.
- Selection lines and are connected to the selection inputs of all four multiplexers.
- Selection lines choose the four bits of one register & transfer them into a 4-line common bus.
- When , the '0' data inputs of all four multiplexers are selected & applied to the outputs that form the bus.
Three-State Bus Buffers
- A bus system can be constructed with three-state gates instead of multiplexers.
- Three-State Gate:
- A digital circuit that exhibits three states.
- Two states are signal equivalents to logic 1 or 0 like a conventional gate.
- The third state is a high-impedance state.
- High-Impedance State:
- Behaves like an open circuit.
- The output is disconnected and does not have a logic significance.
- Three-state gates may perform any logic function such as AND or NAND; however, the most commonly used in the design of a bus system is the buffer gate.
- Normal input A, control input C.
- Output if
- High Impedance if
Memory Transfer Operations
- The operation of a memory circuit is to transfer information from a memory word to the outside world.
- This transfer is called a read operation.
- The transfer of new information to be stored into the memory is called a write operation.
- Read:
- DR = Data Register
- AR = Address Register
- M = Memory
- Write:
- = Register
Arithmetic Micro-operations
- A micro operation is an operation performed with the data stored in registers.
- These are classified into 4 categories:
- Register transfer Micro operation: Transfers binary information from one register to another.
- Arithmetic micro-operations: Perform arithmetic operations on numeric data stored in registers.
- Logic micro-operations: Perform bit manipulation operations on non-numeric data stored in registers.
- Shift micro operations: Perform shift operations on data stored in registers.
- Add Micro operation:
- Subtract Microoperation:
- is the symbol for the 1's complement of .
Arithmetic Micro Operations Summary
| Symbolic Designation | Description |
|---|---|
| R1 plus R2 transferred to R3 | |
| Contents of R1 minus R2 transferred to R3 | |
| Complement the contents of R2 (1's complement) | |
| 2's complement the contents of R2 (negate) | |
| Increment the contents of R1 by one | |
| Decrement the contents of R1 by one |
Binary Adder Circuit
- The digital circuit that forms the arithmetic sum of two bits & a previous carry is called a full-adder.
- The digital circuit that generates the arithmetic sum of two binary numbers of any length is called a binary adder.
- A 4-bit binary adder is implemented using four full adders (FA) in cascade:
- Inputs:
- Outputs:
Adder-Subtractor Circuit
- Addition & subtraction operations can be combined into one common circuit by including Ex-OR gates with each full-adder.
- The mode input M controls the operation:
- When , the circuit is an adder.
- When , the circuit is a subtractor.
- Each Ex-OR gate receives input M & one of the inputs of B.
- When , we have . The full-adders receive the value of B, the input carry is '0', & the circuit performs A plus B.
- When , we have and . The inputs of B are all complemented, and 1 is added through the input carry.
- The circuit performs the operation A + 2's complement of B.
Binary Incrementer
- The increment microoperation adds one to a number in a register.
- Example:
- If a 4-bit register has a binary value 0110, it will become 0111 after it's incremented.
- This microoperation is easily implemented with a binary counter.
- Every time the count enable is active, the clock pulse transition increments the contents of the register by one.
- A 4-bit binary incrementer can be implemented using half adders (HA).
Arithmetic Circuit
- The basic component of an arithmetic circuit is a parallel adder.
- By controlling the data inputs to the adder, it's possible to obtain different types of arithmetic operations.
- The output of the binary adder is calculated from the following arithmetic sum:
Arithmetic Circuit Function Table
| Select | Select | Input | Output | Micro operation | |
|---|---|---|---|---|---|
| 0 | 0 | 0 | Add | ||
| 0 | 0 | 1 | Add with carry | ||
| 0 | 1 | 0 | Subtract with borrow | ||
| 0 | 1 | 1 | Subtract | ||
| 1 | 0 | 0 | 0 | Transfer A | |
| 1 | 0 | 1 | 0 | Increment A | |
| 1 | 1 | 0 | 1 | Decrement A | |
| 1 | 1 | 1 | 1 | Transfer A |
Logic Micro Operations
- Logic micro operations specify binary operations for strings of bits stored in registers.
- These operations consider each bit separately & treat them as binary variables.
- Example:
- content: 1010
- content: 1100
- content after P: 1000
Boolean Functions and Logic Micro-operations
| Boolean Function | Micro-operation | Name |
|---|---|---|
| Clear | Clear | |
| AND | ||
| Transfer A | Transfer A | |
| Transfer B | Transfer B | |
| Ex-OR | ||
| OR | ||
| NOR | ||
| Ex-NOR | ||
| Complement B | ||
| Complement A | ||
| NAND | ||
| Set to all 1's |
- Although there are 16 logic micro operations, most computers use only four - AND, OR, XOR & complement - from which all others can be derived.
Logic Circuit
- Logic Diagram
- Multiplexer with select inputs , , and enable input
- Functional Table for One Stage of Logic Circuit:
- | Output | Operation
- 0 0 | | AND
- 0 1 | | OR
- 1 0 | | XOR
- 1 1 | | Complement
Shift Micro operations
- Used for serial transfer of data.
- Also used in conjunction with arithmetic, logic, and other data-processing operations.
- The contents of a register can be shifted to the left or the right.
- During shift-left operation, the serial input transfers a bit into the rightmost position.
- During shift-right operation, the serial input transfers a bit into the leftmost position.
- Logical Shift:
- Transfers 0 through the serial input.
- Symbols shl and shr are used for logical shift left & shift right microoperations.
- Examples:
Circular Shift (Rotate)
- Circular Shift (rotate):
- Circulates the bits of the register around the two ends without loss of information.
- Arithmetic Shift:
- Shifts a signed binary number to the left or right.
- Arithmetic shift-left multiplies a signed binary number by 2.
- Arithmetic right shift divides the number by 2.
- Shift Micro Operations Summary:
- (Shift left register R)
- (Shift Right register R)
- (Circular Shift left Register R)
- (Circulas Shift Right Register R)
- (Arithmetic shift left R)
- (Arithmetic shift Right R)
Combinational Circuit Shifter
- 4-bit combinational circuit shifter
- Select: 0 for shift right (down), 1 for shift left (up)
- Inputs:
- Outputs:
- Functional Table:
- Select (S) | | | |
- 0 | | | |
- 1 | | | |
Arithmetic Logic Shift Unit
- Instead of having individual registers performing the microoperations directly, computer systems employ a number of storage registers connected to a common operational Unit called an ALU.
- ALU performs an operation & the result is then transferred to a destination register.
- The operations through ALU are performed in one-clock pulse period.
- Shift microoperations are often performed in a separate unit, but sometimes the shift unit is made part of the overall ALU.
Basic Computer Organization and Design
- A computer instruction is a binary code that specifies a sequence of micro operations for the computer.
- A computer reads each instruction from memory and places it in a control register.
- The control then interprets the instruction & proceeds to execute it by issuing a sequence of micro operations.
Instruction Codes
- An instruction code is a group of bits that instruct the computer to perform a specific task.
- It's usually divided into parts, each having its own interpretation.
- Operation code (opcode)
- Operands.
- Operation Code (Opcode):
- A group of bits that define each operation, such as add, subtract, multiply, shift & complement.
- Must consist of at least 'm' bits for a given distinct operations.
- The Control Unit decodes the Opcode & do the required operation.
- Operands:
- The operation must be performed on some data stored in processor registers or in memory.
- Each computer has its own particular instruction code format.
Instruction Code Formats
- The opcode specifies the operation to be performed, and the address specifies the address of the instruction (or data).
- The Basic computer has three instruction code formats.
- The opcode part of the instruction contains three bits, and the meaning of the remaining bits depends on the operation code (op code).
- The three Instruction code formats are:
- Memory - Reference Instruction
- Register - Reference
- Input/output Reference
- The Instruction format will have opcode & address part.
- Address will be of three types:
- Immediate
- Direct Address
- Indirect Address
Addressing Modes - Immediate and Direct
- Immediate Address:
- The address bits of an instruction code specify the actual operand
- Direct Address:
- The address of the location of the operand is given explicitly as a part of the instruction
- Example:
MOVE A, 2000- Copies the contents of memory location 2000 into register A.
- Accumulator (AC):
- Computers that have a single-processor register usually assign to it the name accumulator (AC).
- This is the special register where the result is accumulated and is commonly known as Ac.
- Effective Address:
- Generated by adding a constant value called offset to the contents of a register.
- Offset = contents of Instruction Register
Addressing Mode - Indirect Address
- Indirect Address:
- When a part of the instruction specifies the address of the memory from where we get the address of the operand, the instruction is said to have an indirect addressing mode.
- Computer Registers:
- Computer instructions are normally stored in consecutive memory locations & are executed sequentially, one at a time.
- The control reads an instruction from a specific address in memory & executes it.
Computer Registers for Basic Computer
- List of Registers for the Basic computer:
| Symbol | No. of bits | Register Name | Function |
|---|---|---|---|
| DR | 16 | Data Register | Holds Memory operand |
| AR | 12 | Address Register | Holds Address for memory |
| AC | 16 | Accumulator | Processor register |
| IR | 16 | Instruction Register | Holds instruction code |
| PC | 12 | Program Counter | Holds address of instruction |
| TR | 16 | Temporary Register | Holds temporary data |
| INPR | 8 | Input Register | Holds input character |
| OUTR | 8 | Output Register | Holds output character |
- The memory circuit has a capacity of 4096 words of each word contains 16 bits.
- 12 bits are needed to specify the address of a word in memory.
- 3 bits for the operation part of the instruction & a bit to specify a direct or indirect address.
Basic Computer Registers Details
- Memory Address Register (AR):
- Has 12 bits.
- Holds the address of memory for storage.
- Program Counter (PC):
- Has 12 bits.
- Holds the address of the next instruction to be read from memory.
- The PC goes through a counting sequence & causes the computer to read sequential instructions previously stored in memory.
- INPR + OUTR (Input Register & Output Register):
- Two registers used for I/O.
- The input register receives an 8-bit character from an input device.
- The output register holds an 8-bit character for an output device.
- Instruction Register (IR):
- Once an instruction is fetched from memory, it is stored in the Instruction register (IR).
- The control Unit takes Instruction from this register, decodes & executes it by signals to the appropriate component of computer to carry out the task.
Accumulator, Data Register, and Temporary Register
- Accumulator Register (AC):
- Located inside the CPU.
- Used during arithmetic & logical operations.
- Stores data values fetched from main memory.
- Holds the initial data, intermediate results, & final results of operations.
- The final result is transferred to MM (Memory Module) through MBR (Memory Buffer Register).
- Data Register (DR):
- A register used in microcomputers to temporarily store data being transmitted to or from a peripheral device.
- Temporary Register (TR):
- Used for holding temporary data during processing.
Common Bus System
- A collection of wires that carry some multi-bit information is known as a bus.
- Its main purpose is to transfer Information from one system to another.
- Registers connected to a 16-bit common bus:
- DR, AC, IR, TR (16-bit registers)
- AR, PC (12-bit registers)
Common Bus Operations and Control Signals
- Load (LD):
- Lines from the common bus are connected to the inputs of each register.
- The particular register whose LD signal is enabled receives the data from the bus.
- Increment (INR) & Clear (CLR):
- The contents of a particular register are incremented when its INR signal is enabled & cleared when its CLR signal is enabled.
- Memory Circuit:
- The memory receives the 16-bit information from the bus when its write input is enabled.
- The memory places its 16-bit information onto the bus when its read input is activated and .
- Address Register (AR):
- This register specifies the address in memory for the next read or write operations.
Common Bus Register Operations
- Program Counter (PC):
- PC has 12 bits & it holds the address of the next instruction to be read from memory after the current instruction is executed.
- When , the PC receives or transfers the address from/to the bus when its input is enabled.
- Data Register (DR):
- This register contains the data to be written into memory or receives the data read from memory.
- When , the DR receives/ transfers data from/to the bus when its input is enabled.
- Accumulator (AC):
- The processor register Ac consists of 16 bits.
- Instruction Register (IR):
- To hold the instruction, processor executes, when , the IR receives instruction code from bus when its input is enabled.
- Temporary Register (TR):
- This is a 16 bits register & provides temporary storage of variables or results
- INPR (Input Register)
- OUTR (Output Register)
Computer Instructions and Formats
- Instruction Format:
- An Instruction format or Instruction code is a group of bits used to perform a particular operation on the data stored in computer.
- A processor fetches an instruction from memory & decodes the bits to execute the instruction.
- Different computers may have their own instruction sets.
- Instruction code is divided into two parts:
- operation code
- address of data
- operation code consists group of bits to define an operation such as add, subtract, multiply etc.
- In an instruction format:
- 1st 12 bits (0-11) specify an address
- Next 3 bits specify the addressing mode
- left most bit specify the addressing mode I.
- for direct address
- for Indirect address
Basic Computer Instruction Formats
- Basic computer has three 16-bit instruction code formats:
- Memory Reference Instructions
- Register Reference
- Input / output
- Memory Reference Instructions:
- In memory reference instructions, first 12 bits (0-11) specify an address.
- Next 3 bits specify operation code (oprocte).
- Left most bit specifies the addressing mode I:
- for Direct address
- Indirect address
Memory Reference Instructions
- Following are the Memory Reference Instructions:
| Symbol | I=0 | I=1 | Description |
|---|---|---|---|
| AND | 0xxx | 8xxx | AND memory word to AC |
| ADD | 1XXX | 9××× | ADD memory word to AC |
| CDA | 2xxx | A xxx | LOAD memory word to Ac |
| STA | 3xxx | BXXX | Store contents of Ac in memory |
| BUN | 4xxx | Cxxx | Branch Unconditionally |
| BSA | 5XXX | Dxxx | Branch & Save return Address |
| ISZ | 6xxx | Exxx | Increment & skip of Zero |
- Register Reference Instructions
Register and I/O Reference Instructions
Register Reference Instructions:
- In this, 1st 12 bits (0-11) specify register operation.
- The next 3 bits specify opcode.
Symbol code and Description
CLA: 7800 Clear Ac
CLE: 7400 clear E
CMA: 7200 complement Ac
CME: 7100 complement E
CIR: 7080 circulate right ACRE
CIL: 7040 circulate left ACFE
INC: 7020 increment AC
SPA: 7010 skip next instruction if Ac the +ve
SNA: 7008