Skip to content

Commit

Permalink
Fixed workdir for ghdl in template creation
Browse files Browse the repository at this point in the history
  • Loading branch information
stdefeber committed Oct 4, 2024
1 parent 18972c4 commit 4919acf
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 11 deletions.
8 changes: 7 additions & 1 deletion edalize/ghdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def configure_main(self):

libraries = collections.OrderedDict()
library_options = "--work={lib} --workdir=./{lib}"
top_workdir_options = "--workdir=./{lib}"
ghdlimport = ""
vhdl_sources = ""

Expand All @@ -114,6 +115,11 @@ def configure_main(self):
libraries[top[0]] = []
top_libraries = library_options.format(lib=top[0])

top_workdir = ""
if len(top) > 1:
libraries[top[0]] = []
top_workdir = top_workdir_options.format(lib=top[0])

top_unit = top[-1]

for f in src_files:
Expand Down Expand Up @@ -154,7 +160,7 @@ def configure_main(self):
"run_options": " ".join(run_options),
"make_libraries_directories": make_libraries_directories,
"ghdlimport": ghdlimport,
"top_libraries": top_libraries,
"top_workdir": top_workdir,
},
)

Expand Down
4 changes: 2 additions & 2 deletions edalize/templates/ghdl/Makefile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ TOPLEVEL = {{ toplevel }}
TOPLEVEL_LIBS = {{ top_libraries }}
ANALYZE_OPTIONS = {{ analyze_options }}
RUN_OPTIONS = {{ run_options }}

TOP_WORKDIR = {{ top_workdir }}
VHDL_SOURCES = {{ vhdl_sources }}

all: work-obj{{ standard }}.cf
Expand All @@ -13,7 +13,7 @@ run: $(TOPLEVEL)
$(EDALIZE_LAUNCHER) ghdl -r $(STD) $(ANALYZE_OPTIONS) $(TOPLEVEL_LIBS) $(TOPLEVEL) $(RUN_OPTIONS) $(EXTRA_OPTIONS)

$(TOPLEVEL): $(VHDL_SOURCES) work-obj{{ standard }}.cf
$(EDALIZE_LAUNCHER) ghdl -m $(STD) $(ANALYZE_OPTIONS) $(TOPLEVEL_LIBS) $(TOPLEVEL)
$(EDALIZE_LAUNCHER) ghdl -m $(STD) $(ANALYZE_OPTIONS) $(TOPLEVEL_LIBS) $(TOP_WORKDIR) $(TOPLEVEL)

$(TOPLEVEL).v: $(VHDL_SOURCES) work-obj{{ standard }}.cf
$(EDALIZE_LAUNCHER) ghdl --synth --out=verilog $(STD) $(ANALYZE_OPTIONS) $(TOPLEVEL_LIBS) $(TOPLEVEL)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_ghdl/test01/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ TOPLEVEL = top_module
TOPLEVEL_LIBS =
ANALYZE_OPTIONS = some analyze_options -P./libx
RUN_OPTIONS = a few run_options

TOP_WORKDIR =
VHDL_SOURCES = vhdl_file.vhd vhdl_lfile vhdl2008_file

all: work-obj08.cf
Expand All @@ -13,7 +13,7 @@ run: $(TOPLEVEL)
$(EDALIZE_LAUNCHER) ghdl -r $(STD) $(ANALYZE_OPTIONS) $(TOPLEVEL_LIBS) $(TOPLEVEL) $(RUN_OPTIONS) $(EXTRA_OPTIONS)

$(TOPLEVEL): $(VHDL_SOURCES) work-obj08.cf
$(EDALIZE_LAUNCHER) ghdl -m $(STD) $(ANALYZE_OPTIONS) $(TOPLEVEL_LIBS) $(TOPLEVEL)
$(EDALIZE_LAUNCHER) ghdl -m $(STD) $(ANALYZE_OPTIONS) $(TOPLEVEL_LIBS) $(TOP_WORKDIR) $(TOPLEVEL)

$(TOPLEVEL).v: $(VHDL_SOURCES) work-obj08.cf
$(EDALIZE_LAUNCHER) ghdl --synth --out=verilog $(STD) $(ANALYZE_OPTIONS) $(TOPLEVEL_LIBS) $(TOPLEVEL)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_ghdl/test02/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ TOPLEVEL = top_module
TOPLEVEL_LIBS =
ANALYZE_OPTIONS = some analyze_options -P./libx
RUN_OPTIONS = a few run_options

