Quick Start Guideο
Get up and running with VHDL Digital Design Samples in just a few minutes!
β‘ 5-Minute Setupο
Prerequisites: Git and terminal access
Clone and enter the project:
git clone https://github.com/shishir-dey/vhdl-samples.git cd vhdl-samples
Install GHDL:
brew install ghdl
sudo apt-get install ghdl
Use WSL and follow Ubuntu instructions
Run your first test:
make test
Expected output:
π All tests passed! Total Tests: 8, Passed: 8, Failed: 0
π Your First VHDL Componentο
Letβs examine and test a simple OR gate:
Look at the source code:
cat src/gates/or_gate.vhd
entity or_gate is Port ( A : in STD_LOGIC; B : in STD_LOGIC; C : in STD_LOGIC; D : in STD_LOGIC; O : out STD_LOGIC); end or_gate; architecture Behavioral of or_gate is begin O <= A or B or C or D; end Behavioral;
Check the testbench:
cat test/gates/or_gate_tb.vhd
Run the specific test:
make test-or-gate
Testing: or_gate_tb β Test passed
π§ͺ Explore Different Categoriesο
Test components by category:
Basic Gatesο
make test-gates
# Tests: OR gate, XOR gates
Combinational Logicο
make test-combinational
# Tests: Adders, Decoders, Multiplexers
Sequential Logicο
make test-sequential
# Tests: Flip-flops, Registers
π Project Overviewο
make stats
Sample output:
VHDL Digital Design Samples - Project Statistics
================================================
Directory Structure:
π src/
βββ π gates/ (3 files)
βββ π combinational/ (19 files)
βββ π sequential/ (10 files)
π test/ (8 files)
Lines of Code: 1,754
Components: 32
Test Coverage: 25%
π― Next Stepsο
Now that youβre set up, here are some things to try:
Learn the Architectureο
Explore the project structure:
tree src/
Read component documentation:
Basic Logic Gates - Basic logic gates
Combinational Logic - Adders, decoders, multiplexers
Sequential Logic - Flip-flops, registers, counters
Try Different Componentsο
Test a more complex component:
# Test a 4-bit ripple carry adder
make test-rc-adder
# Test a 2x4 decoder
make test-decoder
# Test a D flip-flop
make test-dff
Examine the VHDL code:
# Look at different modeling styles
cat src/combinational/adders/fa_behaviour.vhd # Behavioral
cat src/combinational/adders/fa_dataflow.vhd # Dataflow
cat src/combinational/adders/fa_structural.vhd # Structural
Build Your Ownο
Create a new component:
cp src/gates/or_gate.vhd src/gates/my_gate.vhd # Edit the file to implement your logic
Create a testbench:
cp test/gates/or_gate_tb.vhd test/gates/my_gate_tb.vhd # Modify to test your component
Test your component:
# Manual testing cd work/ ghdl -a ../src/gates/my_gate.vhd ghdl -a ../test/gates/my_gate_tb.vhd ghdl -e my_gate_tb ghdl -r my_gate_tb
Understand the Testing Frameworkο
Test script details:
cat scripts/run_tests.sh
Manual testing workflow:
# Navigate to work directory
cd work/
# Compile source
ghdl -a ../src/gates/or_gate.vhd
# Compile testbench
ghdl -a ../test/gates/or_gate_tb.vhd
# Elaborate
ghdl -e or_gate_tb
# Run simulation
ghdl -r or_gate_tb
π§ Development Workflowο
The typical development cycle:
Edit code in your favorite editor
Test changes with
make test
Check specific components with
make test-<component>
Build all with
make build
Clean up with
make clean
π‘ Tips and Tricksο
Performanceο
# Use parallel builds
export MAKEFLAGS=-j$(nproc) # Linux
export MAKEFLAGS=-j$(sysctl -n hw.ncpu) # macOS
Editor Setupο
VS Code: Install βVHDL Language Supportβ extension
Vim: Add to .vimrc
:
au BufNewFile,BufRead *.vhd set filetype=vhdl
Debuggingο
# Verbose GHDL output
ghdl -r testbench --wave=output.ghw
# View waveforms (if gtkwave is installed)
gtkwave output.ghw
π Troubleshootingο
Common Issuesο
βGHDL not foundβ
# Check installation
which ghdl
ghdl --version
βPermission deniedβ
# Make scripts executable
chmod +x scripts/run_tests.sh
βTest failedβ
# Run individual test for details
cd work/
ghdl -a ../src/gates/or_gate.vhd
ghdl -a ../test/gates/or_gate_tb.vhd
ghdl -e or_gate_tb
ghdl -r or_gate_tb --wave=debug.ghw
Getting Helpο
π Documentation: Browse the full docs at VHDL Digital Design Samples Documentation
π Issues: GitHub Issues
π‘ Contributing: Contributing Guide
π Whatβs Next?ο
Congratulations! You now have a working VHDL development environment. Here are some learning paths:
For Beginners: - Start with Basic Logic Gates - Learn about Testing Framework - Try modifying existing components
For Intermediate Users: - Explore Combinational Logic - Study different VHDL modeling styles - Implement your own components
For Advanced Users: - Dive into Sequential Logic - Set up Build System - Contribute to the project via Contributing Guide
Ready to dive deeper? Head to the Basic Logic Gates documentation!