Skip to content

Commit e438f9f

Browse files
committed
Add pre_build as prerequisite to all build targets
1 parent 8a3f4f2 commit e438f9f

File tree

8 files changed

+34
-32
lines changed

8 files changed

+34
-32
lines changed

edalize/flows/edaflow.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,11 +241,13 @@ def merge_edam(a, b):
241241

242242
# This is an input node. Inject dependency on pre_build scripts
243243
if not node.deps:
244-
# Inject pre-build scripts before the first command
245-
# that the node executes. Note that this isn't
246-
# technically correct since the first command in
247-
# the list might not be the first command executed
248-
node.inst.commands.commands[0].order_only_deps = ["pre_build"]
244+
# Inject pre-build scripts as an order-only dependency
245+
# before every command that the node executes during build. This is
246+
# probably safe, but might cause pre-build scripts to
247+
# be executed several times
248+
for c in node.inst.commands.commands:
249+
if not "run" in c.targets:
250+
c.order_only_deps.insert(0, "pre_build")
249251
self.commands.commands += node.inst.commands.commands
250252

251253
def add_scripts(self, depends, hook_name):

edalize/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def __init__(
66
self.commands = commands
77
self.targets = targets
88
self.depends = depends
9-
self.order_only_deps = order_only_deps
9+
self.order_only_deps = order_only_deps[:]
1010
self.variables = variables
1111

1212
def __init__(self):

tests/flows/sim/with_cocotb/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pre_build:
77
Vtop.mk: design.vc sv_file.sv vlog_file.v vlog_with_define.v vlog05_file.v vlog_incfile another_sv_file.sv | pre_build
88
$(EDALIZE_LAUNCHER) verilator -f design.vc `cocotb-config --share`/lib/verilator/verilator.cpp
99

10-
Vtop: Vtop.mk c_file.c cpp_file.cpp
10+
Vtop: Vtop.mk c_file.c cpp_file.cpp | pre_build
1111
$(EDALIZE_LAUNCHER) make -f Vtop.mk
1212

1313
post_build: Vtop

tests/test_vivado/Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ pre_build:
77
test_vivado_0.xpr: test_vivado_0.tcl sdc_file sv_file.sv tcl_file.tcl vlog_file.v vlog_with_define.v vlog05_file.v vlog_incfile vhdl_file.vhd vhdl_lfile vhdl2008_file xci_file.xci xdc_file.xdc bootrom.mem another_sv_file.sv | pre_build
88
$(EDALIZE_LAUNCHER) vivado -notrace -mode batch -source test_vivado_0.tcl
99

10-
test_vivado_0.v test_vivado_0.edn: test_vivado_0_synth.tcl test_vivado_0_netlist.tcl | test_vivado_0.xpr
10+
test_vivado_0.v test_vivado_0.edn: test_vivado_0_synth.tcl test_vivado_0_netlist.tcl | pre_build test_vivado_0.xpr
1111
$(EDALIZE_LAUNCHER) vivado -notrace -mode batch -source test_vivado_0_synth.tcl test_vivado_0_netlist.tcl test_vivado_0.xpr
1212

13-
synth: test_vivado_0.v test_vivado_0.edn
13+
synth: test_vivado_0.v test_vivado_0.edn | pre_build
1414

15-
test_vivado_0.bit: test_vivado_0_synth.tcl test_vivado_0_run.tcl | test_vivado_0.xpr
15+
test_vivado_0.bit: test_vivado_0_synth.tcl test_vivado_0_run.tcl | pre_build test_vivado_0.xpr
1616
$(EDALIZE_LAUNCHER) vivado -notrace -mode batch -source test_vivado_0_synth.tcl test_vivado_0_run.tcl test_vivado_0.xpr
1717

18-
build-gui: test_vivado_0.xpr
18+
build-gui: test_vivado_0.xpr | pre_build
1919
$(EDALIZE_LAUNCHER) vivado test_vivado_0.xpr
2020

21-
pgm: test_vivado_0_pgm.tcl test_vivado_0.bit
21+
pgm: test_vivado_0_pgm.tcl test_vivado_0.bit | pre_build
2222
$(EDALIZE_LAUNCHER) vivado -quiet -nolog -notrace -mode batch -source test_vivado_0_pgm.tcl -tclargs xc7a35tcsg324-1 test_vivado_0.bit
2323

2424
post_build: test_vivado_0.bit

tests/test_vivado/board_file/Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ pre_build:
77
test_vivado_0.xpr: test_vivado_0.tcl sdc_file sv_file.sv tcl_file.tcl vlog_file.v vlog_with_define.v vlog05_file.v vlog_incfile vhdl_file.vhd vhdl_lfile vhdl2008_file xci_file.xci xdc_file.xdc bootrom.mem another_sv_file.sv | pre_build
88
$(EDALIZE_LAUNCHER) vivado -notrace -mode batch -source test_vivado_0.tcl
99

10-
test_vivado_0.v test_vivado_0.edn: test_vivado_0_synth.tcl test_vivado_0_netlist.tcl | test_vivado_0.xpr
10+
test_vivado_0.v test_vivado_0.edn: test_vivado_0_synth.tcl test_vivado_0_netlist.tcl | pre_build test_vivado_0.xpr
1111
$(EDALIZE_LAUNCHER) vivado -notrace -mode batch -source test_vivado_0_synth.tcl test_vivado_0_netlist.tcl test_vivado_0.xpr
1212

13-
synth: test_vivado_0.v test_vivado_0.edn
13+
synth: test_vivado_0.v test_vivado_0.edn | pre_build
1414

15-
test_vivado_0.bit: test_vivado_0_synth.tcl test_vivado_0_run.tcl | test_vivado_0.xpr
15+
test_vivado_0.bit: test_vivado_0_synth.tcl test_vivado_0_run.tcl | pre_build test_vivado_0.xpr
1616
$(EDALIZE_LAUNCHER) vivado -notrace -mode batch -source test_vivado_0_synth.tcl test_vivado_0_run.tcl test_vivado_0.xpr
1717

18-
build-gui: test_vivado_0.xpr
18+
build-gui: test_vivado_0.xpr | pre_build
1919
$(EDALIZE_LAUNCHER) vivado test_vivado_0.xpr
2020

21-
pgm: test_vivado_0_pgm.tcl test_vivado_0.bit
21+
pgm: test_vivado_0_pgm.tcl test_vivado_0.bit | pre_build
2222
$(EDALIZE_LAUNCHER) vivado -quiet -nolog -notrace -mode batch -source test_vivado_0_pgm.tcl -tclargs xc7a35tcsg324-1 test_vivado_0.bit
2323

2424
post_build: test_vivado_0.bit

tests/test_vivado/edif_netlist/Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ pre_build:
77
test_vivado_0.xpr: test_vivado_0.tcl netlist.edif netlist.edif | pre_build
88
$(EDALIZE_LAUNCHER) vivado -notrace -mode batch -source test_vivado_0.tcl
99

10-
test_vivado_0.v test_vivado_0.edn: test_vivado_0_synth.tcl test_vivado_0_netlist.tcl | test_vivado_0.xpr
10+
test_vivado_0.v test_vivado_0.edn: test_vivado_0_synth.tcl test_vivado_0_netlist.tcl | pre_build test_vivado_0.xpr
1111
$(EDALIZE_LAUNCHER) vivado -notrace -mode batch -source test_vivado_0_synth.tcl test_vivado_0_netlist.tcl test_vivado_0.xpr
1212

13-
synth: test_vivado_0.v test_vivado_0.edn
13+
synth: test_vivado_0.v test_vivado_0.edn | pre_build
1414

15-
test_vivado_0.bit: test_vivado_0_synth.tcl test_vivado_0_run.tcl | test_vivado_0.xpr
15+
test_vivado_0.bit: test_vivado_0_synth.tcl test_vivado_0_run.tcl | pre_build test_vivado_0.xpr
1616
$(EDALIZE_LAUNCHER) vivado -notrace -mode batch -source test_vivado_0_synth.tcl test_vivado_0_run.tcl test_vivado_0.xpr
1717

18-
build-gui: test_vivado_0.xpr
18+
build-gui: test_vivado_0.xpr | pre_build
1919
$(EDALIZE_LAUNCHER) vivado test_vivado_0.xpr
2020

21-
pgm: test_vivado_0_pgm.tcl test_vivado_0.bit
21+
pgm: test_vivado_0_pgm.tcl test_vivado_0.bit | pre_build
2222
$(EDALIZE_LAUNCHER) vivado -quiet -nolog -notrace -mode batch -source test_vivado_0_pgm.tcl -tclargs xc7a35tcsg324-1 test_vivado_0.bit
2323

2424
post_build: test_vivado_0.bit

tests/test_vivado/edif_netlist_no_link_design/Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ pre_build:
77
test_vivado_0.xpr: test_vivado_0.tcl netlist.edif netlist.edif | pre_build
88
$(EDALIZE_LAUNCHER) vivado -notrace -mode batch -source test_vivado_0.tcl
99

10-
test_vivado_0.v test_vivado_0.edn: test_vivado_0_synth.tcl test_vivado_0_netlist.tcl | test_vivado_0.xpr
10+
test_vivado_0.v test_vivado_0.edn: test_vivado_0_synth.tcl test_vivado_0_netlist.tcl | pre_build test_vivado_0.xpr
1111
$(EDALIZE_LAUNCHER) vivado -notrace -mode batch -source test_vivado_0_synth.tcl test_vivado_0_netlist.tcl test_vivado_0.xpr
1212

13-
synth: test_vivado_0.v test_vivado_0.edn
13+
synth: test_vivado_0.v test_vivado_0.edn | pre_build
1414

15-
test_vivado_0.bit: test_vivado_0_synth.tcl test_vivado_0_run.tcl | test_vivado_0.xpr
15+
test_vivado_0.bit: test_vivado_0_synth.tcl test_vivado_0_run.tcl | pre_build test_vivado_0.xpr
1616
$(EDALIZE_LAUNCHER) vivado -notrace -mode batch -source test_vivado_0_synth.tcl test_vivado_0_run.tcl test_vivado_0.xpr
1717

18-
build-gui: test_vivado_0.xpr
18+
build-gui: test_vivado_0.xpr | pre_build
1919
$(EDALIZE_LAUNCHER) vivado test_vivado_0.xpr
2020

21-
pgm: test_vivado_0_pgm.tcl test_vivado_0.bit
21+
pgm: test_vivado_0_pgm.tcl test_vivado_0.bit | pre_build
2222
$(EDALIZE_LAUNCHER) vivado -quiet -nolog -notrace -mode batch -source test_vivado_0_pgm.tcl -tclargs xc7a35tcsg324-1 test_vivado_0.bit
2323

2424
post_build: test_vivado_0.bit

tests/test_vivado/minimal/Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ pre_build:
77
test_vivado_minimal_0.xpr: test_vivado_minimal_0.tcl | pre_build
88
$(EDALIZE_LAUNCHER) vivado -notrace -mode batch -source test_vivado_minimal_0.tcl
99

10-
test_vivado_minimal_0.v test_vivado_minimal_0.edn: test_vivado_minimal_0_synth.tcl test_vivado_minimal_0_netlist.tcl | test_vivado_minimal_0.xpr
10+
test_vivado_minimal_0.v test_vivado_minimal_0.edn: test_vivado_minimal_0_synth.tcl test_vivado_minimal_0_netlist.tcl | pre_build test_vivado_minimal_0.xpr
1111
$(EDALIZE_LAUNCHER) vivado -notrace -mode batch -source test_vivado_minimal_0_synth.tcl test_vivado_minimal_0_netlist.tcl test_vivado_minimal_0.xpr
1212

13-
synth: test_vivado_minimal_0.v test_vivado_minimal_0.edn
13+
synth: test_vivado_minimal_0.v test_vivado_minimal_0.edn | pre_build
1414

15-
test_vivado_minimal_0.bit: test_vivado_minimal_0_synth.tcl test_vivado_minimal_0_run.tcl | test_vivado_minimal_0.xpr
15+
test_vivado_minimal_0.bit: test_vivado_minimal_0_synth.tcl test_vivado_minimal_0_run.tcl | pre_build test_vivado_minimal_0.xpr
1616
$(EDALIZE_LAUNCHER) vivado -notrace -mode batch -source test_vivado_minimal_0_synth.tcl test_vivado_minimal_0_run.tcl test_vivado_minimal_0.xpr
1717

18-
build-gui: test_vivado_minimal_0.xpr
18+
build-gui: test_vivado_minimal_0.xpr | pre_build
1919
$(EDALIZE_LAUNCHER) vivado test_vivado_minimal_0.xpr
2020

21-
pgm: test_vivado_minimal_0_pgm.tcl test_vivado_minimal_0.bit
21+
pgm: test_vivado_minimal_0_pgm.tcl test_vivado_minimal_0.bit | pre_build
2222
$(EDALIZE_LAUNCHER) vivado -quiet -nolog -notrace -mode batch -source test_vivado_minimal_0_pgm.tcl -tclargs xc7a35tcsg324-1 test_vivado_minimal_0.bit
2323

2424
post_build: test_vivado_minimal_0.bit

0 commit comments

Comments
 (0)