Skip to content

Commit d96a12a

Browse files
committed
prj2bit: add support for diamond
1 parent 5568bb1 commit d96a12a

File tree

5 files changed

+28
-4
lines changed

5 files changed

+28
-4
lines changed

examples/helpers/diamond.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
HDIR=../../pyfpga/helpers
6+
7+
python3 $HDIR/hdl2bit.py -t diamond -o results/diamond-vlog -p lfxp2-5e-5tn144c \
8+
-i ../sources/vlog/include1 -i ../sources/vlog/include2 \
9+
-f ../sources/vlog/blink.v -f ../sources/vlog/top.v \
10+
-f ../sources/cons/brevia2/clk.lpf -f ../sources/cons/brevia2/led.lpf \
11+
--define DEFINE1 1 --define DEFINE2 1 --param FREQ 125000000 --param SECS 1 Top
12+
13+
python3 $HDIR/hdl2bit.py -t diamond -o results/diamond-vhdl -p lfxp2-5e-5tn144c --project example \
14+
-f ../sources/vhdl/blink.vhdl,blink_lib -f ../sources/vhdl/blink_pkg.vhdl,blink_lib -f ../sources/vhdl/top.vhdl \
15+
-f ../sources/cons/brevia2/clk.lpf -f ../sources/cons/brevia2/led.lpf \
16+
--param FREQ 125000000 --param SECS 1 --last cfg Top
17+
18+
python3 $HDIR/prj2bit.py results/diamond-vhdl/example.ldf

examples/helpers/openflow.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,10 @@ python3 $HDIR/hdl2bit.py -t openflow -o results/openflow-vlog -p hx1k-tq144 \
99
-f ../sources/vlog/blink.v -f ../sources/vlog/top.v \
1010
-f ../sources/cons/icestick/clk.pcf -f ../sources/cons/icestick/led.pcf \
1111
--define DEFINE1 1 --define DEFINE2 1 --param FREQ 100000000 --param SECS 1 Top
12+
13+
python3 $HDIR/hdl2bit.py -t openflow -o results/openflow-vhdl -p hx1k-tq144 --project example \
14+
-f ../sources/vhdl/blink.vhdl,blink_lib -f ../sources/vhdl/blink_pkg.vhdl,blink_lib -f ../sources/vhdl/top.vhdl \
15+
-f ../sources/cons/icestick/clk.pcf -f ../sources/cons/icestick/led.pcf \
16+
--param FREQ 125000000 --param SECS 1 --last cfg Top
17+
18+
# OpenFlow doesn't have a project file, so it is not supported by prj2bit

pyfpga/helpers/prj2bit.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22
#
3-
# Copyright (C) 2020-2024 PyFPGA Project
3+
# Copyright (C) 2020-2025 PyFPGA Project
44
#
55
# SPDX-License-Identifier: GPL-3.0-or-later
66
#
@@ -54,6 +54,7 @@ def main():
5454
# Detecting a Project file
5555

5656
tool_per_ext = {
57+
'.ldf': 'diamond',
5758
'.xise': 'ise',
5859
'.prjx': 'libero',
5960
'.qpf': 'quartus',

tests/mocks/diamondc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ with open(args.source, 'r', encoding='utf-8') as file:
4040
match = re.search(pattern, file.read())
4141
if match:
4242
project = match.group(1)
43+
open(f'{project}.ldf', 'w', encoding='utf-8').close()
4344
open(f'{project}.bit', 'w', encoding='utf-8').close()
4445

4546
print(f'INFO:the {tool.upper()} mock has been executed')

tests/regress.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,6 @@ echo "##########################################################################
6565
cd ../examples/helpers
6666

6767
for TOOL in "${!TOOLS[@]}"; do
68-
if [[ "$TOOL" == "diamond" ]]; then
69-
continue
70-
fi
7168
bash "$TOOL".sh
7269
done
7370

0 commit comments

Comments
 (0)