Professional Documents
Culture Documents
FUNDAMENTAL CONCEPTS
► To eKecute a progrwn. the processor fetches one instruction at a time and performs the operations
specified.
► The proces."°r keeps track of the address of the memory location containing the neKt instruction to be
fe1ched using the Program Counter.
► To eKecute W1 instruction, processor must perform following 3 steps:
I ) Felch content~ of memory-location poinled to by PC. Content of this location is 11n ins1ruc1ion
to he eKecuted. The instructions are loaded into IR, Symbolically. this operation is wriuen 11s:
JR f- [[PC]]
2) Increment PC by 4.
PC f-[PCJ + 4
► The fir.It 2 steps are repeated as many times as necessary to complete instruction and they are referred
to as Fetch Phase.
► The operation specified by an instruction can he carried out by performing one or more of the following
actions:
I) Read the contents of a 1:,o:iven memory-location and load them into a register.
3) Perform an arithmetic or logic operation and place the result into a register.
► An organisation in which the arithmetic and logic unit (ALU) and all the registers are in1erconnec1ed
viu single common bus is shown in the figure below.
Control signals
PC
Instruction
MAR deooderand
Memory bus
control logic
MOR
IR
Constant4
RO
Select •
•
•
ALU Rn-1
lines
• ALU and all the registers are interconnected via a Single Common Bus
• Data & address lines of the external memory-bus is connected to the internal processor-bus via MDR
(Memory Datu Register) & MAR ( Memory Address Register) respectively.
• MOR has two input s and two ourputs. h means. the data may be loaded into MD Reither from memory-
bus (external) or from processor-bus.
• MAR's inpul is connected to in1ernal-bus and MAR's output is connec1ed to exlernal- bus (as address
bus is unidirectional).
• Register RO lhrough R(n-1) are the Processor Registers. The programmer can access 1hese regis1ers
for general-purpose use.
• Only pmcessor c.an access 3 registers Y. Z & Tffllp for temporary storage during progrum-ei1ecu1ion.
The programmer canno1access these 3 registers.
• In ALU. I) "A" inpul gets !he operand from lhe output of the multiplexer (MUX).
2) ·'B" inpul gel~ lhe operand directly from the processor-bus.
• MUX selects either oulput of Y or constant-value 4 (which is used lo incremenl the PC).
• Disadvantage: Only one data-word can be transferred over the bus in a clock cycle.
So/11tio11: Provide multiple internal paths. Multiple paths allow several data-transfers to take place in
paraUel.
REGISTER TRANSFERS
• Instruction execution involves a sequence of steps in which data are transferred from one regis1er to another.
• For euch register. two control-signals ore used to place the contents of thot register on the bus or to load the
duta on the bus into the regis1er. The inpul and output of Register Ri are connected 10 the bus viu swilches
con1rolled by lhe signal!> Ri1n & Ri.., respectively.
• When Ri 1,.=l, data on bus is loaded in10 the register Ri. When Ri..=I. con1en1 of Ri is placed on bus and
when Ri.,,.=O, bus can be used for transferring data from other regis1ers.
• Por example,
MoveRl, R2
This transfers the contents of register RI 10 register R2.
This can be accomplished as foUows:
I) Enable the output o f re&,jsters RI by setting R 1.- 10 I . II places the contents of RI on processor-bus.
2) Enable the input of register R2 by setting R2.,,. to I . This loads data from processor-bus into register R4.
• All operations and data transfers within the processor take place within time-periods defined by the
processor-clock.
• The con1rol-signuls tha.1 govern a particular 1ransfor are a.~serted at the start of the clock cycle.
• A 2-inpul multiplexer i.s used IO select the data applied to the input of an edge-triggered D flip-flop.
• Ri1n=I. mux select~ dalll on bus. This data will be loaded into flip-flop at rising-edge of clock. Ri1n=O. mux
feeds back the value c u!Telltly slOred in flip-flop.
• Q ou1pul of flip-Oop is connecled to bus via a tri-state gate. Ri..o=O. gate's ourpul is in the high-impedance
stale. Ri,..= l , the gale drives lhe bus to O or I . depending on the value of Q.
• One of the operands is output of MUX and the other operand is obtained directly from processor-bus.
I) R loul. Yin
3) Zou1. R3in
Step2: Contents from Y and from register R2 are applied to the A and B inputs of ALU; Addition is
performed & Result is st:ored in the Z register.
CONTROL-SIGNALS OF MDR
I) MAR.. contro ls 1he connection to the internal processor address bus &
2) MAR.,,. controls the connection to the memory address bus.
MO~ MOR..,
Memory Out• Bu,
lntcmul Prcx-.:ssor Bu.,
MOR
MOR"" MOR,,
,... ,- I -f :
Clo<l
I
).1AJI,. _J
AdohM
-...
MD._,
Dou
Mf1C
Ml--
_....____-+------------~,I_.,......- -
,L
llming Diagram for Read Opera lion
.
Step Action
Step/: The instruction-fetch operation is initiated by loading content.~ of PC into MAR & sending a Read
request to memory. The Select !tignal is set 10 Select4. which causes the MUJt to select constant 4. This value
is added to operand at input B (PC's content). and the result is stored in Z.
Step2: Updated value in Z is moved 10 PC. This completes lhe PC increment operation and PC will now point
to next i.nstruction.
BRANCHING INSTRUCTIONS
• Control sequence for an i.nconditional branch instruction is as follows:
SlopAcllon
- If N=O. then End & processor returns to step I immediately after step 4.
IfN=I. step 5 is performed to load a new value into PC.
COMPLETE PROCESSOR
• This has sepw-ute processing-uniL~ to dent with integer data und floating-point data.
• Data-Cache is insened between these processing-units & main-memory. The integer and floating unit get
datu f:rom daw cache.
• Processor is connected to system-bus & hence to the rest of the computer by means of a Bus Interface.
• Using separate caches for instructions & data is common practice in many processors today.
• A processor may include several units of each type to increase the potential for concurrent operations.
• To e xecute instructions, the processor musl have some means of generdling the control-signals. There are
two approaches for thls purpose:
J ) Bardwired control and
2) Microprogrammed control.
--- Proc11aor
s.,..aembua
HARDWIRED CONTROL
...
- Extemal
••• Inputs
.• Decode</
IR
. encoder
Co<dlion
- .•• codes
•••
tr s
• Encoder: It gel~ the input from instruct ion decoder. step decoder. external inputs. and condition codes. It
uses all these inpuL~ to generate individual control -signal~: Yin. PCout. Add. End and so on.
For example: Zin= Tl + (T6.ADD) + (T4.BR):
- This signal is asserted during time slot T l for all instructions.
- T6 for an Add instruction.
- T4 for unconditional branch i n.~truction
• Dmdvantages:
I) Since no. of instructions/control-lines is often in hundreds. the complexity of control unit i~ very high.
2) 11 is costly und difficul t to design.
3) The control unit is inflexible because i t is difficult to change the design.
-
c.:..,,,""'
...
ls.F,
I I
r, r, .. . r,
INS,
~
..
-
INS
lnllruclion
E,uds
Ccncffcti
codls
~
...
-,.,.--
llrw,ct,
T, T,
MICROPROGRAMMED CONTROL
• Control Word (CW) is u word wboi.e individual biu represent various control-signals (like Add, PCin).
• Each of lhe con1rol-s1cps in conirol sequence of an ins1ruc1ion defines a unique combina1ion of Is & Os in
cw.
• Individual conirol-wonis in micro-routine are referred 10 as microinsiruclion.~.
• The micro-routines for all instructions in the ins1ruction-se1 of a computer are stored in a special memory
cal led the Control Store (CS).
• Co n1rol-uni1 generates contro l-signals for any instruction by sequentially reading CWs of corresponding
micro-routine from CS.
• Every tin-.: new instruction is loaded into IR. output of Starting Address Genemtor is loaded into µPC.
• Then. µPC is automatically incremented by clock: causing successive microinstructions to be read from CS.
Hence. contro l-signal s are deli vered to various pruts of procesi,or in correct sequence.
Slatting
IR address
One function
generator
cannot be carried
~ ~ ~ - ~ out by this simple
organization.
Control
store CW
•
Ji J I ,l • I )J J a:J a:J )! -
'
.. ~ :I ► N
0 1 1 1 0 0 0 1 I I 0 0 0 0 0 0
2 I 0 0 0 0 0 I 0 0 0 I 0 0 0 I 0
3 0 0 0 0 I I 0 0 0 0 0 0 0 0 0 0
•s 0 0 I I 0 0 0 0 0 0
0 0 0 0 0 0 I 0 0 0
0 0 0 I 0 0
0 I 0 0 I 0
6 0 0 0 0 I 0 0 0 I I 0 0 0 0 0 0
7 0 0 0 0 0 0 0 0 0 0 1 0 I 0 0 I
Advantages:
I. It simplifies the design of Control UniL Thus. it is inexpensive and error free implementation.
2. Control functions an: implemented in software rather than hardware.
3. The design p.rocess is systematic.
4. More ncxible. it can be adaptable i.e., cand correct the design errors quickly and cheaply.
5. Complex functio:ns such a.~ noating-poini arithmetic can be realized efficiently.
Disadvantages:
I. A microprogrammed control unit is somewhat slower than the hardwired control unit because Lime is
required to acce.<;:s the microinstruct ions from CM.
2. The flexibility is achieved at some extra hardware cost due 10 the control memory and iL~ access
ci rcuitry.
• Drawback of previous Microprogram coatrol: IL cannot handle the situation whe n the control unit is
required to check the sla'lus of the condition codes or external inputs 10 choose between alternative courses of
action.
• In case of conditional branching, microinstructions specify which of the external inpuL~. condition codes
should be checked as a condition for branching 10 take place.
• Starting and Branch Addres.~ Generator Block loads a new address into µPC when a microinstruction
instruct~ it 10 do so.
• To allow implementa,tion of o conditionnl branch. inputs to this block consist of external inpuL~ and
condition-codes & contents of IR.
• µPC is incremented every time a new microinstruction is fetched from microprogram memory except in
following situations:
I) When a new instruction is loaded into IR. µPC is loaded with starting address of micro-routine for
th at instruction.
2) When a Branch microinstruction is encountered and hr.inch condition is satisfied, µPC is loaded
with brunch-address.
3) When an End microinstructio n is encountered. µPC is loaded with address of first CW in micro-
routine for i.nstruction fetch cycle.
Add 111llcn,ta•uct1on
25 IIN-4, U - t n n c h t o -
~
26 OltMl·fiold-ol·lf\.... Selec:IY. Add, Z.,
Z.... . PCft . End
Starting and
f=✓f>'anch address,,,.--< Concilion
IA codes
generator
Control
stote cw