These exercises are intended to give you more practice with logisim-evolution and some more insights regarding libraries.
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.
Note that the FSM is implemented by the following diagram:
Observe that the following is a truth table for the FSM:
st1 st0 input | next st1 next st0 output 0 0 0 | 0 1 1 0 0 1 | 1 0 1 0 1 0 | 1 1 0 0 1 1 | 1 0 1 1 0 0 | 0 1 1 1 0 1 | 1 1 0 1 1 0 | 1 1 0 1 1 1 | 1 1 0
We've provided you with a starter Logisim circuit to start out : FSM.circ.
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...
- Show your StateBitZero circuit to your TA and demonstrate that it behaves correctly.
- Show your StateBitOne circuit to your TA and demonstrate that it behaves correctly.
Exercise 2: C hacking
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?
- Use nm with the library. Explain to the TA what you see, especially what do the different numbers, letters and string mean?
- Show the TA how you found out what the hidden function does. Explain to the TA what it does.
- Show the TA how you changed the output of that hidden function and demo the modified library