CodiodeCodiode
Home
Problem Solving
Skill Tracks
My Assignments
Contests
Leaderboard
Community
Settings
Codiode/Problems/Memory Design

Debugging Stack Pointer Off By One

MediumLogic CircuitDebug

Hardware stack pointers must strictly adhere to their empty and full conventions to prevent data corruption. A stack controller manages a 3-bit stack pointer SP that points to the current top element of a memory array.

Expected behavior:

| Push | Pop | Mem_WE | Mem_Addr | SP_Next | |--------|-------|----------|------------|-----------| | 0 | 0 | 0 | SP | SP | | 1 | 0 | 1 | SP + 1 | SP + 1 | | 0 | 1 | 0 | SP | SP - 1 | | 1 | 1 | 0 | SP | SP |

Simulation shows Mem_Addr = 2 for input Push = 1, Pop = 0, and SP = 2. The memory address is incorrect for a push operation, causing the controller to overwrite the current top element instead of writing to the next available slot. Inspect the circuit and correct the fault.

Constraints

  • Only modify the internal wiring or logic gates to correct the fault.
  • Do not alter the top-level module interface or port names.

Topics

combinational-logicdebugpointersmemory-controller

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

  • Debugging FIFO Pointer CorruptionHard
  • Debug Register File Structural HazardMedium
  • Debugging Memory Inference FailuresMedium
  • Debugging Read During Write CollisionMedium
  • Debugging ROM Latch InferenceEasy
  • Full versus Empty AmbiguityMedium

Browse all problems · Learning tracks