|0 = ALU 3
1 = ALUi 2 regs and an immediate
2 = LW load word from memory
3 = SW store word to memory
4 = B branch
5 = BE branch if equal
6 = BLT branch if less than
7 = BGT branch if greater than
The possible values for op are: 0 = ADD , 1 = SUB, 2 = AND, 3 = OR , 4 = XOR
The flags are set by all the ALU operations. The
file stallcpu.lgf on the H: drive contains a
working implementation of this cpu. To work with this you also need the
file called cpu.gat,and you must add the line "gates
+ cpu.gat" to your log.cnf file. cpu.gat contains 2 useful devices - a
16bit ALU and a 16 bit register. Instead of using multiplexors this design
uses tri-state devices; the "oe" pin on a register floats the register
outputs if it is zero. The implementation contains a hardwired control
unit (no microcode!) and a hazard detection unit. When a hazard is detected
the pipeline is stalled.
Your task is to change the hardware so that rather than stall the pipeline, data is forwarded to the ALU. The design already has the necessary routes in the datapath for simple forwarding.
nfwdalutoa puts the output from the previous alu operation onto the "a" input of the alu.
nfwdmemtoa puts the value currently in the datapath for the "mem" cycle onto the "a" input of the alu.
The faster you can make the CPU the more marks you will get. You can do this assignment in stages, first try to work out nfwdalutoa, next you can try nfwdmemtoa. After this there are still some stalls that can be eliminated. The program run by the cpu is called prog.asm and there is also a very simple assembler - asm.c so that you can write your own test programs. Some marks will be awarded for interesting test programs.
As before, submit a single file containing your design. No paper submissions will be accepted (but you can write on the diagram by pressing the 'l' key).