TOP_WORKDIR =
VHDL_SOURCES = vhdl_file.vhd vhdl_lfile

all: work-obj93.cf
Expand All @@ -13,7 +13,7 @@ run: $(TOPLEVEL)
$(EDALIZE_LAUNCHER) ghdl -r $(STD) $(ANALYZE_OPTIONS) $(TOPLEVEL_LIBS) $(TOPLEVEL) $(RUN_OPTIONS) $(EXTRA_OPTIONS)

$(TOPLEVEL): $(VHDL_SOURCES) work-obj93.cf
$(EDALIZE_LAUNCHER) ghdl -m $(STD) $(ANALYZE_OPTIONS) $(TOPLEVEL_LIBS) $(TOPLEVEL)
$(EDALIZE_LAUNCHER) ghdl -m $(STD) $(ANALYZE_OPTIONS) $(TOPLEVEL_LIBS) $(TOP_WORKDIR) $(TOPLEVEL)

$(TOPLEVEL).v: $(VHDL_SOURCES) work-obj93.cf
$(EDALIZE_LAUNCHER) ghdl --synth --out=verilog $(STD) $(ANALYZE_OPTIONS) $(TOPLEVEL_LIBS) $(TOPLEVEL)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_ghdl/test03/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ TOPLEVEL = top_module
TOPLEVEL_LIBS =
ANALYZE_OPTIONS = --ieee=synopsys -P./libx
RUN_OPTIONS = a few run_options

TOP_WORKDIR =
VHDL_SOURCES = vhdl_file.vhd vhdl_lfile

all: work-obj08.cf
Expand All @@ -13,7 +13,7 @@ run: $(TOPLEVEL)
$(EDALIZE_LAUNCHER) ghdl -r $(STD) $(ANALYZE_OPTIONS) $(TOPLEVEL_LIBS) $(TOPLEVEL) $(RUN_OPTIONS) $(EXTRA_OPTIONS)

$(TOPLEVEL): $(VHDL_SOURCES) work-obj08.cf
$(EDALIZE_LAUNCHER) ghdl -m $(STD) $(ANALYZE_OPTIONS) $(TOPLEVEL_LIBS) $(TOPLEVEL)
$(EDALIZE_LAUNCHER) ghdl -m $(STD) $(ANALYZE_OPTIONS) $(TOPLEVEL_LIBS) $(TOP_WORKDIR) $(TOPLEVEL)

$(TOPLEVEL).v: $(VHDL_SOURCES) work-obj08.cf
$(EDALIZE_LAUNCHER) ghdl --synth --out=verilog $(STD) $(ANALYZE_OPTIONS) $(TOPLEVEL_LIBS) $(TOPLEVEL)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_ghdl/test04/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ TOPLEVEL = vhdl_lfile
TOPLEVEL_LIBS = --work=libx --workdir=./libx
ANALYZE_OPTIONS = some analyze_options -P./libx
RUN_OPTIONS = a few run_options

TOP_WORKDIR = --workdir=./libx
VHDL_SOURCES = vhdl_file.vhd vhdl_lfile vhdl2008_file

all: work-obj08.cf
Expand All @@ -13,7 +13,7 @@ run: $(TOPLEVEL)
$(EDALIZE_LAUNCHER) ghdl -r $(STD) $(ANALYZE_OPTIONS) $(TOPLEVEL_LIBS) $(TOPLEVEL) $(RUN_OPTIONS) $(EXTRA_OPTIONS)

$(TOPLEVEL): $(VHDL_SOURCES) work-obj08.cf
$(EDALIZE_LAUNCHER) ghdl -m $(STD) $(ANALYZE_OPTIONS) $(TOPLEVEL_LIBS) $(TOPLEVEL)
$(EDALIZE_LAUNCHER) ghdl -m $(STD) $(ANALYZE_OPTIONS) $(TOPLEVEL_LIBS) $(TOP_WORKDIR) $(TOPLEVEL)

$(TOPLEVEL).v: $(VHDL_SOURCES) work-obj08.cf
$(EDALIZE_LAUNCHER) ghdl --synth --out=verilog $(STD) $(ANALYZE_OPTIONS) $(TOPLEVEL_LIBS) $(TOPLEVEL)
Expand Down

0 comments on commit 4919acf

Please sign in to comment.