Skip to content

Commit

Permalink
Add Symbiflow Quicklogic targets. Pass vendor and part as env var.
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosedp authored and olofk committed Feb 9, 2022
1 parent d79bb28 commit 1a465df
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 1 deletion.
49 changes: 48 additions & 1 deletion edalize/symbiflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,12 +300,19 @@ def configure_vpr(self):
xdc_opts = ["-x"] + placement_constraints if placement_constraints else []

commands = EdaCommands()

# Add vendor variables
commands.add_var("export EDALIZE_VENDOR=%s" % vendor)
commands.add_var("export EDALIZE_PART=%s" % part)

# Synthesis
targets = self.toplevel + ".eblif"
command = ["symbiflow_synth", "-t", self.toplevel]
command += ["-v"] + file_list
command += ["-d", bitstream_device]
command += ["-p" if vendor == "xilinx" else "-P", partname]
if vendor == "quicklogic" and pins_constraints:
command += pcf_opts
command += xdc_opts
commands.add(command, [targets], [])

Expand Down Expand Up @@ -345,7 +352,47 @@ def configure_vpr(self):
command += ["-b", targets]
commands.add(command, [targets], [depends])

commands.set_default_target(targets)
if vendor == "quicklogic":
depends = self.toplevel + ".bit"
targets = self.toplevel + ".bin"
command = ["symbiflow_write_binary"]
command += [depends]
command += [targets]
commands.add(command, [targets], [depends])

depends = self.toplevel + ".bit"
targets = self.toplevel + ".h"
command = ["symbiflow_write_bitheader"]
command += [depends]
command += [targets]
commands.add(command, [targets], [depends])

depends = self.toplevel + ".bit"
targets = self.toplevel + ".openocd.cfg"
command = ["symbiflow_write_openocd"]
command += [depends]
command += [targets]
commands.add(command, [targets], [depends])

depends = self.toplevel + ".bit"
targets = self.toplevel + ".jlink"
command = ["symbiflow_write_jlink"]
command += [depends]
command += [targets]
commands.add(command, [targets], [depends])

commands.set_default_target(
self.toplevel
+ ".bin"
+ " "
+ self.toplevel
+ ".h"
+ " "
+ self.toplevel
+ ".openocd.cfg"
)
else:
commands.set_default_target(targets)
commands.write(os.path.join(self.work_root, "Makefile"))

def configure_main(self):
Expand Down
8 changes: 8 additions & 0 deletions edalize/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,25 @@ def __init__(self, command, targets, depends, order_only_deps=[]):

def __init__(self):
self.commands = []
self.vars = []
self.header = "#Auto generated by Edalize\n\n"

def add(self, command, targets, depends, order_only_deps=[]):
self.commands.append(self.Command(command, targets, depends, order_only_deps))

def add_var(self, var):
self.vars.append(var)

def set_default_target(self, target):
self.default_target = target

def write(self, outfile):
with open(outfile, "w") as f:
f.write(self.header)
for v in self.vars:
f.write(v + "\n")
if self.vars:
f.write("\n\n")
if not self.default_target:
raise RuntimeError("Internal Edalize error. Missing default target")

Expand Down
4 changes: 4 additions & 0 deletions tests/test_symbiflow/vtr/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#Auto generated by Edalize

export EDALIZE_VENDOR=xilinx
export EDALIZE_PART=xc7a35tcsg324-1


all: top_module.bit

top_module.eblif:
Expand Down

0 comments on commit 1a465df

Please sign in to comment.