diff options
author | David Shah <davey1576@gmail.com> | 2017-11-08 16:05:42 +0000 |
---|---|---|
committer | David Shah <davey1576@gmail.com> | 2017-11-08 16:05:42 +0000 |
commit | 629621642f4dd2d857edc914384b78161c438327 (patch) | |
tree | 5591833b846ec740b3a15a71dc24917c1dc4f08d /icefuzz | |
parent | c69b87d59340d37de4c389791e4b8e1cc5cad713 (diff) | |
download | icestorm-629621642f4dd2d857edc914384b78161c438327.tar.gz icestorm-629621642f4dd2d857edc914384b78161c438327.tar.bz2 icestorm-629621642f4dd2d857edc914384b78161c438327.zip |
Preparations for DSP and IpCon fuzzing
Diffstat (limited to 'icefuzz')
-rw-r--r-- | icefuzz/Makefile | 37 | ||||
-rw-r--r-- | icefuzz/cached_dsp0_5k.txt | 0 | ||||
-rw-r--r-- | icefuzz/cached_dsp1_5k.txt | 0 | ||||
-rw-r--r-- | icefuzz/cached_dsp2_5k.txt | 0 | ||||
-rw-r--r-- | icefuzz/cached_dsp3_5k.txt | 0 | ||||
-rw-r--r-- | icefuzz/cached_ipcon_5k.txt | 0 | ||||
-rw-r--r-- | icefuzz/database.py | 18 | ||||
-rw-r--r-- | icefuzz/extract.py | 20 |
8 files changed, 70 insertions, 5 deletions
diff --git a/icefuzz/Makefile b/icefuzz/Makefile index 2e42889..57e9af0 100644 --- a/icefuzz/Makefile +++ b/icefuzz/Makefile @@ -43,7 +43,7 @@ ifneq ($(DEVICECLASS),384) TESTS += aig endif -database: bitdata_io.txt bitdata_logic.txt bitdata_ramb$(RAM_SUFFIX).txt bitdata_ramt$(RAM_SUFFIX).txt +database: bitdata_io.txt bitdata_logic.txt bitdata_ramb$(RAM_SUFFIX).txt bitdata_ramt$(RAM_SUFFIX).txt ifneq ($(RAM_SUFFIX),) cp cached_ramb.txt bitdata_ramb.txt cp cached_ramt.txt bitdata_ramt.txt @@ -55,6 +55,12 @@ endif ifneq ($(RAM_SUFFIX),_5k) cp cached_ramb_5k.txt bitdata_ramb_5k.txt cp cached_ramt_5k.txt bitdata_ramt_5k.txt + cp cached_dsp0_5k.txt bitdata_dsp0_5k.txt + cp cached_dsp1_5k.txt bitdata_dsp1_5k.txt + cp cached_dsp2_5k.txt bitdata_dsp2_5k.txt + cp cached_dsp3_5k.txt bitdata_dsp3_5k.txt + cp cached_ipcon_5k.txt bitdata_ipcon_5k.txt + endif ICEDEVICE=$(DEVICECLASS) python3 database.py python3 export.py @@ -62,6 +68,11 @@ endif diff -U0 cached_logic.txt bitdata_logic.txt || cp -v bitdata_logic.txt cached_logic.txt diff -U0 cached_ramb$(RAM_SUFFIX).txt bitdata_ramb$(RAM_SUFFIX).txt || cp -v bitdata_ramb$(RAM_SUFFIX).txt cached_ramb$(RAM_SUFFIX).txt diff -U0 cached_ramt$(RAM_SUFFIX).txt bitdata_ramt$(RAM_SUFFIX).txt || cp -v bitdata_ramt$(RAM_SUFFIX).txt cached_ramt$(RAM_SUFFIX).txt + diff -U0 cached_dsp0_5k.txt bitdata_dsp0_5k.txt || cp -v bitdata_dsp0_5k.txt cached_dsp0_5k.txt + diff -U0 cached_dsp1_5k.txt bitdata_dsp1_5k.txt || cp -v bitdata_dsp1_5k.txt cached_dsp1_5k.txt + diff -U0 cached_dsp2_5k.txt bitdata_dsp2_5k.txt || cp -v bitdata_dsp2_5k.txt cached_dsp2_5k.txt + diff -U0 cached_dsp3_5k.txt bitdata_dsp3_5k.txt || cp -v bitdata_dsp3_5k.txt cached_dsp3_5k.txt + diff -U0 cached_ipcon_5k.txt bitdata_ipcon_5k.txt || cp -v bitdata_ipcon_5k.txt cached_ipcon_5k.txt timings: ifeq ($(DEVICECLASS),8k) @@ -97,11 +108,18 @@ timings_html: python3 timings.py -h tmedges.txt -t timings_lp8k.txt -l "LP8K with default temp/volt settings" > timings_lp8k.html python3 timings.py -h tmedges.txt -t timings_lp384.txt -l "LP384 with default temp/volt settings" > timings_lp384.html -data_cached.txt: cached_io.txt cached_logic.txt cached_ramb$(RAM_SUFFIX).txt cached_ramt$(RAM_SUFFIX).txt +data_cached.txt: cached_io.txt cached_logic.txt cached_ramb$(RAM_SUFFIX).txt cached_ramt$(RAM_SUFFIX).txt cached_dsp0_5k.txt cached_dsp1_5k.txt cached_dsp2_5k.txt cached_dsp3_5k.txt cached_ipcon_5k.txt gawk '{ print "io", $$0; }' cached_io.txt > data_cached.new gawk '{ print "logic", $$0; }' cached_logic.txt >> data_cached.new gawk '{ print "ramb$(RAM_SUFFIX)", $$0; }' cached_ramb$(RAM_SUFFIX).txt >> data_cached.new gawk '{ print "ramt$(RAM_SUFFIX)", $$0; }' cached_ramt$(RAM_SUFFIX).txt >> data_cached.new + + gawk '{ print "dsp0_5k", $$0; }' cached_dsp0_5k.txt >> data_cached.new + gawk '{ print "dsp1_5k", $$0; }' cached_dsp1_5k.txt >> data_cached.new + gawk '{ print "dsp2_5k", $$0; }' cached_dsp2_5k.txt >> data_cached.new + gawk '{ print "dsp3_5k", $$0; }' cached_dsp3_5k.txt >> data_cached.new + gawk '{ print "ipcon_5k", $$0; }' cached_ipcon_5k.txt >> data_cached.new + mv data_cached.new data_cached.txt bitdata_io.txt: data_cached.txt $(addprefix data_$(DEVICECLASS)_,$(addsuffix .txt,$(TESTS))) @@ -116,6 +134,21 @@ bitdata_ramb$(RAM_SUFFIX).txt: data_cached.txt $(addprefix data_$(DEVICECLASS)_, bitdata_ramt$(RAM_SUFFIX).txt: data_cached.txt $(addprefix data_$(DEVICECLASS)_,$(addsuffix .txt,$(TESTS))) grep ^ramt$(RAM_SUFFIX) $^ | tr -s ' ' | tr -d '\r' | cut -f2- -d' ' | sort -u > $@ +bitdata_dsp0_5k.txt: data_cached.txt $(addprefix data_$(DEVICECLASS)_,$(addsuffix .txt,$(TESTS))) + grep ^dsp0_5k$(RAM_SUFFIX) $^ | tr -s ' ' | tr -d '\r' | cut -f2- -d' ' | sort -u > $@ + +bitdata_dsp1_5k.txt: data_cached.txt $(addprefix data_$(DEVICECLASS)_,$(addsuffix .txt,$(TESTS))) + grep ^dsp1_5k$(RAM_SUFFIX) $^ | tr -s ' ' | tr -d '\r' | cut -f2- -d' ' | sort -u > $@ + +bitdata_dsp2_5k.txt: data_cached.txt $(addprefix data_$(DEVICECLASS)_,$(addsuffix .txt,$(TESTS))) + grep ^dsp2_5k$(RAM_SUFFIX) $^ | tr -s ' ' | tr -d '\r' | cut -f2- -d' ' | sort -u > $@ + +bitdata_dsp3_5k.txt: data_cached.txt $(addprefix data_$(DEVICECLASS)_,$(addsuffix .txt,$(TESTS))) + grep ^dsp3_5k$(RAM_SUFFIX) $^ | tr -s ' ' | tr -d '\r' | cut -f2- -d' ' | sort -u > $@ + +bitdata_ipcon_5k.txt: data_cached.txt $(addprefix data_$(DEVICECLASS)_,$(addsuffix .txt,$(TESTS))) + grep ^ipcon_5k$(RAM_SUFFIX) $^ | tr -s ' ' | tr -d '\r' | cut -f2- -d' ' | sort -u > $@ + datafiles: $(addprefix data_,$(addsuffix .txt,$(TESTS))) ../icepack/icepack: diff --git a/icefuzz/cached_dsp0_5k.txt b/icefuzz/cached_dsp0_5k.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/icefuzz/cached_dsp0_5k.txt diff --git a/icefuzz/cached_dsp1_5k.txt b/icefuzz/cached_dsp1_5k.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/icefuzz/cached_dsp1_5k.txt diff --git a/icefuzz/cached_dsp2_5k.txt b/icefuzz/cached_dsp2_5k.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/icefuzz/cached_dsp2_5k.txt diff --git a/icefuzz/cached_dsp3_5k.txt b/icefuzz/cached_dsp3_5k.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/icefuzz/cached_dsp3_5k.txt diff --git a/icefuzz/cached_ipcon_5k.txt b/icefuzz/cached_ipcon_5k.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/icefuzz/cached_ipcon_5k.txt diff --git a/icefuzz/database.py b/icefuzz/database.py index 8cb81d8..f8f3ccf 100644 --- a/icefuzz/database.py +++ b/icefuzz/database.py @@ -28,6 +28,9 @@ def read_database(filename, tile_type): line = re.sub(r"^Ram config bit:", "RamConfig", line) line = re.sub(r"^PLL config bit:", "PLL", line) line = re.sub(r"^Icegate Enable bit:", "Icegate", line) + line = re.sub(r"^MAC16 functional bit:", "DspConfig", line) + line = re.sub(r"^Hard IP config bit:", "IpConfig", line) + line = line.split() if line[0] == "routing": if line[3] == "wire_gbuf/in": line[3] = "fabout" @@ -61,7 +64,7 @@ def read_database(filename, tile_type): line[1] = re.sub(r"glb_netwk_", "1k_glb_netwk_", line[1]) raw_db.append((bit, (line[0], line[1]))) elif line[0] == "Cascade": - match = re.match("LH_LC0(\d)_inmux02_5", line[1]) + match = re.match("(MULT\d|LH)_LC0(\d)_inmux02_5", line[1]) if match: raw_db.append((bit, ("buffer", "wire_logic_cluster/lc_%d/lout" % (int(match.group(1))-1), "input_2_%s" % match.group(1)))) else: @@ -87,6 +90,11 @@ def read_database(filename, tile_type): raw_db.append((bit, (line[0],))) elif line[0] == "Carry_In_Mux": continue + elif line[0] == "DspConfig": + line[1] = re.sub(r"MULT\d_bram_cbit_", "CBIT_", line[1]) + elif line[0] == "IpConfig": + line[1] = re.sub(r"MULT\d_bram_cbit_", "CBIT_", line[1]) #not a typo, sometimes IP config bits are in DSP tiles and use a MULT prefix... + line[1] = re.sub(r"IPCON_bram_cbit_", "CBIT_", line[1]) else: print("unsupported statement: %s: %s" % (bit, line)) assert False @@ -149,3 +157,11 @@ for device_class in ["5k", "8k"]: with open("database_ramt_%s.txt" % (device_class, ), "w") as f: for entry in read_database("bitdata_ramt_%s.txt" % (device_class, ), "ramt_" + device_class): print("\t".join(entry), file=f) +if device_class == "5k": + for dsp_idx in range(4): + with open("database_dsp%d_5k.txt" % (dsp_idx, ), "w") as f: + for entry in read_database("bitdata_dsp%d_5k.txt" % (dsp_idx, ), "dsp%d_5" % (dsp_idx, )): + print("\t".join(entry), file=f) + with open("database_ipcon.txt", "w") as f: + for entry in read_database("bitdata_ipcon.txt", "ipcon"): + print("\t".join(entry), file=f)
\ No newline at end of file diff --git a/icefuzz/extract.py b/icefuzz/extract.py index 75be225..6f8b8cc 100644 --- a/icefuzz/extract.py +++ b/icefuzz/extract.py @@ -37,8 +37,24 @@ for filename in sys.argv[1:]: else: cur_text_db = text_db.setdefault("ramt_" + device_class if device_class in ["5k", "8k"] else "ramt", set()) ignore = False - elif device_class == "5k" and line.startswith(("IpCon", "DSP")): - ignore = True + elif device_class == "5k" and line.startswith("IpCon"): + cur_text_db = text_db.setdefault("ipcon_5k", set()) + ignore = False + elif device_class == "5k" and line.startswith("DSP"): + match = re.match(r"DSP_Tile_\d+_(\d+)", line) + ypos = int(match.group(1)) + dsp_idx = None + if ypos in [5, 10, 15, 23]: + dsp_idx = 0 + if ypos in [6, 11, 16, 24]: + dsp_idx = 1 + if ypos in [7, 12, 17, 25]: + dsp_idx = 2 + if ypos in [8, 13, 18, 26]: + dsp_idx = 3 + assert dsp_idx != None + cur_text_db = text_db.setdefault("dsp%d_5k" % dsp_idx, set()) + ignore = False elif not ignore: print("'" + line + "'") assert line.startswith(" ") |