Thu, 29 September 2016, 23:11



A student writes:


> Hi Dr. Patt,
>
> In the physical memory combination logic truth table,
> I did not understand why we need to generate both LD.L and LD.H as 1 when
> reading a byte from memory.
> Can you please clarify, which of them need to be 1?
>
> Attached is the picture with my doubts circled.
>
> Thank you,
> <<name withheld to protect the student who wants to know why load 16 bits>>


You are loading a byte into a register.  The byte is 8 bits and the register
is 16 bits.  What are you going to do with those other 8 bits in the register.

Generally, you want to sign extend the byte data from memory in case you want
to do 16-bit arithmetic on that data.  The sign-extend can take place between
the memory and the MDR or between the MDR and the data path.  In the figure
you sent me, I decided to do the sign-extend between the memory and the MDR.
Note the only difference between the output of the two rows of the truth table
you are questioning is the byte rotate, which is done if you loading from an
odd address, and not done if you are loading from an even address (i.e.,
MAR[0] is 1 or 0).  So, the data comes from the appropriate byte of memory and
is rotated into position, [7:0].  Note the mux either takes [15:8] or [7]..[7].
for the high byte of the MDR.  In the case of a byte load, that is the
sign-extend, which must also be loaded into MDR for shipment to the DR of the
load instruction.

Good luck on the first exam.


Yale Patt