Beruflich Dokumente
Kultur Dokumente
Slide 1
IR0
Control Unit
IR
ClkIR
IR7
MUX
A ClkA
8
A B Res
8
B ClkB
IR0 1
SHIFTER
RES ClkR
Data Out
ALU
CY-in CY-out C ClkC
MUX
Carry Out
Slide 2
1,0
1,0
Slide 3
Executing Instructions
1. Set the multiplexers so that the correct registers are connected together 2. Set the arithmetic hardware to compute the correct function 3. Provide a clock pulse to the registers that are to change.
DOC 112: Computer Hardware Lecture 17 Slide 4
0 Idle 1
Get Data
MPX PC
256 by 1 RAM
256 by 1 RAM
&c.
TSB
Data Bus
Slide 5
MPX
A
c1
select
f5f4f3 8 select
B
c1 s1 1 select
Res
SHIFTER
MDR
c4
c0 . . . c8 f0 .
c8
. . f5 s0 . . . s4
ALU
CYout CYin c3
C
+1
s3 MPX PC c5
Go
Controller
MPX
IR
c6
Slide 6
A Simple Controller
0 0
Idle
8
1,0
1
1 1,0
State Idle 1 2 3 4 5 6 7 8
7
1,0
2
1,0
6 3
1,0
5
1,0
1,0
Function Wait for the start signal Set address to get next byte Load the instruction, Set address to get next byte Load Data to Reg A Set address to get next byte Load Data to Regs B and C Set address to get next byte Load the Instruction Load Data to Regs C and MDR Set address to get next byte Load Result Address to MAR Store the Result Set Address to get next byte
Slide 8
Slide 11
32 f4 f3 select SHIFTER
MPX PC c10
A c7
f2 f1 f0 select A
c13
Controller
Slide 12
Problem Break
If we wanted to exchange the contents of register R0 and Register R1, what operations must our processor carry out?
Slide 13
Problem Break
If we wanted to exchange the contents of register R0 and Register R1, what operations must our processor carry out?
AR0 //Load A from R0
R1A,AR1 //Load R1 from A and A from R1 //at the same time! R0A //Load R0 from A
Slide 14
A few observations
Registers A, B, PC, MAR, MDR, IR and C belong to the hardware designers. Registers R0, R1, R2, R3, R4, R5 and R6 can be manipulated by the programmers. Most arithmetic operations will no longer require a carry in, so we can set the ALU Cin directly from the controller if required (eg for an increment instruction)
DOC 112: Computer Hardware Lecture 17 Slide 15
During the F states instructions are fetched from memory During the E states instructions are executed
E1 F3
DOC 112: Computer Hardware Lecture 17
F2
Slide 16
Instruction Format
We need to be very precise about our instruction format so that we can easily interpret it in hardware. We will assume that there will be 255 or less instructions, and the top eight bits will define the instruction. Most instructions will act on a register, so we will let the next four bits define the destination register.
31 24 23 0
31
24 23
20 19
Opcode
DOC 112: Computer Hardware Lecture 17
Rdest
Slide 19
Opcode
DOC 112: Computer Hardware Lecture 17
Rdest
Address
Slide 20
Opcode
Rdest
Address
I32 . . . I21 I20 I19 . . . I1 I0
Slide 21
The memory reference instructions contain a memory address in the bottom 20 bits. The mask converts this unsigned 20 bit number to a 32 bit number by masking the top bits.
DOC 112: Computer Hardware Lecture 17
O1 O0
Opcode
Rdest Rsrc
Unused
Slide 22
Opcode
Rdest Rsrc
Unused
Slide 23
Rdest
Unused
Slide 24
No Register Instructions
SKIP Following an arithmetic or compare operation SKIPPOSITIVE SKIPNEGATIVE and NOP
31 24 23 0
Opcode
Unused
Register Transfers
We continue our design, by determining the register transfers that will be needed to carry out each instruction. These register transfers will become the formal specification of the processor controller.
Slide 27
E3 E2
E1 F3
F2
Slide 28
31
24 23
20 19
Opcode
Rdest
Address
Slide 30
31
24 23
20 19
16 15
Opcode
DOC 112: Computer Hardware Lecture 17
Rdest Rsrc
Unused
Slide 31
31
24 23
20 19
16 15
Opcode
Rdest Rscr
Unused
Slide 32
31
24 23
20 19
Opcode
DOC 112: Computer Hardware Lecture 17
Rdest
Unused
Slide 33
No Register Instructions
Slide 34
To be continued
Slide 35