Commit 1d05138a authored by Tristan Gingold's avatar Tristan Gingold

makefilesim.py: factorize code.

parent 98943d10
......@@ -104,6 +104,10 @@ TOP_MODULE := {top_module}
self.write(" \\\n{}".format(path_mod.relpath(dep_file, cwd)))
self.writeln()
def _makefile_sim_file_touch_stamp(self):
self.write("\t\t@" + shell.mkdir_command() + " $(dir $@)")
self.writeln(" && " + shell.touch_command() + " $@ \n")
def _makefile_sim_dep_files(self):
"""Print dummy targets to handle file dependencies"""
for file_aux in self.fileset.sort():
......@@ -115,8 +119,7 @@ TOP_MODULE := {top_module}
elif isinstance(file_aux, VerilogFile):
command_key = 'vlog'
self.writeln("\t\t" + self.SIMULATOR_CONTROLS[command_key].format(work=file_aux.library))
self.write("\t\t@" + shell.mkdir_command() + " $(dir $@)")
self.writeln(" && " + shell.touch_command() + " $@ \n")
self._makefile_sim_file_touch_stamp()
self.writeln()
def _makefile_sim_command(self):
......
......@@ -119,19 +119,14 @@ class MakefileVsim(MakefileSim):
# rules for all _primary.dat files for sv
for vlog in fileset.filter(VerilogFile).sort():
self._makefile_sim_file_rule(vlog)
compile_template = string.Template(
"\t\tvlog -work ${library} $$(VLOG_FLAGS) "
"${sv_option} $${INCLUDE_DIRS} $$<")
compile_line = compile_template.substitute(
library=vlog.library, sv_option="-sv"
if isinstance(vlog, SVFile) else "")
self.writeln(compile_line)
self.write("\t\t@" + shell.mkdir_command() + " $(dir $@)")
self.writeln(" && " + shell.touch_command() + " $@ \n\n")
self.writeln("\t\tvlog -work {library} $(VLOG_FLAGS) {sv_option} ${{INCLUDE_DIRS}} $<".format(
library=vlog.library, sv_option="-sv" if isinstance(vlog, SVFile) else ""))
self._makefile_sim_file_touch_stamp()
self.writeln()
self.writeln()
# list rules for all _primary.dat files for vhdl
for vhdl in fileset.filter(VHDLFile).sort():
self._makefile_sim_file_rule(vhdl)
self.writeln("\t\tvcom $(VCOM_FLAGS) -work {} $< ".format(vhdl.library))
self.writeln("\t\t@" + shell.mkdir_command() +
" $(dir $@) && " + shell.touch_command() + " $@ \n\n")
self._makefile_sim_file_touch_stamp()
self.writeln()
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