Date: Sun, 21 Sep 2003 18:41:59 -0500 (CDT) From: Yale Patt To: ee360n-15280@sunfire2.ece.utexas.edu Subject: a student writes... A student writes: This question concerns byte alignment on the 32bit data bus to/from the processor with regards to the memory system shown in question 9 of problem set 2. During a byte (SIZE = 00) read from memory, should we expect the lowest significant byte (bits 7:0) of the 32 bit data bus input to the processor from MDR to contain the data byte retrieved from memory in all cases (PHYS_ADDR = x0/x1/x2/x3)? I am not sure I understand exactly what you are asking. Let me try to answer it this way: The data on the bus (for reads and writes) are always aligned as follows. If the bus consists of 32 data lines, bus[31:0], and the byte addressable memory is as I showed in class: 11 10 01 00 <---- last two address bits -------- -------- -------- -------- | | | | | | | | | | | | | | | | | A | | B | | C | | D | | | | | | | | | | | | | | | | | | | | | | | | | -------- -------- -------- -------- | | | | /8 /8 /8 /8 | | | | --------------------/------------------ 32 | / 32 | -------- | | | Proc | | | Then, bus[7:0] goes to D, bus[15:8] goes to C, bus[23:16] goes to B, ... If we are reading a byte with an address ending in 01, that byte shows up on bus[15:8] and must be shifted into position and sign-extended before loaded into a register. Conversely, if we writing a byte into a memory location whose address ends in 11, that byte must be rotated into position so that it is on bus[31:24] when it goes to memory. In this case, only the WE for "A" would be asserted. In both cases, all the rotating, sign-extending, determining which WE to assert are done inside Proc. We could do them all at the memory arrays if we wish, but it is usually preferred to keep the memory arrays simple, straightforward. Yale Patt And for a byte write, should we expect the least significant bytes of the 32 bit data bus from the processor to contain the data to be written to memory. For example, if we wanted to perform a byte write to memory address 0x0000002 of value 0xCD, would the 32 bit data output from the processor reflect the value 0x000000CD? Thanks in advance for your response. <>