CS202 - Assignment Ten

Due: 2015-05-16 4:00p

Objectives

Building the ∑niac

As I said in class, for this assignment you are going to be implementing a hardware simulation of the Σniac processor. Use the slides as your guide for building the datapath and then for specifying the control logic. To get you started, I am once again going to give you a template file.

Understanding the starter circuit

I have given you some circuits to get you started, but before you dive in, you should understand what you are looking at.

You should see two sub-circuits: main and cpu. All of your work will be in cpu. The main circuit is one that I built for you. It has the RAM, ROM, and an instance of the cpu circuit. The memory is broken up into blocks of 8 to make the addressing easier. Note that I use the low three bits of the address to pick a particular value from within a specific memory and a decoder connected to the select inputs to pick which block of memory is being addressed. The ROM can be edited (to program the machine), by clicking on a byte and typing the new value in. This is the primary interaction you will have with the main circuit.

There are, however, two other important parts to the main circuit. The reset button and the clock. The reset button is pretty self explanatory. The clock is something we have not properly played with, however. If you click it with the poke tool, it will oscillate, just like a normal input pin. However, it can actually oscillate on its own. If you look in the Simulate menu, you will find three menu items that control the clock. ‘Tick once’ behaves much like clicking the clock pin – however, the keyboard shortcut makes it more convenient. ‘Tick Enabled’ actually starts the clock. It will start oscillating all on its own. The frequency is controlled via the ‘Tick Frequency’ menu.

Inside the cpu circuit, you will find that I have left you with the input and output pins and the some sample circuitry. There are a number of things to notice:

The Datapath [25 points]

Building the datapath should be fairly straightforward. It should look fairly similar to the picture in the slides (except for the LED displays and the registers that are oriented differently).

For the various registers, you can copy the MB example I gave you. This uses the builtin register circuit (available in Memory). Make sure that you set the bit widths appropriately (values are 8 bit, addresses are 5 bit and the opcode is three bits).

Sadly, Logisim doesn’t include and adder/subtractor. You are welcome to add in a ripple carry adder, since you know how to make that pretty easily. However, you can also use the adder and subtractor circuits available in Arithmetic. You will need a multiplexor to switch between the two if you go this route.

Make sure to instrument the datapath with control points (connected to tunnels) so you can control operations.

Control Logic [40 points]

Once you have the datapath, it is time to build the control logic. Start by creating your state registers. Since t0-t3 advance in order with no variation, you can implement this with a counter and decoder. The E state bit can be implemented however you like, but a D-Flip Flop is sufficient.

Now, you will need to create a small circuit that controls each of the tunneled control lines in the circuit. These functions will use t0-t3, E, the opcode, and the high bit of A and a small number of gates to control set the various control lines. You may find it useful to split out the three bits of the opcode into separate tunnels so you can use them individually. I also found it useful to create tunnels for load, store, and branch, since they came up in a couple of places (i.e., I created small functions based on the opcode to give me a signal indicating that the current operation matched). As a hint, pay attention to the bit patterns of the opcode. For example, there is a simple way to tell that you want to advance to the E steps, can you see it?

Remember that to properly drive the datapath you will need these control signals:


Turning in your work

Please submit the Logisim file as username_hw10.circ on Moodle.