diff --git a/fuzzers/051-imuxlout/piplist.tcl b/fuzzers/051-imuxlout/piplist.tcl index 98a590a6..4b2c87cc 100644 --- a/fuzzers/051-imuxlout/piplist.tcl +++ b/fuzzers/051-imuxlout/piplist.tcl @@ -22,7 +22,7 @@ source ../../utils/utils.tcl proc print_tile_pips {tile_type filename} { set tile [lindex [get_tiles -filter "TYPE == $tile_type"] 0] - puts "Dumping and PIPs for tile $tile ($tile_type) to $filename." + puts "Dumping PIPs for tile $tile ($tile_type) to $filename." set fp [open $filename w] foreach pip [lsort [get_pips -filter {IS_DIRECTIONAL} -of_objects [get_tiles $tile]]] { set src [get_wires -uphill -of_objects $pip] diff --git a/fuzzers/052-clkin/piplist.tcl b/fuzzers/052-clkin/piplist.tcl index 98a590a6..4b2c87cc 100644 --- a/fuzzers/052-clkin/piplist.tcl +++ b/fuzzers/052-clkin/piplist.tcl @@ -22,7 +22,7 @@ source ../../utils/utils.tcl proc print_tile_pips {tile_type filename} { set tile [lindex [get_tiles -filter "TYPE == $tile_type"] 0] - puts "Dumping and PIPs for tile $tile ($tile_type) to $filename." + puts "Dumping PIPs for tile $tile ($tile_type) to $filename." set fp [open $filename w] foreach pip [lsort [get_pips -filter {IS_DIRECTIONAL} -of_objects [get_tiles $tile]]] { set src [get_wires -uphill -of_objects $pip] diff --git a/fuzzers/053-ctrlin/piplist.tcl b/fuzzers/053-ctrlin/piplist.tcl index 98a590a6..4b2c87cc 100644 --- a/fuzzers/053-ctrlin/piplist.tcl +++ b/fuzzers/053-ctrlin/piplist.tcl @@ -22,7 +22,7 @@ source ../../utils/utils.tcl proc print_tile_pips {tile_type filename} { set tile [lindex [get_tiles -filter "TYPE == $tile_type"] 0] - puts "Dumping and PIPs for tile $tile ($tile_type) to $filename." + puts "Dumping PIPs for tile $tile ($tile_type) to $filename." set fp [open $filename w] foreach pip [lsort [get_pips -filter {IS_DIRECTIONAL} -of_objects [get_tiles $tile]]] { set src [get_wires -uphill -of_objects $pip] diff --git a/fuzzers/054-gfan/piplist.tcl b/fuzzers/054-gfan/piplist.tcl index 98a590a6..4b2c87cc 100644 --- a/fuzzers/054-gfan/piplist.tcl +++ b/fuzzers/054-gfan/piplist.tcl @@ -22,7 +22,7 @@ source ../../utils/utils.tcl proc print_tile_pips {tile_type filename} { set tile [lindex [get_tiles -filter "TYPE == $tile_type"] 0] - puts "Dumping and PIPs for tile $tile ($tile_type) to $filename." + puts "Dumping PIPs for tile $tile ($tile_type) to $filename." set fp [open $filename w] foreach pip [lsort [get_pips -filter {IS_DIRECTIONAL} -of_objects [get_tiles $tile]]] { set src [get_wires -uphill -of_objects $pip] diff --git a/fuzzers/056-rempips/piplist.tcl b/fuzzers/056-rempips/piplist.tcl index 98a590a6..4b2c87cc 100644 --- a/fuzzers/056-rempips/piplist.tcl +++ b/fuzzers/056-rempips/piplist.tcl @@ -22,7 +22,7 @@ source ../../utils/utils.tcl proc print_tile_pips {tile_type filename} { set tile [lindex [get_tiles -filter "TYPE == $tile_type"] 0] - puts "Dumping and PIPs for tile $tile ($tile_type) to $filename." + puts "Dumping PIPs for tile $tile ($tile_type) to $filename." set fp [open $filename w] foreach pip [lsort [get_pips -filter {IS_DIRECTIONAL} -of_objects [get_tiles $tile]]] { set src [get_wires -uphill -of_objects $pip] diff --git a/fuzzers/057-bipips/.gitignore b/fuzzers/057-bipips/.gitignore new file mode 100644 index 00000000..274ed6e4 --- /dev/null +++ b/fuzzers/057-bipips/.gitignore @@ -0,0 +1,13 @@ +/filtered_seg_int_l.segbits +/filtered_seg_int_r.segbits +/pattern_l.txt +/pattern_r.txt +/bipiplist.dcp +/bipiplist/ +/bipips_int_l.txt +/bipips_int_r.txt +/seg_int_l.segbits +/seg_int_r.segbits +/specimen_[0-9][0-9][0-9]/ +/todo.txt +/vivado* diff --git a/fuzzers/057-bipips/Makefile b/fuzzers/057-bipips/Makefile new file mode 100644 index 00000000..4ccc88e7 --- /dev/null +++ b/fuzzers/057-bipips/Makefile @@ -0,0 +1,29 @@ + +N := 10 +SPECIMENS := $(addprefix specimen_,$(shell seq -f '%03.0f' $(N))) +SPECIMENS_OK := $(addsuffix /OK,$(SPECIMENS)) + +database: $(SPECIMENS_OK) + ${XRAY_SEGMATCH} -m 5 -M 15 -o seg_int_l.segbits $(addsuffix /segdata_clbl[lm]_l.txt,$(SPECIMENS)) + ${XRAY_SEGMATCH} -m 5 -M 15 -o seg_int_r.segbits $(addsuffix /segdata_clbl[lm]_r.txt,$(SPECIMENS)) + +pushdb: + ${XRAY_MERGEDB} int_l seg_int_l.segbits + ${XRAY_MERGEDB} int_r seg_int_r.segbits + ${XRAY_DBFIXUP} + +$(SPECIMENS_OK): todo.txt + bash generate.sh $(subst /OK,,$@) + touch $@ + +todo.txt: + vivado -mode batch -source bipiplist.tcl + python3 maketodo.py | sort -R | head -n5 > todo.txt + +clean: + rm -rf .Xil/ .cache/ vivado* todo.txt + rm -rf bipiplist/ bipiplist.dcp bipips_int_[lr].txt + rm -rf specimen_[0-9][0-9][0-9]/ seg_int_[lr].segbits + +.PHONY: database pushdb clean + diff --git a/fuzzers/057-bipips/bipiplist.tcl b/fuzzers/057-bipips/bipiplist.tcl new file mode 100644 index 00000000..a9cea653 --- /dev/null +++ b/fuzzers/057-bipips/bipiplist.tcl @@ -0,0 +1,40 @@ +create_project -force -part $::env(XRAY_PART) bipiplist bipiplist + +read_verilog top.v +synth_design -top top + +set_property -dict "PACKAGE_PIN $::env(XRAY_PIN_00) IOSTANDARD LVCMOS33" [get_ports i] +set_property -dict "PACKAGE_PIN $::env(XRAY_PIN_01) IOSTANDARD LVCMOS33" [get_ports o] + +create_pblock roi +resize_pblock [get_pblocks roi] -add "$::env(XRAY_ROI)" + +set_property CFGBVS VCCO [current_design] +set_property CONFIG_VOLTAGE 3.3 [current_design] +set_property BITSTREAM.GENERAL.PERFRAMECRC YES [current_design] + +place_design +route_design + +write_checkpoint -force bipiplist.dcp + +source ../../utils/utils.tcl + +proc print_tile_pips {tile_type filename} { + set tile [lindex [get_tiles -filter "TYPE == $tile_type"] 0] + puts "Dumping bidirectional PIPs for tile $tile ($tile_type) to $filename." + set fp [open $filename w] + foreach pip [lsort [get_pips -filter {!IS_DIRECTIONAL} -of_objects [get_tiles $tile]]] { + set src [get_wires -uphill -of_objects $pip] + set dst [get_wires -downhill -of_objects $pip] + if {[llength [get_nodes -uphill -of_objects [get_nodes -of_objects $dst]]] != 1} { + puts $fp "$tile_type.[regsub {.*/} $dst ""].[regsub {.*/} $src ""]" + puts $fp "$tile_type.[regsub {.*/} $src ""].[regsub {.*/} $dst ""]" + } + } + close $fp +} + +print_tile_pips INT_L bipips_int_l.txt +print_tile_pips INT_R bipips_int_r.txt + diff --git a/fuzzers/057-bipips/generate.py b/fuzzers/057-bipips/generate.py new file mode 100644 index 00000000..c334bc06 --- /dev/null +++ b/fuzzers/057-bipips/generate.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python3 + +import sys, os, re + +sys.path.append("../../../utils/") +from segmaker import segmaker + +segmk = segmaker("design.bits") + +tiledata = dict() +pipdata = set() + +print("Loading tags from design.txt.") +with open("design.txt", "r") as f: + for line in f: + ab, dst, src = line.split() + tile, dst = dst.split("/") + _, src = src.split("/") + + if tile not in tiledata: + tiledata[tile] = { + "pips": set(), + "nodes": set(), + } + + if ab == "A": + tiledata[tile]["pips"].add((dst, src)) + pipdata.add((dst, src)) + else: + tiledata[tile]["nodes"].add(src) + tiledata[tile]["nodes"].add(dst) + +for tile, pips_nodes in tiledata.items(): + pips = pips_nodes["pips"] + nodes = pips_nodes["nodes"] + + for dst, src in pipdata: + if (dst, src) in pips: + segmk.addtag(tile, "%s.%s" % (dst, src), 1) + elif dst not in nodes and src not in nodes: + segmk.addtag(tile, "%s.%s" % (dst, src), 0) + +def bitfilter(frame_idx, bit_idx): + assert os.getenv("XRAY_DATABASE") == "artix7" + return frame_idx in [0, 1] + +segmk.compile(bitfilter=bitfilter) +segmk.write() + diff --git a/fuzzers/057-bipips/generate.sh b/fuzzers/057-bipips/generate.sh new file mode 100644 index 00000000..0b99ad99 --- /dev/null +++ b/fuzzers/057-bipips/generate.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +source ${XRAY_GENHEADER} + +while ! vivado -mode batch -source ../generate.tcl; do + rm -rf design* +done + +${XRAY_BITREAD} -F $XRAY_ROI_FRAMES -o design.bits -z -y design.bit +python3 ../generate.py + diff --git a/fuzzers/057-bipips/generate.tcl b/fuzzers/057-bipips/generate.tcl new file mode 100644 index 00000000..c2d572b8 --- /dev/null +++ b/fuzzers/057-bipips/generate.tcl @@ -0,0 +1,78 @@ +create_project -force -part $::env(XRAY_PART) design design + +read_verilog ../top.v +synth_design -top top + +set_property -dict "PACKAGE_PIN $::env(XRAY_PIN_00) IOSTANDARD LVCMOS33" [get_ports i] +set_property -dict "PACKAGE_PIN $::env(XRAY_PIN_01) IOSTANDARD LVCMOS33" [get_ports o] + +create_pblock roi +resize_pblock [get_pblocks roi] -add "$::env(XRAY_ROI)" + +set_property CFGBVS VCCO [current_design] +set_property CONFIG_VOLTAGE 3.3 [current_design] +set_property BITSTREAM.GENERAL.PERFRAMECRC YES [current_design] + +place_design +route_design + +# write_checkpoint -force design.dcp + +source ../../../utils/utils.tcl + +set fp [open "../todo.txt" r] +set todo_lines {} +for {gets $fp line} {$line != ""} {gets $fp line} { + lappend todo_lines [split $line .] +} +close $fp + +set int_l_tiles [randsample_list [llength $todo_lines] [filter [pblock_tiles roi] {TYPE == INT_L}]] +set int_r_tiles [randsample_list [llength $todo_lines] [filter [pblock_tiles roi] {TYPE == INT_R}]] + +set fp [open "design.txt" w] + +for {set idx 0} {$idx < [llength $todo_lines]} {incr idx} { + set line [lindex $todo_lines $idx] + puts "== $idx: $line" + + set tile_type [lindex $line 0] + set dst_wire [lindex $line 1] + set src_wire [lindex $line 2] + + if {$tile_type == "INT_L"} {set tile [lindex $int_l_tiles $idx]; set other_tile [lindex $int_r_tiles $idx]} + if {$tile_type == "INT_R"} {set tile [lindex $int_r_tiles $idx]; set other_tile [lindex $int_l_tiles $idx]} + + puts "PIP Tile: $tile" + + set driver_site [get_sites -of_objects [get_site_pins -of_objects [get_nodes -downhill \ + -of_objects [get_nodes -of_objects [get_wires $other_tile/CLK*0]]]]] + + puts "LUT Tile (Site): $other_tile ($driver_site)" + + set mylut [create_cell -reference LUT1 mylut_$idx] + set_property -dict "LOC $driver_site BEL A6LUT" $mylut + + set mynet [create_net mynet_$idx] + connect_net -net $mynet -objects "$mylut/I0 $mylut/O" + route_via $mynet "$tile/$src_wire $tile/$dst_wire" + + if {[get_pips -filter "NAME == \"${tile}/${tile_type}.${src_wire}<<->>${dst_wire}\" || NAME == \"${tile}/${tile_type}.${dst_wire}<<->>${src_wire}\"" -of_objects [get_nets $mynet]] != ""} { + puts $fp "A $tile/$dst_wire $tile/$src_wire" + } +} + +route_design + +set all_pips [lsort -unique [get_pips -of_objects [get_nets -hierarchical]]] +foreach tile [get_tiles [regsub -all {CLBL[LM]} [get_tiles -of_objects [get_sites -of_objects [get_pblocks roi]]] INT]] { + foreach pip [filter $all_pips "TILE == $tile"] { + puts $fp "B [get_wires -of_objects $pip]" + } +} + +close $fp + +write_checkpoint -force design.dcp +write_bitstream -force design.bit + diff --git a/fuzzers/057-bipips/maketodo.py b/fuzzers/057-bipips/maketodo.py new file mode 100644 index 00000000..04bcf701 --- /dev/null +++ b/fuzzers/057-bipips/maketodo.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python3 + +import os, re + +def maketodo(pipfile, dbfile): + todos = set() + with open(pipfile, "r") as f: + for line in f: + line = line.split() + todos.add(line[0]) + with open(dbfile, "r") as f: + for line in f: + line = line.split() + if line[0] in todos: + todos.remove(line[0]) + for line in todos: + print(line) + +maketodo("bipips_int_l.txt", "%s/%s/segbits_int_l.db" % (os.getenv("XRAY_DATABASE_DIR"), os.getenv("XRAY_DATABASE"))) +maketodo("bipips_int_r.txt", "%s/%s/segbits_int_r.db" % (os.getenv("XRAY_DATABASE_DIR"), os.getenv("XRAY_DATABASE"))) + diff --git a/fuzzers/057-bipips/top.v b/fuzzers/057-bipips/top.v new file mode 100644 index 00000000..c0e91c58 --- /dev/null +++ b/fuzzers/057-bipips/top.v @@ -0,0 +1,3 @@ +module top (input i, output o); + assign o = i; +endmodule diff --git a/utils/utils.tcl b/utils/utils.tcl index c7f5b5d9..d0714af2 100644 --- a/utils/utils.tcl +++ b/utils/utils.tcl @@ -18,6 +18,7 @@ proc route_via {net nodes} { puts " $from_node -> $to_node: $route" set fixed_route [concat $fixed_route [lrange $route 1 end]] } + set_property -quiet FIXED_ROUTE $fixed_route $net } set_property -quiet FIXED_ROUTE $fixed_route $net