Skip to content

Commit

Permalink
Support cases where more than one command is needed to generate a target
Browse files Browse the repository at this point in the history
  • Loading branch information
GCHQDeveloper560 committed Jul 7, 2021
1 parent a811a8c commit 8ff4cf8
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion edalize/apicula.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def configure_main(self):
depends = self.name+'.pack'
targets = self.name+'.fs'
command = ['gowin_pack', '-d', self.tool_options.get('device'), '-o', targets, depends]
commands.add(command, [self.EdaCommands.Target(targets)], [depends])
commands.add([command], [self.EdaCommands.Target(targets)], [depends])

commands.set_default_target(targets)
commands.write(os.path.join(self.work_root, 'Makefile'))
4 changes: 2 additions & 2 deletions edalize/edatool.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ def write(self, outfile):
f.write(" "+str(d))
f.write("\n")

if c.command:
f.write(f"\t$(EDALIZE_LAUNCHER) {' '.join(c.command)}\n")
for cmd in c.command:
f.write(f"\t$(EDALIZE_LAUNCHER) {' '.join(cmd)}\n")

f.write(f"\n.PHONY: {' '.join(phony_targets)}\n")

Expand Down
8 changes: 4 additions & 4 deletions edalize/icestorm.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def configure_main(self):
command = ['arachne-pnr']
command += self.tool_options.get('arachne_pnr_options', [])
command += ['-p', depends, '-o', targets]
commands.add(command, [self.EdaCommands.Target(depends)], [targets])
commands.add([command], [self.EdaCommands.Target(depends)], [targets])
set_default_target(self.name+'.bin')
elif pnr == 'next':
nextpnr = Nextpnr(yosys.edam, self.work_root)
Expand All @@ -82,20 +82,20 @@ def configure_main(self):
depends = self.name+'.asc'
targets = self.name+'.bin'
command = ['icepack', depends, targets]
commands.add(command, [self.EdaCommands.Target(targets)], [depends])
commands.add([command], [self.EdaCommands.Target(targets)], [depends])

#Timing analysis
depends = self.name+'.asc'
targets = self.name+'.tim'
command = ['icetime', '-tmd', part or '', depends, targets]
commands.add(command, [self.EdaCommands.Target(targets)], [depends])
commands.add([command], [self.EdaCommands.Target(targets)], [depends])
commands.add([], [self.EdaCommands.Target("timing", phony=True)], [targets])

#Statistics
depends = self.name+'.asc'
targets = self.name+'.stat'
command = ['icebox_stat', depends, targets]
commands.add(command, [self.EdaCommands.Target(targets)], [depends])
commands.add([command], [self.EdaCommands.Target(targets)], [depends])
commands.add([], [self.EdaCommands.Target("stats", phony=True)], [targets])

commands.write(os.path.join(self.work_root, 'Makefile'))
4 changes: 2 additions & 2 deletions edalize/nextpnr.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ def configure_main(self):
command += constraints + ['--json', depends] + output

#CLI target
commands.add(command, [self.EdaCommands.Target(targets)], [depends])
commands.add([command], [self.EdaCommands.Target(targets)], [depends])

#GUI target
commands.add(command+['--gui'], [self.EdaCommands.Target("build-gui", phony=True)], [depends])
commands.add([command+['--gui']], [self.EdaCommands.Target("build-gui", phony=True)], [depends])
self.commands = commands.commands
22 changes: 11 additions & 11 deletions edalize/symbiflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def configure_nextpnr(self):
command += ['--device', device]
command += ['--top', self.toplevel]
command += [depends, targets]
commands.add(command, [self.EdaCommands.Target(targets)], [depends])
commands.add([command], [self.EdaCommands.Target(targets)], [depends])

depends = self.name+'.netlist'
targets = self.name+'.phys'
Expand All @@ -196,14 +196,14 @@ def configure_nextpnr(self):
command += ['--write', self.name+'.routed.json']
command += ['--phys', targets]
command += [nextpnr_options]
commands.add(command, [self.EdaCommands.Target(targets)], [depends])
commands.add([command], [self.EdaCommands.Target(targets)], [depends])

depends = self.name+'.phys'
targets = self.name+'.fasm'
command = ['python', '-m', 'fpga_interchange.fasm_generator']
command += ['--schema_dir', '$(INTERCHANGE_SCHEMA_PATH)']
command += ['--family', family, device, self.name+'.netlist', depends, targets]
commands.add(command, [self.EdaCommands.Target(targets)], [depends])
commands.add([command], [self.EdaCommands.Target(targets)], [depends])
else:
targets = self.name+'.fasm'
command = ['nextpnr-'+arch, '--chipdb', chipdb]
Expand All @@ -213,13 +213,13 @@ def configure_nextpnr(self):
command += ['--fasm', targets]
command += ['--log', 'nextpnr.log']
command += [nextpnr_options]
commands.add(command, [self.EdaCommands.Target(targets)], [depends])
commands.add([command], [self.EdaCommands.Target(targets)], [depends])

depends = self.name+'.fasm'
targets = self.name+'.bit'
command = ['symbiflow_write_bitstream', '-d', bitstream_device]
command += ['-f', depends, '-p', partname, '-b', targets]
commands.add(command, [self.EdaCommands.Target(targets)], [depends])
commands.add([command], [self.EdaCommands.Target(targets)], [depends])

