A collection of VHDL designs examples for digital circuits
- π About
- π Acknowledgements
- π§© Designs
- π¦ Structure
- π§ Tools
βοΈ Usage- π Resources
- βοΈ To-do
- π License
Important
I've made this collection to regroup all those designs I've made over the years in one single place and make it available to others who might look for examples circuits.
This repository contains a collection of VHDL circuit examples for digital design course.
These designs are reusable and suitable for a variety of computing and electronics projects, and they were build during my computer science and electronics classes as part of my engineering degree.
Some designs might have multiple architecture implementations to show design options and variations. Basic test bench examples are also given for some circuits.
Warning
Not all the designs are tested and verified (but most are), so feel free to send any fixes if you see any mistakes.
- My school's professors, for introducing me to this "language" and the lessons that came with it.
- VHDL Digital Design - Took inspiration for the Makefile and some VHDL designs. I've stumbled upon this repo while re-structuring mine and looking for already existing ones.
| File | Design Unit | Tested | Analyzed |
|---|---|---|---|
ad_ff |
Asynchronous D Flip-Flop | β | β |
add_sub4 |
4-bits Adder & Subtractor | β | β |
add16 |
16-bits Adder | β | β |
add4 |
4-bits Adder | β | β |
anti_reb |
De-bouncer | β | β |
bin2code |
2-bit line decoder | β | β |
bin2seven_eco |
... with on/off signal | β | β |
bin2seven |
Binary to 7 segments | β | β |
clk_halve |
Frequency Halfer | β | β |
cmp4 |
4-bits Comparator | β | β |
cmpt4_bidirena |
Bidirectional counter | β | β |
cnt256 |
Synchronous 8-bit bi-directional counter | β | β |
cnt4 |
Synchronous 4-bit counter | β | β |
code2bin |
2-bit line encoder | β | β |
d_ff |
Synchronous D Flip-Flop | β | β |
d_latch |
Synchronous D Latch | β | β |
div10 |
Frequency Divider by 10 | β | β |
div2 |
Frequency Divider by 2 | β | β |
dst_hamm |
Hamming Distance calculator | β | β |
full_adder |
Full Adder | β | β |
gen_ena |
Frequency Divider | β | β |
half_add |
Half Adder | β | β |
jk_ff |
Synchronous JK Flip-Flop | β | β |
mem4x8 |
4-byte Synchronous Memory | β | β |
mul_2bits |
2-bits Multiplier | β | β |
mux2x8 |
Two-channel multiplexer | β | β |
mux4x8 |
Four-channel multiplexer | β | β |
mux4x8 |
Four-1bit-channel multiplexer | β | β |
pdf_hamm |
Hamming weight calculator | β | β |
pri_enc |
Priority Encoder | β | β |
reg_4bits |
4-bits Register | β | β |
reg |
8-bits Register | β | β |
ripple_carry_4bits |
4-bits Ripple Carry Adder | β | β |
shift_reg |
N-bits Shift Register | β | β |
t_ff |
T Flip-Flop | β | β |
-
Directories
-
Files
flake.nix- Environment configuration (based on dev-templates).envrc- Used by direnv to load Flakesflake.lock- Used by Flakes to version packagesMakefile- Used to automate checks and analyses
- VSCodium - Code editor
- GHDL - VHDL 2008/93/87 simulator
- VUnit - Testing framework for VHDL
- NVC - VHDL compiler & simulator
- GTKWave - Waveform viewer
- All the files under
rtl/andtb/can be imported in your synthesis tool (e.g Quartus or Vivado). - Optionally, you can use GHDL, which is a cross-platform open-source simulator for VHDL language, to simulate the circuits.
- Install GHDL and GTKWave and add them to your
PATH - Simulated results can be viewed using GTKWave which is an open source waveform viewer.
Run make simulate ARCHNAME=tbname to run the given testbench and display waveform using GTKWave where tbname is any of the testbench names inside the tb directory.
$ make simulate ARCHNAME=tb_counter
>>> cleaning design...
>>> done...
>>> analyzing designs...
>>> simulating design: tb/tb_counter.vhd
tb/tb_counter.vhd:43:9:@510ns:(assertion note): completed
>>> showing waveform for: tb/tb_counter.vhd
GTKWave Analyzer v3.3.94 (w)1999-2018 BSI
...100us stop time is given for simulation by default. Optional STOPTIME= argument can be passed to Makefile to change this value.
make simulate ARCHNAME=tb_counter STOPTIME=1msRun make on the root folder to check syntax and analyze all designs :
$ make
>>> check syntax on all designs...
>>> analyzing designs...
>>> completed...Caution
There should be no errors if you haven't changed anything.
- My college classes
- This old repo I've stumbled upon while searching for other similar repos
- This excellent blog post and how to set up a VHDL environment
- Implement test benches for all designs
This project is licensed under the MIT License - see the LICENSE file for details.