Unit 3
Unit 3
Architecture
SUBJECT CODE: 203105253
UNIT 3
Prepared By
Trilok Suthar
1
INTRODUCTION TO X86 ARCHITECTURE:
CPU CONTROL UNIT DESIGN:
hardwired and micro-programmed design approaches, Case
study -design of a simple hypothetical CPU.
2
Introduction of Control Unit and its Design
3
• It fetches internal instructions of the programs from the main memory
to the processor instruction register, and based on this register
contents, the control unit generates a control signal that supervises
the execution of these instructions.
• A control unit works by receiving input information to which it converts
into control signals, which are then sent to the central processor.
• The computer’s processor then tells the attached hardware what
operations to perform.
4
5
Functions of the Control Unit –
6
BASIC DEFINATIONS
7
BASIC DEFINATIONS
8
Types of Control Unit
9
Hardwired control unit
10
11
• The operation code of an instruction contains the basic data for
control signal generation. In the instruction decoder, the
operation code is decoded. The instruction decoder constitutes a
set of many decoders that decode different fields of the
instruction opcode.
• So, few output lines going out from the instruction decoder
obtains active signal values. These output lines are connected to
the inputs of the matrix that generates control signals for
executive units of the computer. This matrix implements logical
combinations of the decoded signals from the instruction opcode
with the outputs from the matrix that generates signals
representing consecutive control unit states and with signals
coming from the outside of the processor, e.g. interrupt signals.
12
• Control signals for an instruction execution have to be
generated not in a single time point but during the entire
time interval that corresponds to the instruction execution
cycle. Following the structure of this cycle, the suitable
sequence of internal states is organized in the control unit.
14
• When an external signal appears, (e.g. an interrupt) the control unit
takes entry into a next control state that is the state concerned with
the reaction to this external signal (e.g. interrupt processing). The
values of flags and state variables of the computer are used to
select suitable states for the instruction execution cycle.
• The last states in the cycle are control states that commence
fetching the next instruction of the program: sending the program
counter content to the main memory address buffer register and
next, reading the instruction word to the instruction register of
computer.
• When the ongoing instruction is the stop instruction that ends
program execution, the control unit enters an operating system
state, in which it waits for a next user directive.
15
• Fixed logic circuits that correspond directly to the
Boolean expressions are used to generate the control
signals.
• Hardwired control is faster than micro-programmed
control.
• A controller that uses this approach can operate at high
speed.
• RISC architecture is based on hardwired control unit
16
• ADV:
• Fast control signal generation (using combinational
circuit)
• Performance is high
• DISADV:
• Modification is very difficult
• Difficult to correct mistakes or adding new features in
existing design
17
Microprogrammed Control Unit
18
Microprogrammed control unit
19
• The general configuration of a micro-programmed control unit is
demonstrated in the block diagram.
• The control memory is assumed to be a ROM, within which all control
information is permanently stored.
20
• 1) Control Memory
– A memory is part of a control unit : Microprogram
– Computer Memory (employs a microprogrammed control unit)
» Main Memory : for storing user program (Machine instruction/data)
» Control Memory : for storing microprogram (Microinstruction)
• 2) Control Address Register
– Specify the address of the microinstruction
• 3) Sequencer (= Next Address Generator)
– Determine the address sequence that is read from control
memory
– Next address of the next microinstruction can be specified
several way depending on the sequencer input :
• 4) Control Data Register (= Pipeline Register )
– Hold the microinstruction read from control memory
– Allows the execution of the microoperations specified by the
control word simultaneously with the generation of the next
microinstruction 21
• The Control memory address register specifies the address of the
micro-instruction.
• The Control memory is assumed to be a ROM, within which all control
information is permanently stored.
• The control register holds the microinstruction fetched from the
memory.
• The micro-instruction contains a control word that specifies one or
more micro-operations for the data processor.
• While the micro-operations are being executed, the next address is
computed in the next address generator circuit and then transferred
into the control address register to read the next microinstruction.
• The next address generator is often referred to as a micro-program
sequencer, as it determines the address sequence that is read from
control memory.
22
• The control data register holds the present microinstruction while the
next address is computed and read from memory.
• The data register is sometimes called a pipeline register.
• It allows the execution of the microoperations specified by the control
word simultaneously with the generation of the next microinstruction.
• This configuration requires a two-phase clock, with one clock applied to
the address register and the other to the data register.
• The main advantage of the micro programmed control is the fact that
once the hardware configuration is established; there should be no
need for further hardware or wiring changes.
• If we want to establish a different control sequence for the system, all
we need to do is specify a different set of microinstructions for control
memory
23
24
Address Sequencing
25
Steps of Address Sequencing
• Step-1:
An initial address is loaded into the control address register when
power is turned on in the computer.
26
• Step-2:
The control memory next must go through the routine that determines
the effective address of the operand.
27
• Step-3:
The next step is to generate the microoperations that execute the
instruction fetched from memory.
30
• Multiplexer
CAR Increment
JMP/CALL
Mapping
Subroutine Return
• CAR : Control Address Register
– CAR receive the address from 4 different paths
1) Incrementer
2) Branch address from control memory
3) Mapping Logic
4) SBR : Subroutine Register
– Return Address for a subroutine is stored in SBR
31
• SBR : Subroutine Register
– Return Address can not be stored in ROM
– Conditional Branching
• Status Bits
– Control the conditional branch decisions generated in the Branch
Logic
• Branch Logic
– Test the specified condition and Branch to the indicated address if
the condition is met ; otherwise, the control address register is just
incremented.
32
• The microinstruction in control memory contains a set of bits to initiate
microoperations in computer registers and other bits to specify the
method by which the next address is obtained.
• The diagram shows four different paths from which the control
address register (CAR) receives the address.
33
• Branching is achieved by specifying the branch address in one of the
fields of the microinstruction.
34
• The status conditions are special bits in the system that provide
parameter information such as the carry-out of an adder, the sign bit of
a number, the mode bits of an instruction, and input or output status
conditions.
• The status bits, together with the field in the microinstruction that
specifies a branch address, control the conditional branch decisions
• generated in the branch logic.
35
Mapping of Instruction
36
37
A special type of branch exists when a microinstruction specifies a branch
to the first word in control memory where a microprogram routine for an
instruction is located
38
Microprogram example
39
Computer Configuration
40
• The block diagram of the computer is shown in Figure 4.4. It consists of
1. Two memory units:
Main memory -> for storing instructions and data, and
Control memory -> for storing the microprogram.
2. Six Registers:
Processor unit register: AC(accumulator),PC(Program Counter),
AR(Address Register),
DR(Data Register)
Control unit register: CAR (Control Address Register), SBR(Subroutine
Register)
41
• 3. Multiplexers:
The transfer of information among the registers in the processor is
done through
multiplexers rather than a common bus.
4. ALU:
The arithmetic, logic, and shift unit performs microoperations with
data from AC and DR
and places the result in AC
o DR can receive information from AC, PC, or memory.
AR can receive information from PC or DR.
PC can receive information only from AR.
Input data written to memory come from DR, and data read from
memory can go only to DR
.
42
43
MICROINSTRUCTION FIELD DESCRIPTIONS - F1,F2,F3
44
MICROINSTRUCTION FIELD DESCRIPTIONS - CD, BR
45
Symbolic microinstructions
46
a. Symbolic Address : Label ( = Address )
b. Symbol “NEXT” : next address
c. Symbol “RET” or “MAP” : AD field = 0000000
47
SYMBOLIC MICROPROGRAM - FETCH ROUTINE
48
SYMBOLIC MICROPROGRAM
49
BINARY MICROPROGRAM
50
Design of control unit
52
MICROPROGRAM SEQUENCER
53
• The basic components of a microprogrammed control unit are the
control memory and the circuits that select the next address.
The address selection part is called a microprogram sequencer.
A microprogram sequencer can be constructed with digital functions to
suit a particular application.
To guarantee a wide range of acceptability, an integrated circuit
sequencer must provide an internal organization that can be adapted
to a wide range of applications.
The purpose of a microprogram sequencer is to present an address to
the control memory
so that a microinstruction may be read and executed.
54
• Commercial sequencers include within the unit an internal register stack
used for temporary storage of addresses during microprogram looping
and subroutine calls.
Some sequencers provide an output register which can function as the
address register for the control memory.
• The second multiplexer tests the value of a selected status bit and the
result of the test is applied to an input logic circuit.
55
• The output from CAR provides the address for the control memory.
• The other three inputs to multiplexer 1 come from the address field of
the present microinstruction, from the output of SBR, and from an
external source that maps the instruction.
56
• The CD (condition) field of the microinstruction selects one of the
status bits in the second multiplexer.
• If the bit selected is equal to 1, the T (test) variable is equal to 1;
otherwise, it is equal to 0.
• The T value together with the two bits from the BR (branch) field goes
to an input logic circuit.
57
58
Memory :
As the word implies “memory” means the place where we have to store
data or information.
There are various units which are used to measure computer memory
• Bit -Smallest unit of computer memory
• Byte-8 bit = 1 byte
• Kilobyte-1024 byte = 1 KB
• Megabyte-1024 KB = 1 MB
• Gigabyte-1024 MB = 1 GB
• Terabyte-1024 GB = 1 TB
59
MEMORY CLASSIFICATION
1) Primary Memory:-
• Primary memory also known as “main memory” or “internal memory”
which is located in the motherboard of system or as we say which is
directly connected to the CPU. It is the place where only little bit of data
are stored either by manufacturer or by user.
• This is further divided into two parts:-
• RAM
• ROM
60
2) Secondary Memory:-
• The place where we store our personal data in computer system
• It is non-volatile in nature so that we cannot loose the data when
power supply is off.
• There are two methods for accessing the data from it:-
• (A) Sequential–
• This is the method in which we search the data sequentially or line by
line until you find the desired data. E.g. Magnetic tape,
• (B) Direct–
• This is the method in which computer can go directly to the
information that the user wants.
• e.g.magnetic disk,optical disk,etc
61
62
63
64
65
66
67
Associative/CAM (Content Addressable Memory )