Sunteți pe pagina 1din 33

Lecture 15:

A Manual Processor (part 2)

DOC 112: Computer Hardware Lecture 15

Slide 1

The Basic Processor Architecture from last lecture was:


Data In
IR7
8

IR0

Control Unit

IR

ClkIR

SelA MUX
8

F-ALU A ClkA
8 8

A B Res
8

F-Shifter SHIFTER RES ClkR


8

B ClkB SelC
1

Data Out

ALU
CY-in CY-out C ClkC

MUX

Carry Out

DOC 112: Computer Hardware Lecture 15

Slide 2

Registers A B Res and IR are all of the form:

Register C is a single D-Q flip-flop


DOC 112: Computer Hardware Lecture 15 Slide 3

Multiplexer to select A has the form:


Select I7
0 1

O7
MUX

The multiplexer to select C is a single bit version of this


O1 O0

I1 I0

0 1 0 1

DOC 112: Computer Hardware Lecture 15

Slide 4

f2 f1 f0

The Arithmetic and Logic Unit is a combinatorial logic circuit

An-1 A1 A0 Bn-1 B1 B0 Cin

Cout

ALU

On-1

O1 O0

Selection Bits/Results 000 000 zero 001 B-A minus 010 A-B minus 011 A+B plus 100 A B xor 101 A or B or 110 A B and
Slide 5

111 1111 -1

DOC 112: Computer Hardware Lecture 15

The Shifter is another combinatorial logic circuit implemented by multiplexers:


f2 f1 f0

In-1 SHIFTER I1 I0

On-1 O1 O0

Cin

DOC 112: Computer Hardware Lecture 15

Slide 6

Now for the control unit:


Data In
IR7
8

IR0

Control Unit

IR

ClkIR

IR7

IR6 IR5 IR4


8

MUX

A ClkA
8

A B Res
8

IR3 IR2 IR1

B ClkB
IR0 1

SHIFTER

RES ClkR

Data Out

ALU
CY-in CY-out C ClkC

MUX

Carry Out

DOC 112: Computer Hardware Lecture 15

Slide 7

Instruction Format
IR7 IR6 IR4 IR3 IR1 IR0

SelA

SelALU SelSHFT Instruction Register IR

SelCY

The multiplexers are controlled by bits 0 and 7 of the instruction SELA 0-1 Selects the input to the A register 0 selects shifter output, 1 selects external Data Input.

SELCY 0-1 Selects the input to the CARRY-in of the ALU: 0 selects logic 1, 1 selects C-out
DOC 112: Computer Hardware Lecture 15 Slide 8

Instruction Format (Continued)


IR7 IR6 IR4 IR3 IR1 IR0

SelA

SelALU SelSHFT Instruction Register IR

SelCY

SELALU bits 4, 5 and 6 selects the ALU output: 000 ZERO 001 B-mi-A

010 A-mi-B 011 A-pl-B 100 A-xor-B 101 A-or-B 110 A-and-B 111 MINUS ONE
DOC 112: Computer Hardware Lecture 15 Slide 9

Instruction Format (Continued)


IR7 IR6 IR4 IR3 IR1 IR0

SelA

SelALU

SelSHFT

SelCY

Instruction Register IR
SELSHIFT Selects the shift function: 000: Unchanged 010: Rotate Right 100: Unchanged 110: Arithmetic right shift 001: Arithmetic Left Shift 011: Logical right shift 101: Left shift with carry 111: Right shift with carry

DOC 112: Computer Hardware Lecture 15

Slide 10

Designing the control unit


At each clock pulse the controller provides one or more register with a clock pulse taking the processor through a fixed cycle of states
OPERATE CONTROL System Clock
ClkIR ClkA ClkB ClkR ClkC

DOC 112: Computer Hardware Lecture 15

Slide 11

Execution Cycle of the Manual Processor


1. 2. 3. 4. 5. Load the "Data In" lines into the IR register. Load the A register Load the B and the C registers Load the "Data In" lines into the IR register Load the RES and the C registers .... Go to step 1 of the next instruction ....

DOC 112: Computer Hardware Lecture 15

Slide 12

The State Transition Diagram

DOC 112: Computer Hardware Lecture 15

Slide 13

The Program
The execution cycle implicitly defines the format of the program. At each step a new item arrives on the data in lines synchronised with the system clock.
Operation Code 1 Data 1 Data 2 Operation Code 2 Unused

Instruction

Instruction

Instruction

etc.

DOC 112: Computer Hardware Lecture 15

Slide 14

The processing cycle


Data In
IR7
8

IR0

Control Unit

IR

ClkIR

IR7

IR6 IR5 IR4


8

MUX

A ClkA
8

A B Res
8

IR3 IR2 IR1

B ClkB
IR0 1

SHIFTER

RES ClkR

Data Out

ALU
CY-in CY-out C ClkC

MUX

Carry Out

DOC 112: Computer Hardware Lecture 15

Slide 15

Step 1: IR receives a clock pulse. It is loaded from the Data In lines


Data In
8 8

IR7

IR0

Control Unit

IR

ClkIR

IR7

IR6 IR5 IR4


8

MUX

A ClkA
8

A B Res
8

IR3 IR2 IR1

B ClkB
IR0 1

SHIFTER

RES ClkR

Data Out

ALU
CY-in CY-out C ClkC

MUX

Carry Out

DOC 112: Computer Hardware Lecture 15

Slide 16

Step 2: A receives a clock pulse. It might be loaded from the Data In lines
Data In
8 8

IR7

IR0

Control Unit

IR

ClkIR

IR7

IR6 IR5 IR4


8

MUX

A ClkA
8

A B Res
8

