From 56cb76e90f3a2395ed76a66a00d75991f714d334 Mon Sep 17 00:00:00 2001 From: Maciej Kurc Date: Wed, 10 Jul 2019 14:59:46 +0200 Subject: [PATCH] Added a makefile which allows to fuzz features for both SLICEM and SLICEL but separate them during database merge. Signed-off-by: Maciej Kurc --- fuzzers/016-clb-noutmux/Makefile | 8 +++- fuzzers/016-clb-noutmux/generate.py | 10 ++--- fuzzers/016-clb-noutmux/top.py | 16 ++++---- fuzzers/clb_ext.mk | 60 +++++++++++++++++++++++++++++ 4 files changed, 78 insertions(+), 16 deletions(-) create mode 100644 fuzzers/clb_ext.mk diff --git a/fuzzers/016-clb-noutmux/Makefile b/fuzzers/016-clb-noutmux/Makefile index 15886b91..bf122110 100644 --- a/fuzzers/016-clb-noutmux/Makefile +++ b/fuzzers/016-clb-noutmux/Makefile @@ -1,4 +1,8 @@ +# Specimen count N := 4 -CLB_DBFIXUP=Y -include ../clb.mk + +# A grep regex for SLICEM features to be skipped for SLICELs +SLICEM_FEATURES ?= "DOUTMUX.MC31" + +include ../clb_ext.mk diff --git a/fuzzers/016-clb-noutmux/generate.py b/fuzzers/016-clb-noutmux/generate.py index 197c6206..a06ff35c 100644 --- a/fuzzers/016-clb-noutmux/generate.py +++ b/fuzzers/016-clb-noutmux/generate.py @@ -62,8 +62,8 @@ for l in f: # create 0-tags for all sources on the remaining (unused) MUXes for loc, muxes in cache.items(): for which in muxes: - for src in "F7 F8 CY O5 XOR 5Q AMC31".split(): - if src == "AMC31" and which is not "D": continue + for src in "F7 F8 CY O5 XOR 5Q MC31".split(): + if src == "MC31" and which is not "D": continue if src == "F7" and which not in "AC": continue if src == "F8" and which not in "B": continue if src == "5Q": src = which + "5Q" @@ -76,7 +76,7 @@ def bitfilter(frame_idx, bit_idx): # in this fuzzer we get some aliasing with those bits, so we have to manually exclude # them. (Maybe FIXME: read the bit locations from the database files) - # Since the SRL32 is enabled along with DOUTMUX.AMC31, bits related to + # Since the SRL32 is enabled along with DOUTMUX.MC31, bits related to # SRL32 features are masked out. if (frame_idx, bit_idx) in [ @@ -87,9 +87,9 @@ def bitfilter(frame_idx, bit_idx): (30, 19), (31, 19), # B5MA (30, 9), - (31, 8), # A5MA + (31, 8), # A5MA (30, 16), # ALUT.SRL - (1, 23), # WEMUX.CE + ( 1, 23), # WEMUX.CE ]: return False diff --git a/fuzzers/016-clb-noutmux/top.py b/fuzzers/016-clb-noutmux/top.py index ca104024..3c81c38e 100644 --- a/fuzzers/016-clb-noutmux/top.py +++ b/fuzzers/016-clb-noutmux/top.py @@ -9,7 +9,6 @@ INCREMENT = os.getenv('CLBN', 0) CLBN = 400 + int(INCREMENT) print('//Requested CLBs: %s' % str(CLBN)) - def gen_slicels(): for _tile_name, site_name, _site_type in util.get_roi().gen_sites( ['SLICEL']): @@ -21,7 +20,6 @@ def gen_slicems(): ['SLICEM']): yield site_name - DIN_N = CLBN * 8 DOUT_N = CLBN * 8 @@ -40,7 +38,7 @@ for i in range(CLBN): if use_slicem: loc = next(slicems) - variants = ['CY', 'F78', 'O5', 'XOR', 'B5Q', 'AMC31'] + variants = ['CY', 'F78', 'O5', 'XOR', 'B5Q', 'MC31'] else: loc = next(slicels) variants = ['CY', 'F78', 'O5', 'XOR', 'B5Q'] @@ -49,8 +47,8 @@ for i in range(CLBN): modules = ['clb_NOUTMUX_' + x for x in variants] module = random.choice(modules) - if module == 'clb_NOUTMUX_AMC31': - n = 3 # Only DOUTMUX has AMC31 input + if module == 'clb_NOUTMUX_MC31': + n = 3 # Only DOUTMUX has MC31 input elif module == 'clb_NOUTMUX_F78': n = random.randint(0, 2) else: @@ -83,7 +81,7 @@ module myLUT8 (input clk, input [7:0] din, //Otherwise this FF drops out //output wire [3:0] n5ff_q); output wire ff_q, - output wire amc31); + output wire mc31); parameter N=-1; parameter LOC="SLICE_FIXME"; @@ -157,7 +155,7 @@ module myLUT8 (input clk, input [7:0] din, .D(din[5]), .A(din[4:0]), .Q(lutno6[0]), - .Q31(amc31)); + .Q31(mc31)); assign lutno5[0] = din[6]; @@ -313,7 +311,7 @@ module clb_NOUTMUX_B5Q (input clk, input [7:0] din, output [7:0] dout); .ff_q(dout[0])); endmodule -module clb_NOUTMUX_AMC31 (input clk, input [7:0] din, output [7:0] dout); +module clb_NOUTMUX_MC31 (input clk, input [7:0] din, output [7:0] dout); parameter LOC="SLICE_FIXME"; parameter N=0; // Dummy @@ -322,6 +320,6 @@ module clb_NOUTMUX_AMC31 (input clk, input [7:0] din, output [7:0] dout); .lut8o(), .caro(), .carco(), .bo5(), .bo6(), - .ff_q(), .amc31(dout[0])); + .ff_q(), .mc31(dout[0])); endmodule ''') diff --git a/fuzzers/clb_ext.mk b/fuzzers/clb_ext.mk new file mode 100644 index 00000000..902777b9 --- /dev/null +++ b/fuzzers/clb_ext.mk @@ -0,0 +1,60 @@ +# Speciment count +N ?= 1 + +# A grep regex for SLICEM features to be skipped for SLICELs +SLICEM_FEATURES ?= "*" + +# This set of variables are used to store the increment +# in the number of CLBs in case they are not enough and +# the generated database is inconsistent +CLBN ?= 0 +INC ?= 50 +VAR ?= "CLBN=$$(($(CLBN) + $(INC)))" +ENV_VAR ?= "CLBN=$(CLBN)" +ITER ?= 0 +MAX_ITER ?= 10 +FUZDIR = ${PWD} + +SEGMATCH_ARGS ?=-m 2 -M 2 + +SEGDATAS=$(addsuffix /segdata_clbl[lm]_[lr].txt,$(SPECIMENS)) + +include ../fuzzer.mk + +build/segbits_clbx.rdb: $(SPECIMENS_OK) + ${XRAY_SEGMATCH} $(SEGMATCH_ARGS) -o build/segbits_clbx.rdb $(SEGDATAS) + +checkdb: + # If the database presents errors or is incomplete, the fuzzer is rerun. + # When it reaches the maximum number of iterations it fails. + @if [ $(ITER) -gt $(MAX_ITER) ]; then \ + echo "Max Iterations reached. Fuzzer unsolvable."; \ + exit 1; \ + fi + $(MAKE) parsedb || $(MAKE) $(VAR) ITER=$$(($(ITER) + 1)) run + +parsedb: + $(foreach file, $(wildcard build/*.db), ${XRAY_PARSEDB} --strict $(file);) + +database: build/segbits_clbl.db build/segbits_clbm.db + +build/segbits_clbm.rdb: build/segbits_clbx.rdb + cp $^ $@ +build/segbits_clbl.rdb: build/segbits_clbx.rdb + cat $^ | grep -E -v $(SLICEM_FEATURES) >$@ + +build/%.db: build/%.rdb + ${XRAY_DBFIXUP} --db-root build --zero-db bits.dbf --seg-fn-in $^ --seg-fn-out $@ + ${XRAY_MASKMERGE} $(subst .rdb,.db,$(subst segbits,mask,$^)) $(SEGDATAS) + +pushdb: checkdb + ${XRAY_MERGEDB} clbll_l build/segbits_clbl.db + ${XRAY_MERGEDB} clbll_r build/segbits_clbl.db + ${XRAY_MERGEDB} mask_clbll_l build/mask_clbl.db + ${XRAY_MERGEDB} mask_clbll_r build/mask_clbl.db + ${XRAY_MERGEDB} clblm_l build/segbits_clbm.db + ${XRAY_MERGEDB} clblm_r build/segbits_clbm.db + ${XRAY_MERGEDB} mask_clblm_l build/mask_clbm.db + ${XRAY_MERGEDB} mask_clblm_r build/mask_clbm.db + +.PHONY: checkdb parsedb pushdb