- #1
Wallboy
- 4
- 0
I'm currently learning the MIPS architecture and am implementing my own version of the ISA in a logic simulator. I'm sure I understand the differences between Byte and Word addressing, but I don't understand why we need Byte Addressing.
How I currently have my memory system implemented, is I have a 32x32 sized RAM. When I address my memory, I leave the lower two bits disconnected from the address input so all my addresses end in 00, or a value divisible by 4. This way all the addresses between a a number divisible 4 select the same data. Example of the PC addressing some instruction:
Now for implementing load byte instructions, I use a 4:1 MUX where each of the inputs is 8 bits that make up each Byte of the 32 bit word of data. I then use the offset value within the load byte instructions as the select to the MUX to select which byte I want. Then sign/zero extend the value to be written back to the register file.
This is where I don't see the use of using byte addressing when we can just use word addressing and use some simple logic like the MUX to select individual bytes within the 32 bit word.
How I currently have my memory system implemented, is I have a 32x32 sized RAM. When I address my memory, I leave the lower two bits disconnected from the address input so all my addresses end in 00, or a value divisible by 4. This way all the addresses between a a number divisible 4 select the same data. Example of the PC addressing some instruction:
Code:
PC Address Data Physical Address
0x00000000 0x1234ABCD 0x00000000
0x00000001 0x1234ABCD 0x00000000
0x00000002 0x1234ABCD 0x00000000
0x00000003 0x1234ABCD 0x00000000
0x00000004 0x567890EF 0x00000001
0x00000005 0x567890EF 0x00000001
...
Now for implementing load byte instructions, I use a 4:1 MUX where each of the inputs is 8 bits that make up each Byte of the 32 bit word of data. I then use the offset value within the load byte instructions as the select to the MUX to select which byte I want. Then sign/zero extend the value to be written back to the register file.
This is where I don't see the use of using byte addressing when we can just use word addressing and use some simple logic like the MUX to select individual bytes within the 32 bit word.