Skip to content

leoraclet/vhdl-designs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

VHDL Designs

A collection of VHDL designs examples for digital circuits

license language last commit

Table of contents

πŸ“– About

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.

πŸ™ Acknowledgements

  • 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.

🧩 Designs

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 βœ— βœ“

πŸ“¦ Structure

  • Directories

    • .vscode - Project specific VSCode settings (formatting and extensions)
    • rtl - VHDL designs and circuits (.vhd)
    • tb - VHDL test bench files
    • doc - Documentation (on its way, but not yet ...)
  • Files

    • flake.nix - Environment configuration (based on dev-templates)
    • .envrc - Used by direnv to load Flakes
    • flake.lock - Used by Flakes to version packages
    • Makefile - Used to automate checks and analyses

πŸ”§ Tools

  • VSCodium - Code editor
  • GHDL - VHDL 2008/93/87 simulator
  • VUnit - Testing framework for VHDL
  • NVC - VHDL compiler & simulator
  • GTKWave - Waveform viewer

✈️ Usage

  1. All the files under rtl/ and tb/ can be imported in your synthesis tool (e.g Quartus or Vivado).
  2. Optionally, you can use GHDL, which is a cross-platform open-source simulator for VHDL language, to simulate the circuits.
  3. Install GHDL and GTKWave and add them to your PATH
  4. Simulated results can be viewed using GTKWave which is an open source waveform viewer.

πŸš€ Simulate

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=1ms

πŸ§ͺ Check & Analyze

Run 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.

πŸ“š Resources

  • 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

βœ”οΈ To-do

  • Implement test benches for all designs

πŸ“œ License

This project is licensed under the MIT License - see the LICENSE file for details.

About

πŸ”Œ A collection of simple VHDL designs, modules and circuits

Topics

Resources

License

Stars

Watchers

Forks

Contributors