5 ms·
This might be a bit of a tangent but what's the advantages and disadvantages of register-memory vs. load-store? Thanks!
by hangonhn 4y ago
This might be a bit of a tangent but what's the advantages and disadvantages of register-memory vs. load-store? Thanks!
- rwaksmunski 4y agoI would imagine load-store to be simpler to implement in hardware.
- __s 4y agoregister-memory will involve a more complicated encoding (to designate addressing modes, tho arguably register/memory is only 1 bit, but that halves your register count for the same size encoding, & it gets messy because your addressing encoding itself will want to reference registers & then you add in offsets/scaling for r1+r2*4) & screws up cycle accurate instruction timing (because memory latency is cache dependent)
- oso2k 4y agoRM machines usually have more Memory Modes with which to access memory. You can do a math op while indirectly accessing a memory address that depends on a calculation of that address and add and offset to it. So that makes programming many things easier. It’s a little more how humans learn and think of math. Think using arrays, lists, vectors, hashes, trees. However, this often generates data dependencies which makes pipelining and ILP require more work to achieve efficiently. It also often makes the code dense. https://en.m.wikipedia.org/wiki/Register%E2%80%93memory_architecture https://en.m.wikipedia.org/wiki/Register%E2%80%93memory_arch... LS is generally found in RISC machines and is also generally considered far easier to implement pipelining and ILP. Fewer and often simpler Memory Modes, more obvious or simpler to deduce data dependencies. But it often takes a few more instructions to complete an algorithm or even a simple expression. Less code density. https://en.m.wikipedia.org/wiki/Load%E2%80%93store_architecture https://en.m.wikipedia.org/wiki/Load%E2%80%93store_architect... There’s also stack machines which approximate math well especially if you like RPN/prefix notation. They just tends to make logical constructs like loops look unfamiliar when compared to math or typical/popular programming languages. So it makes programming easy, compiling easy since it’s relatively natural to analyze & compile expressions. Also, instructions can be extremely compact such as single bytes. https://en.m.wikipedia.org/wiki/Stack_machine https://en.m.wikipedia.org/wiki/Stack_machine Another slightly related take was VLIW. You take snippets of instructions (Basic Blocks in PL) that are known to fit certain pipelining or data dependencies rules. Theses blocks of code can then be executed concurrently since you have well established criteria. However making compilers able to predict when blocks should execute in the presence of a complex single processor turned out to make writing the compilers very complex. https://en.m.wikipedia.org/wiki/Very_long_instruction_word https://en.m.wikipedia.org/wiki/Very_long_instruction_word
- P_I_Staker 4y agoAside, if you've had an interest in the Itanium processor, and the very long instruction word sound familiar, that's because it's one of the most famous, widely used example. If memory serves, the compilers never really caught on. The assumption was that they would eventually figure out how to leverage the explicit parallelism efficiently, but it never materialized as a performant solution for most problems.
- woodruffw 4y agoIn principle, load-store architectures are simpler to implement, simpler to write compilers for, simpler to write speculative optimizations for, and have denser/simpler instruction encodings. Similarly in principle, register-memory architectures are simpler to write assembly for as a human, and simpler to write different speculative optimizations for.