Home / Learn Verilog / Stack (LIFO)

Stack (LIFO)

Last in, first out.

Bottom lineLast in, first out.

Breaking it down

Stack3--2C1B0A
Stack

The basic idea

A stack pointer moves up on push and down on pop.

Why this comes up

Call stacks, expression evaluation.

The mechanics

Pointer plus memory.

Where it is used

  • Everyday RTL design
  • FPGA and ASIC projects
  • Testbenches and debugging

Try it

StackVerilog: edit and run

Pops return 30, 20, 10.

Quick check

1. Stack returns...