Use a four-state Moore machine. In state wait for an outer-sensor activation; combines the outer-only and both-sensors phases; records that the visitor has reached the inner-only phase; emits the one-cycle count pulse. Only has
INC = 1.The complete state transition table, with input order , isFor a normal entry the states are ; retreat after the first sensor instead gives with no pulse. Repeated samples at one sensor remain in the corresponding phase. State always exits on the next edge, so its output lasts exactly one clock period; an outer activation on that next edge goes directly to , allowing the next visitor to start immediately.
state 00 01 11 10 INC
A A B B A 0
B A B B C 0
C I B B C 0
I A B B A 1This follows the question's single-visitor entry model and merges the two outer-active phases as its hint requests. Inputs are sampled synchronously; the table also specifies deterministic recovery for other sampled combinations. It is not a specification of a bidirectional occupancy counter for arbitrary overlapping entry and exit traffic.
Encode by , , , , with reset to . Two positive-edge-triggered D flip-flops store the state. Minimizing the Boolean functions from the complete table givesEquivalently, the minimal sum of products form of is . The displayed factorization saves duplicated logic. The equations use only AND gates, OR gates and NOT gates; connect to the corresponding flip-flop data input and use one common clock.
For example, with input gives , entering the pulse state. In , either gives or gives , independently of ; the pulse cannot persist. The four states are distinguishable by their current output or future response to inputs and , so two state bits are also necessary.
Address a read-only memory with the two state bits and two input bits. Each word stores the two next-state bits and
INC, so a direct replacement for all the combinational logic is bits, or 48 bits. Program its 16 words from the state table, duplicating a state's output over all four input addresses. The two D flip-flops and clock remain outside the ROM. Articles by others on the same topic
There are currently no matching articles.
