Registers and Addressed Memory

Registers hold values directly used by a circuit's local operations. A memory array stores a larger collection selected by an address.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Walk a data movement
  2. Keep the route visible
  3. Trace where a numerical result is actually stored
  4. Distinguish register names from address numbers

Walk a data movement

A computation might read a quantity from address 20 into a register, add one, and write a result to address 21. The retained register and the two memory cells are separate state. Addressed memory explains what is changed by the write.

Keep the route visible

Drawing the transfers helps distinguish receiving a new operand from modifying storage. Input, state, and output can be annotated at the level of each component.[1]

Trace where a numerical result is actually stored

A toy CPU loads the value seven from memory location 40 into register R1. Adding two to R1 changes the register to nine. Memory at 40 stays seven until an explicit store writes the new register value back. See a fetch, decode and execute trace.

Before: memory[40]=7
LOAD R1,[40] → R1=7
ADD R1,2 → R1=9
STORE [40],R1 → memory[40]=9

Distinguish register names from address numbers

The identifier R1 selects a register, while memory address one selects a position in a separate address space in this toy model. Trace operands according to their addressing modes. Test that modifying a loaded value alone does not update its source.

References

  1. Noam Nisan and Shimon Schocken, From Nand to Tetris: Course Projects ↩