Shift Register Based LIFO Stack
Hardware stacks provide zero-latency state saving for fast interrupt return addresses and nested subroutine calls. A bidirectional shift register implements a Last-In-First-Out (LIFO) memory structure by physically moving data elements rather than updating read and write pointers.
Construct a 4-word deep, 1-bit wide stack using bidirectional shifting. The top of the stack is always available on data_out.
| push | pop | Action | |--------|-------|--------| | 0 | 0 | Hold state | | 1 | 0 | Shift left: data_in enters the top of the stack | | 0 | 1 | Shift right: discard the top of the stack | | 1 | 1 | Hold state (invalid operation) |
The empty signal must assert when zero elements are in the stack. The full signal must assert when four elements are in the stack. Prevent pushes when full is high and prevent pops when empty is high. Synchronous rst clears all data to 0 and resets the stack occupancy to empty. When the stack is empty, data_out must output 0.
Constraints
- Implement a 4-deep, 1-bit wide LIFO.
- Use a bidirectional shift register for data storage.
- Ignore
pushcommands whenfullis high. - Ignore
popcommands whenemptyis high. - Clear all internal data and occupancy state when
rstis high.
Topics
Solve this problem
Place the gates, wire them up and watch the signals settle. Every submission runs on the same simulation engine that grades it.
This problem is part of Codiode Pro. The statement above is free to read.
The circuit builder and code editor need a desktop screen. On a phone, read the problem here and open it on a laptop to solve.