This page does not represent the most current semester of this course; it is present merely as an archive.
Use the simulator distribution described in Lab 3 for this lab.
You may work with a single partner on this assignment.
Work in the sim/pipe
directory for this homework.
Do the textbook's problem 4.57: modify PIPE so it only uses one write port in the register file. Modify pipe-1w.hcl
to implement this logic.
An outline for success:
Split IPOPL
into two icode
s by changing f_icode
to be IPOP2
if imem_icode
and D_icode
are both IPOPL
.
Make sure that both IPOPL
and IPOP2
decode the same (same number of bytes, etc).
Have the first half of pop (IPOPL
) predict the new PC (f_predPC
) to be the same as the current PC (f_pc
) so that we will see it again for the second one.
Many places the HCL has IPOPL
now it will need to have IPOP2
instead or and/or in addition. Use the following to consider if it should be changed to IPOP2
:
IPOPL
will now act like iaddl $4, %esp
IPOP2
will now act like mrmovl -4(%esp), rA
where rA
is the destination register of the original popl
instruction.
Regression tests will verify that you didn't break anything:
linux> (cd ../pipe; make psim VERSION=1w)
linux> (cd ../ptest; make SIM=../pipe/psim)
Write port dstM should remain disabled (it already is in pipe-1w
, but don't re-enable it). One way to check that is:
linux> grep w_dstM pipe-1w.hcl
int w_dstM = RNONE;
if running the above grep
outputs anything other than that one line, you won't get any credit for this assignment.
Finally, any code with popl
should now take one more instruction per popl
; for example,
irmovl $0x100, %esp
pushl %esp
popl %eax
halt
should execute 9 instructions (not 8 like std
).
Submit your pipe-1w.hcl in the usual place.