Lab 5

Computer Architecture I ShanghaiTech University
Lab 4 Lab 5 Lab 6

Goals

These exercises are intended to give you more practice with logisim-evolution and some more insights regarding libraries.

Exercises

Exercise 1: FSMs to digital logic

Translate a FSM into a digital logic circuit.

If you've been paying attention in lecture you've noticed that the circuit we built in part 2 of last weeks lab (Lab 4) looks eerily similar to the diagram of a general FSM circiut. We're going to modify our circuit to implement the following FSM:

If two ones in a row or two zeroes in a row have ever been seen, output zeros forever. Otherwise, output a one.

  1. Note that the FSM is implemented by the following diagram:

  2. Observe that the following is a truth table for the FSM:

    st1 st0 input | next st1 next st0 output
    000|011
    001|101
    010|110
    011|101
    100|011
    101|110
    110|110
    111|110

  3. We've provided you with a starter Logisim circuit to start out : FSM.circ.

  4. Note that the top level of the circuit looks almost exactly the same as our previous adder circuit, but now there's a FSMLogic block instead of a adder block. FSMLogic is the combinational logic block for this FSM. We have handled the output bit for you, as it's the most complicated to simplify and implement. You should complete the circuit by completing the StateBitOne and StateBitZero subcircuits.

    You could go from the truth table to SOP to a circuit, or you could notice that for each state bit, there are only two situations in which it is zero. This could make your life easier if you think a bit outside the box...

Checkoff

Exercise 2: C hacking

We are going to examine and hack the a library libdoubll.a. The according header file is libdoubll.h.

The library contains a hidden function that is not specified in the header file. Use the program nm to find out the name of the hidden function. Find out what this function does!

Install the Bless hex editor (using apt-get install) and examine libdoubll.a with it. Can you change the output of the hidden function using the hex editor?

Checkoff