From 08e8d1b118bc8f276991141938daac4c174f60a1 Mon Sep 17 00:00:00 2001 From: Maciej Kurc Date: Mon, 27 Apr 2020 15:48:30 +0200 Subject: [PATCH] Fixed solution of CCIOn_USED bits. Signed-off-by: Maciej Kurc --- fuzzers/045-hclk-cmt-pips/generate.py | 8 ++++ fuzzers/045-hclk-cmt-pips/generate.tcl | 12 ++++-- fuzzers/045-hclk-cmt-pips/top.py | 57 +++++++++++++++++++++++--- 3 files changed, 67 insertions(+), 10 deletions(-) diff --git a/fuzzers/045-hclk-cmt-pips/generate.py b/fuzzers/045-hclk-cmt-pips/generate.py index dc96f2af..ad6e992d 100644 --- a/fuzzers/045-hclk-cmt-pips/generate.py +++ b/fuzzers/045-hclk-cmt-pips/generate.py @@ -125,6 +125,14 @@ def main(): if "FREQ_REF" in port: continue + # It seems that CCIOn_USED is not enabled when a net goes through + # FREQ_REFn. Do not emit this tag if this happens. + if "CCIO" in port: + n = int(port[-1]) + dst = "HCLK_CMT_MUX_OUT_FREQ_REF{}".format(n) + if dst in tiledata[tile]["dsts"]: + continue + if port in tiledata[tile]["dsts"] or port in tiledata[tile]["srcs"]: segmk.add_tile_tag(tile, "{}_USED".format(port), 1) else: diff --git a/fuzzers/045-hclk-cmt-pips/generate.tcl b/fuzzers/045-hclk-cmt-pips/generate.tcl index a37a3120..bf158c07 100644 --- a/fuzzers/045-hclk-cmt-pips/generate.tcl +++ b/fuzzers/045-hclk-cmt-pips/generate.tcl @@ -219,16 +219,20 @@ proc make_manual_routes {filename} { continue } - # Ripup it - route_design -unroute -nets [get_nets $net_name] + set net [get_nets $net_name] + + # Rip it up + set_property -quiet FIXED_ROUTE "" $net + set_property IS_ROUTE_FIXED 0 $net + route_design -unroute -nets $net # Make the route - set status [route_via $net_name [list $wire_name] 0] + set nodes [get_nodes -of_objects [get_wires $wire_name]] + set status [route_via $net_name [list $nodes] 0] # Failure, skip manual routing of this net if { $status != 1 } { puts "MANROUTE: Manual routing failed!" - set net [get_nets $net_name] set_property -quiet FIXED_ROUTE "" $net set_property IS_ROUTE_FIXED 0 $net continue diff --git a/fuzzers/045-hclk-cmt-pips/top.py b/fuzzers/045-hclk-cmt-pips/top.py index 5bd35a6a..35721444 100644 --- a/fuzzers/045-hclk-cmt-pips/top.py +++ b/fuzzers/045-hclk-cmt-pips/top.py @@ -84,6 +84,21 @@ class ClockSources(object): self.sources[cmt].append(source) self.source_to_cmt[source] = cmt + def remove_clock_source(self, source, cmt="ANY"): + """ + Removes a clock source from the available clock sources list + """ + if source in self.source_to_cmt: + del self.source_to_cmt[source] + + if cmt == "ANY": + for sources in self.sources.values(): + if source in sources: + sources.remove(source) + else: + if source in self.sources[cmt]: + self.sources[cmt].remove(source) + def get_random_source( self, cmt, uses_left_right_routing=False, no_repeats=False): """ Get a random source that is routable to the specific CMT. @@ -423,12 +438,16 @@ module top({inputs}); hclks_used_by_cmt[src_cmt].add(src) return src + # Track used IOB sources + used_iob_clks = set() + if random.random() > .10: for tile_name, site in gen_sites('BUFHCE'): + wire_name = clock_sources.get_random_source( site_to_cmt[site], uses_left_right_routing=True, - no_repeats=mmcm_pll_only or have_iob_clocks) + no_repeats=mmcm_pll_only) if wire_name is not None and 'BUFHCE' in wire_name: # Looping a BUFHCE to a BUFHCE requires using a hclk in the @@ -440,6 +459,11 @@ module top({inputs}); if wire_name is None: continue + if "IBUF" in wire_name: + used_iob_clks.add(wire_name) + clock_sources.remove_clock_source(wire_name) + adv_clock_sources.remove_clock_source(wire_name) + print( """ assign I_{site} = {wire_name};""".format( @@ -458,8 +482,25 @@ module top({inputs}); print(bufhs.getvalue()) for _, site in gen_sites('BUFR'): + + # Do not use BUFR always + if random.random() < 0.50: + continue + + available_srcs = set(iob_clks[site_to_cmt[site]]) - used_iob_clks + if len(available_srcs) == 0: + continue + + src = random.choice(list(available_srcs)) + + if src != "": + used_iob_clks.add(src) + clock_sources.remove_clock_source(src) + adv_clock_sources.remove_clock_source(src) + adv_clock_sources.add_clock_source( 'O_{site}'.format(site=site), site_to_cmt[site]) + print( """ wire O_{site}; @@ -467,7 +508,7 @@ module top({inputs}); BUFR bufr_{site} ( .I({I}), .O(O_{site}) - );""".format(I=random.choice(iob_clks[site_to_cmt[site]]), site=site)) + );""".format(I=src, site=site)) route_file = open("routes.txt", "w") @@ -493,8 +534,8 @@ module top({inputs}); for _, site in gen_sites('PLLE2_ADV'): for cin in ('cin1', 'cin2', 'clkfbin'): if random.random() > .2: - src = adv_clock_sources.get_random_source( - site_to_cmt[site], no_repeats=have_iob_clocks) + + src = adv_clock_sources.get_random_source(site_to_cmt[site]) src_cmt = adv_clock_sources.source_to_cmt[src] @@ -507,6 +548,8 @@ module top({inputs}); continue if "IBUF" in src: + clock_sources.remove_clock_source(src) + adv_clock_sources.remove_clock_source(src) fix_ccio_route(src) print( @@ -517,8 +560,8 @@ module top({inputs}); for _, site in gen_sites('MMCME2_ADV'): for cin in ('cin1', 'cin2', 'clkfbin'): if random.random() > .2: - src = adv_clock_sources.get_random_source( - site_to_cmt[site], no_repeats=have_iob_clocks) + + src = adv_clock_sources.get_random_source(site_to_cmt[site]) src_cmt = adv_clock_sources.source_to_cmt[src] if 'IBUF' not in src and 'BUFR' not in src: @@ -530,6 +573,8 @@ module top({inputs}); continue if "IBUF" in src: + clock_sources.remove_clock_source(src) + adv_clock_sources.remove_clock_source(src) fix_ccio_route(src) print(