A = Car is at the gate (1 if at gate; 0 otherwise)

B = Position signal (complicated)

  • (by default, the gate is low to block passage)
  • Gate opens at A=1 and V=1
    • If A switches to 0 before V=0, then gate closes
  • As soon as the car is no longer detected (likely when the car has passed the gate), lower the gate
  • R=1 means “raise” and L=1 means “lower”
    • While the gate is being moved, the R or L must be held at 1 so the gate doesn’t stop at the middle (I’m guessing only for the cycles where it hasn’t finished moving)
      • Means R and L cannot change unless B has changed to 1.
  • B will be 1 when the gate has reached one of the two final positions (fully open or closed)
    • B is also 1 if it’s in one of the discrete states
  • Ensure the gate doesn’t attack people

Lifting (1X0) (just verified)

AVB
000Lowering (0XX)e
001Loweringe
010Loweringe
011Loweringe
100Same (1X0)e
101Up (1X1)e
110Samee
111Upe

Lowering (0X0)

  • i.e. no car in sight
AVB
000Same (0X0)e
001Down (0X1)e
010Samee
011Downe
100Lifting (1XX)e
101Liftinge
110Liftinge
111Liftinge
  • Assuming: If there’s a car, stop lowering and lift for safety!

Up (1XX)

AVB
000Lower (0XX)e
001Lowere
010Lowere
011Lowere
100Stay (1XX)e
101Staye
110Staye
111Staye

Down (0XX) (only when A=V=1 does it go to raising) (stays down UNLESS A=V=1) If A=0 before V=1, then stay closed

AVB
000Stay (0XX)
001Stay
010Stay
011Stay
100Stay (10X)
101Stay
110Lift (11X)
111Lift

Part A: 2

StateInput (AVB)Next State
Down0XX or 10XDown
Down11XLifting
Lifting0XXLowering
Lifting1X0Lifting
Lifting1X1Up
Up1XXUp
Up0XXLowering
Lowering0X0Lowering
Lowering1XXLifting
Lowering0X1Down

Part A: 3

Since there are 4 states, we would need ceil(log_2(4)) = 2 bits minimum to store the 4 states.

Part A: 4

Flip flop values to state assignments:

F1F0
00Down
01Lifting
10Up
11Lowering

Part A: 5 State Table

F1F0AVBnewF1newF0
000XX or 10X00
0011X01
010XX11
011X001
011X110
101XX10
100XX11
110X011
111XX01
110X100

Part B

(This was when i thought it was a mealy machine)

Part B for real

  1. A Moore Machine; each state determines raising, lowering, or lack thereof.

Submission

  1. Krish Patel | 1011078129 State transitions diagram: (separate)

State Table (Part A):

StateInput (AVB)Next State
Down0XX or 10XDown
Down11XLifting
Lifting0XXLowering
Lifting1X0Lifting
Lifting1X1Up
Up1XXUp
Up0XXLowering
Lowering0X0Lowering
Lowering1XXLifting
Lowering0X1Down

Flipflop assignments:

00Down
01Lifting
10Up
11Lowering
Truth table for the state logic:
State ()Input ()Next State ()
000XX00
0010X00
0011X01
010XX11
011X001
011X110
101XX10
100XX11
110X011
111XX01
110X100
Truth table for the output logic
RL
0000
0110
1000
1101