Chargement…
Chargement…
Start from a technical specification and design the complete VHDL, validated by GHDL simulation.
0/76 exercises completed
AND Gate
VHDLDesign a two-input AND logic gate. This is the fundamental building block of all combinational logic.
OR Gate
VHDLDesign a two-input OR logic gate. The output is active when at least one input is '1'.
NOT Gate (Inverter)
VHDLDesign a logic inverter. The output is the complement of the input.
XOR Gate
VHDLDesign a two-input XOR (exclusive OR) logic gate. Used in adders, parity detection and encryption.
2-to-1 Multiplexer
VHDLDesign a purely combinational 2-to-1 multiplexer. The selector chooses which of the 2 inputs is forwarded to the output.
NAND Gate
VHDLDesign a two-input NAND logic gate. This is the universal gate: any logic function can be built using NAND gates.
Complete 2-to-1 Multiplexer
NOR Gate
VHDLDesign a two-input NOR logic gate. Like NAND, it is a universal gate.
Complete NAND Gate
XNOR Gate
VHDLDesign a two-input XNOR (equivalence) logic gate. The output is active when both inputs are the same.
Complete NOR Gate
Half Adder
VHDLDesign a half adder that adds two bits without carry-in.
Complete XNOR Gate
1-Bit Full Adder
VHDLDesign a 1-bit full adder with carry-in and carry-out. This block is the fundamental building block of any arithmetic unit.
Complete Half Adder
4-to-1 Multiplexer
VHDLDesign a purely combinational 4-to-1 multiplexer. The 2-bit selector chooses which of the 4 inputs is forwarded to the output.
Complete 1-Bit Full Adder
2-to-4 Binary Decoder
VHDLDesign a 2-to-4 binary decoder with an enable signal. The output is a one-hot code corresponding to the selector value when the decoder is active.
Complete 4-to-1 Multiplexer
8-Bit Parity Checker
VHDLDesign an 8-bit parity checker. The output indicates whether the number of 1-bits in the input is odd (parity = 1) or even (parity = 0).
Complete 2-to-4 Binary Decoder
4-Bit Comparator
VHDLDesign a 4-bit combinational comparator that compares two unsigned numbers and indicates whether the first is greater than, equal to, or less than the second.
Complete 8-Bit Parity Checker
D Flip-Flop with Enable
VHDLImplement a D flip-flop with enable and active-high asynchronous reset. The flip-flop stores i_d on the rising edge only if i_en is active.
Complete 4-Bit Comparator
4-Bit Register
VHDLImplement a 4-bit register with enable and active-high asynchronous reset.
Complete D Flip-Flop with Enable
4-Bit Left Shift Register
VHDLImplement a 4-bit left shift register with serial input and asynchronous reset.
Complete 4-Bit Register
4-Bit SIPO Shift Register
VHDLImplement a 4-bit serial-in parallel-out (SIPO) shift register with asynchronous reset. Bits enter serially and are available in parallel.
Complete 4-Bit Left Shift Register
4-Bit Up Counter
VHDLImplement a 4-bit synchronous up counter with enable and asynchronous reset.
Complete 4-Bit SIPO Shift Register
4-Bit Down Counter
VHDLImplement a 4-bit synchronous down counter with enable and asynchronous reset. Reset initializes to maximum value (15).
Complete 4-Bit Up Counter
4-Bit Ring Counter
VHDLImplement a 4-bit ring counter with asynchronous reset. A single '1' bit circulates through the register.
Complete 4-Bit Down Counter
SPI Slave (CPOL=0, CPHA=1)
VHDLImplement a generic SPI slave in mode 1 (CPOL=0, CPHA=1) receiving a 32-bit frame.
Complete 4-Bit Ring Counter
8-bit SPI Master
VHDLImplement an SPI master (mode 0: CPOL=0, CPHA=0) capable of transmitting and receiving a byte over an SPI bus.
Complete SPI Slave (CPOL=0, CPHA=1)
SPI Master Mode 0
VHDLImplement an SPI master in mode 0 (CPOL=0, CPHA=0) capable of transferring 8 bits serially.
Complete 8-bit SPI Master
BCD Counter
VHDLImplement a synchronous BCD counter that counts from 0 to 9 then wraps to 0, with active-low asynchronous reset and enable input.
Complete SPI Master Mode 0
Clock Divider
VHDLImplement a generic clock divider that divides the input frequency by 2 × G_HALF, with asynchronous reset.
Complete BCD Counter
4-bit Shift Register
VHDLImplement a 4-bit serial shift register (SISO) with asynchronous reset. Bits shift right on each rising edge.
Complete Clock Divider
Sequence Detector "101"
VHDLImplement a Mealy state machine that detects the binary sequence "101" on a serial input, with overlap handling.
Complete 4-bit Shift Register
Simple 4-operation ALU
VHDLImplement a combinational ALU performing 4 operations on two 8-bit operands: addition, subtraction, AND, and OR, with carry flag.
Complete Sequence Detector "101"
Transparent Latch (FPGA Pitfall)
VHDLImplement a transparent latch to understand this classic FPGA pitfall. When enable is high, output follows input; when enable is low, output holds its value.
Complete Simple 4-operation ALU
Loadable Shift Register
VHDLImplement an 8-bit loadable shift register combining parallel load and left shift, with load taking priority.
Complete Transparent Latch (FPGA Pitfall)
Pulse Stretcher
VHDLImplement a pulse stretcher that extends a single-cycle signal into an output active for G_CYCLES clock cycles.
Complete Loadable Shift Register
Watchdog Timer
VHDLImplement a safety watchdog timer: a counter decrements continuously and triggers a timeout if no i_kick signal is received in time.
Complete Pulse Stretcher
LED Sequence Controller
VHDLImplement a 3-state FSM controller (OFF, BLINK, ON) that drives an LED with blinking. Each button press advances the sequence.
Complete Watchdog Timer
PWM Generator
VHDLImplement a PWM generator with a sequential counter and a combinational output controlled by the duty cycle.
Complete LED Sequence Controller
8-bit LFSR
VHDLImplement an 8-bit Linear Feedback Shift Register (LFSR) with seed loading and combinational feedback output.
Complete PWM Generator
Moving Average Filter (4 samples)
VHDLImplement a 4-sample moving average filter with a sequential shift register and combinational average computation.
Complete 8-bit LFSR
Generic Parallel Register with Enable
VHDLImplement an N-bit parallel register with enable and combinational update detection.
Complete Moving Average Filter (4 samples)
2-FF CDC Synchronizer with Edge Detection
VHDLImplement a two flip-flop CDC synchronizer with combinational rising and falling edge detection.
Complete Generic Parallel Register with Enable
CRC-16/CCITT (polynomial 0x1021)
VHDLImplement a synchronous CRC-16 calculator, bit by bit, with the CCITT polynomial and a combinational output of the CRC register.
Complete 2-FF CDC Synchronizer with Edge Detection
I2C Master - Start & Addressing
VHDLImplement the first two phases of an I2C master: START condition and sending the 7-bit address + R/W bit via a 5-state FSM.
Complete CRC-16/CCITT (polynomial 0x1021)
7-Segment Decoder
VHDLImplement a 7-segment decoder that converts a BCD digit (0-9) into 7 signals to light the correct display segments, with enable.
Complete I2C Master - Start & Addressing
Top Level - Instantiation
VHDLImplement a top level that instantiates a BCD counter and a 7-segment decoder, correctly wiring internal signals and external ports.
Complete 7-Segment Decoder
4-Bit Binary Multiplier
VHDLDesign a 4-bit combinational multiplier that computes the product of two unsigned numbers on an 8-bit output.
Complete Top Level - Instantiation
BCD to Binary Converter
VHDLDesign a combinational converter that transforms an 8-bit BCD (Binary-Coded Decimal) number into its 7-bit binary value.
Complete 4-Bit Binary Multiplier
8-to-1 Multiplexer
VHDLDesign a purely combinational 8-to-1 multiplexer. The 3-bit selector chooses which of the 8 inputs is forwarded to the output.
Complete BCD to Binary Converter
1-to-2 Demultiplexer
VHDLDesign a 1-to-2 demultiplexer. The input is routed to one of the two outputs based on the selector.
Complete 8-to-1 Multiplexer
1-to-4 Demultiplexer
VHDLDesign a 1-to-4 demultiplexer. The input is routed to one of the four outputs based on the 2-bit selector.
Complete 1-to-2 Demultiplexer
3-to-8 Binary Decoder
VHDLDesign a 3-to-8 binary decoder with enable signal. The output is a one-hot code corresponding to the selector value.
Complete 1-to-4 Demultiplexer
Binary to Gray Code Converter
VHDLDesign a 4-bit binary to Gray code converter. Gray code is used in communications because only one bit changes between consecutive values.
Complete 3-to-8 Binary Decoder
Gray Code to Binary Converter
VHDLDesign a 4-bit Gray code to binary converter. Inverse operation of the binary to Gray converter.
Complete Binary to Gray Code Converter
4-Bit Subtractor
VHDLDesign a 4-bit combinational subtractor that computes the difference of two unsigned numbers with borrow indication.
Complete Gray Code to Binary Converter
JK Flip-Flop
VHDLImplement a JK flip-flop with active-high asynchronous reset. The JK flip-flop is the most versatile: it can hold, set, reset, or toggle its output.
Complete 4-Bit Subtractor
T Flip-Flop
VHDLImplement a T (Toggle) flip-flop with active-high asynchronous reset. When T='1', the output toggles on each rising edge.
Complete JK Flip-Flop
Synchronous SR Flip-Flop
VHDLImplement a synchronous SR flip-flop with active-high asynchronous reset. S sets the output to '1', R resets it to '0'.
Complete T Flip-Flop
BCD to Excess-3 Encoder
VHDLDesign a combinational encoder that converts a valid BCD digit to Excess-3 code.
Complete Synchronous SR Flip-Flop
Hamming (7,4) Encoder
VHDLEncode 4 data bits with three even-parity bits to form a Hamming (7,4) word.
Complete BCD to Excess-3 Encoder
Fix an Unintended Latch
VHDLFix an incomplete combinational process that keeps an old value when `i_sel = "11"`.
Complete Hamming (7,4) Encoder
Odd Counter
VHDLBuild a synchronous counter that only walks through 4-bit odd values.
Complete Fix an Unintended Latch
Self Reloading Counter
VHDLImplement a down counter that reloads itself when it reaches zero.
Complete Odd Counter
Thermometer to Binary Decoder
VHDLConvert an 8-bit thermometer code to a binary count.
Complete Self Reloading Counter
Fibonacci Generator
VHDLDesign an 8-bit sequential Fibonacci sequence generator.
Complete Thermometer to Binary Decoder
Sequence Reverser
VHDLReverse the order of four nibbles packed into a 16-bit word.
Complete Fibonacci Generator
Running Sum Calculator
VHDLAdd a stream of unsigned samples into a 12-bit accumulator.
Complete Sequence Reverser
Duplicate Detector
VHDLDetect whether four 4-bit values contain at least one duplicate.
Complete Running Sum Calculator
Difference Calculator
VHDLCompute the signed difference between two 8-bit samples.
Complete Duplicate Detector
Stream Accumulator
VHDLAccumulate a packet of samples and report the sum on the last word.
Complete Difference Calculator
Prefix Sum
VHDLCompute cumulative sums for four 4-bit values.
Complete Stream Accumulator
Hamming Distance Calculator
VHDLCount the differing bits between two 8-bit words.
Complete Prefix Sum
Trailing Zero Counter
VHDLCount consecutive zeros starting at the least significant bit.
Complete Hamming Distance Calculator
MAC Address Filter
VHDLAccept a frame when its destination MAC is local or broadcast.
Complete Trailing Zero Counter
Packet Length Validator
VHDLCheck that a packet length sits inside an allowed window.
Complete MAC Address Filter
VLAN Tag Detector
VHDLDetect common VLAN TPIDs and extract the TCI field.
Complete Packet Length Validator
ReLU Activation Unit
VHDLImplement an 8-bit signed ReLU activation.
Complete VLAN Tag Detector
Max Pooling Unit
VHDLCompute the maximum over a 2x2 window of 8-bit pixels.
Complete ReLU Activation Unit
Argmax Unit
VHDLReturn the maximum value and its index among four inputs.
Complete Max Pooling Unit