# Hog: HDL on git

:::{admonition} Star us!
:class: important
Like Hog? Star us on [GitLab](https://gitlab.com/hog-cern/Hog) or [GitHub](https://github.com/hog-cern/Hog)!
:::

## Introduction

Coordinating gateware development among many international collaborators is increasingly common. Ensuring gateware synthesis with Place and Route **reproducibility** and guaranteeing **traceability** of binary files is essential.

[Hog](https://gitlab.com/hog-cern/hog) addresses these challenges by leveraging advanced git features and integrating with HDL IDEs: **AMD Vivado**, **AMD Vitis**, **AMD ISE (PlanAhead)[^ise]**, **Intel Quartus[^quartus]**, **Microchip Libero[^tcllib]**, and **Lattice Diamond[^tcllib]**. Hog also supports the open-source VHDL simulator **GHDL**. Integration with these tools aims to minimize unnecessary overhead for developers.

[^quartus]: Not all Hog features are supported for Quartus. If a feature described in the documentation is supported only by AMD IDEs, it is clearly stated. If some functions you are looking for are not mentioned, they might be [scheduled for development in a future release](https://gitlab.com/hog-cern/Hog/-/issues).
[^ise]: Hog provides minimal support for earlier generations of AMD chips using the PlanAhead tool. The PlanAhead GUI is very similar to Vivado and should be familiar to Vivado users. Under the hood, it uses the same tools as ISE but provides a Tcl-scriptable front-end that allows easy integration with Hog. It has been tested only with version 14.7 and has some limitations, but it does allow you to create, compile, and track project versions both locally and in GitLab CI/CD.
[^tcllib]: Libero SoC and Lattice Diamond do not include a full version of the `tcllib` package, which is required by several Hog functions. Developers must install `tcllib` on their machine and set an environment variable to tell Hog where to find the package. For Libero, Hog does not provide support for core container files (e.g., `.xci` files in Vivado); instead, these must be generated by a Libero Tcl command, which can be added to the Hog project using the `post-creation.tcl` file.

If you want to be notified about new Hog releases, please subscribe to our [Newsletter](http://cern.ch/go/nBn8).

:::{tip}
Hog is **completely free**. It is developed by an international team of researchers from academia and industry ([Author list](05-License/02-Authors)). If you use it, please cite [our paper](https://iopscience.iop.org/article/10.1088/1748-0221/16/04/T04006/meta) in your articles and proceedings. Here is the [citation](hog.bib) in BibTeX format.
:::

### Waste no time thanks to Hog

To work with a repository managed by Hog, simply clone it,
run the Hog script, and start working!

The animated GIF below shows one of our [example projects](01-Getting-Started/04-Example-Project):

![hog example gif](hog.gif)

### What's new in Hog 2026.2?

- **Vitis HLS build pipeline** — Full `v++`-based flow (csim, synthesis, cosim, impl); csim/cosim optional via `hog.conf`; HLS work directory placed under `vitis_unified/` workspace
- **New COCOTB command** — Generates a Python cocotb test script compiling all Hog project sources with the chosen simulator
- **TREE/Hierarchy improvements** — SystemVerilog header files and VHDL package generic definitions now supported
- **New `VERSION` command** - Returns the version of a Hog project 
- **New `VHDLLS` command** - Generates the configuration file for the VHDL-LS Language Server
- **Configurable log storage** — choose log file name and location via new options
- **`HOG_NO_ZIP`** — skip uploading artifacts to release
- `DebugProjects` folder added to sim and gen job artifacts
- Hog only checks for changes in the chosen project, before building it in the CI

### What is Hog?

Hog is a **set of Tcl/Shell scripts** plus a robust **methodology** to manage HDL designs in a git repository.

Hog is included as a git **submodule** in the HDL repository and allows developers to create Vivado/PlanAhead/Quartus/Libero projects locally, synthesise/implement them, or start working on them.

Using Hog helps you to:

- Easily and effectively **maintain HDL code on git**
- Ensure that **code is not modified** before building binary files
- Guarantee **traceability of binary files** (even if produced locally)
- Work seamlessly on **Windows and Linux**
- **Reduce code duplication** by making it easy to share code among projects
- Save time setting up **Continuous Integration** on GitLab or **GitHub Actions**

```{warning}
Specific instructions for Windows users are available in the Instructions for Windows users section.
```

Thanks to **Hog CI** you will be able to:

- **automatically tag** your repository for semantic versioning
- **automatically create releases** on GitLab/GitHub (including timing and utilisation reports, changelog, and binary files)
- **automatically add changelog** in the release note (use the `FEATURE:` keyword in commit messages)
- **Speed up IP synthesis** by archiving synthesised blocks
- **Archive the output binary files** on a remote file system

### Rationale

For synthesis and Place and Route (P&R) **reproducibility**, we need absolute control of:

- HDL source files
- Constraint files
- IDE settings

For **traceability**, every time we produce a binary file, we must:

- know exactly the **source code** that produced the binary files
- be able to **go back to that point** in the repository

To do this, Hog **automatically** embeds the git **commit SHA** into the binary file together with a more understandable **numeric version** __M.m.p__. Moreover, it automatically renames the file, including the version and inserts the hexadecimal value of the SHA so that it can be retrieved (using a text editor) in case files are renamed.

Hog aims to **reduce to the minimum** the time needed for an external developer to **get up to speed** to work on an HDL project.
Hog **does not rely on any external tool** or library. Only git (at least 2.9.3) and on those tools you must already have to synthesise, implement (Vivado/PlanAhead/Quartus) and simulate (Modelsim/Questasim/Riviera) the design.

:::{tip}
To start working on any project contained in a Gitlab repository handled with Hog, you just need to:

```console
git clone --recursive <HDL repository>
cd <HDL repository>
./Hog/Do CREATE <project>
```

The project will appear in `./Projects/<project>`  and you can open it with your Vivado (ISE/Quartus) GUI.
If you don't know the project name, just run `./Hog/Do LIST` and a list will be displayed.
:::

### What does Hog do?

The heart of hog is the `Do` script. For example you can type:

```console
./Hog/Do CREATE <my_project>
```

to create locally the Vivado/PlanAhead/Quartus/Libero project locally into the `Projects` directory. When creating the project, Hog integrates a set of Tcl scripts (contained in `Hog/Tcl/integrated`) into the IDE software.

If you don't want to use the graphical interface of the IDE, run:

```shell
./Hog/Do WORKFLOW <my_project>
```

and Hog will run the complete workflow of the desired HDL project, creating the binary files in the `bin` directory.

To simulate in batch mode, run:

```shell
./Hog/Do SIMULATE <my_project>
```

runs the simulation workflow.

```shell
./Hog/Do VIEW <my_project>
```

shows a tree of all the files in the selected project, like this:

```shell
  fifo.src
  ├──sources/top/top_fifo.vhd top=top_fifo
  ├──sources/src/adder.vhd 93
  └──IP/fifo_generator_0/fifo_generator_0.xci

  other_lib.src
  └──sources/src/different_adder.vhd

  fifo.con
  └──sources/xdc/ku.xdc

  second.sim
  └──sources/sim/tb_second.vhd

  fifo.sim
  ├──sources/sim/tb_fifo.vhd
  ├──sources/sim/TB_example_wave.do
  └──sources/sim/TB_example.udo
```

:::{tip}
Directives for the `Hog/Do` script can be shortened.

For example `./Hog/Do L` will list the projects and
`./Hog/Do C <project>` will create `<project>`.
:::

To learn everything about the `Hog/Do` script, just type `./Hog/Do HELP`.


### Contacts

Are you a git enthusiast? And a Tcl fan? Join us and read the [Developing for Hog](04-Developing-for-Hog/01-contributing) section.

To report a [problem](03-Report-Suggest/01-Report) or suggest a [feature](03-Report-Suggest/02-Suggest), use the git issues in the [Hog git repository](https://gitlab.com/hog-cern/Hog).
Please check in existing and solved issues before opening a new one.

For questions related to Hog, please get in touch with [Hog support](mailto:hog-group@cern.ch).

For anything related to this site, please get in touch with [Davide Cieri](mailto:davide.cieri@cern.ch)

Keep up to date with Hog's [Newsletter](http://cern.ch/go/Zh9s).

```{toctree}
:maxdepth: 1
:hidden:
:glob:
:caption: Getting Started

01-Getting-Started/*
```

```{toctree}
:maxdepth: 1
:hidden:
:glob:
:caption: User Manual

02-User-Manual/*
02-User-Manual/01-Hog-local/00*
02-User-Manual/02-Hog-CI/00*
```

```{toctree}
:maxdepth: 1
:hidden:
:glob:
:caption: Hog Tutorial at CERN

Indico Agenda <https://indico.cern.ch/event/1509409/>
YouTube Video <https://www.youtube.com/playlist?list=PLMvfX5C2G0PCL2r8GRd7ZFeIOXNfRAeiW>
07*/*
```

```{toctree}
:maxdepth: 1
:hidden:
:glob:
:caption: Bug Report and Suggestions

03*/*
```

```{toctree}
:maxdepth: 1
:hidden:
:glob:
:caption: Developing for Hog

04*/*
Hog Doxygen Develop <https://cern.ch/hog/doxy-develop>
Hog Doxygen Master  <https://cern.ch/hog/doxy-master>
```

```{toctree}
:maxdepth: 1
:hidden:
:glob:
:caption: Releases

06*/*
Hog Releases <https://gitlab.com/hog-cern/Hog/-/releases>
Hog Newsletter <http://cern.ch/go/nBn8>
```

```{toctree}
:maxdepth: 1
:hidden:
:glob:
:caption: License and Authors

05-License/*
```
