CodiodeCodiode
Home
Problem Solving
Skill Tracks
My Assignments
Contests
Leaderboard
Community
Settings
Codiode/Problems/Sequential Logic

Shift Register Based LIFO Stack

MediumLogic CircuitBuild

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 push commands when full is high.
  • Ignore pop commands when empty is high.
  • Clear all internal data and occupancy state when rst is high.

Topics

shift-registerdatapathlifostack

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.

Sign in to solveSee what Pro unlocks

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.

Related problems

  • 3-bit Ripple Counter from Toggle Flip-FlopsEasy
  • D Latch from a 2:1 MUXEasy
  • 2-bit Ring CounterEasy
  • T Flip-Flop from a D Flip-FlopEasy
  • Handshake Deadlock Due to Early ResetHard
  • Reconvergence of Individually Synchronized BitsHard
  • Debug: Asynchronous Clear GlitchHard
  • Clock Gate Enable Crossing DomainsHard

Browse all problems · Learning tracks