Coa Unit-4
Coa Unit-4
PROCESSOR
Some Fundamental Concepts
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 instruction to be fetched using Program Counter
(PC).
Instruction Register (IR)
Suppose each instruction comprises 4 bytes, and that is stored in one
memory word. To execute an instruction, the process will do following
Processor Organization Internal processor
bus
Control signals
PC
Instruction
Address
decoder and
lines
MAR control logic
MDR HAS Memory
TWO INPUTS bus
AND TWO
MDR
OUTPUTS Data
lines IR
Constant 4 R0
Select MUX
Add
A B
ALU Sub R n - 1
control ALU
lines
Carry-in
XOR TEMP
MDR
Ri
Ri out
Y in
Constant 4
Select MUX
A B
ALU
Z in
Z out
Figure 7.2. Input and output gating for the registers in Figure 7.1.
• Writing the word into a memory location follows the desired address is loaded into MAR. Then, the
data to be written are loaded in to MDR, and a Write command is issued.
Internal processor
bus
Control signals
PC
Instruction
Address
decoder and
lines
MAR control logic
Memory
bus
MDR
Data
lines IR
Y
Constant 4 R0
Select MUX
Add
A B
ALU Sub R n - 1
control ALU
lines
Carry-in
XOR TEMP
Z
Execution of Branch Instructions
Control sequence for an unconditional branch instruction is as follows:
1) PCout, MARin, Read, Select4, Add, Zin
2) Zout, PCin, Yin, WMFC
3) MDRout, IRin
4) Offset-field-of-IRout, Add, Zin
5) Zout, PCin, End
Execution of branch instruction contd..
The processing starts, as usual, the fetch phase ends in step3.
• In step 4, the offset-value is extracted from IR by instruction-decoding circuit.
• Since the updated value of PC is already available in register Y, the offset X is gated onto the
bus, and an addition operation is performed.
• In step 5, the result, which is the branch-address, is loaded into the PC.
• The offset X used in a branch instruction is usually the difference between the branch target-
address and the address immediately following the branch instruction. (For example, if the
branch instruction is at location 1000 and branch target-address is 1200, then the value of X
must be 196, since the PC will be containing the address 1004 after fetching the instruction at
location 1000).
• In case of conditional branch, we need to check the status of the condition-codes before
loading a new value into the PC.
e.g.: Offset-field-of-IRout, Add, Zin, If N=0 then End
If N=0, processor returns to step 1 immediately after step 4. If N=1, step 5 is performed to load
a new value into PC.
Multiple-Bus Organization
Bus A Bus B Bus C
Incrementer
PC
Register
file
Constant 4
MUX
A
ALU R
Instruction
decoder
IR
MDR
MAR
Step Action
External
inputs
Decoder/
IR
encoder
Condition
codes
Control signals
Step decoder
T 1 T2 Tn
INS 1
External
INS 2 inputs
Instruction
IR Encoder
decoder
Condition
codes
INSm
Run End
Control signals
T4 T6
T1
Figure 7.12. Generation of the Zin control signal for the processor in Figure 7.1.
For example, Zin=T1+T6.ADD+T4.BR ;
This signal is asserted during time-slot T1 for all instructions,
during T6 for an Add instruction
during T4 for unconditional branch instruction
When RUN=1, counter is incremented by 1 at the end of
every clock cycle. When RUN=0, counter stops counting.
Sequence of operations carried out by this machine is
determined by wiring of logic elements, hence the name
“hardwired”.