Example #1
0
logging.basicConfig()

prj = Project('vivado', 'zybo-design')
prj.set_part('xc7z010-1-clg400')

prj.set_outdir('../../build/zybo-design')

prj.add_files('../../hdl/blinking.vhdl')
prj.add_files('zybo.xdc')
prj.add_files('design.tcl', filetype='design')

export = """
set PROJECT %s
if { [ catch {
    # Vitis
    write_hw_platform -fixed -force -include_bit -file ${PROJECT}.xsa
} ] } {
    # SDK
    write_hwdef -force -file ${PROJECT}.hwdef
    write_sysdef -force -hwdef [glob -nocomplain *.hwdef] \\
       -bitfile [glob -nocomplain *.bit] -file ${PROJECT}.hdf
}
""" % ('zybo-design')

prj.add_hook(export, 'postbit')

try:
    prj.generate()
except Exception as e:
    logging.warning('{} ({})'.format(type(e).__name__, e))
Example #2
0
set_property strategy "Flow_PerfOptimized_high" $obj
set_property "steps.synth_design.args.fanout_limit" "400" $obj
set_property "steps.synth_design.args.keep_equivalent_registers" "1" $obj
set_property "steps.synth_design.args.resource_sharing" "off" $obj
set_property "steps.synth_design.args.no_lc" "1" $obj
set_property "steps.synth_design.args.shreg_min_size" "5" $obj
set obj [get_runs impl_1]
set_property strategy "Performance_Explore" $obj
set_property "steps.opt_design.args.directive" "Explore" $obj
set_property "steps.place_design.args.directive" "Explore" $obj
set_property "steps.phys_opt_design.is_enabled" "1" $obj
set_property "steps.phys_opt_design.args.directive" "Explore" $obj
set_property "steps.route_design.args.directive" "Explore" $obj
"""
    }
}

for tool in commands:
    for strategy in commands[tool]:
        PRJ = Project(tool)
        PRJ.set_outdir('../../build/hooks/%s-%s' % (tool, strategy))
        PRJ.add_files('../../hdl/blinking.vhdl')
        PRJ.set_top('Blinking')
        PRJ.add_hook('puts "Appling {} optimizations"'.format(strategy),
                     'project')
        PRJ.add_hook(commands[tool][strategy], 'project')
        try:
            PRJ.generate(to_task='syn')
        except RuntimeError:
            print('ERROR:generate:{} not found'.format(tool))