Skip to content

Instantly share code, notes, and snippets.

@syed-ahmed
Created February 10, 2021 04:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save syed-ahmed/c4e64bc4d5e58625418cbd25567403f6 to your computer and use it in GitHub Desktop.
Save syed-ahmed/c4e64bc4d5e58625418cbd25567403f6 to your computer and use it in GitHub Desktop.
a200t_1600_LUTS
pld_dir?=/media/lilbirb/research/code/pld/
src=$(pld_dir)/do_blink/symbiflow_benchmark/fig2_at200/1600/src
base=$(abspath .)
symb_dir?=$(pld_dir)/third_party/symbiflow-arch-defs
do_blink_dir?=$(pld_dir)/build/do_blink/rrgraphs
YOSYS = $(symb_dir)/env/conda/envs/symbiflow_arch_def_base/bin/yosys
VPR?=$(pld_dir)/third_party/vtr-verilog-to-routing/vpr/vpr
GENFASM = $(symb_dir)/env/conda/envs/symbiflow_arch_def_base/bin/genfasm
XCFASM = $(symb_dir)/env/conda/envs/symbiflow_arch_def_base/bin/xcfasm
PYTHON = $(symb_dir)/env/conda/envs/symbiflow_arch_def_base/bin/python
SYNTH_TCL = $(symb_dir)/xc/xc7/yosys/conv.tcl
DEVICE_ARCH?=artix7_200t
DEVICE_FAMILY?=xc7a200t
DEVICE_NAME?=fig2-1600
DEVICE_SPEED?=ffg1156-1
ARCH = $(do_blink_dir)/xc/xc7/archs/$(DEVICE_ARCH)/devices/$(DEVICE_FAMILY)-$(DEVICE_NAME)-roi-virt/arch.timing.xml
DEVICE = $(DEVICE_FAMILY)-$(DEVICE_NAME)-test
PART = $(DEVICE_FAMILY)$(DEVICE_SPEED)
RR_GRAPH_BIN = $(do_blink_dir)/xc/xc7/archs/$(DEVICE_ARCH)/devices/rr_graph_$(DEVICE_FAMILY)-$(DEVICE_NAME)_test.rr_graph.real.bin
LOOKAHEAD_BIN = $(do_blink_dir)/xc/xc7/archs/$(DEVICE_ARCH)/devices/rr_graph_$(DEVICE_FAMILY)-$(DEVICE_NAME)_test.lookahead.bin
PLACE_DELAY_BIN = $(do_blink_dir)/xc/xc7/archs/$(DEVICE_ARCH)/devices/rr_graph_$(DEVICE_FAMILY)-$(DEVICE_NAME)_test.place_delay.bin
PINMAP_CSV = $(do_blink_dir)/xc/xc7/nexys_video-$(DEVICE_NAME)_pinmap.csv
YOSYS_MEMORY_PATCH = $(pld_dir)/symbiflow/memory/yosys/yosys_memory_patch.sh
MERGE_PORTS = $(pld_dir)/symbiflow/memory/yosys/merge_ports.perl
CLOCK_PATCH = $(pld_dir)/symbiflow/clk/2clkto1clk.sh
targets=$(notdir $(wildcard $(src)/*))
targets:=$(filter-out flow_calc_1 flow_calc_2 leaf_Interface,$(targets))
#$(info $(targets))
tmp_pref:=$(shell mktemp -u)
export symb_dir
all: $(addsuffix /out.route.wrap,$(targets))
%.wrap:
- $(MAKE) $*
.PRECIOUS: %.eblif %.net %.place %.route %.fasm $(targets:=/out.eblif) $(targets:=/out.net) $(targets:=/out.place) $(targets:=/out.route) $(targets:=/top.fasm)
.SECONDARY: %.eblif %.net %.place %.route %.fasm $(targets:=/out.eblif) $(targets:=/out.net) $(targets:=/out.place) $(targets:=/out.route) $(targets:=/top.fasm)
#$(targets): %: %/out.eblif
#$(targets): %: %/out.eblif %/out.net %/out.place %/out.route
#$(targets): %: %/out.route
#$(targets): %: %/out.eblif %/out.net %/out.place
#/tmp/arch.timing.xml: $(ARCH)
# @ cp $(ARCH) /tmp/arch.timing.xml
#/tmp/rr_graph.real.bin: $(RR_GRAPH_BIN)
# @ cp $(RR_GRAPH_BIN) /tmp/rr_graph.real.bin
$(abspath $(targets)):
@ mkdir $@
%/top_io.place: %/out.eblif %/out.net %/top.pcf
cd $* && PYTHONPATH=$(symb_dir)/utils \
/usr/bin/time --output=$(@F).time $(PYTHON) \
$(symb_dir)/xc/common/utils/prjxray_create_ioplace.py \
--map $(PINMAP_CSV) \
--blif out.eblif \
--pcf top.pcf \
--net out.net \
--out top_io.place
%/out.net: %/out.eblif
@echo "Running VPR Packing Only"
-@ cd $* && /usr/bin/time --output=$(@F).time $(VPR) $(ARCH) out.eblif --device $(DEVICE) \
--read_rr_graph $(RR_GRAPH_BIN) \
--max_router_iterations 500 \
--routing_failure_predictor off \
--router_high_fanout_threshold -1 \
--constant_net_method route \
--route_chan_width 500 \
--router_heap bucket \
--clock_modeling route \
--place_delta_delay_matrix_calculation_method dijkstra \
--place_delay_model delta_override \
--router_lookahead extended_map \
--clustering_pin_feasibility_filter on \
--check_route quick \
--strict_checks off \
--allow_dangling_combinational_nodes on \
--disable_errors check_unbuffered_edges:check_route \
--congested_routing_iteration_threshold 0.8 \
--incremental_reroute_delay_ripup off \
--base_cost_type delay_normalized_length_bounded \
--bb_factor 10 \
--initial_pres_fac 4.0 \
--check_rr_graph off \
--suppress_warnings noisy_warnings.log,sum_pin_class:check_unbuffered_edges:load_rr_indexed_data_T_values:check_rr_node:trans_per_R:check_route \
--read_router_lookahead $(LOOKAHEAD_BIN) \
--read_placement_delay_lookup $(PLACE_DELAY_BIN) \
--balance_block_type_utilization off \
--pack
%/out.place: %/out.net %/top_io.place
@echo "Running VPR Placing Only"
-@ cd $* && /usr/bin/time --output=$(@F).time $(VPR) $(ARCH) out.eblif --device $(DEVICE) \
--read_rr_graph $(RR_GRAPH_BIN) \
--max_router_iterations 500 \
--routing_failure_predictor off \
--router_high_fanout_threshold -1 \
--constant_net_method route \
--route_chan_width 500 \
--router_heap bucket \
--clock_modeling route \
--timing_tradeoff 0.9 \
--place_delta_delay_matrix_calculation_method dijkstra \
--place_delay_model delta_override \
--router_lookahead extended_map \
--check_route quick \
--strict_checks off \
--allow_dangling_combinational_nodes on \
--disable_errors check_unbuffered_edges:check_route \
--congested_routing_iteration_threshold 0.8 \
--incremental_reroute_delay_ripup off \
--base_cost_type delay_normalized_length_bounded \
--bb_factor 3 \
--initial_pres_fac 4.0 \
--check_rr_graph off \
--suppress_warnings noisy_warnings.log,sum_pin_class:check_unbuffered_edges:load_rr_indexed_data_T_values:check_rr_node:trans_per_R:check_route \
--read_router_lookahead $(LOOKAHEAD_BIN) \
--read_placement_delay_lookup $(PLACE_DELAY_BIN) \
--balance_block_type_utilization off \
--fix_clusters top_io.place \
--place
%/out.route: %/out.place
@echo "Running VPR Routing Only"
-@ cd $* && /usr/bin/time --output=$(@F).time $(VPR) $(ARCH) out.eblif --device $(DEVICE) \
--read_rr_graph $(RR_GRAPH_BIN) \
--max_router_iterations 500 \
--routing_failure_predictor off \
--router_high_fanout_threshold -1 \
--constant_net_method route \
--route_chan_width 500 \
--router_heap bucket \
--clock_modeling route \
--place_delta_delay_matrix_calculation_method dijkstra \
--place_delay_model delta_override \
--router_lookahead extended_map \
--check_route quick \
--strict_checks off \
--allow_dangling_combinational_nodes on \
--disable_errors check_unbuffered_edges:check_route \
--congested_routing_iteration_threshold 0.8 \
--incremental_reroute_delay_ripup off \
--base_cost_type delay_normalized_length_bounded \
--bb_factor 10 \
--acc_fac 0.7 \
--astar_fac 1.8 \
--initial_pres_fac 2.828 \
--pres_fac_mult 1.2 \
--check_rr_graph off \
--suppress_warnings noisy_warnings.log,sum_pin_class:check_unbuffered_edges:load_rr_indexed_data_T_values:check_rr_node:trans_per_R:check_route \
--read_router_lookahead $(LOOKAHEAD_BIN) \
--read_placement_delay_lookup $(PLACE_DELAY_BIN) \
--route
%/top.fasm: %/out.route
@ echo "Generating FASM"
- cd $* && /usr/bin/time --output=$(@F).time $(GENFASM) $(ARCH) out.eblif \
--device $(DEVICE) \
--read_rr_graph $(RR_GRAPH_BIN) \
--max_router_iterations 500 \
--routing_failure_predictor off \
--router_high_fanout_threshold -1 \
--constant_net_method route \
--route_chan_width 500 \
--router_heap bucket \
--clock_modeling route \
--place_delta_delay_matrix_calculation_method dijkstra \
--place_delay_model delta_override \
--router_lookahead extended_map \
--check_route off \
--strict_checks off \
--allow_dangling_combinational_nodes on \
--disable_errors check_unbuffered_edges:check_route \
--congested_routing_iteration_threshold 0.8 \
--incremental_reroute_delay_ripup off \
--base_cost_type delay_normalized_length_bounded \
--bb_factor 10 \
--initial_pres_fac 4.0 \
--check_rr_graph off \
--suppress_warnings noisy_warnings.log,sum_pin_class:check_unbuffered_edges:load_rr_indexed_data_T_values:check_rr_node:trans_per_R:check_route
- cd $* && /usr/bin/cmake -E copy top.fasm genfasm.fasm
- cd $* && cat top.fasm top_fasm_extra.fasm > top.concat.fasm
- cd $* && /usr/bin/cmake -E rename top.concat.fasm top.fasm
%/top.bit: %/top.fasm
- cd $* && PYTHONPATH=$(symb_dir)/env/conda/envs/symbiflow_arch_def_base/lib/python3.7/site-packages/:$(symb_dir)/third_party/prjxray:$(symb_dir)/third_party/prjxray/third_party/fasm \
&& /usr/bin/time --output=$(@F).time $(XCFASM) \
--db-root $(shell $(symb_dir)/env/conda/envs/symbiflow_arch_def_base/bin/prjxray-config)/artix7 \
--sparse \
--emit_pudc_b_pullup \
--fn_in top.fasm \
--bit_out top.bit \
--frm2bit $(symb_dir)/env/conda/envs/symbiflow_arch_def_base/bin/xc7frames2bit \
--part_file $(shell $(symb_dir)/env/conda/envs/symbiflow_arch_def_base/bin/prjxray-config)/artix7/$(PART)/part.yaml \
--part $(PART)
%/top_bit.v: %/top.bit %/top.pcf
- cd $* && PYTHONPATH=$(symb_dir)/env/conda/lib/python3.8/site-packages:$(symb_dir)/third_party/prjxray:$(symb_dir)/third_party/prjxray/third_party/fasm:$(symb_dir)/utils \
$(PYTHON) -mfasm2bels \
--db_root $(symb_dir)/third_party/prjxray-db/zynq7 \
--rr_graph $(RR_GRAPH_BIN) \
--vpr_capnp_schema_dir $(symb_dir)/env/conda/envs/symbiflow_arch_def_base/capnp \
--route out.route \
--bitread $(symb_dir)/build/third_party/prjxray/build/tools/bitread \
--bit_file top.bit \
--fasm_file top.bit.fasm \
--iostandard LVCMOS33 \
--drive 12 \
--pcf top.pcf \
--eblif out.eblif \
--top top \
top_bit.v \
top_bit.v.xdc \
--part $(PART) \
--connection_database $(symb_dir)/build/xc/xc7/archs/zynq7_z020/devices/xc7z020-virt/channels.db \
--vpr_grid_map $(symb_dir)/build/xc/xc7/archs/zynq7_z020/devices/xc7z020-virt/vpr_grid_map.csv
%/runme.tcl: %/top_bit.v
-cd $* && $(PYTHON) $(symb_dir)/xc/common/utils/vivado_create_runme.py \
--name rendering_pynqz1_vivado \
--verilog top_bit.v \
--routing_xdc top_bit.v.xdc \
--top top \
--part $(PART) \
--output_tcl runme.tcl \
--clock_pins clk \
--clock_periods 10.0
summary:
@ ./summary.sh
%/out.eblif: %/top_synth.json
- cd $* && $(PYTHON) $(symb_dir)/utils/split_inouts.py -i top_synth.json -o top.json
- cd $* && OUT_EBLIF=out.pre_eblif \
OUT_SYNTH_V=synth.vout \
$(symb_dir)/utils/quiet_cmd.sh \
/usr/bin/time --output=$(@F).time $(YOSYS) -p "read_json top.json ; tcl $(SYNTH_TCL)" -l out.eblif.log
- $(MERGE_PORTS) $*/out.pre_eblif $*/out.eblif
%/splitio: %/top_synth.json
- cd $* && $(PYTHON) $(symb_dir)/utils/split_inouts.py -i top_synth.json -o top.json
$(targets:=.clean): %.clean:
- @ rm -rf $*/out.eblif $*/out.net $*/out.place $*/out.route
clean: $(targets:=.clean)
echo_ap_%:
echo $(abspath $*)
echo_%:
@ echo $($*)
-include $(targets:=/.deps)
.SECONDEXPANSION:
%/top.pcf: $(src)/%/top.pcf | $$(abspath $$(dir %))
- cp $< $(@D)
$(foreach d,$(wildcard $(src)/*/*.dat),$(notdir $(patsubst %/,%,$(dir $d)))/$(notdir $d)): %.dat: $(src)/%.dat | $$(abspath $$(dir %))
- cp $< $@
$(foreach d,$(wildcard $(src)/*/*.sv),$(notdir $(patsubst %/,%,$(dir $d)))/$(notdir $d)): %.sv: $(src)/%.sv | $$(abspath $$(dir %))
- cp $< $@
$(foreach d,$(wildcard $(src)/*/*.vh),$(notdir $(patsubst %/,%,$(dir $d)))/$(notdir $d)): %.vh: $(src)/%.vh | $$(abspath $$(dir %))
- cp $< $@
$(foreach d,$(wildcard $(src)/*/*.v),$(notdir $(patsubst %/,%,$(dir $d)))/$(notdir $d)): %.v: $(src)/%.v | $$(abspath $$(dir %))
- $(YOSYS_MEMORY_PATCH) $< $@
$(targets:=/top_synth.json): %/top_synth.json: $$(addprefix %/,$$(notdir $$(wildcard $(src)/%/*.dat))) $$(addprefix %/,$$(notdir $$(wildcard $(src)/%/*.v))) $$(addprefix %/,$$(notdir $$(wildcard $(src)/%/*.sv))) $$(addprefix %/,$$(notdir $$(wildcard $(src)/%/*.vh))) %/top.pcf | $$(abspath %)
@ echo $*
- cd $* && /usr/bin/cmake -E env TECHMAP_PATH=$(symb_dir)/xc/xc7/techmap symbiflow-arch-defs_SOURCE_DIR=$(symb_dir) symbiflow-arch-defs_BINARY_DIR=$(pld_dir)/build/third_party/symbiflow-arch-defs OUT_JSON=top_synth.json OUT_SYNTH_V=top_synth.vout OUT_FASM_EXTRA=top_fasm_extra.fasm PART_JSON= INPUT_XDC_FILE= USE_ROI=TRUE PCF_FILE=top.pcf PINMAP_FILE=$(PINMAP_CSV) /usr/bin/time --output=$(@F).time $(YOSYS) -p "tcl ../../../../common/synth.tcl" -l top_synth.json.log *.v
- cd $* && /usr/bin/cmake -E touch top_fasm_extra.fasm
- cd $* && /usr/bin/cmake -E touch_nocreate top_fasm_extra.fasm
- cd $* && mv top_synth.vout.premap.v top_synth.vout.premap.vout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment