Hi! I have made two truth tables but have a hard time writing the boolean expression in order to be able to see how to draw a diagram of the state machine using logic gates and D elements. I am using Moore FSM and below are the instrctions and my truth tables. WOuld really appreciate help on how to go about writing the boolean expression so I can draw the circuit! The problem for me to understand is what truth table to use and how to write the boolean expression without it getting too long and complex of an equation. Any guidance is very much appreciated!
Lioncage for one lion
There exists a lion pen in a zoo somewhere. The pen is composed of two parts, a cage ("lejonbur") and a larger
outside area, connected to each other by one hallway. The shape of the pen makes it difficult for the zookeeper
to know where the lion is when cleaning the outside area. To alert the zookeeper of when the lion exits the
cage, two sensors, G1 and G2, are placed in the hallway. Looking from inside the cage, G1 is placed before G2.
The sensor will send logical ones (1) when a lion is infront of it, and logical zeros (0) when it is not. A lion
leaving the cage will therefore trigger the following sequence.
(G1, G2) : 00 → 10 → 11 → 01 → 00
A lion entering the cage would instead trigger the following sequence.
(G1, G2) : 00 → 01 → 11 → 10 → 00
The above sequences only mark the switching of the sensors. In reality, the sensors will repeat each combination
many times between each step in the sequence.
We will start by solving the lioncage when there is only one lion in the pen before solving the problem for
multiple lions. All lions follow a set of rules:
• No lion can turn around when it has entered the hallway.
• No lion can dodge a sensor when walking through the hallway.
• No lion can fit its entire body between the two sensors, they are too close to each other.
• Only one lion at a time can walk through the hallway.
Note
The corresponding finite-state machine (FSM) of a state graph can be divided into two parts: combinational
logic and state memory.
An FSM starts in some state and has some input signals that are together sent through some combinational
logic K, giving an output and also a next state. The current state then changes from the previous state to
the next +
as the state memory D updates, see figure 1.
To figure out the size of the state memory we calculate the number of bits, , needed to store the number of
states the FSM has.
= ⌈2(#states)⌉
Task 1.3.2
Create a truth table for the combinational logic used to realize the state graph. Write boolean
expressions for the output functions in the truth table. Draw a diagram of the state machine using logic gates
and D-elements.
| State | Description | Q2Q1Q0 | Danger |
|---|---|---|---|
| S0 | 00 inside the cage | 000 | 0 |
| S1 | 10 (by G1) | 001 | 1 |
| S2 | 11 (between G1 och G2) | 010 | 1 |
| S3 | 01 (byG2) | 011 | 1 |
| S4 | 00 outside | 100 | 1 |
| Current (Q2Q1Q0) | G1G2 | Next (Q2’Q1’Q0’) |
|---|---|---|
| 000 (S0) | 00 | 000 (S0) |
| 000 (S0) | 10 | 001 (S1) |
| 001 (S1) | 10 | 001 (S1) |
| 001 (S1) | 11 | 010 (S2) |
| 001 (S1) | 00 | 000 (S0) |
| 010 (S2) | 11 | 010 (S2) |
| 010 (S2) | 01 | 011 (S3) |
| 010 (S2) | 10 | 001 (S1) |
| 011 (S3) | 01 | 011 (S3) |
| 011 (S3) | 11 | 010 (S2) |
| 011 (S3) | 00 | 100 (S4) |
| 100 (S4) | 00 | 100 (S4) |
| 100 (S4) | 01 | 011 (S3) |
Lioncage for one lion
There exists a lion pen in a zoo somewhere. The pen is composed of two parts, a cage ("lejonbur") and a larger
outside area, connected to each other by one hallway. The shape of the pen makes it difficult for the zookeeper
to know where the lion is when cleaning the outside area. To alert the zookeeper of when the lion exits the
cage, two sensors, G1 and G2, are placed in the hallway. Looking from inside the cage, G1 is placed before G2.
The sensor will send logical ones (1) when a lion is infront of it, and logical zeros (0) when it is not. A lion
leaving the cage will therefore trigger the following sequence.
(G1, G2) : 00 → 10 → 11 → 01 → 00
A lion entering the cage would instead trigger the following sequence.
(G1, G2) : 00 → 01 → 11 → 10 → 00
The above sequences only mark the switching of the sensors. In reality, the sensors will repeat each combination
many times between each step in the sequence.
We will start by solving the lioncage when there is only one lion in the pen before solving the problem for
multiple lions. All lions follow a set of rules:
• No lion can turn around when it has entered the hallway.
• No lion can dodge a sensor when walking through the hallway.
• No lion can fit its entire body between the two sensors, they are too close to each other.
• Only one lion at a time can walk through the hallway.
Note
The corresponding finite-state machine (FSM) of a state graph can be divided into two parts: combinational
logic and state memory.
An FSM starts in some state and has some input signals that are together sent through some combinational
logic K, giving an output and also a next state. The current state then changes from the previous state to
the next +
as the state memory D updates, see figure 1.
To figure out the size of the state memory we calculate the number of bits, , needed to store the number of
states the FSM has.
= ⌈2(#states)⌉
Task 1.3.2
Create a truth table for the combinational logic used to realize the state graph. Write boolean
expressions for the output functions in the truth table. Draw a diagram of the state machine using logic gates
and D-elements.