From ac19cd48a491e4006725ed35a9943729bde35565 Mon Sep 17 00:00:00 2001 From: Ross Thompson Date: Wed, 2 Feb 2022 19:14:42 -0600 Subject: [PATCH 1/4] Broken makefiles. --- pipelined/regression/Makefile | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/pipelined/regression/Makefile b/pipelined/regression/Makefile index 66c48e1a5..19531441b 100644 --- a/pipelined/regression/Makefile +++ b/pipelined/regression/Makefile @@ -11,24 +11,25 @@ make all: # *** Build old tests/imperas-riscv-tests for now; # Delete this part when the privileged tests transition over to tests/wally-riscv-arch-test # Also delete bin/exe2memfile at that point - make -C ../../tests/imperas-riscv-tests - make -C ../../tests/imperas-riscv-tests XLEN=64 - cd ../../tests/imperas-riscv-tests; exe2memfile.pl work/*/*.elf - cd ../../tests/imperas-riscv-tests; extractFunctionRadix.sh work/*/*.elf.objdump + make -C ../../tests/imperas-riscv-tests --jobs + make -C ../../tests/imperas-riscv-tests XLEN=64 --jobs + #cd ../../tests/imperas-riscv-tests; exe2memfile.pl work/*/*.elf + #cd ../../tests/imperas-riscv-tests; extractFunctionRadix.sh work/*/*.elf.objdump # Build riscv-arch-test 64 and 32-bit versions - make -C ../../addins/riscv-arch-test - make -C ../../addins/riscv-arch-test XLEN=32 - cd ../../addins/riscv-arch-test; elf2hex.sh - cd ../../addins/riscv-arch-test; extractFunctionRadix.sh work/*/*/*.elf.objdump + make -C ../../addins/riscv-arch-test --jobs + make -C ../../addins/riscv-arch-test XLEN=32 --jobs + #cd ../../addins/riscv-arch-test; elf2hex.sh + #cd ../../addins/riscv-arch-test; extractFunctionRadix.sh work/*/*/*.elf.objdump # extractFunctionRadix. *** # Build wally-riscv-arch-test - make -C ../../tests/wally-riscv-arch-test/ - make -C ../../tests/wally-riscv-arch-test/ XLEN=32 - cd ../../tests/wally-riscv-arch-test; elf2hex.sh - cd ../../tests/wally-riscv-arch-test; extractFunctionRadix.sh work/*/*/*.elf.objdump + make -C ../../tests/wally-riscv-arch-test/ --jobs + make -C ../../tests/wally-riscv-arch-test/ XLEN=32 --jobs + make -f makefile wally-sim-files + #cd ../../tests/wally-riscv-arch-test; elf2hex.sh + #cd ../../tests/wally-riscv-arch-test; extractFunctionRadix.sh work/*/*/*.elf.objdump # ***extractFunctionRadix # Only compile Imperas tests if they are installed locally. From 789cf13be633800e8c9ca3df325754ced205251d Mon Sep 17 00:00:00 2001 From: Ross Thompson Date: Wed, 2 Feb 2022 19:15:11 -0600 Subject: [PATCH 2/4] broken makefiles. --- pipelined/regression/makefile | 66 +++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 pipelined/regression/makefile diff --git a/pipelined/regression/makefile b/pipelined/regression/makefile new file mode 100644 index 000000000..00ac14327 --- /dev/null +++ b/pipelined/regression/makefile @@ -0,0 +1,66 @@ +ROOT := ../.. +SUFFIX := work +ARCHDIR := $(ROOT)/addins/riscv-arch-test +WALLYDIR:= $(ROOT)/tests/wally-riscv-arch-test +IMPERASDIR := $(ROOT)/tests/imperas-riscv-tests +DIR1 := $(ROOT)/addins/riscv-arch-test/$(SUFFIX) +DIR2 := $(ROOT)/tests/wally-riscv-arch-test/$(SUFFIX) +DIR3 := $(ROOT)/tests/imperas-riscv-tests/$(SUFFIX) +ALLDIRS := $(DIR1) $(DIR2) $(DIR3) + + +#ALLDIRS := . + +ELFFILES ?= $(shell find $(ALLDIRS) -type f -regex ".*\.elf") +MEMFILES ?= $(ELFFILES:.elf=.elf.memfile) +ADDRFILES ?= $(ELFFILES:.elf=.elf.objdump.addr) + +print: + echo "files in $(ALLDIRS) are $(ELFFILES)." + echo "memfiles are $(MEMFILES)" + +.PHONY: all +#.NOTPARALLEL: all +all: elfs wally-sim-files + +wally-sim-files: $(MEMFILES) $(ADDRFILES) + echo "$@" + +.PHONY: elfs +elfs: + make -C $(ARCHDIR) --jobs + make -C $(ARCHDIR) XLEN=64 --jobs + make -C $(WALLYDIR) --jobs + make -C $(WALLYDIR) XLEN=64 --jobs + make -C $(IMPERASDIR) --jobs + make -C $(IMPERASDIR) XLEN=64 --jobs + +# notes to self on how this works. +# The find command locates all of the *.elf files in directory DIR1. A list of .memfiles and +# .addr files are generated from the .elf. These are used as targets. +# % is a wildcard in a make target which is then referenced as % in the depenecies and $* +# in the recipe. +# because elf2hex requires a bit width we use findstring to figure out if the compiled directory +# is XLEN=64 or 32. This is hacky and will likely break in the future. +# the .addr is a separate target so make can split into more jobs and more parallism. +%.elf.memfile: %.elf + echo $(shell echo $(strip $(subst rv,,$(findstring rv64,$*))) | head -c 2) +#ifeq (64,$(subst rv,,$(findstring rv64,$*))) +#ifeq (64,$(shell echo $(strip $(subst rv,,$(findstring rv64,$*))) | head -c 2)) +#ifeq (64,$(subst rv,,$(findstring rv64,$*))) +#ifneq (,$(shell echo $(strip $(subst rv,,$(findstring rv64,$*))) | head -c 2)) + echo $(findstring rv64,$*) + echo hello $* $(shell echo $(findstring rv64,$*) | head -c 4) +#ifneq (,$(findstring rv64,$*)) +ifneq ('',$(shell echo $(findstring rv64,$*) | head -c 4)) + @echo got 64 +# echo riscv64-unknown-elf-elf2hex --bit-width 64 --input $< --output $@ +else + @echo got 32 +# echo riscv64-unknown-elf-elf2hex --bit-width 32 --input $< --output $@ +endif + +%.elf.objdump.addr: %.elf.objdump + extractFunctionRadix.sh $< + +#riscv64-unknown-elf-elf2hex --bit-width $(shell echo $* | head -c 4 | tail -c 2) --input $< --output $@ From 9da3223ce6cfeb1ecf60a9a6e5a3f6667fed3b34 Mon Sep 17 00:00:00 2001 From: Ross Thompson Date: Thu, 3 Feb 2022 00:00:15 -0600 Subject: [PATCH 3/4] Manged to get all the tests compiled and converted to memfiles using new makefiles. --- pipelined/regression/makefile | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/pipelined/regression/makefile b/pipelined/regression/makefile index 00ac14327..ed0913f9d 100644 --- a/pipelined/regression/makefile +++ b/pipelined/regression/makefile @@ -29,9 +29,9 @@ wally-sim-files: $(MEMFILES) $(ADDRFILES) .PHONY: elfs elfs: make -C $(ARCHDIR) --jobs - make -C $(ARCHDIR) XLEN=64 --jobs + make -C $(ARCHDIR) XLEN=32 --jobs make -C $(WALLYDIR) --jobs - make -C $(WALLYDIR) XLEN=64 --jobs + make -C $(WALLYDIR) XLEN=32 --jobs make -C $(IMPERASDIR) --jobs make -C $(IMPERASDIR) XLEN=64 --jobs @@ -44,21 +44,7 @@ elfs: # is XLEN=64 or 32. This is hacky and will likely break in the future. # the .addr is a separate target so make can split into more jobs and more parallism. %.elf.memfile: %.elf - echo $(shell echo $(strip $(subst rv,,$(findstring rv64,$*))) | head -c 2) -#ifeq (64,$(subst rv,,$(findstring rv64,$*))) -#ifeq (64,$(shell echo $(strip $(subst rv,,$(findstring rv64,$*))) | head -c 2)) -#ifeq (64,$(subst rv,,$(findstring rv64,$*))) -#ifneq (,$(shell echo $(strip $(subst rv,,$(findstring rv64,$*))) | head -c 2)) - echo $(findstring rv64,$*) - echo hello $* $(shell echo $(findstring rv64,$*) | head -c 4) -#ifneq (,$(findstring rv64,$*)) -ifneq ('',$(shell echo $(findstring rv64,$*) | head -c 4)) - @echo got 64 -# echo riscv64-unknown-elf-elf2hex --bit-width 64 --input $< --output $@ -else - @echo got 32 -# echo riscv64-unknown-elf-elf2hex --bit-width 32 --input $< --output $@ -endif + riscv64-unknown-elf-elf2hex --bit-width $(if $(findstring rv64,$*),64,32) --input $< --output $@ %.elf.objdump.addr: %.elf.objdump extractFunctionRadix.sh $< From 55382be0555d573d00102e4b3320e9988705d926 Mon Sep 17 00:00:00 2001 From: Ross Thompson Date: Thu, 3 Feb 2022 08:32:48 -0600 Subject: [PATCH 4/4] Completed makefile updates to accelerate the generation of memfiles. There are two makefiles in the regression directory. Makefile calls the submakefiles for generating elf files. The second makefile-memfiles generates the memfiles, addr, and label files. --- pipelined/regression/Makefile | 4 ++- .../regression/{makefile => makefile-memfile} | 25 ++++--------------- 2 files changed, 8 insertions(+), 21 deletions(-) rename pipelined/regression/{makefile => makefile-memfile} (67%) diff --git a/pipelined/regression/Makefile b/pipelined/regression/Makefile index 19531441b..610571691 100644 --- a/pipelined/regression/Makefile +++ b/pipelined/regression/Makefile @@ -27,7 +27,9 @@ make all: # Build wally-riscv-arch-test make -C ../../tests/wally-riscv-arch-test/ --jobs make -C ../../tests/wally-riscv-arch-test/ XLEN=32 --jobs - make -f makefile wally-sim-files + +# build the memfiles and address files. + make -f makefile-memfile wally-sim-files --jobs #cd ../../tests/wally-riscv-arch-test; elf2hex.sh #cd ../../tests/wally-riscv-arch-test; extractFunctionRadix.sh work/*/*/*.elf.objdump # ***extractFunctionRadix diff --git a/pipelined/regression/makefile b/pipelined/regression/makefile-memfile similarity index 67% rename from pipelined/regression/makefile rename to pipelined/regression/makefile-memfile index ed0913f9d..030cf8d57 100644 --- a/pipelined/regression/makefile +++ b/pipelined/regression/makefile-memfile @@ -3,13 +3,7 @@ SUFFIX := work ARCHDIR := $(ROOT)/addins/riscv-arch-test WALLYDIR:= $(ROOT)/tests/wally-riscv-arch-test IMPERASDIR := $(ROOT)/tests/imperas-riscv-tests -DIR1 := $(ROOT)/addins/riscv-arch-test/$(SUFFIX) -DIR2 := $(ROOT)/tests/wally-riscv-arch-test/$(SUFFIX) -DIR3 := $(ROOT)/tests/imperas-riscv-tests/$(SUFFIX) -ALLDIRS := $(DIR1) $(DIR2) $(DIR3) - - -#ALLDIRS := . +ALLDIRS := $(ARCHDIR)/$(SUFFIX) $(WALLYDIR)/$(SUFFIX) $(IMPERASDIR)/$(SUFFIX) ELFFILES ?= $(shell find $(ALLDIRS) -type f -regex ".*\.elf") MEMFILES ?= $(ELFFILES:.elf=.elf.memfile) @@ -19,22 +13,12 @@ print: echo "files in $(ALLDIRS) are $(ELFFILES)." echo "memfiles are $(MEMFILES)" -.PHONY: all -#.NOTPARALLEL: all -all: elfs wally-sim-files +.PHONY: all wally-sim-files +all: wally-sim-files wally-sim-files: $(MEMFILES) $(ADDRFILES) echo "$@" -.PHONY: elfs -elfs: - make -C $(ARCHDIR) --jobs - make -C $(ARCHDIR) XLEN=32 --jobs - make -C $(WALLYDIR) --jobs - make -C $(WALLYDIR) XLEN=32 --jobs - make -C $(IMPERASDIR) --jobs - make -C $(IMPERASDIR) XLEN=64 --jobs - # notes to self on how this works. # The find command locates all of the *.elf files in directory DIR1. A list of .memfiles and # .addr files are generated from the .elf. These are used as targets. @@ -49,4 +33,5 @@ elfs: %.elf.objdump.addr: %.elf.objdump extractFunctionRadix.sh $< -#riscv64-unknown-elf-elf2hex --bit-width $(shell echo $* | head -c 4 | tail -c 2) --input $< --output $@ +.PHONY: clean +clean: