build.xilinx: Convert attributes to something Yosys understands.

Convert keep, dont_touch and async_reg to something Yosys understands.

Write out an EDIF file with the attributes so that Vivado can use them.
(Requires Yosys with commit
115ca57647)
This commit is contained in:
Tim 'mithro' Ansell 2018-10-05 12:48:30 -07:00
parent 78414c0588
commit ace976242e
1 changed files with 30 additions and 2 deletions

View File

@ -235,9 +235,37 @@ def _run_yosys(device, sources, vincpaths, build_name):
ys_contents += "read_{}{} {}\n".format(language, incflags, filename) ys_contents += "read_{}{} {}\n".format(language, incflags, filename)
ys_contents += """\ ys_contents += """\
# hierarchy -top top hierarchy -top top
# FIXME: Are these needed?
# proc; memory; opt; fsm; opt # proc; memory; opt; fsm; opt
synth_xilinx -top top -edif {build_name}.edif""".format(build_name=build_name)
# Map keep to keep=1 for yosys
log
log XX. Converting (* keep = "xxxx" *) attribute for Yosys
log
attrmap -tocase keep -imap keep="true" keep=1 -imap keep="false" keep=0 -remove keep=0
select -list a:keep=1
# Add keep=1 for yosys to objects which have dont_touch="true" attribute.
log
log XX. Converting (* dont_touch = "true" *) attribute for Yosys
log
select -list a:dont_touch=true
setattr -set keep 1 a:dont_touch=true
# Convert (* async_reg = "true" *) to async registers for Yosys.
# (* async_reg = "true", dont_touch = "true" *) reg xilinxmultiregimpl0_regs1 = 1'd0;
log
log XX. Converting (* async_reg = "true" *) attribute to async registers for Yosys
log
select -list a:async_reg=true
setattr -set keep 1 a:async_reg=true
synth_xilinx -top top
write_edif -attrprop {build_name}.edif
""".format(build_name=build_name)
ys_name = build_name + ".ys" ys_name = build_name + ".ys"
tools.write_to_file(ys_name, ys_contents) tools.write_to_file(ys_name, ys_contents)