We have a read-only register which lets us store permanent data in a loop. We want to turn it into a read-write register that will let us change the data dynamically.
To achieve this, we’re going to build a selector, a device that selects from 2 input streams.
There are 3 streams coming in from the bottom:
- Two input streams,
a
andb
- A control stream
The control stream decides which input stream gets routed to the output stream:
- When the control stream has
, it sends the left stream
a
to the output - When the control stream has
, it sends the right stream
b
to the output
This will let us dynamically select which stream we want to use.
dynamic register
How does this help us with building a dynamic register?
As the register loops around, you can think of it as constantly “reading in” its own data. But if we now place our selector at the start of this loop, we can switch the register between two modes: reading its own data, or reading an external source. This will let us overwrite the register.
- The right-hand stream reads the register
- While we send
through the control stream, the register loops its data
- When we send
through the control stream, the register reads from the write stream
This might look like a lot of space just to store 6 bits. However, the read and write mechanisms remain a constant size even if we scale up the register. So if we made a huge register that could store (say) a thousand bits, the read/write parts would still fit into about half a disk.
Now we have the ability to read and write blocks of data, let’s look at way to apply this to a previous problem.
continue