













Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!














(^0) InstructionMemory A^1 D
A^ ALUB
THIS IS IT!
“Motivating Force”
or “Inciting Incident” This is the point in the coursewhere the PLOT actually begins.We are now ready to build acomputer.The ingredients are all in place,now it is time to build a legitimatecomputer. One that executesinstructions, much the way anyother desktop, PDA, or othercomputer does.
(^1 )
A^ B^ ALU
RA1^ RA2WA^ RegisterWEFile(3-port)WD RD1^ RD
Sub Bool Shft Math
OP 0 XX^
0 1
A+B 1 XX^
0 1
A-B X^ X^
1 1
0
X^ X^
1 1
1
X^00
1
0 B<<A X^10
1 0
B>>A X^ 1 1^
1 0
B>>>A X^00
0
0 A & B X^01
0 0
A | B X^10
0 0
A ^ B X^ 1 1^
0 0
A | B
RA1^ RegisterFile
PC +
Rt: <20:16> ALU A^
Control LogicALUFN^ WERF
00
100XXX 00000
RA1^ RegisterFile
PC +
A^ ALU
Control LogicALUFN^ WERF
00
000XXX shamt
shamt:<10:6>^ ASEL^10
PC +
RA1^ RegisterFile
A^ ALU
Control Logic
Adr
00
immediate
SEXT shamt:<10:6>^ ASEL^10
PC +
RA1^ RegisterFile
A^ ALU
Control Logic
Adr
00
immediate
SEXT shamt:<10:6>
PC +
RA1^ RegisterFile
A^ ALU
Control Logic
Adr
00
immediate
That “x4” unit istrivial. I’ll just wirethe input shiftedover 2–bitpositions. Why add, anotheradder? Couldn’t wereuse the one inthe ALU? Nope, itneeds to do asubtraction.
SEXT shamt:<10:6>
(^012) (^345) 6
Rd:<15:11> Rt:<20:16>^
(^01) “31” (^2) “27” 3
PC +
RA1^ RegisterFile
A^ ALU
Control Logic
Adr
00
00000
SEXT shamt:<10:6>
(^012) (^345) 6
Rd:<15:11> Rt:<20:16>^
(^01) “31” (^2) “27” 3
PC +
RA1^ RegisterFile
A^ ALU
Control Logic
Adr
00
slt:^ if (Reg[rs] < Reg[rt]) Reg[rd]
←←←←^ 1; else Reg[rd]
←←←←^0
sltu: if (Reg[rs] < Reg[rt]) Reg[rd]
←←^ 1; else Reg[rd]←←
←←^0 ←←
00000
SEXT shamt:<10:6>
(^012) (^345) 6
Rd:<15:11> Rt:<20:16>^
(^01) “31” (^2) “27” 3
PC +
RA1^ RegisterFile
A^ ALU
Control Logic
Adr
00
lui:^ Reg[rt]
←←←←^ Immediate << 16
immediate
BSEL (^01) SEXT
(^012) (^345) 6
Rd:<15:11> Rt:<20:16>^
(^01) “31” (^2) “27” 3 shamt:<10:6>^ “16”^ ASEL^201
PC +
RA1^ RegisterFile
A^ ALU
Control Logic
Adr
00
BSEL (^01) SEXT
(^012) (^345) 6
0x800000000x80000040 0x
These inputsshouldprobably beregistered afew times toavoidmetastabilityproblems
shamt:<10:6>“16”^ ASEL^201 WASEL Rd:<15:11> Rt:<20:16>^
(^01) “31” (^2) “27” 3
PC +
RA1^ RegisterFile
A^ ALU
Control Logic
Adr
00
Rd:<15:11> Rt:<20:16>^
0123
BSEL (^01) SEXT shamt:<10:6>
(^012) (^345) 6
“16”
0x800000000x80000040 0x
“31”“27”
1