From f1cbbc38a6a2e5e2eb90b1a648e7c9039888c631 Mon Sep 17 00:00:00 2001 From: Tomasz Michalak Date: Thu, 14 Jan 2021 13:54:03 +0100 Subject: [PATCH 1/2] 005-tilegrid: Add GTP_CHANNEL tilegrid fuzzer Signed-off-by: Tomasz Michalak --- fuzzers/005-tilegrid/Makefile | 6 ++ fuzzers/005-tilegrid/add_tdb.py | 1 + fuzzers/005-tilegrid/gtp_channel/Makefile | 10 +++ fuzzers/005-tilegrid/gtp_channel/generate.tcl | 36 +++++++++++ fuzzers/005-tilegrid/gtp_channel/top.py | 61 +++++++++++++++++++ 5 files changed, 114 insertions(+) create mode 100644 fuzzers/005-tilegrid/gtp_channel/Makefile create mode 100644 fuzzers/005-tilegrid/gtp_channel/generate.tcl create mode 100644 fuzzers/005-tilegrid/gtp_channel/top.py diff --git a/fuzzers/005-tilegrid/Makefile b/fuzzers/005-tilegrid/Makefile index 68567929..4eea3fb1 100644 --- a/fuzzers/005-tilegrid/Makefile +++ b/fuzzers/005-tilegrid/Makefile @@ -35,6 +35,7 @@ ifeq (${XRAY_DATABASE}, artix7) # Artix7 only TILEGRID_TDB_DEPENDENCIES += pcie/$(BUILD_FOLDER)/segbits_tilegrid.tdb TILEGRID_TDB_DEPENDENCIES += gtp_common/$(BUILD_FOLDER)/segbits_tilegrid.tdb +TILEGRID_TDB_DEPENDENCIES += gtp_channel/$(BUILD_FOLDER)/segbits_tilegrid.tdb endif ifeq (${XRAY_DATABASE}, zynq7) @@ -144,6 +145,9 @@ pcie/$(BUILD_FOLDER)/segbits_tilegrid.tdb: ${BASICDB_TILEGRID} gtp_common/$(BUILD_FOLDER)/segbits_tilegrid.tdb: ${BASICDB_TILEGRID} cd gtp_common && $(MAKE) +gtp_channel/$(BUILD_FOLDER)/segbits_tilegrid.tdb: ${BASICDB_TILEGRID} + cd gtp_channel && $(MAKE) + $(BUILD_FOLDER)/tilegrid_tdb.json: add_tdb.py $(TILEGRID_TDB_DEPENDENCIES) python3 add_tdb.py \ --fn-in ${BASICDB_TILEGRID} \ @@ -185,6 +189,7 @@ clean: cd hclk_ioi && $(MAKE) clean cd pcie && $(MAKE) clean cd gtp_common && $(MAKE) clean + cd gtp_channel && $(MAKE) clean clean_all: rm -rf build_* run.*.ok @@ -213,6 +218,7 @@ clean_all: cd hclk_ioi && $(MAKE) clean_all cd pcie && $(MAKE) clean_all cd gtp_common && $(MAKE) clean_all + cd gtp_channel && $(MAKE) clean_all .PHONY: database pushdb clean clean_all run diff --git a/fuzzers/005-tilegrid/add_tdb.py b/fuzzers/005-tilegrid/add_tdb.py index 8f611801..b98526e7 100644 --- a/fuzzers/005-tilegrid/add_tdb.py +++ b/fuzzers/005-tilegrid/add_tdb.py @@ -118,6 +118,7 @@ def run(fn_in, fn_out, verbose=False): ("cfg_int", int_frames, int_words), ("monitor_int", int_frames, int_words), ("orphan_int_column", int_frames, int_words), + ("gtp_channel", 32, 22), ] for (subdir, frames, words) in tdb_fns: diff --git a/fuzzers/005-tilegrid/gtp_channel/Makefile b/fuzzers/005-tilegrid/gtp_channel/Makefile new file mode 100644 index 00000000..0e3d4d73 --- /dev/null +++ b/fuzzers/005-tilegrid/gtp_channel/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 ?= 12 +GENERATE_ARGS?="--oneval 1 --design params.csv --dframe 1d --dword 4" +include ../fuzzaddr/common.mk diff --git a/fuzzers/005-tilegrid/gtp_channel/generate.tcl b/fuzzers/005-tilegrid/gtp_channel/generate.tcl new file mode 100644 index 00000000..59dff171 --- /dev/null +++ b/fuzzers/005-tilegrid/gtp_channel/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-47}] + set_property IS_ENABLED 0 [get_drc_checks {REQP-126}] + 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/gtp_channel/top.py b/fuzzers/005-tilegrid/gtp_channel/top.py new file mode 100644 index 00000000..37cb4552 --- /dev/null +++ b/fuzzers/005-tilegrid/gtp_channel/top.py @@ -0,0 +1,61 @@ +#!/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 ['GTPE2_CHANNEL']: + 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) + + print( + ''' + (* KEEP, DONT_TOUCH, LOC = "{}" *) + GTPE2_CHANNEL #( + .RXSYNC_OVRD(1'b{}) + ) gtpe2_channel_{} ();'''.format(site_name, isone, site_name)) + + print("endmodule") + write_params(params) + + +if __name__ == '__main__': + run() From e7995c74ee2fe33432a4ee2d05284c54f73332ad Mon Sep 17 00:00:00 2001 From: Alessandro Comodi Date: Mon, 18 Jan 2021 14:33:38 +0100 Subject: [PATCH 2/2] 005-tilegrid: allow auto-alignment of frame Signed-off-by: Alessandro Comodi --- fuzzers/005-tilegrid/gtp_channel/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fuzzers/005-tilegrid/gtp_channel/Makefile b/fuzzers/005-tilegrid/gtp_channel/Makefile index 0e3d4d73..29436b32 100644 --- a/fuzzers/005-tilegrid/gtp_channel/Makefile +++ b/fuzzers/005-tilegrid/gtp_channel/Makefile @@ -6,5 +6,5 @@ # # SPDX-License-Identifier: ISC N ?= 12 -GENERATE_ARGS?="--oneval 1 --design params.csv --dframe 1d --dword 4" +GENERATE_ARGS?="--oneval 1 --design params.csv --dword 4 --auto-frame" include ../fuzzaddr/common.mk