Reputation: 171
lw
- A word is loaded into a register (in the CPU) from the specified address.
But from which memory is the word loaded? The RAM or the disk? I get that the memory is outside the CPU but which memory is the address (the second operand) referring to?
Upvotes: 0
Views: 283
Reputation: 16596
Storage devices are usually connected through more complex I/O (input/output) mechanism, as they did operate on speed which didn't even relate to the CPU speed (I mean any I/O with harddisk did take "ages" even with old MHz processors).
The MIPS architecture is probably closest to the "second generation" from the wiki:
They typically separated the computer into two "worlds", the CPU and memory on one side, and the various devices on the other.
The memory chip is usually directly connected to CPU (with M wires for address bus, on MIPS up to 32, and N wires for data transfer, on MIPS 32 also for data) and couple of wires handling the read/write/ack/err/parity transfer logic... which is lot of wires, and usually this takes major part of CPU pins and [almost] all pins of RAM chip.
Connecting any/several storage devices in similar generous way would made the design of PCB very difficult and expensive, so the I/O pins were usually more sparse, and all I/O devices shared that part of bus, using some control pins to sync/share when which device is using the bus.
So the data on disk don't have any "addresses" directly on CPU, the addressing is done by sending (sometimes several) signals over I/O bus to the device, by several instructions and taking some CPU time + syncing. The old disks were so slow, that this was no problem, also some block devices had simple enough logic to be controlled by DMA chip, which stands for "Direct Memory Access", this allowed the CPU to just set up the transfer with initial values, then the DMA chip finished it waiting for all the data coming from the device and writing it directly to RAM chip (without further CPU intervention).
Any ASM instructions talking about "addresses" and "memory" are always talking about RAM/ROM/alike chips, anything else would have it in instruction description.
Upvotes: 2