Commit e055387d authored by Davide Cieri's avatar Davide Cieri
Browse files

Diamond tutorial

parent 0477ef8d
Loading
Loading
Loading
Loading
+81 −0
Original line number Diff line number Diff line
@@ -629,7 +629,9 @@ Once the pipeline is succesfull, we can merge the merge the merge request. This

## Step 6. Create a Quartus Project

:::{warning}
For this step you need to have Quartus installed on your local machine, and on your CI machines, in the case you want to add the Quartus build to the pipeline.
:::

We want to implement the same BFT project in a MAX10 FPGA (`10M50DAF484C6GES`). The first step is to copy the Hog BFT project into a new directory of `Top`.

@@ -763,3 +765,82 @@ git commit -m "FEATURE: Adding Quartus BFT project"
If everything goes well, Hog should have copied to the `bin` folder the report and binary files for the Quartus project.


## Step 7. Create a Lattice Diamond Project

:::{warning}
For this step you need to have Lattice Diamond installed on your local machine, and on your CI machines, in the case you want to add the Diamond build to the pipeline.

To run Hog with Diamond, you also need a local installation of tcllib, and to create a `HOG_TCLLIB_PATH` environmental variable pointing to the libraries. On Ubuntu,

```bash
sudo apt install tcllib
export HOG_TCLLIB_PATH=/usr/share/tcltk/tcllib1.21/
```
:::

For Diamond, we will convert the demo project for the MachXO3LF Starter Kit, that can be downloaded ![here](https://www.latticesemi.com/view_document?document_id=51476).

Let's create new folders, to store the Diamond's project source files.

```bash
mkdir -p diamond/src diamond/con
```

Copy inside `src` the Verilog source files and inside `.con` the `.lpf` Logic Preference file.

```bash
cp <path_to_diamond_project>/source/*.v diamond/src
cp project/Blink.lpf diamond/con/
```

Now create the project folder inside Top

```bash
mkdir -p Top/diamond_blink/list
```

Create the `hog.conf` file, and paste the following code, to

```ini
# diamond 3.14.0
[main]
DEVICE=LCMXO3LF-6900C-5BG256C
```

Finally create the two list files for the constraint and source files inside `Top/diamond_blink/list`.

::::{tab-set}
:::{tab-item} `sources.src`
```bash
diamond/src/XO3L_SK_blink.v top=XO3L_SK_blink
diamond/src/heartbeat.v
diamond/src/kitcar.v
```
:::

:::{tab-item} `constr.con`
```bash
diamond/con/Blink.lpf enable
```
:::

The `enable` property allows us to ovveride the default Logic Preference file in the Diamond project.

Commit everything we just did.

```bash
git add diamond Top/diamond_blink
git commit -m "FEATURE: Adding Diamond project"
```

We are now ready to create and build our project with Hog.

```
./Hog/Do CW diamond_blink
```

If everything went well you can access the binary and report files inside the `bin/diamond-blink*` folder. You can also open the project with the Diamond GUI.

```bash
diamond Project/diamond_blink/diamond_blink.ldf
```