Refactor ISE so that it supports the new project stage

parent e73d287a
...@@ -82,25 +82,39 @@ class ToolISE(ToolSyn): ...@@ -82,25 +82,39 @@ class ToolISE(ToolSyn):
"par_usage_statistics.html", "webtalk_pn.xml"], "par_usage_statistics.html", "webtalk_pn.xml"],
'mrproper': ["*.bit", "*.bin", "*.mcs"]} 'mrproper': ["*.bit", "*.bin", "*.mcs"]}
_ISE_RUN = ''' _ISE_RUN = '''\
$(TCL_OPEN)
set process {{{0}}} set process {{{0}}}
process run $$process process run $$process
set result [process get $$process status] set result [process get $$process status]
if {{ $$result == "errors" }} {{ if {{ $$result == "errors" }} {{
puts "$$process failed" puts "$$process failed"
exit 1 exit 1
}}''' }}
$(TCL_SAVE)
TCL_CONTROLS = {'create': 'project new $(PROJECT_FILE)', $(TCL_CLOSE)'''
'open': 'project open $(PROJECT_FILE)',
'save': 'project save', TCL_CONTROLS = {
'close': 'project close', 'create': 'project new $(PROJECT_FILE)',
'synthesize': _ISE_RUN.format('Synthesize - XST'), 'open': 'project open $(PROJECT_FILE)',
'translate': _ISE_RUN.format('Translate'), 'save': 'project save',
'map': _ISE_RUN.format('Map'), 'close': 'project close',
'par': _ISE_RUN.format('Place & Route'), 'project': '$(TCL_CREATE)\n'
'bitstream': _ISE_RUN.format('Generate Programming File'), '$(TCL_FILES)\n'
'install_source': '*.bit *.bin'} 'foreach filename $$hdl_files {{\n'
' xfile add $$filename\n'
' puts "Adding file $$filename to the project."\n'
'}}\n'
'{0}\n'
'project set top $(TOP_MODULE)\n'
'$(TCL_SAVE)\n'
'$(TCL_CLOSE)',
'synthesize': _ISE_RUN.format('Synthesize - XST'),
'translate': _ISE_RUN.format('Translate'),
'map': _ISE_RUN.format('Map'),
'par': _ISE_RUN.format('Place & Route'),
'bitstream': _ISE_RUN.format('Generate Programming File'),
'install_source': '*.bit *.bin'}
def __init__(self): def __init__(self):
super(ToolISE, self).__init__() super(ToolISE, self).__init__()
...@@ -126,8 +140,8 @@ if {{ $$result == "errors" }} {{ ...@@ -126,8 +140,8 @@ if {{ $$result == "errors" }} {{
" and can not be guessed!") " and can not be guessed!")
quit(-1) quit(-1)
syn_properties = self.manifest_dict.get("syn_properties") syn_properties = self.manifest_dict.get("syn_properties")
create_new = [] project_new = []
create_new.append(self._tcl_controls["create"]) project_tcl = self._tcl_controls["project"]
tmp = 'project set "{0}" "{1}"' tmp = 'project set "{0}" "{1}"'
properties = [ properties = [
['family', syn_family], ['family', syn_family],
...@@ -140,9 +154,10 @@ if {{ $$result == "errors" }} {{ ...@@ -140,9 +154,10 @@ if {{ $$result == "errors" }} {{
if not syn_properties is None: if not syn_properties is None:
properties.extend(syn_properties) properties.extend(syn_properties)
for prop in properties: for prop in properties:
create_new.append(tmp.format(prop[0], prop[1])) project_new.append(tmp.format(prop[0], prop[1]))
create_new.append('set compile_directory .') project_new.append('set compile_directory .')
self._tcl_controls["create"] = "\n".join(create_new) self._tcl_controls["project"] = project_tcl.format(
"\n".join(project_new))
super(ToolISE, self).makefile_syn_tcl() super(ToolISE, self).makefile_syn_tcl()
def makefile_syn_files(self): def makefile_syn_files(self):
...@@ -153,11 +168,5 @@ if {{ $$result == "errors" }} {{ ...@@ -153,11 +168,5 @@ if {{ $$result == "errors" }} {{
for file_aux in self.fileset: for file_aux in self.fileset:
self.writeln(hdl.format(file_aux.rel_path())) self.writeln(hdl.format(file_aux.rel_path()))
self.writeln("}") self.writeln("}")
self.writeln(
'foreach filename $$hdl_files {\n'
' xfile add $$filename\n'
' puts "Adding file $$filename to the project."\n'
'}')
self.writeln("project set top $(TOP_MODULE)")
self.writeln("endef") self.writeln("endef")
self.writeln("export TCL_FILES") self.writeln("export TCL_FILES")
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