I'm pretty new to computer organization and systems so I apologize in advance if I say anything wrong. I'm learning about the MIPS architecture and I have a ton of questions about memory and addressing:
- So far, all I know is that when we have a 32-bit CPU, that means that we process data in 32 bit chunks. The CPU consists of the ALU and cache memory that comprises of 32 registers. The memory stores instructions that are 32 bits long. The way I visualise memory is that it is a rectangle with multiple rows, with each row being 32 bits long.
- Now, my question is related to how we address registers and memory. When we use the load word or store word commands, we call certain memory locations in order to store data in them, or to transfer data stored in them into a register present in the cache. I have come across terms such as $t0, $s0 etc. which I'm assuming are monikers for certain kinds of registers. My question is- How long are memory addresses in bits? For example, if we want to access data stored in row 1 of the memory, how long is the "address" of row 1? I read somewhere that the address itself is 32 bits long, and this 32 bit address in turn refers to data that is 32 bits long. Does this mean that there are 2^32 possible addresses or rows of memory, with each address storing 32 bits of data?
- Now if the above is true, I assumed that registers also have addresses that are 32 bits long, but then I realized that in MIPS there are only 32 registers, which means that each register address is 5 bits long, and each 5-bit address points to 32-bit long data. In that case, are register addresses and memory addresses of different lengths, i.e. 5bits and 32 bits respectively?
- My final confusion is related to the difference between byte addressability and word addressability. If data is byte addressable, that means that every byte has its own address. Does this mean that the 2^32 memory locations I spoke about earlier point to data that is 8 bits long and not 32 bits long? Similarly, in the case of registers, does every byte of the 32 registers have its own address? Which means that there are 4*32 unique addresses for each byte? In that case, it contradicts the fact that 5 bits are used to store the address. As you can see, I'm extremely confused and would appreciate all the help I can get.