ch5c
ch5c
FSM
• State -- bubble
• control signals in bubble
• next state given by signals on arc
• not a great language to specify when things are complex
Microprogramming
Datapath remains the same
Only control is specified differently but does the same
Combinational
control logic Datapath control outputs
Microcode
Outputs storage
Datapath
Outputs control
outputs
Inputs
Input
Next state
1
State register
Inputs from instruction
register opcode field Sequencing
Microprogram counter
control
Adder
Implement control
• random logic - only if CAD tools generate
• PLAs - mostly generated by CAD tools
• Control store + update - why accept this contraint?
Vertical
• more and narrower micro-instructions
• dense encoding
• smaller control store - but may need more steps
Exceptions: Background
What happens:
• instruction fetch page fault
• illegal opcode
• privileged opcode
• arithmetic overflow
• data page fault
• I/O device statuc change
• power-on/reset
Exceptions: Software
• Exception handler (MIPS: .ktext beginning at 0x80000080)
• Set flag to detect incorrect entry -exception while in handler
• Save some registers
• Find exception type (MIPS: exception_code in Cause reg)
• E.g., I/O interrupt or syscall
• Jump to specific exception handler ...
Implementing Exceptions
We worry only about hardware, not software handler
IntCause
• 0 undef instruction
• 1 arithmetic overflow
(Op = 'J')
')
)
(O
pe
EQ
ty
p
R-
'B
SW ') =
=
= ' p
=
(O
ot
(Op
p
Memory address Branch
(O
Jump
he
or
') Execution
r)
computation LW completion completion
= '
2 (Op 6 8 9
ALUSrcA = 1
ALUSrcA = 1 ALUSrcA = 1 ALUSrcB = 00
ALUSrcB = 00 ALUSrcB = 00 PCWrite
ALUOp = 01
ALUOp = 00 ALUOp = 10 PCSource = 10
PCWriteCond
PCSource = 01
(Op = 'LW')
(O
p
=
'S
W'
Memory Memory
)
Write-back step
4 Overflow
RegWrite
MemtoReg = 1
RegDst = 0
Implementing Exceptions
New arcs in the FSM just like regular arcs
FSM more complex if must add many arcs