computer organization lecture 18
DESCRIPTION
Computer Organization Lecture 18. IF, ID, R-type microprogramming Exam 2 review. Microprogramming overview. Review instructions, understand goals Determine state diagram Microprogram individual instructions List tokens on one line Repeat for remaining clocks Merge all instructions - PowerPoint PPT PresentationTRANSCRIPT
Fall 2006
Lillevik 333f06-l18 1University of Portland School of Engineering
EE 333
Computer OrganizationLecture 18
IF, ID, R-type microprogrammingExam 2 review
Fall 2006
Lillevik 333f06-l18 2University of Portland School of Engineering
EE 333
Microprogramming overview
• Review instructions, understand goals
• Determine state diagram
• Microprogram individual instructions– List tokens on one line– Repeat for remaining clocks
• Merge all instructions
• Test, test, test
Fall 2006
Lillevik 333f06-l18 3University of Portland School of Engineering
EE 333
MicroAsm
• Java application: MicroAsm.class, SavitchIn.class
• Microinstruction: free format, no fixed fields
• Requires input file: text-only, file.upg
• Creates output file: file.txt• Errors: command line file name, file I/O,
unrecognizable token
• Execution: BlueJ or DOS command line
Fall 2006
Lillevik 333f06-l18 4University of Portland School of Engineering
EE 333
MicroAsm syntax• Directives
org: nbrSets uPC to value of nbr, used with branch token
// commentEverthing after // ignored
• Each line – directives (optional)– tokens (signals to assert)– last line contains return
Fall 2006
Lillevik 333f06-l18 5University of Portland School of Engineering
EE 333
MicroAsm source format
Fall 2006
Lillevik 333f06-l18 6University of Portland School of Engineering
EE 333
uProgram tokens
Token Value FunctionBranch 0000 0100 Branch the uPgm to the opcode (default is next address)
Rwr 0000 0400 Write to the REG file
Imm 0000 0800 uPgm controls ALU function (default is IR[3:0])
PCinc 0000 1000 Increment the PC
PCwr 0000 2000 Write to the PC
PCwrcond 0000 4000 Write to the PC if EQ is asserted
EPC 0000 8000 Select EPC for PC write
IoD 0001 0000 Select RALU for memory address (default is PC)
MEMwr 0002 0000 Write to the memory (default is to read)
IRwr 0004 0000 Write to the IR
MDRwr 0008 0000 Write to the MDR
Fall 2006
Lillevik 333f06-l18 7University of Portland School of Engineering
EE 333
uProgram tokens, continued.
Token Value Function SPCwr 0010 0000 Write to SPC register
PCsrc 0020 0000 PC write data is branch address (default is jump address)
ALUa-R0
ALUa-PC
0040 0000
0000 0000
First ALU argument is R0
First ALU argument is PC (default is PC)
ALUb-R1
ALUb-Ext
ALUb-Trnc
0000 0000
0080 0000
0100 0000
Second ALU argument is R1
Second ALU argument is Sign Extended offset
Second ALU argument is Truncated offset
REG-RALU
REG-MDR
0000 0000
0200 0000
REG write data is the RALU
REG write data is the MDR
Fall 2006
Lillevik 333f06-l18 8University of Portland School of Engineering
EE 333
uProgram tokens, continued.
Token Value Function REGfmt 0800 0000 Selects IR[10] for the REG destination (default is IR[9])
ALUOpadd
ALUOpsub
ALUOpand
ALUOpor
ALUOpsll
ALUOpsrl
0000 0000
1000 0000
2000 0000
3000 0000
8000 0000
9000 0000
ALU function is add
ALU function is subtract
ALU function is logical AND
ALU function is logical OR
ALU function is shift left logically
ALU function is shift right logically
Next
Return
uPC+1
00
Inserts uPC+1 into uPgm next address (default)
Inserts 00 into uPgm next address
Fall 2006
Lillevik 333f06-l18 9University of Portland School of Engineering
EE 333
Fall 2006
Lillevik 333f06-l18 10University of Portland School of Engineering
EE 333
Fall 2006
Lillevik 333f06-l18 11University of Portland School of Engineering
EE 333
Partial MDP16 state diagram
A
G
C
D
E
F
H
B
JI
Lw or SwR-fmt Beq Jump
Reset
Lw Sw
Fall 2006
Lillevik 333f06-l18 12University of Portland School of Engineering
EE 333
MDP16 state diagram
ID
sllno
p
R-fmt
sw
srl lw
addi
beq j ori
subi
andi
IFReset
1- 3
add
itio
nal c
lock
s
2 clocks
Fall 2006
Lillevik 333f06-l18 13University of Portland School of Engineering
EE 333
IF state ?
• Write instruction from memory into IR
• Increment the program counter
IRwr
PCinc
Fall 2006
Lillevik 333f06-l18 14University of Portland School of Engineering
EE 333
ID state ?
• Determine optimistic branch address
• Branch to opcode
Alua-pc
Alub-ext
imm
aluopadd
branch
Fall 2006
Lillevik 333f06-l18 15University of Portland School of Engineering
EE 333
R-type instruction
• Op code: 01
• Func bits (IR[3:0]) determine ALU operation
• Write result into register file
Fall 2006
Lillevik 333f06-l18 16University of Portland School of Engineering
EE 333
R-type EX state?
• Origin: 0x10
• Operation: clock 3– RALUout = A funct B
• Functional units– ALU funct = IR[0:3]– ALU inputs
• R0• R1
Org: 10
alua-r0
Alub-r1
Fall 2006
Lillevik 333f06-l18 17University of Portland School of Engineering
EE 333
R-type WB state?
• Next: return to IF
• Operation: clock 4
– Reg [ IR(9)] = ALUout
• Functional units– Must write to reg file– Data comes from RALU– Use IR[9] as destination register
rwr
reg-ralu
return
Fall 2006
Lillevik 333f06-l18 18University of Portland School of Engineering
EE 333
Exam 2 review
See website Syllabus & Reference page
Fall 2006
Lillevik 333f06-l18 19University of Portland School of Engineering
EE 333
Fall 2006
Lillevik 333f06-l18 20University of Portland School of Engineering
EE 333
IF state ?
• Write instruction from memory into IR
• Increment the program counter
IRWr
PCinc
Fall 2006
Lillevik 333f06-l18 21University of Portland School of Engineering
EE 333
ID state ?
• Determine optimistic branch address
• Dispatch to opcode
Imm
aluA_Pc
aluB_Ext
aluOpAdd
branch
Fall 2006
Lillevik 333f06-l18 22University of Portland School of Engineering
EE 333
IF, ID microprogram
Two microinstructions, two ROM contents
Fall 2006
Lillevik 333f06-l18 23University of Portland School of Engineering
EE 333
R-type microprogram
• Func bits (IR[3:0]) determine ALU operation
• Write result into register file
aluA_R0
aluB_R1
Rwr
reg_Ralu
Return
Fall 2006
Lillevik 333f06-l18 24University of Portland School of Engineering
EE 333
R-type microprogram