Commit 0c404d13 authored by Tristan Gingold's avatar Tristan Gingold

isim: factorize code.

parent 5e104de0
......@@ -118,9 +118,23 @@ class ToolISim(MakefileSim):
self.write("{}: {} ".format(self.get_stamp_file(file_aux), file_aux.rel_path()))
self.writeln(' '.join([fname.rel_path() for fname in file_aux.depends_on]))
def _makefile_sim_compile_file(self, srcfile):
if isinstance(srcfile, VerilogFile):
res = "vlogcomp -work {lib}=.{slash}{lib} $(VLOGCOMP_FLAGS) ".format(
lib=srcfile.library, slash=shell.makefile_slash_char())
if srcfile.include_dirs:
res += ' -i '
res += ' '.join(srcfile.include_dirs)
res += " $<"
return res
elif isinstance(srcfile, VHDLFile):
return "vhpcomp $(VHPCOMP_FLAGS) -work {lib}=.{slash}{lib} $< ".format(
lib=srcfile.library, slash=shell.makefile_slash_char())
else:
return None
def _makefile_sim_compilation(self):
"""Print the compile simulation target for Xilinx ISim"""
fileset = self.fileset
libs = set(f.library for f in self.fileset)
self.writeln('LIBS := ' + ' '.join(libs))
# tell how to make libraries
......@@ -155,24 +169,4 @@ fuse:
# Modify xilinxsim.ini file by including the extra local libraries
# self.write(' '.join(["\t(echo """, lib+"="+lib+"/."+lib, ">>",
# "${XILINX_INI_PATH}/xilinxsim.ini"]))
# rules for all _primary.dat files for sv
# incdir = ""
for vl_file in fileset.filter(VerilogFile).sort():
self._makefile_syn_file_rule(vl_file)
self.write("\t\tvlogcomp -work {lib}=.{slash}{lib}".format(
lib=vl_file.library, slash=shell.makefile_slash_char()))
self.write(" $(VLOGCOMP_FLAGS) ")
if vl_file.include_dirs:
self.write(' -i ')
self.write(' '.join(vl_file.include_dirs))
self.writeln(" $<")
self._makefile_touch_stamp_file()
self.writeln()
self.write("\n")
# list rules for all _primary.dat files for vhdl
for vhdl_file in fileset.filter(VHDLFile).sort():
self._makefile_syn_file_rule(vhdl_file)
self.writeln("\t\tvhpcomp $(VHPCOMP_FLAGS) -work {lib}=.{slash}{lib} $< ".format(
lib=vhdl_file.library, slash=shell.makefile_slash_char()))
self._makefile_touch_stamp_file()
self.writeln()
self._makefile_sim_dep_files()
......@@ -115,7 +115,7 @@ class MakefileSim(ToolMakefile):
cmd = self.SIMULATOR_CONTROLS.get(key)
if cmd is None:
return None
return "\t\t" + cmd.format(work=srcfile.library)
return cmd.format(work=srcfile.library)
def _makefile_sim_dep_files(self):
"""Print dummy targets to handle file dependencies"""
......@@ -123,7 +123,7 @@ class MakefileSim(ToolMakefile):
cmd = self._makefile_sim_compile_file(file_aux)
if cmd is not None:
self._makefile_sim_file_rule(file_aux)
self.writeln(cmd)
self.writeln("\t\t" + cmd)
self._makefile_touch_stamp_file()
self.writeln()
......
......@@ -39,19 +39,20 @@ fuse:
work/.work:
(mkdir -p work && touch work/.work && echo work=work >> xilinxsim.ini) || rm -rf work
work/gate3_tb/.gate3_tb_v: ../files/gate3_tb.v ../files/gate3.vhd
vlogcomp -work work=./work $(VLOGCOMP_FLAGS) -i ../files $<
work/gate/.gate_vhdl: ../files/gate.vhdl
vhpcomp $(VHPCOMP_FLAGS) -work work=./work $<
@mkdir -p $(dir $@) && touch $@
work/gate/.gate_vhdl: ../files/gate.vhdl
work/gate3/.gate3_vhd: ../files/gate3.vhd \
work/gate/.gate_vhdl
vhpcomp $(VHPCOMP_FLAGS) -work work=./work $<
@mkdir -p $(dir $@) && touch $@
work/gate3/.gate3_vhd: ../files/gate3.vhd ../files/gate.vhdl
vhpcomp $(VHPCOMP_FLAGS) -work work=./work $<
work/gate3_tb/.gate3_tb_v: ../files/gate3_tb.v \
work/gate3/.gate3_vhd
vlogcomp -work work=./work $(VLOGCOMP_FLAGS) -i ../files $<
@mkdir -p $(dir $@) && touch $@
......
......@@ -39,19 +39,20 @@ fuse:
work\.work:
(mkdir work && type nul >> work\.work && echo work=work >> xilinxsim.ini) || del /s /q /f work
work/gate3_tb/.gate3_tb_v: ../files/gate3_tb.v ../files/gate3.vhd
vlogcomp -work work=.\work $(VLOGCOMP_FLAGS) -i ../files $<
work/gate/.gate_vhdl: ../files/gate.vhdl
vhpcomp $(VHPCOMP_FLAGS) -work work=.\work $<
@mkdir $(dir $@) && type nul >> $@
work/gate/.gate_vhdl: ../files/gate.vhdl
work/gate3/.gate3_vhd: ../files/gate3.vhd \
work/gate/.gate_vhdl
vhpcomp $(VHPCOMP_FLAGS) -work work=.\work $<
@mkdir $(dir $@) && type nul >> $@
work/gate3/.gate3_vhd: ../files/gate3.vhd ../files/gate.vhdl
vhpcomp $(VHPCOMP_FLAGS) -work work=.\work $<
work/gate3_tb/.gate3_tb_v: ../files/gate3_tb.v \
work/gate3/.gate3_vhd
vlogcomp -work work=.\work $(VLOGCOMP_FLAGS) -i ../files $<
@mkdir $(dir $@) && type nul >> $@
......
......@@ -39,19 +39,20 @@ fuse:
work/.work:
(mkdir -p work && touch work/.work && echo work=work >> xilinxsim.ini) || rm -rf work
work/gate3_tb/.gate3_tb_v: ../files/gate3_tb.v ../files/gate3.vhd
vlogcomp -work work=./work $(VLOGCOMP_FLAGS) -i ../files $<
work/gate/.gate_vhdl: ../files/gate.vhdl
vhpcomp $(VHPCOMP_FLAGS) -work work=./work $<
@mkdir -p $(dir $@) && touch $@
work/gate/.gate_vhdl: ../files/gate.vhdl
work/gate3/.gate3_vhd: ../files/gate3.vhd \
work/gate/.gate_vhdl
vhpcomp $(VHPCOMP_FLAGS) -work work=./work $<
@mkdir -p $(dir $@) && touch $@
work/gate3/.gate3_vhd: ../files/gate3.vhd ../files/gate.vhdl
vhpcomp $(VHPCOMP_FLAGS) -work work=./work $<
work/gate3_tb/.gate3_tb_v: ../files/gate3_tb.v \
work/gate3/.gate3_vhd
vlogcomp -work work=./work $(VLOGCOMP_FLAGS) -i ../files $<
@mkdir -p $(dir $@) && touch $@
......
......@@ -35,8 +35,7 @@ fuse:
work/.work:
(mkdir -p work && touch work/.work && echo work=work >> xilinxsim.ini) || rm -rf work
work/gate/.gate_vhdl: gate.vhdl
work/gate/.gate_vhdl: gate.vhdl
vhpcomp $(VHPCOMP_FLAGS) -work work=./work $<
@mkdir -p $(dir $@) && touch $@
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment