02 Ch5 Basic Computer Organization and Design
02 Ch5 Basic Computer Organization and Design
INTRODUCTION
• Every different processor type has its own design (different
registers, buses, microoperations, machine instructions, etc)
• Modern processor is a very complex device
• However, to understand how processors work, we will start
with a simplified processor model
• This is similar to real processors
• M. Morris Mano introduces a simple processor model he
calls the Basic Computer
• We will use this to introduce processor organization and the
relationship of the RTL model to the higher level computer
processor
15 0
4095
INSTRUCTIONS
• Program
– A sequence of (machine) instructions
• (Machine) Instruction
– A group of bits that tell the computer to perform a
specific operation (a sequence of micro-operation)
• The instructions of a program, along with any needed data
are stored in memory
• The CPU reads the next instruction from memory
• It is placed in an Instruction Register (IR)
• Control circuitry in control unit then translates the
instruction into the sequence of microoperations necessary
to implement it
INSTRUCTION FORMAT
• A computer instruction is often divided into two parts
– An opcode (Operation Code) that specifies the operation
for that instruction
– An address that specifies the registers and/or locations in
memory to use for that operation
• In the Basic Computer, since the memory contains 4096 (=
212) words, we needs 12 bit to specify memory address
• bit 15 of the instruction specifies the addressing mode (0:
direct addressing, 1: indirect addressing)
• Since the instructions, are 16 bits long, that leaves 3 bits for
the instruction’s opcode
15 14 12 11 0
Instruction Format I Opcode Address
Addressibg mode
ADDRESSING MODES
• The address field of an instruction can represent either
– Direct address: uses memory address of data
– Indirect address: uses address of address of data
Direct addressing Indirect addressing
300 1350
457 Operand
1350 Operand
+ +
AC AC
PROCESSOR REGISTERS
• A processor has many registers to hold instructions,
addresses, data, etc
• Program Counter (PC) that holds the memory address of the
next instruction to get (12 bits)
• In a direct or indirect addressing, the processor needs to keep
track of what locations in memory it is addressing: The
Address Register (AR) is used for this (12 bits)
• When an operand is found, using either direct or indirect
addressing, it is placed in the Data Register (DR) (16 bits). The
processor then uses this value as data for its operation
• The Basic Computer has a single general purpose register –
the Accumulator (AC) (16 bits)
PROCESSOR REGISTERS
• Often a processor will need a register to store intermediate
results or other temporary data; in the Basic Computer this is
the Temporary Register (TR) (16 bits)
• The Basic Computer uses a very simple model of input/output
(I/O) operations
– Input devices are considered to send 8 bits of character
data to the processor
– The processor can send 8 bits of character data to output
devices
• The Input Register (INPR) holds an 8 bit character gotten from
an input device
• The Output Register (OUTR) holds an 8 bit character to be
send to an output device
11 0
PC
Memory
11 0
4096 x 16
AR
15 0
IR CPU
15 0 15 0
TR DR
7 0 7 0 15 0
OUTR INPR AC
LD INR CLR
PC 2
LD INR CLR
DR 3
LD INR CLR
E
ALU AC 4
LD INR CLR
INPR
IR 5
LD
TR 6
LD INR CLR
OUTR
Clock
LD
16-bit common bus
• Three control lines, S2, S1, and S0 control which register the
bus selects as its input
S2 S1 S0 Register
0 0 0
0 0 1 AR
0 1 0 PC
0 1 1 DR
1 0 0 AC
1 0 1 IR
1 1 0 TR
1 1 1 Memory
• Either one of the registers will have its load signal activated,
or the memory will have its read signal activated
– Will determine where the data from the bus gets loaded
CONTROL UNIT
• Control unit (CU) of a processor translates from machine
instructions to the control signals for the microoperations
that implement them
• Control units are implemented in one of two ways
• Hardwired Control
– CU is made up of sequential and combinational circuits to
generate the control signals
• Microprogrammed Control
– A control memory on the processor contains
microprograms that activate the necessary control signals
3x8
decoder
7 65 4 32 1 0
D0
I Combinational
D7 Control
logic
Control
T15 signals
T0
15 14 . . . . 2 1 0
4 x 16
decoder
TIMING SIGNALS
- Generated by 4-bit sequence counter and 416 decoder
- The SC can be incremented or cleared.
T1
T2
T3
T4
D3
CLR
SC
INSTRUCTION CYCLE
• In Basic Computer, a machine instruction cycle is executed
in the following steps:
1. Fetch an instruction from memory
2. Decode the instruction
3. Read the effective address from memory if the instruction
has an indirect address
4. Execute the instruction
S0
Memory
7
unit
Address
Read
AR 1
LD
PC 2
INR
IR 5
LD Clock
Common bus
T0
AR PC
T1
IR M[AR], PC PC + 1
T2
Decode Opcode in IR(12-14),
AR IR(0-11), I IR(15)
T3 T3 T3 T3
Execute Execute AR M[AR] Nothing
input-output register-reference
instruction instruction
SC 0 SC 0 Execute T4, T5, …
memory-reference
instruction
SC 0
D'7IT3: AR M[AR]
D'7I'T3: Nothing
D7I'T3: Execute a register-reference instr.
D7IT3: Execute an input-output instr.
Computer Architectures Lab
Basic Computer Organization & Design 23 Instruction Cycle
ADD to AC
D1T4: DR M[AR] Read operand
D1T5: AC AC + DR, E Cout, SC 0 Add to AC and store
carry in E
LDA: Load to AC
D2T4: DR M[AR]
D2T5: AC DR, SC 0
STA: Store AC
D3T4: M[AR] AC, SC 0
AR = 135 135 21
136 Subroutine PC = 136 Subroutine
D6T4: DR M[AR]
D6T5: DR DR + 1
D6T6: M[AR] DR, if (DR = 0) then (PC PC + 1), SC 0
D5T 5 D6T 5
PC AR DR DR + 1
SC 0
D6T 6
M[AR] DR
If (DR = 0)
then (PC PC + 1)
SC 0
8 circuit To bus
From INPR
Control
gates
CONTROL OF AC REGISTER
Gate structures for controlling
the LD, INR, and CLR of AC