From c48a5bc5976e2424366ec8090ff98c8eb9221726 Mon Sep 17 00:00:00 2001 From: Alessandro Comodi Date: Wed, 16 Jan 2019 12:06:17 +0100 Subject: [PATCH 1/6] fuzzers/piplist: Moving piplist files to piplist folder Signed-off-by: Alessandro Comodi --- fuzzers/{ => piplist}/piplist.tcl | 2 +- fuzzers/{ => piplist}/piplist.v | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename fuzzers/{ => piplist}/piplist.tcl (96%) rename fuzzers/{ => piplist}/piplist.v (100%) diff --git a/fuzzers/piplist.tcl b/fuzzers/piplist/piplist.tcl similarity index 96% rename from fuzzers/piplist.tcl rename to fuzzers/piplist/piplist.tcl index f8398cce..70f67ba1 100644 --- a/fuzzers/piplist.tcl +++ b/fuzzers/piplist/piplist.tcl @@ -3,7 +3,7 @@ source "$::env(XRAY_DIR)/utils/utils.tcl" proc build_project {} { create_project -force -part $::env(XRAY_PART) piplist piplist - read_verilog $::env(XRAY_DIR)/fuzzers/piplist.v + read_verilog $::env(XRAY_FUZZERS_DIR)/piplist/piplist.v synth_design -top top set_property -dict "PACKAGE_PIN $::env(XRAY_PIN_00) IOSTANDARD LVCMOS33" [get_ports i] diff --git a/fuzzers/piplist.v b/fuzzers/piplist/piplist.v similarity index 100% rename from fuzzers/piplist.v rename to fuzzers/piplist/piplist.v From 5b7575bdd204369ba4b637840475dbf5f4fb1e83 Mon Sep 17 00:00:00 2001 From: Alessandro Comodi Date: Wed, 16 Jan 2019 12:07:00 +0100 Subject: [PATCH 2/6] fuzzers/Makefiles: pips_int_*.txt now directed to piplist folder All the fuzzers that made use of the pips_int_*.txt files now seek for those dependencies in the fuzzers/piplist/build folder so there is no need to regenerate them if already present Signed-off-by: Alessandro Comodi --- fuzzers/050-pip-seed/Makefile | 17 +++++++++++------ fuzzers/int_loop.mk | 15 +++++++++------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/fuzzers/050-pip-seed/Makefile b/fuzzers/050-pip-seed/Makefile index 72de3993..d45fef45 100644 --- a/fuzzers/050-pip-seed/Makefile +++ b/fuzzers/050-pip-seed/Makefile @@ -10,6 +10,7 @@ endif # Driven by int_loop.sh ITER := 1 MAKETODO_FLAGS=--re ".*" --not-endswith ".VCC_WIRE" +PIPLIST_TCL=$(XRAY_FUZZERS_DIR)/piplist/piplist.tcl # See int_loop_check.py # Original did 200 specimins open loop CHECK_ARGS := --max-iters 12 --stable-iters 2 @@ -63,12 +64,13 @@ $(SPECIMENS_OK): build/todo.txt bash generate.sh $(subst /OK,,$@) touch $@ -build/pips_int_l.txt: $(XRAY_DIR)/fuzzers/piplist.tcl - mkdir -p build/$(ITER) - cd build && ${XRAY_VIVADO} -mode batch -source $(XRAY_DIR)/fuzzers/piplist.tcl +$(XRAY_FUZZERS_DIR)/piplist/build/pips_int_l.txt: $(XRAY_FUZZERS_DIR)/piplist/piplist.tcl + mkdir -p $(XRAY_FUZZERS_DIR)/piplist/build + cd $(XRAY_FUZZERS_DIR)/piplist/build && ${XRAY_VIVADO} -mode batch -source $(PIPLIST_TCL) -build/todo.txt: build/pips_int_l.txt $(XRAY_DIR)/fuzzers/int_maketodo.py -# Doesn't pushdb until very end. Compare against db so far +build/todo.txt: $(XRAY_FUZZERS_DIR)/piplist/build/pips_int_l.txt $(XRAY_DIR)/fuzzers/int_maketodo.py + # Doesn't pushdb until very end. Compare against db so far + mkdir -p build/$(ITER) python3 $(XRAY_DIR)/fuzzers/int_maketodo.py --db-dir build $(MAKETODO_FLAGS) |sort >build/todo_all.txt cat build/todo_all.txt | sort -R > build/todo.txt.tmp mv build/todo.txt.tmp build/todo.txt @@ -92,5 +94,8 @@ clean: cleaniter: rm -rf build/$(ITER) build/todo.txt -.PHONY: database pushdb run clean cleaniter +# Remove piplist build files in piplist directory +cleanpiplist: + rm -rf $(XRAY_FUZZERS_DIR)/piplist/build +.PHONY: database pushdb run clean cleaniter cleanpiplist diff --git a/fuzzers/int_loop.mk b/fuzzers/int_loop.mk index 26b18863..2762b79a 100644 --- a/fuzzers/int_loop.mk +++ b/fuzzers/int_loop.mk @@ -14,7 +14,7 @@ endif ITER ?= 1 MAKETODO_FLAGS ?= PIP_TYPE?=pips_int -PIPLIST_TCL?=$(XRAY_DIR)/fuzzers/piplist.tcl +PIPLIST_TCL?=$(XRAY_FUZZERS_DIR)/piplist/piplist.tcl # See int_loop_check.py # rempips took 35 iters once, so set 50 as a good start point @@ -61,12 +61,12 @@ $(SPECIMENS_OK): build/todo.txt bash ${XRAY_DIR}/utils/top_generate.sh $(subst /OK,,$@) touch $@ -build/$(PIP_TYPE)_l.txt: $(XRAY_DIR)/fuzzers/piplist.tcl - mkdir -p build/$(ITER) - cd build && ${XRAY_VIVADO} -mode batch -source $(PIPLIST_TCL) +$(XRAY_FUZZERS_DIR)/piplist/build/$(PIP_TYPE)_l.txt: $(XRAY_FUZZERS_DIR)/piplist/piplist.tcl + mkdir -p $(XRAY_FUZZERS_DIR)/piplist/build + cd $(XRAY_FUZZERS_DIR)/piplist/build && ${XRAY_VIVADO} -mode batch -source $(PIPLIST_TCL) # Used 1) to see if we are done 2) pips to try in generate.tcl -build/todo.txt: build/$(PIP_TYPE)_l.txt $(XRAY_DIR)/fuzzers/int_maketodo.py build/database/seeded +build/todo.txt: $(XRAY_FUZZERS_DIR)/piplist/build/$(PIP_TYPE)_l.txt $(XRAY_DIR)/fuzzers/int_maketodo.py build/database/seeded XRAY_DATABASE_DIR=${FUZDIR}/build/database python3 $(XRAY_DIR)/fuzzers/int_maketodo.py --pip-type $(PIP_TYPE) $(MAKETODO_FLAGS) |sort >build/todo_all.txt cat build/todo_all.txt | sort -R | head -n$(TODO_N) > build/todo.txt.tmp mv build/todo.txt.tmp build/todo.txt @@ -97,5 +97,8 @@ clean: cleaniter: rm -rf build/$(ITER) build/todo.txt -.PHONY: database pushdb run clean cleaniter +cleanpiplist: + rm -rf $(XRAY_FUZZERS_DIR)/piplist/build + +.PHONY: database pushdb run clean cleaniter cleanpiplist From 3b28934d6727b30c406768b6fa705f689f39fe09 Mon Sep 17 00:00:00 2001 From: Alessandro Comodi Date: Wed, 16 Jan 2019 12:09:35 +0100 Subject: [PATCH 3/6] fuzzers/int_maketodo.py: added piplist directory Signed-off-by: Alessandro Comodi --- fuzzers/int_maketodo.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/fuzzers/int_maketodo.py b/fuzzers/int_maketodo.py index 6916c55c..7e1e31b1 100644 --- a/fuzzers/int_maketodo.py +++ b/fuzzers/int_maketodo.py @@ -85,20 +85,30 @@ def maketodo(pipfile, dbfile, intre, not_endswith=None, verbose=False): verbose and print('Print %u entries w/ %u drops' % (lines, drops)) -def run(build_dir, db_dir, intre, pip_type, not_endswith=None, verbose=False): +def run( + build_dir, + db_dir, + pip_dir, + intre, + pip_type, + not_endswith=None, + verbose=False): if db_dir is None: db_dir = "%s/%s" % ( os.getenv("XRAY_DATABASE_DIR"), os.getenv("XRAY_DATABASE")) + if pip_dir is None: + pip_dir = "%s/piplist/build" % (os.getenv("XRAY_FUZZERS_DIR")) + assert intre, "RE is required" maketodo( - "%s/%s_l.txt" % (build_dir, pip_type), + "%s/%s_l.txt" % (pip_dir, pip_type), "%s/segbits_int_l.db" % db_dir, intre, not_endswith, verbose=verbose) maketodo( - "%s/%s_r.txt" % (build_dir, pip_type), + "%s/%s_r.txt" % (pip_dir, pip_type), "%s/segbits_int_r.db" % db_dir, intre, not_endswith, @@ -114,6 +124,7 @@ def main(): parser.add_argument('--verbose', action='store_true', help='') parser.add_argument('--build-dir', default="build", help='') parser.add_argument('--db-dir', default=None, help='') + parser.add_argument('--pip-dir', default=None, help='') parser.add_argument('--re', required=True, help='') parser.add_argument('--pip-type', default="pips_int", help='') parser.add_argument( @@ -123,6 +134,7 @@ def main(): run( build_dir=args.build_dir, db_dir=args.db_dir, + pip_dir=args.pip_dir, intre=args.re, pip_type=args.pip_type, not_endswith=args.not_endswith, From b5f7243f39f50aee174c2cb6f6bb15a8e00ae094 Mon Sep 17 00:00:00 2001 From: Alessandro Comodi Date: Wed, 16 Jan 2019 12:10:13 +0100 Subject: [PATCH 4/6] utils/environment.sh: added fuzzers dir to env variables Signed-off-by: Alessandro Comodi --- utils/environment.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/environment.sh b/utils/environment.sh index eb6ee049..23e759e1 100644 --- a/utils/environment.sh +++ b/utils/environment.sh @@ -9,6 +9,7 @@ export XRAY_UTILS_DIR="$( cd -P "$( dirname "$XRAY_ENV_PATH" )" && pwd )" export XRAY_DIR="$( dirname "$XRAY_UTILS_DIR" )" export XRAY_DATABASE_DIR="${XRAY_DIR}/database" export XRAY_TOOLS_DIR="${XRAY_DIR}/build/tools" +export XRAY_FUZZERS_DIR="${XRAY_DIR}/fuzzers" if [ -e "${XRAY_DIR}/env/bin/activate" ]; then source "${XRAY_DIR}/env/bin/activate" From bf05a19525cdbe7758b0fba488659a271b3944d7 Mon Sep 17 00:00:00 2001 From: Alessandro Comodi Date: Wed, 16 Jan 2019 12:48:51 +0100 Subject: [PATCH 5/6] bipiplist.tcl: changed verilog reference Signed-off-by: Alessandro Comodi --- fuzzers/057-pip-bi/bipiplist.tcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fuzzers/057-pip-bi/bipiplist.tcl b/fuzzers/057-pip-bi/bipiplist.tcl index fff2381f..bfd3d478 100644 --- a/fuzzers/057-pip-bi/bipiplist.tcl +++ b/fuzzers/057-pip-bi/bipiplist.tcl @@ -1,6 +1,6 @@ create_project -force -part $::env(XRAY_PART) bipiplist bipiplist -read_verilog $::env(XRAY_DIR)/fuzzers/piplist.v +read_verilog $::env(XRAY_FUZZERS_DIR)/piplist/piplist.v synth_design -top top set_property -dict "PACKAGE_PIN $::env(XRAY_PIN_00) IOSTANDARD LVCMOS33" [get_ports i] From 11d42757bf09de440bb60bda2b721778ab8ddb6c Mon Sep 17 00:00:00 2001 From: Alessandro Comodi Date: Wed, 16 Jan 2019 17:43:51 +0100 Subject: [PATCH 6/6] fuzzers/int_loop.mk: fixed dependency in makefile Signed-off-by: Alessandro Comodi --- fuzzers/int_loop.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fuzzers/int_loop.mk b/fuzzers/int_loop.mk index 2762b79a..75ab587d 100644 --- a/fuzzers/int_loop.mk +++ b/fuzzers/int_loop.mk @@ -61,7 +61,7 @@ $(SPECIMENS_OK): build/todo.txt bash ${XRAY_DIR}/utils/top_generate.sh $(subst /OK,,$@) touch $@ -$(XRAY_FUZZERS_DIR)/piplist/build/$(PIP_TYPE)_l.txt: $(XRAY_FUZZERS_DIR)/piplist/piplist.tcl +$(XRAY_FUZZERS_DIR)/piplist/build/$(PIP_TYPE)_l.txt: $(PIPLIST_TCL) mkdir -p $(XRAY_FUZZERS_DIR)/piplist/build cd $(XRAY_FUZZERS_DIR)/piplist/build && ${XRAY_VIVADO} -mode batch -source $(PIPLIST_TCL)