commands.set_default_target(targets)
commands.write(os.path.join(self.work_root, 'Makefile'))
Expand Down Expand Up @@ -290,7 +290,7 @@ def configure_vpr(self):
command += ['-d', bitstream_device]
command += ['-p' if vendor == 'xilinx' else '-P', partname]
command += xdc_opts
commands.add(command, [self.EdaCommands.Target(targets)], [])
commands.add([command], [self.EdaCommands.Target(targets)], [])

#P&R
eblif_opt = ['-e', self.toplevel+'.eblif']
Expand All @@ -299,34 +299,34 @@ def configure_vpr(self):
depends = self.toplevel+'.eblif'
targets = self.toplevel+'.net'
command = ['symbiflow_pack'] + eblif_opt + device_opt + sdc_opts + vpr_options
commands.add(command, [self.EdaCommands.Target(targets)], [depends])
commands.add([command], [self.EdaCommands.Target(targets)], [depends])

depends = self.toplevel+'.net'
targets = self.toplevel+'.place'
command = ['symbiflow_place'] + eblif_opt + device_opt
command += ['-n', depends, '-P', partname]
command += sdc_opts + pcf_opts + vpr_options
commands.add(command, [self.EdaCommands.Target(targets)], [depends])
commands.add([command], [self.EdaCommands.Target(targets)], [depends])

depends = self.toplevel+'.place'
targets = self.toplevel+'.route'
command = ['symbiflow_route'] + eblif_opt + device_opt
command += sdc_opts + vpr_options
commands.add(command, [self.EdaCommands.Target(targets)], [depends])
commands.add([command], [self.EdaCommands.Target(targets)], [depends])

depends = self.toplevel+'.route'
targets = self.toplevel+'.fasm'
command = ['symbiflow_write_fasm'] + eblif_opt + device_opt
command += sdc_opts + vpr_options
commands.add(command, [self.EdaCommands.Target(targets)], [depends])
commands.add([command], [self.EdaCommands.Target(targets)], [depends])

depends = self.toplevel+'.fasm'
targets = self.toplevel+'.bit'
command = ['symbiflow_write_bitstream'] + ['-d', bitstream_device]
command += ['-f', depends]
command += ['-p' if vendor == 'xilinx' else '-P', partname]
command += ['-b', targets]
commands.add(command, [self.EdaCommands.Target(targets)], [depends])
commands.add([command], [self.EdaCommands.Target(targets)], [depends])

commands.set_default_target(targets)
commands.write(os.path.join(self.work_root, 'Makefile'))
Expand Down
2 changes: 1 addition & 1 deletion edalize/trellis.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def configure_main(self):
depends = self.name+'.config'
targets = self.name+'.bit'
command = ['ecppack', '--svf', self.name+'.svf', depends, targets]
commands.add(command, [self.EdaCommands.Target(targets)], [depends])
commands.add([command], [self.EdaCommands.Target(targets)], [depends])

commands.set_default_target(self.name+'.bit')
commands.write(os.path.join(self.work_root, 'Makefile'))
10 changes: 5 additions & 5 deletions edalize/vivado.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def configure_main(self):
#Create project file
project_file = self.name+'.xpr'
tcl_file = [self.name+'.tcl']
commands.add(vivado_command+tcl_file, [self.EdaCommands.Target(project_file)], tcl_file + edif_files)
commands.add([vivado_command+tcl_file], [self.EdaCommands.Target(project_file)], tcl_file + edif_files)

#Synthesis target
if synth_tool == 'yosys':
Expand All @@ -192,16 +192,16 @@ def configure_main(self):
else:
depends = [f'{self.name}_synth.tcl', project_file]
targets = [self.EdaCommands.Target(f'{self.name}.runs/synth_1/__synthesis_is_complete__')]
commands.add(vivado_command+depends, targets, depends)
commands.add([vivado_command+depends], targets, depends)
commands.add([], [self.EdaCommands.Target('synth', phony=True)], targets)

#Bitstream generation
run_tcl = self.name+'_run.tcl'
depends = [run_tcl, project_file]
bitstream = self.name+'.bit'
commands.add(vivado_command+depends, [self.EdaCommands.Target(bitstream)], depends)
commands.add([vivado_command+depends], [self.EdaCommands.Target(bitstream)], depends)

commands.add(['vivado', project_file], [self.EdaCommands.Target('build-gui', phony=True)], [project_file])
commands.add([['vivado', project_file]], [self.EdaCommands.Target('build-gui', phony=True)], [project_file])

depends = [self.name+'_pgm.tcl', bitstream]
command = ['vivado', '-quiet', '-nolog', '-notrace', '-mode', 'batch',
Expand All @@ -210,7 +210,7 @@ def configure_main(self):
part = self.tool_options.get('part', "")
command += [part] if part else []
command += [bitstream]
commands.add(command, [self.EdaCommands.Target('pgm', phony=True)], depends)
commands.add([command], [self.EdaCommands.Target('pgm', phony=True)], depends)

commands.set_default_target(bitstream)
commands.write(os.path.join(self.work_root, 'Makefile'))
Expand Down
2 changes: 1 addition & 1 deletion edalize/yosys.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def configure_main(self):
template_vars)

commands = self.EdaCommands()
commands.add(['yosys', '-l', 'yosys.log', '-p', f'"tcl {template}"'],
commands.add([['yosys', '-l', 'yosys.log', '-p', f'"tcl {template}"']],
[self.EdaCommands.Target(f'{self.name}.{output}') for output in ['blif', 'json','edif']],
[template])
if self.tool_options.get('yosys_as_subtool'):
Expand Down

0 comments on commit 8ff4cf8

Please sign in to comment.