Practice
VHDL practice problems
Each problem here ships a VHDL testbench of its own, so a VHDL design is graded natively, not translated. You write the design for the given entity, and GHDL simulates it against the tests.
222 problems49 free to solve51 easy, 115 medium, 56 hard
The same problems accept Verilog and SystemVerilog, which makes them a direct way to compare how one design reads in each language.
What these problems cover
- Processes, signals and variables
- std_logic, std_logic_vector and numeric_std arithmetic
- Clocked processes, resets, counters and shift registers
- State machines with enumerated types
- Datapath and memory blocks
Free to start
Solve these with a free account. Every other statement on this page is free to read.
Problems by track
Verilog Syntax and Language Basics20
- Basic Module Ports
- Vector Port Endianness
- Inout Port Mechanics
- Port Width Mismatch
- Parameterized Module Width
- Overriding Parameters via Hash Parentheses
- Bitwise versus Logical Negation
- Reduction AND and NAND
- Reduction XOR Parity Generator
- Addition with Carry Out
- Multiplication Width Expansion
- Ternary Operator Mux
Combinational RTL12
- Intermediate Variables in Combinational Blocks
- Priority Routing via If Else
- Tristate Bus Driver
- Instruction Decoder using Casez
- Parameterized Equality Comparator
- Decoder with Enable Logic
- Binary to Gray Code Datapath
- Find First One Priority Encoder
- Variable Indexed Part Select
- 8-to-1 Multiplexer via Case Statement
- Cascaded 4-to-1 Multiplexer
- Packet Header Formatter
Sequential RTL22
- Basic D Flip Flop
- Four Stage Shift Register
- Variable Swap Without Temporary Storage
- Asynchronous Active Low Reset
- Synchronous Active High Reset
- Dual Reset: Async Hard Clear and Sync Soft Clear
- Basic Clock Enable Register
- Register with Byte Enables
- Priority Control: Reset Overrides Enable Overrides Load
- Parameterized Serial In Parallel Out
- Parallel In Serial Out with Load Control
- Bidirectional Arithmetic Shift Register
FSM Coding15
- Three-Process Moore FSM
- The Default Assignment Trick
- Typedef Enum State Machine
- Explicit One Hot Encoding
- Overlapping Sequence Detector Checker
- Nonoverlapping Sequence Detector with Abort
- Sequence Detector: 101
- Vending Machine Accumulator FSM
- Traffic Light Controller with Timer
- Serial Adder Mealy Machine
- Valid and Ready Handshake Transmitter
- Valid and Ready Handshake Receiver
Synthesis Intuition17
- The Incomplete Case Latch
- Ternary Operator Safety
- The Variable Loop Bound
- If Else Priority Encoder
- Parameterized Sign Extension Unit
- Four Stage Pipelined Multiplier
- ROM Inference via Case
- Power of Two Alignment
- Tapped Delay Line
- Up Down Counter with Dynamic Step
- Registered vs Combinational Output
- The Implicit State Machine
Datapath Design25
- 8-bit ALU with Flags
- Signed versus Unsigned Comparison ALU
- 8-bit Logical Barrel Shifter
- 16-bit Arithmetic Barrel Shifter
- 4x4 Array Multiplier from Gates
- 16-bit Sequential Multiplier
- Signed Sequential Multiplier
- 8-bit Signed Accumulator
- Saturating Subtractor
- Absolute Value with Bit Growth
- 16-bit Leading Zero Counter Loop
- 32-bit Leading Zero Counter Tree
Memory and Storage24
- Combinational ROM Initialization
- Synchronous Single Port RAM
- Write First Single Port RAM
- Read First Single Port RAM
- Read After Write Hazard Detection
- Simple Dual Port RAM 1R1W
- True Dual Port RAM 2RW
- True Dual Port RAM Collision Resolution
- Register File with Hardwired Zero
- CPU Register File 2R1W
- Shift Register Based FIFO
- Circular Buffer Pointer Math
Pipelining18
- Two Stage Datapath
- Valid Data Propagation
- Reconvergent Paths with Different Latencies
- Global Pipeline Stall
- Valid Bubble Insertion
- Upstream vs Downstream Stall Backpressure
- Branch Flush Mechanism
- Simultaneous Stall and Flush Priority
- Parameterized Pipeline Delay Line
- Parameterized Pipeline with Valid Signals
- Parameterized Pipelined Reduction OR
- Pipeline Interlock on Data Hazard
Interfaces and Protocols19
- Synchronous Rising Edge Detector
- Continuous Counter Debounce
- Basic Pulse Width Modulator
- Glitch Free PWM with Shadow Register
- Basic Fibonacci LFSR
- Serial CRC-8 Generator
- Valid Ready Pipeline Stage
- The Skid Buffer
- Baud Rate Pulse Generator
- UART Transmitter FSM
- UART Receiver Oversampling Counter
- UART Receiver Data Shifter
SystemVerilog RTL9
Clock Domain Crossing and Synchronization32
- Two-Flop Synchronizer
- Asynchronous Assertion and Synchronous Deassertion
- Reset Synchronizer Tree
- Coordinated Reset Sequence
- Divide by Two Clock Generator
- Divide by Three with 50% Duty Cycle
- Divide by Even N with 50% Duty Cycle
- Latch-Based Clock Gating Cell
- Glitch Free Clock Multiplexer
- The Glitchy Clock Multiplexer
- Clock Enable Generator
- Full Four Phase Handshake Protocol
Debug and Verification4
Interview Circuit5
How your answer is checked
VHDL submissions are analyzed and simulated by GHDL in VHDL 2008 mode against the problem's VHDL testbench. You get each test's expected and actual value and the waveform of the run.
Questions
- Which VHDL standard is used?
- VHDL 2008, through GHDL.
- Why do only some RTL problems offer VHDL?
- Verilog and VHDL cannot share a testbench, so VHDL is offered on a problem only once a VHDL testbench has been written and checked for it. This page lists the problems that have one.
- Does the FSM view work for VHDL?
- The state diagram is drawn for VHDL designs. GHDL's waveform skips enumerated signals, so a VHDL state machine gets the diagram but not the per clock state trace.