Finishing the ALU/ALU Control
Notes
- Back to chapter 4.
- If you look at the diagram
- Note that the ALU has a different control unit.
- ALU Control takes input from the regular control unit.
- ALU OP table on 271
- And it also takes the full instruction
- This allows it to examine the opcode
- As well as various control bits encoded in the instruction
- Like bits 10-11 in the D type instruction
- And SHAMT in the R type
- The ALU control uses this combination to the proper bits to control the ALU (as we developed in class)
- See the table on 272/273
- This is most likely done as a hard coded circuit
- Appendix C discusses constricting control units.
- Note: This seems to be just raw MIPS hardware.
- But the idea is good.
- Control can be done in a number of ways
- Combinational circuits, no memory
- Circuits with memory.
- We have seen combinational circuits in L&S
- These are fast, somewhat easy to build when they are simple
- But become complex when they need to be large.
- Looking at the bits in table 4.1.2 (273) there are only 4-5 bits of the opcode that we make a decision on.
- Most are don't cares
- So this is on the more simple side.
- A second way to build a circuit is using sequential circuits
- Remember, these have a memory.
- In Ben Eater's 8-bit computer
- He had a table, indexed into by the opcode and a μpc
- The μpc was simply the step required to execute a portion of the instruction
- This instruction was just the state of the various control lines at that step.
- For example, Fetch had two pieces
- MI/CO (Clock out, MAR in)
- RO/II/CE (Memory to MDR*, MDR to IR, PC++)
- We might look at those notes.
- Add was the longest instruction
- Fetch as above
- IO/MI - IR out/load MAR (move the immediate to the IR)
- RO/BI - Memory to MDR/ MDR to ALU Src 2
- EO/AI - ALU to bus/ Load A register from bus
- This type of encoding is good as it is changeable
- But it is slower than a direct circuit.
- Μinstructions are stored in a EEPROM
- And we will be fetching from that.
- It will be small and fast,
- But it will still slower than a direct circuit.
- A second way is a finite state machine or an automata
- Each state represents a different action for the machine
- Based on the opcode/results the machine moves to a different state
- Each state consists of the values of the control lines.
- I found a FSM on line, but I don't like it.
- So let's build a LEG8 FSM
- Consider:
- Load
- Store
- Add r,r,r
- Add r,r,I
- B
- BZ
- It might be helpful to consider a modified fetch decode execute
- Instruction Fetch
- Decode/Register Read
- Execute/ALU Operation
- Memory Operation
- Register Write
- If we do this, someone please take a picture and send it to me.
- Consider:
- But implementing this would be a matter of adding a state register and control for each state
-
- This is from appendix C in P&H
-
- PLA a quick side trip
- A programmable logic array
- This is a generic circuit that implements an OR of ANDS
- The generic category might be Programmable Logic Device (PLD)
- They are (apparently ) purchasable
-
(By Ilia Kr. - Own work. Created using Inkscape, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=22305322)
- In the logic diagram adding multiple dots to an and line computes the sum
- Adding multiple dots to the or line, computes the product.
- Remember for an adder:
- Cout = ab + aCin + bCin
- S = a b Cin + a b Cin + a b Cin + abCin
-
(Same attribute as above, modified by me)
- I am fairly sure that you can get these as FPGA's (Field Programmable G Arrays) that can be changed electronically.
- P&H finish with this (long) statement
-
Independent of whether the control is represented as a finite-state diagram or as a microprogram, translation to a hardware control implementation is similar. Each state or microinstruction asserts a set of control outputs and specifies how to choose the next state. The next-state function may be implemented by either encoding it in a finite-state machine or using an explicit sequencer. The explicit sequencer is more efficient if the number of states is large and there are many sequences of consecutive states without branching. The control logic may be implemented with either ROMs or PLAs (or even a mix). PLAs are more efficient unless the control function is very dense. ROMs may be appropriate if the control is stored in a separate memory, as opposed to within the same chip as the datapath.