Module-6 COMPUTER ARCHITECTURE
Module-6 COMPUTER ARCHITECTURE
CPU Organization
All Questions are IMP
Explain about General register organization with proper diagram.
Generally CPU has seven general registers. Register organization show how registers are
selected and how data flow between register and ALU. A decoder is used to select a
particular register.The output of each register is connected to two multiplexers to form the
two buses A and B. The selection lines in each multiplexer select the input data for the
particular bus.
The A and B buses form the two inputs of an ALU.The operation select lines decide the
micro operation to be performed by ALU. The result of the micro operation is available at
the output bus. The output bus connected to the inputs of all registers, thus by selecting a
destination register it is possible to store the result in it.
SEL-D or
Binary code SELA SELB SEL-REG
001 R1 R1 R1
010 R2 R2 R2
011 R3 R3 R3
100 R4 R4 R4
101 R5 R5 R5
110 R6 R6 R6
111 R7 R7 R7
Operation with symbol
Operation
selection code Operation symbol
What is stack? Give the organization of register stack with all necessary
elements and explain the working of push and pop operations.?
Stack: It is a useful feature that is included in the CPU which follows the LIFO principle(Last
In First Out).It is a storage device that stores info in such a manner that the item stored last
is the first item retrieved.
Register Stack: A stack register is a computer central processor register whose purpose is
to keep track of a call stack. It can be placed in a portion of a large memory or it can be
organized as a collection of a finite number of memory words or registers.
Stack Pointer: It is the register that holds the address for the stack,because it’s value
always points at the top of stack.
Operations of Stack:
1. Push: Operation of insertion in stack and increase the value of stack pointer by
Execution of Push Operation
SP<--SP+1 M[SP]<--DR if(SP==0) then FULL<--1 EMTY<--0
2. Pop: Operation of deletion in stack and it decreases the value of stack pointer by1.
Execution of Pop Operation
DR<--M[SP] SP<--SP-1 if(SP==0) then EMTY<--1 FULL<--0
Stack Organization
The Last In First Out (LIFO) list is another name for stack. It is the CPU's most
crucial feature. It saves information so that the last element saved is retrieved first. A
memory space with an address register is called a stack. This register, known as the
Stack Pointer, affects the stack's address (SP). The address of the element at the
top of the stack is continuously influenced by the stack pointer.
Memory Stack Organization
A stack can exist as a stand-alone unit as in Fig. 3 or can be implemented in a random-access memory
attached to a CPU. The implementation of a stack in the CPU is done by assigning a portion of memory
to a stack operation and using a processor register as a stack pointer.
Figure 4 shows a portion of computer memory partitioned into three segments: program, data, and stack.
The program counter PC points at the address of the next instruction in the program. The address register
AR points at an array of data.
The stack pointer SP points at the top of the stack. The three registers are connected to a common
address bus, and either one can provide an address for memory.
PC is used during the fetch phase to read an instruction. AR is used during the execute phase to read
an operand.
SP is used to push or pop items into or the stack. As shown in Fig. 4, the initial value of SP is 4001
and the stack grows with decreasing addresses.
Thus the first item stored in the stack is at address 4000, the second item is stored at address 3999,
and the last address that can be used for the stack Is 3000.
No provisions are available for stack limjt checks.
We assume that the items in the stack communicate with a data register DR . A new item is inserted
with the push operation as follows:
SP ← SP - 1
M[SP] ← DR
The stack pointer is decremented so that it points at the address of the next word. A memory write
operation inserts the word from DR into the top of the stack. A new item is deleted with a pop operation
as follows:
DR ← M[SP]
SP ← SP + 1
The top item is read from the stack into DR. The stack pointer is then incremented to point at the next
item in the stack.
Most computers do not provide hardware to check for stack overflow (full stack) or underflow (empty
stack).
The stack limits can be checked by using two processor registers: one to hold the upper limit (3000 in
this case), and the other to hold the lower limit (4001 in this case).
After a push operation, SP is compared with the upper-limit register and after a pop operation, SP is
compared with the lower-limit register.
The two microoperations needed for either the push or pop are (1) an access to memory through SP,
and (2) updating SP. Which of the two microoperations is done first and whether SP is updated by
incrementing or decrementing depends on the organization of the stack.
In Fig. 4 the stack grows by decreasing the memory address. The stack may be constructed to grow by
increasing the memory address as in Fig. 3.
In such a case, SP is incremented for the push operation and decremented for the pop operation. A
stack may be constructed so that SP points at the next empty location above the top of the stack.
In this case the sequence of microoperations must be interchanged. A stack pointer is loaded with an
initial value. This initial value must be the bottom address of an assigned stack in memory. Henceforth,
SP is automatically decremented or incremented with every push or pop operation.
The advantage of a memory stack is that the CPU can refer to it without having to specify an address,
since the address is always available and automatically updated in the stack pointer.
A stack based computer do not use address field in instruction. To evaluate a expression first
it is converted to revere Polish Notation i.e. Post fix Notation.
2. One Address Instructions – This use a implied ACCUMULATOR register for data
manipulation.One operand is in accumulator and other is in register or memory
location.Implied means that the CPU already know that one operand is in accumulator
so there is no need to specify it
3. One Address Instructions – This use a implied ACCUMULATOR register for data
manipulation.One operand is in accumulator and other is in register or memory
location.Implied means that the CPU already know that one operand is in
accumulator so there is no need to specify it
4. Three Address Instructions – This has three address field to specify a register or
a memory location. Program created are much short in size but number of bits per
instruction increase. These instructions make creation of program much easier but it
does not mean that program will run much faster because now instruction only
contain more information but each micro operation (changing content of register,
loading address in address bus etc.) will be performed in one cycle only.
Explain an accumulator based central processing unit organization with block
diagram
Wright down the difference between RISC and CISC Computer
These chips are relatively simple to These chips are complex to design.
4.
design.
Registers are used for procedure The stack is used for procedure
12.
arguments and return addresses. arguments and return addresses.
What is Interrupt in Computer? Explain various types of Interrupts?
An interrupt is a signal from a device attached to a computer or from a program
within the computer that requires the operating system to stop and figure out
what to do next.
Interrupt systems are nothing but while the CPU can process the programs if the
CPU needs any IO operation. Then, it is sent to the queue and it does the CPU
process. Later on Input/output (I/O) operation is ready.
The I/O devices interrupt the data which is available and does the remaining
process; like that interrupts are useful. If interrupts are not present, the CPU
needs to be in idle state for some time, until the IO operation needs to complete.
So, to avoid the CPU waiting time interrupts are coming into picture.
Types of interrupts
There are two types of interrupts which are as follows −
Hardware interrupts
The interrupt signal generated from external devices and i/o devices are made interrupt to
CPU when the instructions are ready.
For example − In a keyboard if we press a key to do some action this pressing of the keyboard
generates a signal that is given to the processor to do action, such interrupts are called
hardware interrupts.
Hardware interrupts are classified into two types which are as follows −
Maskable Interrupt − The hardware interrupts that can be delayed when a
highest priority interrupt has occurred to the processor.
Non Maskable Interrupt − The hardware that cannot be delayed and
immediately be serviced by the processor.
Software interrupts
The interrupt signal generated from internal devices and software programs need to access
any system call then software interrupts are present.
Software interrupt is divided into two types. They are as follows −
Normal Interrupts − The interrupts that are caused by the so ware instructions
are called software instructions.
Exception − Excep on is nothing but an unplanned interrup on while execu ng
a program. For example − while execu ng a program if we got a value that is
divided by zero is called an exception.
Explain Interrupt Cycle
After the execute cycle is completed, a test is made to determine if an interrupt was
enabled (e.g. so that another process can access the CPU)
If not, instruction cycle returns to the fetch cycle
If so, the interrupt cycle might performs the following tasks: (simplified...)
move the current value of PC into MBR
move the PC-save-address into MAR
move the interrupt-routine-address into PC
move the contents of the address in MBR into indicated memory cell
continue the instruction cycle within the interrupt routine
after the interrupt routine finishes, the PC-save-address is used to reset the value of
PC and program execution can continue
Numerical
Consider a processor with 64 registers and an instruction set of size twelve. Each
instruction has five distinct fields, namely, opcode, two source register
identifiers, one destination register identifier, and a twelve-bit immediate
value. Each instruction must be stored in memory in a byte-aligned fashion. If a
program has 100 instructions, the amount of memory (in bytes) consumed by
the program text is ____________.
(A) 100
(B) 200
(C) 400
(D) 500