This repository contains synthesizable hardware design solutions for selected ChipDev.io quests.
Each solution is implemented in VHDL-2008, includes a testbench using VUnit for automation, and can be simulated both locally and on EDA Playground.
A tb_xy_wave.do file is also provided to preload signals and variables for convenient waveform inspection in ModelSim.
These examples serve as a learning resource or starting point for building, simulating, and verifying digital designs in a structured way.
Note
All challenges are from chipdev.io/question-list Each challenge is solved in VHDL-2008 with VUnit testbenches (Difficulty and companies shown for reference)
Note
Quest #27 is missing from the chipdev.io website's numbered sequence. In this repository, 28 is referred to as the 27th quest.
-
Simple Router β π’ Easy β π’ Apple, Nvidia
- Design a router that directs packets to outputs based on destination.
-
Second Largest β π’ Easy β π’ Nvidia, Intel
- Identify the second largest number from a set of inputs.
-
Rounding Division β π Medium β π’ Apple
- Perform integer division and round the result.
-
Gray Code Counter β π΄ Hard β π’ Google, Qualcomm
- Implement a counter using Gray code sequence.
-
Reversing Bits β π’ Easy β π’ AMD, Broadcom
- Reverse the bits of a binary input word.
-
Edge Detector β π’ Easy β π’ Nvidia, Tesla
- Detect rising and falling edges on an input signal.
-
Parallel-in, Serial-out Shift Register β π’ Easy β π’ Tesla, Apple
- Load data in parallel and shift it out serially.
-
Serial-in, Parallel-out Shift Register β π’ Easy β π’ Nvidia, AMD
- Shift data in serially and output it in parallel.
-
Fibonacci Generator β π’ Easy β π’ Cadence, Synopsys
- Generate numbers in the Fibonacci sequence.
-
Counting Ones β π’ Easy β π’ Microsoft, ARM
- Count the number of 1βs in a binary vector.
-
Gray Code to Binary β π Medium β π’ Google, Synopsys
- Convert Gray code to binary representation.
-
Trailing Zeroes β π’ Easy β π’ Tesla, Microsoft
- Count trailing 0s in a binary number.
-
One-Hot Detector β π’ Easy β π’ Broadcom
- Check if exactly one bit is set.
-
Stopwatch Timer β π’ Easy β π’ Intel, Cadence
- Create a stopwatch with start/stop/reset.
-
Sequence Detector β π’ Easy β π’ Apple, AMD
- FSM to detect a specific binary pattern.
-
Divisible by 3 β π Medium β π’ Google, Broadcom
- Check divisibility by 3 using binary logic.
-
Divisible by 5 β π Medium β π’ Nvidia, Cadence
- Check divisibility by 5 using binary logic.
-
Palindrome Detector β π’ Easy β π’ Tesla, Synopsys
- Determine if a binary string is a palindrome.
-
Programmable Sequence Detector β π Medium β π’ AMD, ARM
- Detect a binary pattern defined at runtime.
-
Divide-by-Evens Clock Divider β π’ Easy β π’ Intel, ARM
- Clock divider that supports even divisors only.
-
FizzBuzz β π’ Easy β π’ Intel, Broadcom
- Hardware implementation of the FizzBuzz game.
-
Full Adder β π’ Easy β π’ Tesla, AMD
- 1-bit full adder with carry-in and carry-out.
-
Basic ALU (Intro to Verilog) β π’ Easy β π’ Microsoft
- Simple ALU supporting arithmetic and logic ops.
-
Ripple Carry Adder β π Medium β π’ Nvidia, Cadence
- Multi-bit adder using ripple carry full adders.
-
Flip-Flop Array β π Medium β π’ Apple, AMD
- Array of D flip-flops for holding data.
-
Multi-Bit FIFO β π΄ Hard β π’ Tesla, Synopsys
- FIFO with multi-bit enqueue/dequeue logic.
-
Dot Product β π Medium β π’ Intel, Qualcomm
- Compute the dot product of two binary vectors.
-
Binary to Thermometer Decoder β π’ Easy β π’ Intel, Cadence
- Convert binary input to thermometer code.
-
Thermometer Code Detector β π’ Easy β π’ Google, Cadence
- Check if input follows thermometer encoding.
-
2-Read 1-Write Register File β π΄ Hard β π’ Tesla, AMD
- Register file with two read ports and one write port.
-
Configurable 8-Bit LFSR β π Medium β π’ Google, Synopsys
- LFSR with selectable seed and tap positions.
-
Carry-Select Adder β π Medium β π’ Intel, ARM
- Adder optimized using carry-select structure.
-
Bubble Sort β π Medium β π’ Tesla, Google
- Sort a vector of values using bubble sort.
-
Mealy Finite State Machine (FSM) β π’ Easy β π’ Google, Microsoft
- FSM where outputs depend on both current state and input.
Note
Deviations from ChipDev.io Specifications
This repository makes two consistent changes across all implementations:
-
Reset signal naming: ChipDev.io uses various names (
resetn,reset_n,reset). This repository uniformly usesrst_nfor consistency. -
Generic parameters: Some quests specify hardcoded bit widths. This repository adds
DATA_WIDTHand similar generic parameters where appropriate to improve reusability.
Some signal names from the original problems (e.g., port naming conventions) may not be optimal but were preserved to maintain alignment with the source material. Quest-specific deviations are documented in individual README files.
Note
Professional Verification Approach
All testbenches follow industry-standard practices:
- VUnit framework: Automated test execution with pass/fail reporting
- OSVVM RandomPkg: Constrained-random stimulus generation for better coverage than sequential patterns
- Dual verification: Checker procedures use different coding styles than the DUT to avoid systematic errors
- Edge case testing: Explicit tests for boundary conditions, resets, and corner cases
- ModelSim .do files: Pre-configured waveform views for debugging
Test strategies typically include:
- Directed tests: Exhaustive testing of all valid states/combinations
- Random tests: Hundreds of randomized inputs to catch unexpected corner cases
- Reset testing: Verify proper initialization and reset behavior
- OS: (Anything that can run the following)
- IDE:
VSCode latestwith following plugins:
- VHDL Simulator: (Anything that supports VHDL-2008):
- Script execution environment:
Python 3.11.4to automatise testing via VUnit
- IDE:
- Open terminal
- Run
git clone [email protected]:nselvara/chipdev.io.git - Run
cd "Project name" - Run
git submodule update --init --recursiveto initialise and update submodules - Run
code .to open VSCode in the current directory
- Open a terminal in the project directory
- Run
pip install -r ip/requirements.txtto install all dependencies
You can simulate this project on EDA Playground without installing anything locally. Use the following settings:
- Testbench + Design:
VHDL - Top entity:
tb_test_entity(or whatever your testbench entity is called) - β
Enable
VUnit(required to use VUnit checks likecheck_equal)
Warning
Enabling VUnit will automatically create a testbench.py file.
Do not delete this file, as it is required for:
- Initializing the VUnit test runner
- Loading
vunit_libcorrectly - Enabling procedures such as
check_equal,check_true, etc.
Warning
However, EDA Playground will not create any VHDL testbench for you. Therefore, you need to manually create your own VHDL testbench file:
- Click the β symbol next to the file list
- Name it
tb.vhd(or your own testbench name)- Paste your testbench VHDL code into it
- β
Select
OSVVMunder Libraries if your testbench uses OSVVM features - Tools & Simulators:
Aldec Riviera Pro 2022.04or newer - Compile Options:
-2008 - β
Check
Open EPWave after run - β
Check
Use run.do Tcl fileorUse run.bash shell scriptfor more control (optional)
These settings ensure compatibility with your VUnit-based testbenches and allow waveform viewing through EPWave.
Make sure the environment variable for ModelSim or QuestaSim is set, if not:
Important
Don't forget to write the correct path to the ModelSim/QuestaSim folder
Open terminal and run either of the following commands:
Caution
Don't forget to write >> instead of > if you want to append to the file else you
echo "export VUNIT_MODELSIM_PATH=/opt/modelsim/modelsim_dlx/linuxpe" >> ~/.bashrc
# $questa_fe is the path to the folder where QuestaSim is installed
echo "export VUNIT_MODELSIM_PATH=\"$questa_fe/21.4/questa_fe/win64/\"" >> ~/.bashrcThen restart the terminal or run source ~/.bashrc command.
Open PowerShell and run either of the following commands:
setx /m VUNIT_MODELSIM_PATH C:\modelsim_dlx64_2020.4\win64pe\
setx /m VUNIT_MODELSIM_PATH C:\intelFPGA_pro\21.4\questa_fe\win64\This project uses VUnit for automated VHDL testbench simulation.
The script test_runner.py acts as a wrapper, so you donβt need to deal with VUnit internals.
-
Open a terminal in the project directory.
-
To run all testbenches, simply execute:
python ip/test_runner.py
- Uses
run_all_testbenches_libinternally.- This hides the VUnit implementation
- Looks for testbenches in the
./ip/folder. - Runs all files matching
tb_*.vhd(recursive pattern**). - GUI can be enabled via
gui=Trueintest_runner.py.
You can change the following arguments in test_runner.py:
run_all_testbenches_lib(
path="./ip/", # Path where the HDL & tb files are located
tb_pattern="**", # Match all testbenches
timeout_ms=1.0, # Timeout in milliseconds
gui=False, # Set to True to open ModelSim/QuestaSim GUI
compile_only=False, # Only compile, donβt run simulations
clean=False, # Clean before building
debug=False, # Enable debug logging
use_xilinx_libs=False, # Add Xilinx simulation libraries
use_intel_altera_libs=False, # Add Intel/Altera simulation libraries
excluded_list=[], # List of testbenches to exclude
xunit_xml="./test/res.xml" # Output file for test results
)All VHDL source code, testbenches, and scripts in this repository are licensed under the GNU General Public License v3.0 (GPLv3). See the LICENSE file for full details.
Note
Problem statements and task descriptions referenced from chipdev.io are not part of this license. They are Β© chipdev.io and are used under fair use for educational purposes only. This repository is not affiliated with or endorsed by chipdev.io. This file and the accompanying VHDL code are licensed under GPLv3.
Note
See LICENSE-THIRD-PARTY for more.