From 95eb4f812b2f29ce74885abf8ecc69c72517d62f Mon Sep 17 00:00:00 2001 From: Hans Baier Date: Sat, 8 Feb 2025 03:18:43 +0700 Subject: [PATCH] add fuzzers/005-tilegrid/gtx_common Signed-off-by: Hans Baier --- fuzzers/005-tilegrid/gtx_common/Makefile | 10 ++++ fuzzers/005-tilegrid/gtx_common/generate.tcl | 36 ++++++++++++ fuzzers/005-tilegrid/gtx_common/top.py | 62 ++++++++++++++++++++ 3 files changed, 108 insertions(+) create mode 100644 fuzzers/005-tilegrid/gtx_common/Makefile create mode 100644 fuzzers/005-tilegrid/gtx_common/generate.tcl create mode 100644 fuzzers/005-tilegrid/gtx_common/top.py diff --git a/fuzzers/005-tilegrid/gtx_common/Makefile b/fuzzers/005-tilegrid/gtx_common/Makefile new file mode 100644 index 00000000..82d266cf --- /dev/null +++ b/fuzzers/005-tilegrid/gtx_common/Makefile @@ -0,0 +1,10 @@ +# Copyright (C) 2017-2020 The Project X-Ray Authors. +# +# Use of this source code is governed by a ISC-style +# license that can be found in the LICENSE file or at +# https://opensource.org/licenses/ISC +# +# SPDX-License-Identifier: ISC +N ?= 8 +GENERATE_ARGS?="--oneval 0 --design params.csv --dword 45 --dbit 27 --dframe 1e" +include ../fuzzaddr/common.mk diff --git a/fuzzers/005-tilegrid/gtx_common/generate.tcl b/fuzzers/005-tilegrid/gtx_common/generate.tcl new file mode 100644 index 00000000..eea37d79 --- /dev/null +++ b/fuzzers/005-tilegrid/gtx_common/generate.tcl @@ -0,0 +1,36 @@ +# Copyright (C) 2017-2020 The Project X-Ray Authors +# +# Use of this source code is governed by a ISC-style +# license that can be found in the LICENSE file or at +# https://opensource.org/licenses/ISC +# +# SPDX-License-Identifier: ISC +source "$::env(XRAY_DIR)/utils/utils.tcl" + +proc run {} { + create_project -force -part $::env(XRAY_PART) design design + read_verilog top.v + synth_design -top top + + set_property CFGBVS VCCO [current_design] + set_property CONFIG_VOLTAGE 3.3 [current_design] + set_property BITSTREAM.GENERAL.PERFRAMECRC YES [current_design] + + # Disable MMCM frequency etc sanity checks + set_property IS_ENABLED 0 [get_drc_checks {PDRC-29}] + set_property IS_ENABLED 0 [get_drc_checks {PDRC-30}] + set_property IS_ENABLED 0 [get_drc_checks {AVAL-50}] + set_property IS_ENABLED 0 [get_drc_checks {AVAL-53}] + set_property IS_ENABLED 0 [get_drc_checks {REQP-126}] + set_property IS_ENABLED 0 [get_drc_checks {REQP-48}] + set_property IS_ENABLED 0 [get_drc_checks {NSTD-1}] + set_property IS_ENABLED 0 [get_drc_checks {UCIO-1}] + + place_design + route_design + + write_checkpoint -force design.dcp + write_bitstream -force design.bit +} + +run diff --git a/fuzzers/005-tilegrid/gtx_common/top.py b/fuzzers/005-tilegrid/gtx_common/top.py new file mode 100644 index 00000000..c20ea2f0 --- /dev/null +++ b/fuzzers/005-tilegrid/gtx_common/top.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017-2020 The Project X-Ray Authors. +# +# Use of this source code is governed by a ISC-style +# license that can be found in the LICENSE file or at +# https://opensource.org/licenses/ISC +# +# SPDX-License-Identifier: ISC +import os +import random +random.seed(int(os.getenv("SEED"), 16)) +from prjxray import util +from prjxray.db import Database + + +def gen_sites(): + db = Database(util.get_db_root(), util.get_part()) + grid = db.grid() + for tile_name in sorted(grid.tiles()): + loc = grid.loc_of_tilename(tile_name) + gridinfo = grid.gridinfo_at_loc(loc) + + for site_name, site_type in gridinfo.sites.items(): + if site_type in ['GTXE2_COMMON']: + yield tile_name, site_name + + +def write_params(params): + pinstr = 'tile,val,site\n' + for tile, (site, val) in sorted(params.items()): + pinstr += '%s,%s,%s\n' % (tile, val, site) + open('params.csv', 'w').write(pinstr) + + +def run(): + print(''' +module top(input wire in, output wire out); + ''') + + params = {} + + sites = list(gen_sites()) + for (tile_name, site_name), isone in zip(sites, + util.gen_fuzz_states(len(sites))): + params[tile_name] = (site_name, isone) + + attr = 4 if isone else 5 + print( + ''' + (* KEEP, DONT_TOUCH, LOC="{site}" *) + GTXE2_COMMON #( + .QPLL_FBDIV({attr}) + ) {site} ();'''.format(attr=attr, site=site_name)) + + print("endmodule") + write_params(params) + + +if __name__ == '__main__': + run()