Simple Memory Assignment
Please read all of these instructions carefully before starting!
For this assignment you will create a simple memory circuit using Logisim. This memory will consist of two registers, each of which can store a 2-bit value. There will be 4 inputs to your memory:
- i0 and i1, which are used to write new values into one of the registers.
- ADDRESS, which is used to specify which register to use. Since there are only 2 registers, we only need a 1-bit address.
- WRITE, which is used to activate the input to a register’s flip-flops (instead of a clock).
Your memory will have 2 outputs:
- o0 and o1, which will be the two bits stored in the selected register when WRITE is not activated.
I have provided a Logism file named examples.circ
which contains a decoder and a 2-bit register. Play around with both of these before you start working on your circuit and be sure you understand how they work. See below for desriptions.
Create your solution in a separate Logism project and save it as a file named solution.circ
(all lowercase). You can copy my examples and paste them into a separate Logism project when you are building up your circuit.
Decoder
The decoder has two inputs and four outputs. Exactly one of the outputs will be 1 at any given time, based on the values of the inputs. Logism provides a single-unit decoder, but you must use a decoder consisting of gates like the one in my example for your solution. Feel free to copy and paste my example decoder.
In your solution, the inputs to the decoder will be ADDRESS and WRITE. Thus the outputs of the decoder will be used to activate the following functionality:
- When ADDRESS is 0 and WRITE is 0, o0 and o1 are the values of the bits stored in register 0.
- When ADDRESS is 1 and WRITE is 0, o0 and o1 are the values of the bits stored in register 1.
- When ADDRESS is 0 and WRITE is 1, the values stored in register 0 are updated to be i0 and i1, and both o0 and o1 are 0.
- When ADDRESS is 1 and WRITE is 1, the values stored in register 1 are updated to be i0 and i1, and both o0 and o1 are 0.
Register
The register uses two of Logisim’s built-in D flip-flops. The outputs of the register are the current states of the flip-flops. There are 2 data inputs and one input named WRITE. The moment WRITE becomes 1, the stored values in the flip-flops are updated to be the values of the data inputs.
Putting it Together
Your final solution will have one decoder and two registers. The A and B input pins in my example decoder will become the ADDRESS and WRITE inputs. You will need to remove the output pins from the decoder and instead route the outputs of the decoder to the appropriate gates in order to select the appropriate functionality. For example, the output from the decoder that is 1 when ADDRESS is 0 and WRITE is 1 must be wired to both of the WRITE inputs of register 0.
The outputs of the decoder when WRITE is 0 are a little more complicated to route. You’ll need to logically combine these outputs with the Q outputs of the registers to select the appropriate values for o0 and o1. Again, you’ll want to remove the output pins from the example registers and instead wire the outputs of the registers appropriately.
Testing your Circuit
Here is an example sequence of inputs you can use to test your circuit. You should try other permutations of inputs as well. Use Simulate -> Reset Simulation to reset all the input pins and flip-flop values to 0. Here we go:
- Initially all inputs, outputs, and flip-flop values are 0
- Set ADDRESS to 1. Both outputs should still be 0.
- Set i1 to 1. Again the output should not change, and the flip-flop values should not change.
- Set WRITE to 1. This should write the i0 and i1 values to the flip-flops of register 1. In this case, one of the flip-flop values should become 1. Both outputs are still 0.
- Set WRITE to 0. Now the contents of register 1 should be the output (i0 should be 0 and i1 should be 1).
- Set ADDRESS to 0. The outputs should now switch to be the values of register 0 (which in this case would still both be 0).
Now try writing values to register 0 and ensure that the output is correct when you toggle the WRITE input off again. Make sure you try writing all combinations of bits for both registers.
Staying Sane
Creating this circuit may feel a little overwhelming. Some suggestions:
- Label things as you go so you don’t get lost thinking about what wire is what.
- Go back to my examples to remind yourself what the basic building blocks look like when they’re not surrounded by wires.
- Re-read these instructions if you feel like you have forgotten what the heck you are supposed to be doing in the first place.
Submission
Make sure your inputs and outputs are labeled correctly. Add the file solution.circ
to your local assignment repository and push your submission back to git-keeper.