This problem arose related to the implementation of the load byte in a single data cycle without changing the data memory, and the solution was something lower.
alt text http://img214.imageshack.us/img214/7107/99897101.jpg
This is actually a pretty realistic question; most memory systems are completely word-based and individual bytes are typically considered only inside the processor. When you see βBus Errorβ on many computers, this often means that the processor tried to access a memory address that was not correctly aligned according to the words, and the memory system raised an exception. In any case, since byte addresses may not be a multiple of 4, we cannot pass them into memory directly. However, we can still get into any byte, because each byte can be found in some words and all word addresses are multiples of 4. So, the first thing we do is to make sure that we get the right word. If we take the high 30 bit address (that is, ALUresult [31-2]) and combine them with two 0 bits into the lower one (this is what "remains"shift 2 "really does), we have the address of the byte of the word that contains the desired byte. This is only the native byte address, rounded to a multiple of 4. This change means that lw will now also round addresses to a multiple of 4, but that's OK, since unaligned addresses will not work for lw in any case with this memory block. Well, now we get the word data back from the memory. How do we get the byte we want from it? Well, note that the byte offset is inside the word just the lower 2 bits of the address bytes are set. So we just use these 2 bits to select the corresponding byte from the word using the multiplexer.Note that the byte numbering is a large number, which is suitable for MIPS. Then we have a zero byte extension of up to 32 bits (i.e. just combine it with 24 zeros at its high end)as the problem indicates this. Actually, it was a small mistake to the question: in fact, the lbu instruction zero expands the byte, but the lb Sign expands it. Well. Finally, we need to expand the MemtoReg Multimedia Multiplexer to receive one new input: a byte with a zero extended value for the pound case. Control MemtoReg signal should be expanded to 2 bits. the original 0 and 1 cases change to 00 and 01, respectively, and we add a new case 10, which is used only in the case of the pound.Control MemtoReg signal should be expanded to 2 bits. the original 0 and 1 cases change to 00 and 01, respectively, and we add a new case 10, which is used only in the case of the pound.Control MemtoReg signal should be expanded to 2 bits. the original 0 and 1 cases change to 00 and 01, respectively, and we add a new case 10, which is used only in the case of the pound.
, , . ALU 2 ... ? , , , ??? , , ? ( , )