













































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!














































Cont’d The design of a CPU is a task that in large part involves choosing the hardware for implementing the machine instructions. The user who programs the computer in machine or assembly language must be aware of the register set, the memory structure, the type of data supported by the instructions and the function that each instruction performs.
General Register Organization
Cont’d There are 14 binary selection inputs in the unit, and their combined value specifies a control word. It consists of four fields. Three fields contain three bits each, and one field has five bits. The three bits of SELA select a source register for the A input of the ALU. The three bits of SELB select a register for the B input of the ALU. The three bits of SELD select a destination register using the decoder and its seven load outputs. The five bits of OPR select one of the operations in the ALU. The 14-bit control word when applied to the selection inputs specify a particular micro-operation. The encoding of the register selections is specified in figures.
Cont’d
Symbolic designation (^) Microoperation SELA SELB SELD OPR Control word (^) R1 R2-R3 R2 R3 R1 SUB 010 011 001 00101 (^) R4 R4 V R5 R4 R5 R4 OR 100 101 100 01010 (^) R6 R6 +1 R6 -- R6 INCA 110 000 110 00001 (^) R7 R1 R1 -- R7 TSFA 001 000 111 00000 (^) Output R2 R2 -- None TSFA 010 000 000 00000 (^) Output input input -- None TSFA 000 000 000 00000 (^) R4 sh1 R4 R4 -- R4 SHLA 100 000 100
Stack Organization A stack is a storage device that stores information in such a manner that the item stored last in the first item retrieved(LIFO). The operation of a stack can be compared to a stack of trays. The last tray placed on top of the stack is the first to be taken off. The register that holds the address for the stack is called a stack pointer(SP). Because its value always points at the top item in the stack. The two operations of a stack are the insertion and deletion of items. The operation of insertion is called push(as the result of pushing a new item on top. The operation of deletion is called pop(as the result of removing one item).
Cont’d There are two types of stack organization
**_1. Register stack: built using registers
Cont’d Three items are placed in the stack: A, B and C. Item C is on top of the stack so that the content of SP is now 3. To remove the top item, the stack is popped by reading the memory word at address 3 and decrementing the content of SP. Item B is now on top of the stack since SP holds address 2. To insert a new item, the stack is pushed by incrementing SP and writing a word in the next higher location of the stack. Note that item C has been read out but not physically removed. This does not matter because when the stack is pushed, a new item is written in its place
Cont’d In a 64 word stack, the stack pointer contains 6 bits because 2 6 =64. Since SP has only six bits, it cannot exceed a number greater than 63 ( in binary). When 63 is incremented by 1, the result is 0 since 111111 +1=1000000 in binary, but SP can accommodate only the six least significant bits. Similarly, when 000000 is decremented by 1, the result is 111111. The one bit register FULL is set to 1 when the stack is full, and one bit register EMTY is set to 1 when the stack is empty of items. DR is the data register that holds the binary data to be written into or read out of the stack.
The pop operation consists of the following sequence of micro operations: DR M[SP] Read item from the top of stack SP SP-1 Decrement stack pointer If (SP=0) then (EMTY 1) check if stack is empty FULL 0 Mark the stack not full
Memory Stack: