Skip to content

Commit 8e0f479

Browse files
committed
ghdl: added a more concise alternative
1 parent 6c08653 commit 8e0f479

File tree

6 files changed

+85
-70
lines changed

6 files changed

+85
-70
lines changed

ghdl-yosys/Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/make
2+
3+
COMMAND=bash
4+
5+
vlog1 vlog2 vhdl1 vhdl2:
6+
$(COMMAND) $@.sh
7+
8+
clean:
9+
rm -fr *.asc *.bit *.cf *.edif *.json *.pcf

ghdl-yosys/vhdl1.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
DOCKER="docker run --rm -v $HOME:$HOME -w $PWD"
6+
HDL=../resources/mix
7+
CONSTRAINT=../../resources/constraints/icestick
8+
9+
rm -fr *.cf *.json
10+
11+
VHDL_FILES=$HDL/top.vhdl
12+
VLOG_FILES=$HDL/blink.v
13+
14+
$DOCKER hdlc/ghdl:yosys yosys -Q -m ghdl -p "
15+
ghdl $VHDL_FILES -e;
16+
read_verilog $VLOG_FILES;
17+
synth_ice40 -top Top -json blink.json
18+
"
19+
20+
cat $CONSTRAINT/clk.pcf $CONSTRAINT/led.pcf > icestick.pcf
21+
$DOCKER hdlc/nextpnr:ice40 nextpnr-ice40 --json blink.json --hx8k --package tq144:4k --pcf icestick.pcf --asc blink.asc
22+
$DOCKER hdlc/icestorm icepack blink.asc blink.bit

ghdl-yosys/vlog1.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
DOCKER="docker run --rm -v $HOME:$HOME -w $PWD"
6+
HDL=../resources/mix
7+
CONSTRAINT=../../resources/constraints/icestick
8+
9+
rm -fr *.cf *.json
10+
11+
VHDL_FILES=$HDL/blink.vhdl
12+
VLOG_FILES=$HDL/top.v
13+
14+
$DOCKER hdlc/ghdl:yosys yosys -Q -m ghdl -p "
15+
ghdl $VHDL_FILES -e;
16+
read_verilog $VLOG_FILES;
17+
synth_ice40 -top Top -json blink.json
18+
"
19+
20+
cat $CONSTRAINT/clk.pcf $CONSTRAINT/led.pcf > icestick.pcf
21+
$DOCKER hdlc/nextpnr:ice40 nextpnr-ice40 --json blink.json --hx8k --package tq144:4k --pcf icestick.pcf --asc blink.asc
22+
$DOCKER hdlc/icestorm icepack blink.asc blink.bit

ghdl/vhdl.sh

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,38 @@
22

33
set -e
44

5-
FLAGS="--std=08 -fsynopsys -fexplicit -frelaxed"
5+
DIR=../resources/vhdl
66

7-
ghdl -a $FLAGS --work=blink_lib ../resources/vhdl/blink.vhdl
8-
ghdl -a $FLAGS --work=blink_lib ../resources/vhdl/blink_pkg.vhdl
9-
ghdl -a $FLAGS ../resources/vhdl/top.vhdl
7+
FLAGS="--std=08 -fsynopsys -fexplicit -frelaxed"
108

119
GENERICS="-gBOO=true -gINT=255 -gLOG='1' -gVEC="11111111" -gCHR='Z' -gSTR="WXYZ" -gSKIP_REA=1"
12-
ghdl --synth $FLAGS $GENERICS Top ARCH_SEL
10+
11+
###############################################################################
12+
# Alternative 1
13+
###############################################################################
14+
15+
# This alternative is better to specify particular options per file
16+
17+
ghdl -a $FLAGS --work=blink_lib $DIR/blink.vhdl
18+
ghdl -a $FLAGS --work=blink_lib $DIR/blink_pkg.vhdl
19+
ghdl -a $FLAGS $DIR/top.vhdl
20+
21+
# --out=raw-vhdl generate a VHDL 93 netlist
22+
23+
ghdl synth $FLAGS --out=raw-vhdl $GENERICS Top ARCH_SEL
24+
25+
# This alternative creates .cf files due the ghdl -a
26+
rm -fr *.cf
27+
28+
###############################################################################
29+
# Alternative 2
30+
###############################################################################
31+
32+
# This alternative is more concise
33+
34+
# --work=<LIBNAME> applies to the following files
35+
# --out=verilog generate a Verilog netlist
36+
37+
ghdl synth $FLAGS --out=verilog $GENERICS \
38+
--work=blink_lib $DIR/blink.vhdl $DIR/blink_pkg.vhdl \
39+
--work=work $DIR/top.vhdl -e Top ARCH_SEL

openflow/Makefile

Lines changed: 0 additions & 11 deletions
This file was deleted.

openflow/mix.sh

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)