In the datapath, there are several places where a mux (multiplexor) is
used to select which of two sources should provide a value. When you
modify the datapath to add the jal
instruction, you may find yourself
wanting to change one or more of these two-way choices to a three-way
choice. There are two options for how you can do this; either is
fine. One option is to add a second two-way mux, with the output from
one of the two-way muxes feeding into one of the inputs of the other.
Then you will have a new control signal controlling the new mux. The
other option is to modifying the existing two-way mux to be a
three-way mux, with a new input labeled 2 (in addition to the existing
inputs 0 and 1). If you do this, you'll need to widen the mux's
control signal from a one-bit control (capable of selecting 0 or 1) to
a two-bit control (capable of selecting 0 (binary 00), 1 (binary 01),
or 2 (binary 10). The fourth possibility, binary 11, wouldn't be
used.
In the datapath, you may find yourself wanting to inject a constant value in at some point. You can do this just by writing the constant with an arrow leading from it, as in the example of the 4 that feeds into the adder that computes PC+4.
In the control table from page 308 (Figure 5.18), you will definitely need to add a
row, for the jal
instruction. However, you may also need to add one
or more more columns, for any newly added or widened control signals
that you introduce in the datapath. If so, you will need to show the
values of these new control signals in the existing rows as well as in
the new row. Be sure to also add a "Jump" column, which the
textbook implicitly added in the last paragraph of page 313. Be sure to use X where possible, rather
than needlessly specifying 0 or 1.
addi
instruction. Add any necessary datapaths and control signals to the multicycle datapath of Figure 5.28 on page 323 and show the necessary modifications to the finite state machine of Figure 5.38 on page 339. (Note that the latter diagram is buggy; in state 4, RegDst should be 0 and MemtoReg should be 1.) You can show your modifications on photocopies of the figures.
Instructor: Max Hailperin