IR3 IR2 IR1

B ClkB
IR0 1

SHIFTER

RES ClkR

Data Out

ALU
CY-in CY-out C ClkC

MUX

Carry Out

DOC 112: Computer Hardware Lecture 15

Slide 17

Step 3: B and C receive a clock pulse. B is loaded from the Data In lines
Data In
8 8

IR7

IR0

Control Unit

IR

ClkIR

IR7

IR6 IR5 IR4


8

MUX

A ClkA
8

A B Res
8

IR3 IR2 IR1

B ClkB
IR0 1

SHIFTER

RES ClkR

Data Out

ALU
CY-in CY-out C ClkC

MUX

Carry Out

DOC 112: Computer Hardware Lecture 15

Slide 18

Step 4: IR receives a clock pulse. It is loaded from the Data In lines


Data In
8 8

IR7

IR0

Control Unit

IR

ClkIR

IR7

IR6 IR5 IR4


8

MUX

A ClkA
8

A B Res
8

IR3 IR2 IR1

B ClkB
IR0 1

SHIFTER

RES ClkR

Data Out

ALU
CY-in CY-out C ClkC

MUX

Carry Out

DOC 112: Computer Hardware Lecture 15

Slide 19

Step 5: Res and C receive a clock pulse. They are loaded from the ALU/Shifter
Data In
8 8

IR7

IR0

Control Unit

IR

ClkIR

IR7

IR6 IR5 IR4


8

MUX

A ClkA
8

A B Res
8

IR3 IR2 IR1

B ClkB
IR0 1

SHIFTER

RES ClkR

Data Out

ALU
CY-in CY-out C ClkC

MUX

Carry Out

DOC 112: Computer Hardware Lecture 15

Slide 20

Step 1 (again): IR receives a clock pulse. It is loaded from the Data In lines
Data In
8 8

IR7

IR0

Control Unit

IR

ClkIR

IR7

IR6 IR5 IR4


8

MUX

A ClkA
8

A B Res
8

IR3 IR2 IR1

B ClkB
IR0 1

SHIFTER

RES ClkR

Data Out

ALU
CY-in CY-out C ClkC

MUX

Carry Out

DOC 112: Computer Hardware Lecture 15

Slide 21

Step 2 (again): A receives a clock pulse. It might be loaded from the ALU/Shifter
Data In
8 8

IR7

IR0

Control Unit

IR

ClkIR

IR7

IR6 IR5 IR4


8

MUX

A ClkA
8

A B Res
8

IR3 IR2 IR1

B ClkB
IR0 1

SHIFTER

RES ClkR

Data Out

ALU
CY-in CY-out C ClkC

MUX

Carry Out

DOC 112: Computer Hardware Lecture 15

Slide 22

The cycle continues


The cycle continues in the same way while the processor is being operated, taking data and instructions from the Data In lines and putting the results on the Data Out lines. The design of the control unit which implements this cycle follows our (now very familiar) methodology.

DOC 112: Computer Hardware Lecture 15

Slide 23

Control Signals (output logic)


We can choose a state assignment that makes the output logic simple

DOC 112: Computer Hardware Lecture 15

Slide 24

The State Transition Table

DOC 112: Computer Hardware Lecture 15

Slide 25

Karnaugh Maps of the Controller

DOC 112: Computer Hardware Lecture 15

Slide 26

Checking the Unused States

Thus, if the OPERATE/IDLE signal is at logical 0 the system drops into the IDLE state immediately and the processor is ready to start working properly.

DOC 112: Computer Hardware Lecture 15

Slide 27

Gating the Registers


The controller generates outputs for ClkA, ClkB, ClkC, ClkIR and ClkRes. These signals are positive throughout the state, they are used as follows: A
System Clock ClkA

Everything happens on the falling edge of the clock.


DOC 112: Computer Hardware Lecture 15 Slide 28

Gating the Registers


A safer design has the controller changing on the negative edge and the registers being loaded on the positive edge of the clock. This ensures that, when the input is taken from the RAM it can be properly established before a register is loaded. A NAND gate does the trick
A System Clock
DOC 112: Computer Hardware Lecture 15

ClkA

Slide 29

Program Execution: Compute (A+B)/2


0.Set OPERATE/IDLE signal to 0 & apply two clocks.

The processor is in the IDLE state Input is loaded in the IR register. ALU is set to 00000000, shifter = unchanged. Because IR7=1 the Data In lines are loaded onto register A.
Slide 30

1. Set OPERATE/IDLE to 1 Set input data to 10000000 & apply one clock pulse. 2. Set number A on the Data In lines & apply one clock pulse
DOC 112: Computer Hardware Lecture 15

Program Execution: (A+B)/2


3.Set number B on the Data In lines and apply one clock pulse

B is loaded from the Data In lines and C is loaded from the ALU carry which is 0 The IR register is loaded from the Data In line. The ALU is set to A plus B and the shifter to logical shift right. The result (A+B)/2 is clocked into the RES register, the C bit indicates overflow
Slide 31

4. Set the Data In lines to to 00110111 and apply one clock pulse. 5. Apply one clock pulse.

DOC 112: Computer Hardware Lecture 15

The (A+B)/2 instruction in a program


The decrement instruction could be used as part of a longer program. The result of decrementing the number goes back to memory via the data out lines
10000000 Number A Number B 00110111 Unused

Instruction

Instruction

Instruction

DOC 112: Computer Hardware Lecture 15

Slide 32

At last:
We have succeeded in executing one program instruction! Well take a look at getting the instructions in and the results out next time.

DOC 112: Computer Hardware Lecture 15

Slide 33

S-ar putea să vă placă și