How to get the output equation in a three bits output mealy fsm?

Thread Starter

Gr10

Joined Feb 10, 2025
15
I'm currently trying to get the output and state equation for a Elevator FSM. This is the bubble diagram corresponding FSM

1753138331668.png


1. States

| State | Code (2 bits) | Meaning |
| :---- | :-----------: | :------------- |
| S1 | 00 | Floor 1 (low) |
| S2 | 01 | Floor 2 (mid) |
| S3 | 10 | Floor 3 (high) |

Note: Here I used "binary encoding" taking account that there are only three states.


2. Inputs (floor requests)

| Signal | Code (2 bits) | Meaning |
| :----- | :-----------: | :-------------------- |
| R1 | 01 | Request for 1st floor |
| R2 | 10 | Request for 2nd floor |
| R3 | 11 | Request for 3rd floor |



3. Outputs (elevator actions)

| Signal | Code (3 bits) | Meaning |
| :----- | :-----------: | :--------------- |
| U1 | 100 | Go up 1 floor |
| U2 | 101 | Go up 2 floors |
| D1 | 001 | Go down 1 floor |
| D2 | 010 | Go down 2 floors |
| NoGo | 111 | Stay in place |


4. State-Transition Descriptions

This is a Mealy machine, so outputs depend on the current state and the input:

1. From S1 (00) – Floor 1

R1 (01) → stays in **S1 (00); Output = NoGo (111)
Already on floor 1 and floor 1 is requested; no movement.”
R2 (10) → goes to S2 (01); Output = U1 (100)
On floor 1 and floor 2 is requested; go up 1 floor.”
R3 (11) → goes to S3 (10); Output = U2 (101)
On floor 1 and floor 3 is requested; go up 2 floors.

2. From S2 (01) – Floor 2

R1 (01) → goes to S1 (00); Output = D1 (001)
“On floor 2 and floor 1 is requested; go down 1 floor.”
R2 (10) → stays in S2 (01); Output = NoGo (111)
“On floor 2 and floor 2 is requested; no movement.”
R3 (11) → goes to S3 (10); Output = U1 (100)
“On floor 2 and floor 3 is requested; go up 1 floor.”

3. From S3 (10) – Floor 3

R1 (01) → goes to S1 (00); Output = D2 (010)
“On floor 3 and floor 1 is requested; go down 2 floors.”
R2 (10) → goes to **S2 (01)**; **Output = D1 (001)
“On floor 3 and floor 2 is requested; go down 1 floor.”
R3 (11) → stays in S3 (10); Output = NoGo (111)
“On floor 3 and floor 3 is requested; no movement.”




This is the state table that I've made:

| Present State (Q₁ Q₀) | Input | Next State (Q₁′ Q₀′) | Output |
| :-------------------: | :-----------: | :------------------: | :---------------: |
| **S₁** (00) | **R₁** (01) | **S₁** (00) | NO\_GO (111) |
| **S₁** (00) | **R₂** (10) | **S₂** (01) | U₁ (011) |
| **S₁** (00) | **R₃** (11) | **S₃** (10) | U₂ (100) |
| **S₂** (01) | **R₁** (01) | **S₁** (00) | D₁ (001) |
| **S₂** (01) | **R₂** (10) | **S₂** (01) | NO\_GO (111) |
| **S₂** (01) | **R₃** (11) | **S₃** (10) | U₁ (011) |
| **S₃** (10) | **R₁** (01) | **S₁** (00) | U₁ (011) |
| **S₃** (10) | **R₂** (10) | **S₂** (01) | D₂ (010) |
| **S₃** (10) | **R₃** (11) | **S₃** (10) | NO\_GO (111) |


But my main doubt is how I get the output equation from the table?

One thing that came to mind is go down the table and look for each entry where NOGO is the output, and make a sum of product boolean expression out of the inputs and state. For example:

For NOGO:

| State (Q1Q0) | Input | Next State (Q1⁺Q0⁺) | Output (3 bits) | Transition |
| :----------: | :----------: | :-----------------: | :-------------: | :-------------------------------------: |
| 00 (**S1**) | 01 (**R1**) | 01 (**S2**) | 011 (**U1**) | Moves up from S1 to S2 (↑ one floor) |
| 00 (**S1**) | 10 (**R2**) | 00 (**S1**) | 111 (**NoGo**) | Stay in S1

NOGO = Q0' Q1' R2 R2 +...(other NOGO for other states)

That approach is fine?

Also I dont know how to get the next state equations.
 
Last edited:

WBahn

Joined Mar 31, 2012
32,702
You've already got several other threads on this same problem. That just invites chaos as people can't keep track of what thread they've mentioned one thing when trying to build on it. Please, one thread per topic/problem.
 
Top