Commit f3c20ffb authored by Tristan Gingold's avatar Tristan Gingold

Merge branch 'fix-lattice-diamond-take2' into 'develop'

Fix lattice diamond take2: Filter clean targets - Add only relevant stages for every tool

See merge request !18
parents 2df02528 f9fd1743
......@@ -242,6 +242,25 @@ class EDFFile(File):
"""EDIF Netlist Files"""
pass
class IPXFile(File):
"""This is the class providing the Lattice Diamond IP Express Manifest file"""
pass
class LPCFile(File):
"""This is the class providing the Lattice Diamond IP Express module parameter Customization file"""
pass
class RVLFile(File):
"""This is the class providing the Lattice Diamond Reveal Inserter Project/Debug file"""
pass
class RVAFile(File):
"""This is the class providing the Lattice Diamond Reveal Analyzer RVA file"""
pass
#class SVFFile(File):
# """This is the class providing the Lattice Diamond Reveal Analyzer SVF file"""
# pass
LATTICE_FILE_DICT = {
'ldf': LDFFile,
......@@ -250,7 +269,11 @@ LATTICE_FILE_DICT = {
'edif': EDFFile,
'edi': EDFFile,
'edn': EDFFile,
'pcf': PCFFile}
'pcf': PCFFile,
'ipx': IPXFile,
'lpc': LPCFile,
'rvl': RVLFile,
'rva': RVAFile}
# MICROSEMI/ACTEL FILES
......
......@@ -26,7 +26,7 @@
from __future__ import absolute_import
from .makefilesyn import MakefileSyn
from ..sourcefiles.srcfile import EDFFile, LPFFile, VHDLFile, VerilogFile
from ..sourcefiles.srcfile import EDFFile, LPFFile, VHDLFile, VerilogFile, IPXFile, LPCFile, RVLFile, RVAFile
class ToolDiamond(MakefileSyn):
......@@ -40,20 +40,26 @@ class ToolDiamond(MakefileSyn):
'linux_bin': 'diamondc',
'project_ext': 'ldf'}
STANDARD_LIBS = ['ieee', 'std']
STANDARD_LIBS = ['ieee', 'std', 'machxo2', 'machxo3']
_LATTICE_SOURCE = 'prj_src {0} {{srcfile}}'
_LATTICE_SETTINGS_DUMMY = '#prj_src {0} {{srcfile}}'
_LATTICE_PURGE_SOURCE = 'prj_src remove -all'
SUPPORTED_FILES = {
EDFFile: _LATTICE_SOURCE.format('add'),
LPFFile: _LATTICE_SOURCE.format('add -exclude') + '; ' +
_LATTICE_SOURCE.format('enable')}
LPFFile: _LATTICE_SETTINGS_DUMMY.format('add -exclude') + '; ' +
_LATTICE_SOURCE.format('enable'),
IPXFile: _LATTICE_SOURCE.format('add'),
LPCFile: _LATTICE_SOURCE.format('add'),
RVLFile: _LATTICE_SOURCE.format('add'),
RVAFile: _LATTICE_SOURCE.format('add')}
HDL_FILES = {
VHDLFile: _LATTICE_SOURCE.format('add'),
VerilogFile: _LATTICE_SOURCE.format('add')}
CLEAN_TARGETS = {'clean': ["*.sty", "$(PROJECT)"],
CLEAN_TARGETS = {'clean': ["*.sty", "*.ldf", "$(PROJECT)"],
'mrproper': ["*.jed"]}
TCL_CONTROLS = {'create': 'prj_project new -name $(PROJECT)'
......@@ -75,7 +81,13 @@ class ToolDiamond(MakefileSyn):
' -impl $(PROJECT) -task Bitgen\n'
'$(TCL_SAVE)\n'
'$(TCL_CLOSE)',
'install_source': '$(PROJECT)/$(PROJECT)_$(PROJECT).jed'}
'prom': '$(TCL_OPEN)\n'
'prj_run Export'
' -impl $(PROJECT) -task Jedecgen\n'
'$(TCL_SAVE)\n'
'$(TCL_CLOSE)',
'install_source': '$(PROJECT)/$(PROJECT)_$(PROJECT).jed',
'files': _LATTICE_PURGE_SOURCE}
def __init__(self):
super(ToolDiamond, self).__init__()
......
......@@ -168,7 +168,7 @@ endif""")
"""Generate the synthesis Makefile targets for handling design build"""
stage_previous = "files.tcl"
stage_list = ["project", "synthesize", "translate",
"map", "par", "bitstream"]
"map", "par", "bitstream", "prom"]
for stage in stage_list:
if stage in self._tcl_controls:
echo_command = '\t\techo {0} >> $@'
......@@ -186,7 +186,7 @@ endif""")
def _makefile_syn_command(self):
"""Create the Makefile targets for user defined commands"""
stage_list = ["project", "synthesize", "translate",
"map", "par", "bitstream"]
"map", "par", "bitstream", "prom"]
for stage in stage_list:
if stage in self._tcl_controls:
self.writeln("""\
......@@ -199,11 +199,17 @@ SYN_POST_{0}_CMD := {2}
def _makefile_syn_clean(self):
"""Print the Makefile clean target for synthesis"""
self.makefile_clean()
self.writeln("\t\t" + shell.del_command() +
" project synthesize translate map par bitstream")
self.writeln("\t\t" + shell.del_command() +
" project.tcl synthesize.tcl translate.tcl" +
" map.tcl par.tcl bitstream.tcl files.tcl")
_stage_clean_targets=""
_stage_tcl_clean_targets=""
stage_list = ["project", "synthesize", "translate",
"map", "par", "bitstream", "prom"]
for stage in stage_list:
if stage in self._tcl_controls:
_stage_clean_targets += f" {stage}"
_stage_tcl_clean_targets += f" {stage}.tcl"
_stage_tcl_clean_targets+=" files.tcl"
self.writeln("\t\t" + shell.del_command() + _stage_clean_targets)
self.writeln("\t\t" + shell.del_command() + _stage_tcl_clean_targets)
self.writeln()
self.makefile_mrproper()
......
......@@ -29,6 +29,7 @@ endif
all: bitstream
files.tcl:
@echo prj_src remove -all >> $@
echo 'prj_src add ../files/gate.vhdl' >> $@
SYN_PRE_PROJECT_CMD :=
......@@ -40,6 +41,9 @@ SYN_POST_PAR_CMD :=
SYN_PRE_BITSTREAM_CMD :=
SYN_POST_BITSTREAM_CMD :=
SYN_PRE_PROM_CMD :=
SYN_POST_PROM_CMD :=
project.tcl:
echo $(TCL_CREATE) >> $@
echo source files.tcl >> $@
......@@ -76,12 +80,24 @@ bitstream: par bitstream.tcl
$(SYN_POST_BITSTREAM_CMD)
touch $@
CLEAN_TARGETS := $(LIBS) *.sty $(PROJECT)
prom.tcl:
echo $(TCL_OPEN) >> $@
echo prj_run Export -impl $(PROJECT) -task Jedecgen >> $@
echo $(TCL_SAVE) >> $@
echo $(TCL_CLOSE) >> $@
prom: bitstream prom.tcl
$(SYN_PRE_PROM_CMD)
$(TCL_INTERPRETER) $@.tcl
$(SYN_POST_PROM_CMD)
touch $@
CLEAN_TARGETS := $(LIBS) *.sty *.ldf $(PROJECT)
clean:
rm -rf $(CLEAN_TARGETS)
rm -rf project synthesize translate map par bitstream
rm -rf project.tcl synthesize.tcl translate.tcl map.tcl par.tcl bitstream.tcl files.tcl
rm -rf project par bitstream prom
rm -rf project.tcl par.tcl bitstream.tcl prom.tcl files.tcl
mrproper: clean
rm -rf *.jed
......
......@@ -6,6 +6,7 @@
TOP_MODULE := gate2
PROJECT := gate2
PROJECT_FILE := $(PROJECT).
TOOL_PATH :=
TCL_INTERPRETER := yosys -c
ifneq ($(strip $(TOOL_PATH)),)
TCL_INTERPRETER := $(TOOL_PATH)/$(TCL_INTERPRETER)
......@@ -68,8 +69,8 @@ CLEAN_TARGETS := $(LIBS) $(PROJECT).asc $(PROJECT).blif
clean:
rm -rf $(CLEAN_TARGETS)
rm -rf project synthesize translate map par bitstream
rm -rf project.tcl synthesize.tcl translate.tcl map.tcl par.tcl bitstream.tcl files.tcl
rm -rf synthesize par bitstream
rm -rf synthesize.tcl par.tcl bitstream.tcl files.tcl
mrproper: clean
rm -rf $(PROJECT).bin
......
......@@ -70,8 +70,8 @@ CLEAN_TARGETS := $(LIBS) $(PROJECT)
clean:
rm -rf $(CLEAN_TARGETS)
rm -rf project synthesize translate map par bitstream
rm -rf project.tcl synthesize.tcl translate.tcl map.tcl par.tcl bitstream.tcl files.tcl
rm -rf project bitstream
rm -rf project.tcl bitstream.tcl files.tcl
mrproper: clean
rm -rf *.pdb *.stp
......
......@@ -123,8 +123,8 @@ CLEAN_TARGETS := $(LIBS) planAhead_* planAhead.* .Xil $(PROJECT).cache $(PROJECT
clean:
rm -rf $(CLEAN_TARGETS)
rm -rf project synthesize translate map par bitstream
rm -rf project.tcl synthesize.tcl translate.tcl map.tcl par.tcl bitstream.tcl files.tcl
rm -rf project synthesize par bitstream
rm -rf project.tcl synthesize.tcl par.tcl bitstream.tcl files.tcl
mrproper: clean
rm -rf *.bit *.bin
......
......@@ -65,8 +65,8 @@ CLEAN_TARGETS := $(LIBS) *.rpt *.smsg *.summary *.done *.jdi *.pin *.qws db incr
clean:
rm -rf $(CLEAN_TARGETS)
rm -rf project synthesize translate map par bitstream
rm -rf project.tcl synthesize.tcl translate.tcl map.tcl par.tcl bitstream.tcl files.tcl
rm -rf project bitstream
rm -rf project.tcl bitstream.tcl files.tcl
mrproper: clean
rm -rf *.sof *.pof *.jam *.jbc *.ekp *.jic
......
......@@ -65,8 +65,8 @@ CLEAN_TARGETS := $(LIBS) *.rpt *.smsg *.summary *.done *.jdi *.pin *.qws db incr
clean:
rm -rf $(CLEAN_TARGETS)
rm -rf project synthesize translate map par bitstream
rm -rf project.tcl synthesize.tcl translate.tcl map.tcl par.tcl bitstream.tcl files.tcl
rm -rf project bitstream
rm -rf project.tcl bitstream.tcl files.tcl
mrproper: clean
rm -rf *.sof *.pof *.jam *.jbc *.ekp *.jic
......
......@@ -123,8 +123,8 @@ CLEAN_TARGETS := $(LIBS) .Xil *.jou *.log *.pb *.dmp $(PROJECT).cache $(PROJECT)
clean:
rm -rf $(CLEAN_TARGETS)
rm -rf project synthesize translate map par bitstream
rm -rf project.tcl synthesize.tcl translate.tcl map.tcl par.tcl bitstream.tcl files.tcl
rm -rf project synthesize par bitstream
rm -rf project.tcl synthesize.tcl par.tcl bitstream.tcl files.tcl
mrproper: clean
rm -rf *.bit *.bin
......
......@@ -123,8 +123,8 @@ CLEAN_TARGETS := $(LIBS) .Xil *.jou *.log *.pb *.dmp $(PROJECT).cache $(PROJECT)
clean:
rm -rf $(CLEAN_TARGETS)
rm -rf project synthesize translate map par bitstream
rm -rf project.tcl synthesize.tcl translate.tcl map.tcl par.tcl bitstream.tcl files.tcl
rm -rf project synthesize par bitstream
rm -rf project.tcl synthesize.tcl par.tcl bitstream.tcl files.tcl
mrproper: clean
rm -rf *.bit *.bin
......
......@@ -68,8 +68,8 @@ CLEAN_TARGETS := $(LIBS) *.rpt *.smsg *.summary *.done *.jdi *.pin *.qws db incr
clean:
rm -rf $(CLEAN_TARGETS)
rm -rf project synthesize translate map par bitstream
rm -rf project.tcl synthesize.tcl translate.tcl map.tcl par.tcl bitstream.tcl files.tcl
rm -rf project bitstream
rm -rf project.tcl bitstream.tcl files.tcl
mrproper: clean
rm -rf *.sof *.pof *.jam *.jbc *.ekp *.jic
......
......@@ -129,8 +129,8 @@ CLEAN_TARGETS := $(LIBS) .Xil *.jou *.log *.pb *.dmp $(PROJECT).cache $(PROJECT)
clean:
rm -rf $(CLEAN_TARGETS)
rm -rf project synthesize translate map par bitstream
rm -rf project.tcl synthesize.tcl translate.tcl map.tcl par.tcl bitstream.tcl files.tcl
rm -rf project synthesize par bitstream
rm -rf project.tcl synthesize.tcl par.tcl bitstream.tcl files.tcl
mrproper: clean
rm -rf *.bit *.bin
......
......@@ -69,8 +69,8 @@ CLEAN_TARGETS := $(LIBS) *.rpt *.smsg *.summary *.done *.jdi *.pin *.qws db incr
clean:
del /s /q /f $(CLEAN_TARGETS)
@-rmdir /s /q $(CLEAN_TARGETS) >nul 2>&1
del /s /q /f project synthesize translate map par bitstream
del /s /q /f project.tcl synthesize.tcl translate.tcl map.tcl par.tcl bitstream.tcl files.tcl
del /s /q /f project bitstream
del /s /q /f project.tcl bitstream.tcl files.tcl
mrproper: clean
del /s /q /f *.sof *.pof *.jam *.jbc *.ekp *.jic
......
......@@ -124,8 +124,8 @@ CLEAN_TARGETS := $(LIBS) .Xil *.jou *.log *.pb *.dmp $(PROJECT).cache $(PROJECT)
clean:
rm -rf $(CLEAN_TARGETS)
rm -rf project synthesize translate map par bitstream
rm -rf project.tcl synthesize.tcl translate.tcl map.tcl par.tcl bitstream.tcl files.tcl
rm -rf project synthesize par bitstream
rm -rf project.tcl synthesize.tcl par.tcl bitstream.tcl files.tcl
mrproper: clean
rm -rf *.bit *.bin
......
......@@ -87,8 +87,8 @@ CLEAN_TARGETS := $(LIBS) $(PROJECT) *.log
clean:
rm -rf $(CLEAN_TARGETS)
rm -rf project synthesize translate map par bitstream
rm -rf project.tcl synthesize.tcl translate.tcl map.tcl par.tcl bitstream.tcl files.tcl
rm -rf project bitstream
rm -rf project.tcl bitstream.tcl files.tcl
mrproper: clean
rm -rf *.pdb *.stp
......
......@@ -69,8 +69,8 @@ CLEAN_TARGETS := $(LIBS) $(PROJECT) *.log
clean:
rm -rf $(CLEAN_TARGETS)
rm -rf project synthesize translate map par bitstream
rm -rf project.tcl synthesize.tcl translate.tcl map.tcl par.tcl bitstream.tcl files.tcl
rm -rf project bitstream
rm -rf project.tcl bitstream.tcl files.tcl
mrproper: clean
rm -rf *.pdb *.stp
......
......@@ -125,7 +125,7 @@ def test_ghdl():
run_compare(path="008ghdl")
def test_icestorm():
run_compare_filter(filter="TOOL_PATH", path="009icestorm")
run_compare(path="009icestorm")
def test_isim010():
run_compare_xilinx(path="010isim")
......
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