diff --git a/fuzzers/065-gtp-common-pips/Makefile b/fuzzers/065-gtp-common-pips/Makefile index 79c0c0b1..68a8f0e5 100644 --- a/fuzzers/065-gtp-common-pips/Makefile +++ b/fuzzers/065-gtp-common-pips/Makefile @@ -7,7 +7,7 @@ # SPDX-License-Identifier: ISC export FUZDIR=$(shell pwd) PIP_TYPE?=gtp_common_${XRAY_PART} -SEG_TYPE?=gtp_common +SEG_TYPE?=gtp_common_mid_left PIPLIST_TCL=$(FUZDIR)/gtp_common_pip_list.tcl BUILD_DIR = ${FUZDIR}/build_${XRAY_PART} @@ -22,6 +22,8 @@ SEGMATCH_FLAGS=-c 2 SPECIMENS_DEPS=$(BUILD_DIR)/cmt_regions.csv A_PIPLIST=gtp_common_${XRAY_PART}.txt +CHECK_ARGS= --zero-entries --timeout-iters 5 --todo-dir $(BUILD_DIR)/todo + include ../pip_loop.mk $(BUILD_DIR)/segbits_gtp_common.rdb: $(SPECIMENS_OK) diff --git a/fuzzers/065-gtp-common-pips/generate.py b/fuzzers/065-gtp-common-pips/generate.py index ba60b252..52e4db33 100644 --- a/fuzzers/065-gtp-common-pips/generate.py +++ b/fuzzers/065-gtp-common-pips/generate.py @@ -88,7 +88,7 @@ def main(): tile_type = pips_srcs_dsts["type"] pips = pips_srcs_dsts["pips"] - for src, dst in pipdata["GTP_COMMON_MID_LEFT"]: + for src, dst in pipdata["GTP_COMMON"]: if (src, dst) in ignpip: pass elif (src, dst) in pips: diff --git a/fuzzers/065-gtp-common-pips/generate.tcl b/fuzzers/065-gtp-common-pips/generate.tcl index 8b8ee17d..111f8acb 100644 --- a/fuzzers/065-gtp-common-pips/generate.tcl +++ b/fuzzers/065-gtp-common-pips/generate.tcl @@ -39,7 +39,7 @@ proc shuffle_list {list} { # Get the dictionary of nets with one corresponding source wire # of a PIP from the todo list -proc get_nets_with_todo_pip_wires {direction net_regexp wire_regexp used_destinations {verbose false}} { +proc get_nets_with_todo_pip_wires {direction net_regexp wire_regexp used_destinations {verbose false} {cmt_net false}} { set todo_map [load_todo $direction] set nets [get_nets] set todo_nets [dict create] @@ -70,6 +70,10 @@ proc get_nets_with_todo_pip_wires {direction net_regexp wire_regexp used_destina set wire [lindex [split $wire /] 1] set tile_type [get_property TILE_TYPE [get_tiles $tile]] + if { $cmt_net } { + dict set todo_nets $net [list $tile $wire] + continue + } if { ![dict exists $todo_map $wire] } { continue @@ -122,40 +126,11 @@ proc get_nets_with_todo_pip_wires {direction net_regexp wire_regexp used_destina puts "Interesting net $net (including $wire) is being rerouted." } } + return $todo_nets } -proc remove_net_randomly {wire_regexp} { - # Randomly removes a net containing a given wire - set nets [get_nets] - set net_to_remove "" - - foreach net $nets { - set wires [get_wires -of_objects $net] - - foreach wire $wires { - if [regexp $wire_regexp $wire] { - set net_to_remove $net - break - } - } - } - - if { $net_to_remove != "" && rand() <= 0.1 } { - puts "Removing net: $net_to_remove" - remove_net $net_to_remove - } -} - proc route_todo {} { - - # It is very common to have nets passing through the - # HCLK_GTP_CK_IN[01] wires, resulting in results. - # This step removes the net containing the problematic - # wire with a 10% probability - remove_net_randomly "HCLK_GTP_CK_IN0" - remove_net_randomly "HCLK_GTP_CK_IN1" - set used_destinations [dict create] set todo_map [load_todo "dsts"] set gtp_channel_nets [get_nets_with_todo_pip_wires "dsts" "gtp_channel_clock" "GTPE2_COMMON_\[TR\]XOUTCLK_MUX_\[0123\]" $used_destinations true] @@ -239,8 +214,8 @@ proc route_todo {} { } set todo_map [load_todo "srcs"] - set pll_nets [get_nets_with_todo_pip_wires "srcs" "pll_clock" "HCLK_GTP_CK_IN" $used_destinations true] - set mmcm_nets [get_nets_with_todo_pip_wires "srcs" "mmcm_clock" "HCLK_GTP_CK_IN" $used_destinations true] + set pll_nets [get_nets_with_todo_pip_wires "srcs" "pll_clock" "HCLK_GTP_CK_IN" $used_destinations true true] + set mmcm_nets [get_nets_with_todo_pip_wires "srcs" "mmcm_clock" "HCLK_GTP_CK_IN" $used_destinations true true] set cmt_nets [dict merge $pll_nets $mmcm_nets] puts "CMT nets: $cmt_nets" dict for {net tile_wire} $cmt_nets { @@ -304,13 +279,11 @@ proc route_todo {} { set src_wire [lindex $wire_pair 0] set dst_wire [lindex $wire_pair 1] - if { [dict exists $used_destinations "$tile/$dst_wire"] } { - puts "Not routing to $tile / $dst_wire, in use." - continue - } + set used_dst_wire [dict exists $used_destinations "$tile/$dst_wire"] + set used_src_wire [dict exists $used_destinations "$tile/$src_wire"] - if { [dict exists $used_destinations "$tile/$src_wire"] } { - puts "Not routing to $tile / $src_wire, in use." + if { $used_dst_wire || $used_src_wire } { + puts "Not routing to $tile / $src_wire or $dst_wire, in use." continue } diff --git a/fuzzers/065-gtp-common-pips/gtp_common_pip_list.tcl b/fuzzers/065-gtp-common-pips/gtp_common_pip_list.tcl index a2856474..fad8b60b 100644 --- a/fuzzers/065-gtp-common-pips/gtp_common_pip_list.tcl +++ b/fuzzers/065-gtp-common-pips/gtp_common_pip_list.tcl @@ -31,7 +31,7 @@ proc print_tile_pips {tile_type filename} { set dst_gtp_mux_match [regexp {GTPE2_COMMON_[RT]XOUTCLK_MUX_[0123]} $dst_wire] if { $dst_hclk_match || $dst_ibufds_mux_match || $dst_gtp_mux_match } { - set pip_string "$tile_type.[regsub {.*/} $dst ""].[regsub {.*/} $src ""]" + set pip_string "GTP_COMMON.[regsub {.*/} $dst ""].[regsub {.*/} $src ""]" if ![dict exists $pips $pip_string] { puts $fp $pip_string dict set pips $pip_string 1 diff --git a/fuzzers/065-gtp-common-pips/top.py b/fuzzers/065-gtp-common-pips/top.py index 4cae8350..8e990c1b 100644 --- a/fuzzers/065-gtp-common-pips/top.py +++ b/fuzzers/065-gtp-common-pips/top.py @@ -30,6 +30,28 @@ def read_site_to_cmt(): yield (site, cmt) +def todo_pips(): + """ Returns a boolean tuple corresponding to the presence or not + of a type of PIP in the todo list.""" + + is_gtp_channel_left = False + is_ibufds_left = False + is_cmt_left = False + + with open("../../todo_all.txt", "r") as todo_file: + for line in todo_file: + fields = line.split(".") + + if "HCLK_GTP_CK_IN" not in fields[1]: + continue + + is_gtp_channel_left |= fields[2].startswith("GTPE2_COMMON") + is_ibufds_left |= fields[2].startswith("IBUFDS") + is_cmt_left |= fields[2].startswith("HCLK") + + return (is_gtp_channel_left, is_ibufds_left, is_cmt_left) + + class ClockSources(object): """ Class for tracking clock sources. """ @@ -288,7 +310,7 @@ module top( );""".format(site=site, rx=gtp_channel_clock_rx, tx=gtp_channel_clock_tx)) for cmt in cmt_with_gtp: - cmt_clock_used = 0 + cmt_clock_used = False for _, bufhce in gen_sites('BUFHCE'): if site_to_cmt[bufhce] != cmt: @@ -296,12 +318,16 @@ module top( chance = random.random() - if chance < 0.2 or cmt_clock_used < 3: - cmt_clock_used += 1 + use_gtp_channel, use_ibufds, use_cmt = todo_pips() + + if (chance < 0.3 and use_cmt) or not cmt_clock_used: + # There must always be at least one CMT clock used + # to trigger the bits for the GTP_COMMON and IBUFDS pips + cmt_clock_used = True clock_name = cmt_clock_sources.get_random_source(cmt) - elif chance > 0.2 and chance < 0.4: + elif chance > 0.3 and chance < 0.4 and use_ibufds: clock_name = ibufds_clock_sources.get_random_source(cmt) - elif chance < 0.6: + elif chance < 0.7 and use_gtp_channel: clock_name = gtp_channel_clock_sources.get_random_source(cmt) else: continue