Vivado output generation
Signed-off-by: Joppe Blondel <joppe@blondel.nl>
This commit is contained in:
@ -34,7 +34,7 @@ architecture structural of toplevel is
|
||||
-- ----------
|
||||
-- COMPONENTS
|
||||
-- ----------
|
||||
component zynq_ps
|
||||
component zynqps
|
||||
port (
|
||||
FCLK_CLK0 : out std_logic;
|
||||
FCLK_RESET0_N : out std_logic;
|
||||
@ -101,7 +101,7 @@ begin
|
||||
ARESETN => ARESETN(0),
|
||||
LED => LED
|
||||
);
|
||||
zynq_ps_i : component zynq_ps port map(
|
||||
zynqps_i : component zynqps port map(
|
||||
-- MIO
|
||||
MIO => MIO,
|
||||
-- CLOCKS
|
||||
|
@ -40,7 +40,10 @@ speedgrade = -2
|
||||
toplevel = toplevel
|
||||
# Created netlist toplevel
|
||||
netlist_top = toplevel
|
||||
#synth_opts =
|
||||
synth_opts = -flatten_hierarchy none -keep_equivalent_registers
|
||||
#opt_opts =
|
||||
#place_opts =
|
||||
#route_opts =
|
||||
|
||||
# Fileset
|
||||
files_vhdl = RTL/heartbeat.vhd RTL/toplevel.vhd
|
||||
|
@ -15,41 +15,41 @@ def do(config, target, log, subprocesses, prefix='.'):
|
||||
|
||||
res = xst(config, target, log, subprocesses, prefix)
|
||||
if res != 0:
|
||||
print("ERROR: xst returned with", res)
|
||||
log("ERROR: xst returned with", res)
|
||||
return res
|
||||
|
||||
log("Implement")
|
||||
|
||||
res = ngdbuild(config, target, log, subprocesses, prefix)
|
||||
if res != 0:
|
||||
print("ERROR: ngdbuild returned with", res)
|
||||
log("ERROR: ngdbuild returned with", res)
|
||||
return res
|
||||
|
||||
res = map(config, target, log, subprocesses, prefix)
|
||||
if res != 0:
|
||||
print("ERROR: map returned with", res)
|
||||
log("ERROR: map returned with", res)
|
||||
return res
|
||||
|
||||
res = par(config, target, log, subprocesses, prefix)
|
||||
if res != 0:
|
||||
print("ERROR: par returned with", res)
|
||||
log("ERROR: par returned with", res)
|
||||
return res
|
||||
|
||||
log("Generate output files")
|
||||
|
||||
res = netgen(config, target, log, subprocesses, prefix)
|
||||
if res != 0:
|
||||
print("ERROR: netgen returned with", res)
|
||||
log("ERROR: netgen returned with", res)
|
||||
return res
|
||||
|
||||
res = bitgen(config, target, log, subprocesses, prefix)
|
||||
if res != 0:
|
||||
print("ERROR: bitgen returned with", res)
|
||||
log("ERROR: bitgen returned with", res)
|
||||
return res
|
||||
|
||||
log("Analyze design")
|
||||
|
||||
res = trce(config, target, log, subprocesses, prefix)
|
||||
if res != 0:
|
||||
print("ERROR: trce returned with", res)
|
||||
log("ERROR: trce returned with", res)
|
||||
return res
|
@ -4,6 +4,8 @@ import time
|
||||
import subprocess
|
||||
|
||||
from .util_VIVADO.synth import synth
|
||||
from .util_VIVADO.impl import impl
|
||||
from .util_VIVADO.out import out
|
||||
|
||||
def do(config, target, log, subprocesses, prefix='.'):
|
||||
shutil.rmtree(config.get('project', 'build_dir', fallback='build'), True)
|
||||
@ -12,5 +14,19 @@ def do(config, target, log, subprocesses, prefix='.'):
|
||||
|
||||
res = synth(config, target, log, subprocesses, prefix)
|
||||
if res != 0:
|
||||
print("ERROR: vivado returned with", res)
|
||||
log("ERROR: vivado returned with", res)
|
||||
return res
|
||||
|
||||
log("Implement")
|
||||
|
||||
res = impl(config, target, log, subprocesses, prefix)
|
||||
if res != 0:
|
||||
log("ERROR: vivado returned with", res)
|
||||
return res
|
||||
|
||||
log("Generate output files")
|
||||
|
||||
res = out(config, target, log, subprocesses, prefix)
|
||||
if res != 0:
|
||||
log("ERROR: vivado returned with", res)
|
||||
return res
|
47
remotesyn/toolchains/util_VIVADO/impl.py
Normal file
47
remotesyn/toolchains/util_VIVADO/impl.py
Normal file
@ -0,0 +1,47 @@
|
||||
import shutil
|
||||
import os
|
||||
import time
|
||||
import subprocess
|
||||
|
||||
def impl(config, target, log, subprocesses, prefix='.'):
|
||||
log(" - parsing options")
|
||||
opt_opts = config.get(f'target.{target}', 'opt_opts', fallback='')
|
||||
place_opts = config.get(f'target.{target}', 'place_opts', fallback='')
|
||||
route_opts = config.get(f'target.{target}', 'route_opts', fallback='')
|
||||
build_dir = config.get(f'project', 'build_dir', fallback='build')
|
||||
out_dir = config.get(f'project', 'out_dir', fallback='out')
|
||||
|
||||
prefix = f'{os.getcwd()}/{prefix}'
|
||||
build_dir = f'{prefix}/{build_dir}'
|
||||
out_dir = f'{prefix}/{out_dir}/{target}'
|
||||
|
||||
log(" - creating output directories")
|
||||
os.makedirs(build_dir, exist_ok=True)
|
||||
os.makedirs(out_dir, exist_ok=True)
|
||||
|
||||
log(" - writing project tcl file")
|
||||
with open(f'{build_dir}/do.tcl', 'w') as f:
|
||||
f.write('set_param general.maxThreads 8\n')
|
||||
f.write(f"open_checkpoint {out_dir}/post_synth.dcp\n")
|
||||
f.write(f"opt_design {opt_opts}\nplace_design {place_opts}\nroute_design {route_opts}\n")
|
||||
f.write(f"write_checkpoint -force post_impl.dcp\n")
|
||||
|
||||
log(" - run vivado")
|
||||
p = subprocess.Popen(f"vivado -mode batch -source do.tcl",
|
||||
shell=True, cwd=build_dir,
|
||||
stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||
subprocesses.append(p)
|
||||
while p.poll() is None:
|
||||
time.sleep(1)
|
||||
res = p.returncode
|
||||
|
||||
log(" - copy logs")
|
||||
shutil.copy(f'{build_dir}/vivado.log', f'{out_dir}/impl.log')
|
||||
|
||||
if res!=0:
|
||||
return res
|
||||
|
||||
log(" - copy output files")
|
||||
shutil.copy(f'{build_dir}/post_impl.dcp', f'{out_dir}/post_impl.dcp')
|
||||
|
||||
return res
|
69
remotesyn/toolchains/util_VIVADO/out.py
Normal file
69
remotesyn/toolchains/util_VIVADO/out.py
Normal file
@ -0,0 +1,69 @@
|
||||
import shutil
|
||||
import os
|
||||
import time
|
||||
import subprocess
|
||||
|
||||
def out(config, target, log, subprocesses, prefix='.'):
|
||||
log(" - parsing options")
|
||||
device = config.get(f'target.{target}', 'device', fallback='')
|
||||
package = config.get(f'target.{target}', 'package', fallback='')
|
||||
speedgrade = config.get(f'target.{target}', 'speedgrade', fallback='')
|
||||
toplevel = config.get(f'target.{target}', 'toplevel', fallback='toplevel')
|
||||
netlist_top = config.get(f'target.{target}', 'netlist_top', fallback='toplevel')
|
||||
files_vhdl = config.get(f'target.{target}', 'files_vhdl', fallback='').split()
|
||||
files_verilog = config.get(f'target.{target}', 'files_verilog', fallback='').split()
|
||||
files_sysverilog = config.get(f'target.{target}', 'files_sysverilog', fallback='').split()
|
||||
files_con = config.get(f'target.{target}', 'files_con', fallback='').split()
|
||||
files_xci = config.get(f'target.{target}', 'files_xci', fallback='').split()
|
||||
opt_opts = config.get(f'target.{target}', 'opt_opts', fallback='')
|
||||
place_opts = config.get(f'target.{target}', 'place_opts', fallback='')
|
||||
route_opts = config.get(f'target.{target}', 'route_opts', fallback='')
|
||||
build_dir = config.get(f'project', 'build_dir', fallback='build')
|
||||
out_dir = config.get(f'project', 'out_dir', fallback='out')
|
||||
|
||||
prefix = f'{os.getcwd()}/{prefix}'
|
||||
build_dir = f'{prefix}/{build_dir}'
|
||||
out_dir = f'{prefix}/{out_dir}/{target}'
|
||||
|
||||
log(" - creating output directories")
|
||||
os.makedirs(build_dir, exist_ok=True)
|
||||
os.makedirs(out_dir, exist_ok=True)
|
||||
|
||||
log(" - writing project tcl file")
|
||||
with open(f'{build_dir}/do.tcl', 'w') as f:
|
||||
f.write(f"open_checkpoint {out_dir}/post_impl.dcp\n")
|
||||
f.write(f"set_property SEVERITY {{Warning}} [get_drc_checks NSTD-1]\nset_property SEVERITY {{Warning}} [get_drc_checks UCIO-1]\n")
|
||||
f.write(f"set_property BITSTREAM.General.UnconstrainedPins {{Allow}} [current_design]\n")
|
||||
f.write(f"write_debug_probes -force out.ltx\nwrite_bitstream -force -bin_file out.bit\nreport_timing_summary -file timing.log\nreport_power -file power.log\n")
|
||||
f.write(f"report_utilization -file util.log\n")
|
||||
f.write(f"write_checkpoint -force {out_dir}/{target}.dcp\n")
|
||||
f.write(f"open_checkpoint {out_dir}/{target}.dcp\n")
|
||||
f.write(f"write_hw_platform -fixed -force -file {out_dir}/{target}.xsa\n")
|
||||
f.write(f"write_verilog -force -mode timesim -cell {netlist_top} -rename_top {netlist_top} -sdf_anno true netlist.v\n") # -nolib
|
||||
f.write(f"write_sdf -force -cell {netlist_top} -rename_top {netlist_top} -mode timesim netlist.sdf\n")
|
||||
|
||||
log(" - run vivado")
|
||||
p = subprocess.Popen(f"vivado -mode batch -source do.tcl",
|
||||
shell=True, cwd=build_dir,
|
||||
stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||
subprocesses.append(p)
|
||||
while p.poll() is None:
|
||||
time.sleep(1)
|
||||
res = p.returncode
|
||||
|
||||
log(" - copy logs")
|
||||
shutil.copy(f'{build_dir}/vivado.log', f'{out_dir}/out.log')
|
||||
|
||||
if res!=0:
|
||||
return res
|
||||
|
||||
log(" - copy output files")
|
||||
shutil.copy(f'{build_dir}/netlist.v', f'{out_dir}/impl_netlist.v')
|
||||
shutil.copy(f'{build_dir}/netlist.sdf', f'{out_dir}/impl_netlist.sdf')
|
||||
shutil.copy(f'{build_dir}/timing.log', f'{out_dir}/timing.log')
|
||||
shutil.copy(f'{build_dir}/util.log', f'{out_dir}/util.log')
|
||||
shutil.copy(f'{build_dir}/power.log', f'{out_dir}/power.log')
|
||||
shutil.copy(f'{build_dir}/out.bin', f'{out_dir}/out.bin')
|
||||
shutil.copy(f'{build_dir}/out.bit', f'{out_dir}/out.bit')
|
||||
|
||||
return res
|
@ -29,6 +29,7 @@ def synth(config, target, log, subprocesses, prefix='.'):
|
||||
|
||||
log(" - writing project tcl file")
|
||||
with open(f'{build_dir}/do.tcl', 'w') as f:
|
||||
f.write('set_param general.maxThreads 8\n')
|
||||
for s in files_vhdl:
|
||||
f.write(f"read_vhdl \"{prefix}/{s}\"\n")
|
||||
for s in files_verilog:
|
||||
|
Reference in New Issue
Block a user