This repository contains a collection of HDL (Hardware Description Language) examples that I created while practicing VHDL and Verilog in the Vivado environment. The examples are organized into different modules, covering various concepts and techniques in FPGA design.
The repository is structured into language-specific folders (VHDL/
and Verilog/
), each containing multiple modules.
Within each module, you will find:
sim/
– Simulation filessrc/
– Source filessetup.tcl
– A TCL script to automate the Vivado project setup
This organization allows for easy navigation and usage of different modules based on the HDL language you’re working with.
HDL_examples/
├── <language>/ - Directory for VHDL/ and Verilog/ examples
│ └── <module>/ - Directory for a specific module
│ ├── sim/ - Contains simulation files for the module
│ ├── src/ - Contains source files for the module
│ └── setup.tcl - TCL script for setting up the Vivado project for the module
├── create_project.tcl - TCL script for creating a new Vivado project
└── cleanup.tcl - TCL script for cleaning up set variables in the console
The modules in this repository are listed below in the order I created them. However, you are free to explore them in any order:
- logic_gates – Basic logic gates implementation
- mux_demux – Multiplexers and demultiplexers
- coder_converter_comparator – Encoders, decoders, converters, and comparators
- latches_and_flip-flops – Latches and flip-flops (sequential elements)
- registers – Register-based designs
- memory – Memory modules and related concepts
- counters – Various types of counters
- FSM – Finite State Machines
- parameterized_design – Parameterized modules and reusable components
- hierarchical_design – Hierarchical design with submodules
📝 Note: The hierarchical_design module contains subprojects that demonstrate hierarchy in both
VHDL/
andVerilog/
. You need to run thesetup.tcl
script separately for each subproject.
To get started with the examples, clone this repository to your local machine:
git clone https://github.com/vgalovic/HDL_examples.git
To set up a specific module in Vivado, follow these steps:
If you have just installed Vivado, you may need to fetch the latest available boards. Run the following command in the TCL console:
xhub::refresh_catalog [xhub::get_xstores xilinx_board_store]
Once the boards are updated, open the TCL console in Vivado and run:
source <base_directory>/HDL_examples/<language>/<module>/setup.tcl
This will:
- Create a new Vivado project in:
- Linux:
$HOME/Documents/Vivado/HDL_examples/<language>/
- Windows:
%USERPROFILE%\Documents\Vivado\HDL_examples\<language>\
- Linux:
- Add all relevant source and simulation files for the selected module.
- Set the top-level module/entity if it is specified in the
setup.tcl
script.
Replace
<base_directory>
,<language>
, and<module>
with the appropriate paths.