Memory system
In entry 21 we built a memory system consisting of 16x4 RAM, an MDR (Memory Data Register), a MAR (Memory address Register) and two MUX's. This allows RAM to be hooked up to either buses or DIP's:
I combined these 5 components into one chip called "SixteenByFourMemorySystem": It has the following pins:
- MARD (4): D pins of MAR, connection from the address bus.
- DIPA (4): Connect to address DIP's
- MDRD (4): D pins of MDR, connect from the data bus.
- DIPB (4): Connect to data DIP's
- WA (4): To the address bus (tri-state), W pins of MAR and RAM
- WD (4): To the data bus (tri-state), W pins of MDR and RAM
- Two pins to set source of address and data in RAM:
- SA: Select pin of address MUX (left)
- SD: Select pin of data MUX (right)
- 6 control pins + clock:
- MARL: Load pin of MAR
- MARW: Write pin of MAR
- MDRL: Load pin of MDR
- MDRW: Write pin of MDR
- RAML: Load pin of RAM
- RAMW: Write pin of RAM
Testing the ALU
In the previous entry, we designed the simplest version of an ALU, one that can add two 4-bit numbers A and B:
I want to try this out in combination with the memory system. This is the test I want to perform:
- Use the DIP switches to program RAM. Program address 0: 5 and address 1: 3.
- Move the content of address 0 (the number 5) to a register named A.
- Move the content of address 1 (the number 3) to a register named B.
- Hook up to ALU, which will calculate the sum (the number 8).
- Store the sum in RAM at address 2.
This is what we need to hook up:
- "SixteenByFourMemorySystem", see above
- Two "FourBitRegister", see entry 15
- "FourBitAdderTriState", see entry 22
Controls and DIPs:
Try this out yourself at Wokwi, project "Testing the ALU", where you can see all the connections. We can confirm that the setup is working as expected by performing the following steps:
I want to move on to a new topic, the program counter... in the next entry.