Unit Iv Coa - PPT
Unit Iv Coa - PPT
Unit Iv Coa - PPT
COMPUTER ORGANIZATION
AND ARCHITECTURE
UNIT-4
operations.
⮚ Processor fetches one instruction at a time and perform the operation specified.
⮚ Instructions are fetched from successive memory locations until a branch or a jump
instruction is encountered.
⮚ Processor keeps track of the address of the memory location containing the next
• Fetch the contents of the memory location pointed to by the PC. The contents of this
location are loaded into the IR (fetch phase).
IR ← [[PC]]
• Assuming that the memory is byte addressable, increment the contents of the PC by 4
(Fetch phase).
PC ← [PC] + 4
• Carry out the actions specified by the instruction in the IR (Execution phase).
➢ Transfer a word of data from one processor register to another or to the ALU.
➢ Perform an arithmetic or a logic operation and store the result in a processor register.
➢ Fetch the contents of a given memory location and load them into a processor register.
➢ Store a word of data from a processor register into a given memory location
➢ ALU
➢ Various digital circuits for executing different micro operations.(gates, MUX, decoders,
counters).
➢ Contains the memory address of the next instruction to be fetched and executed.
➢ Data can be loaded into MDR either from memory bus or from internal processor bus.
➢ The data and address lines are connected to the internal bus via MDR and MAR
21CSS201T - COA Prepared by DSBS Department 9
Single Bus Organization - contd.
Registers
➢ The processor registers R0 to Rn-1 vary considerably from one processor to another.
➢ Registers Y, Z & TEMP are temporary registers used by processor during the execution of some instruction.
Multiplexer
➢ Select either the output of the register Y or a constant value 4 to be provided as input A of the ALU.
Data Path
➢ The registers, ALU and interconnecting bus are collectively referred to as the data
path.
➢ The input and output gates for register Ri are controlled by signals is Riin and Riout
○ Riin is set to 1 – data available on common bus are loaded into Ri.
○ Riout is set to 0 – the bus can be used for transferring data from other registers .
➢ All operations and data transfers within the processor take place within time-periods
➢ When edge-triggered flip-flops are not used, 2 or more clock-signals may be needed to
Example:
➢ Enable output of register R1 by setting R1out=1. This places the contents of R1 on the
processor bus.
➢ Enable input of register R4 by setting R4in=1. This loads the data from the processor
○ When Riin=1, mux selects data on bus. This data will be loaded into flip-flop at rising-edge of
clock.
○ When Riin= 0, mux feeds back the value currently stored in flip-flop.
○ When Riout= 0, gate's output is in the high-impedance state. (This corresponds to the open circuit
state of a switch).
○ When Riout=1, the gate drives the bus to 0 or 1, depending on the value of Q.
➢ ALU gets the two operands from MUX and bus. The result is temporarily stored in
register Z.
➢ What is the sequence of operations to add the contents of register R1 to those of R2 and
○ R1out, Yin
○ Zout, R3in
➢ The response time of each memory access varies (cache miss, memory-mapped I/O,…)
➢ To accommodate this, the processor waits until it receives an indication that the requested operation
➢ Move (R1), R2
○ MAR ← [R1]
○ R2 ← [MDR]
Move (R1), R2
1.R1out, MARin, Read
2.MDRinE, WMFC
3.MDRout, R2in
○ R1out,MARin
○ R2out,MDRin,Write
○ MDRoutE, WMFC
➢ Add (R3), R1
➢ Fetch the first operand (the contents of the memory location pointed to by R3)
➢ Add (R3), R1
Figure. Control Sequence for Execution Figure. Single Bus Organization of the Datapath inside a processor
➢ A branch instruction replaces the contents of PC with the branch target address,
➢ The offset X is usually the difference between the branch target address and the
➢ UnConditional branch
Multi-bus structure
• Most commercial processors provide multiple internal paths to enable several
transfers to take place in parallel.
• Data transfer requires less control sequences.
• Mutiple data transfer can be done in a single clock cycle
Hardwired control
• Control signals are produced by appropriate circuitries.
• Control unit is designed as a finite state machine.
• Inflexible but fast.
• Appropriate for simpler machines (e.g. RISC machines)
Microprogrammed control
• Control signals are generated as a micro program consisting of 0s and 1s.
• Control path is designed hierarchically using principles identical to the CPU design.
• Flexible, but slow.
• Appropriate for complex machines (e.g. CISC machines)
• The run signal will make the step counter count up every time but when set to 0 this
signal will make the counter to hold irrespective of the clock pulse. This is done WMFC
signal is issued.
• Here we use a sequence of bits to notify, the signals that are to be set for a particular
action.
• For example if PCout is used in a particular step then the bit allocated for PCout will be set
to 1.
• Every instruction will have its own microroutine which is made up of microinstructions.
• Microroutines for all instructions in the instruction set of a computer are stored in a
special memory called Control Store.
• The Control Unit generates the control signals: by sequentially reading the CWs of the
corresponding microroutine from the control store.
• However the access time of the main memory may be much greater than the time
required to perform basic pipeline stage operations inside the processor.
• If cache is included on the same chip as the processor, access time to cache is equal to
the time required to perform basic pipeline stage operations .
• Some pipelined processors have shared a single-memory pipeline for data and
instructions. As a result, when an instruction contains a data memory reference, it will
conflict with the instruction reference for a later instruction
• To resolve this hazard, we stall the pipeline for 1 clock cycle when the data memory
access occurs. A stall is commonly called a pipeline bubble or just bubble
• If the branch is taken then the PC value is not known till the end of I2.
• Next third instructions are fetched even though they are not required
• Hence they have to be flushed after branch is taken and new set of instruction have to
be fetched from the branch address