From bd26319a75b2ae4f52dc397b22c97e19b08d527f Mon Sep 17 00:00:00 2001 From: Neel Gala Date: Fri, 8 Apr 2022 20:51:52 +0530 Subject: updated python script, Makefile and README to process new files - the python file is well commented - the README provides a brief overview of how the python script works and the various artifacts it can generate --- Makefile | 55 ++++++++++++++++++++++++++----------------------------- 1 file changed, 26 insertions(+), 29 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 6354ecc..828916f 100644 --- a/Makefile +++ b/Makefile @@ -1,44 +1,41 @@ -SHELL := /bin/sh - +EXTENSIONS := "rv*" "unratified/rv*" ISASIM_H := ../riscv-isa-sim/riscv/encoding.h PK_H := ../riscv-pk/machine/encoding.h ENV_H := ../riscv-tests/env/encoding.h OPENOCD_H := ../riscv-openocd/src/target/riscv/encoding.h INSTALL_HEADER_FILES := $(ISASIM_H) $(PK_H) $(ENV_H) $(OPENOCD_H) -ALL_REAL_ILEN32_OPCODES := opcodes-rv32i opcodes-rv64i opcodes-rv32m opcodes-rv64m opcodes-rv32a opcodes-rv64a opcodes-rv32h opcodes-rv64h opcodes-rv32f opcodes-rv64f opcodes-rv32d opcodes-rv64d opcodes-rv32q opcodes-rv64q opcodes-rv32xbitmanip opcodes-rv64xbitmanip opcodes-system opcodes-svinval opcodes-rv32zfh opcodes-rv32d-zfh opcodes-rv32q-zfh opcodes-rv64zfh opcodes-rvzk opcodes-rv32zk opcodes-rv64zk opcodes-zicbo opcodes-rv32zba opcodes-rv32zbb opcodes-rv32zbc opcodes-rv32zbkb opcodes-rv32zbkx opcodes-rv32zbs opcodes-rv64zba opcodes-rv64zbb opcodes-rv64zbkb -ALL_REAL_OPCODES := $(ALL_REAL_ILEN32_OPCODES) opcodes-rvc opcodes-rv32c opcodes-rv64c opcodes-custom opcodes-rvv opcodes-rvp - -ALL_OPCODES := opcodes-pseudo $(ALL_REAL_OPCODES) opcodes-rvv-pseudo - -install: encoding.out.h inst.chisel instr-table.tex priv-instr-table.tex - set -e; for FILE in $(INSTALL_HEADER_FILES); do cp -f encoding.out.h $$FILE; done +default: everything -encoding.out.h: $(ALL_OPCODES) parse_opcodes encoding.h - echo "/*" > $@ - echo " * This file is auto-generated by running 'make' in" >> $@ - echo " * https://github.com/riscv/riscv-opcodes (`git log -1 --format="format:%h"`)" >> $@ - echo " */" >> $@ - echo >> $@ - cat encoding.h >> $@ - cat $(ALL_OPCODES) | ./parse_opcodes -c >> $@ +.PHONY : everything +everything: + @./parse.py -c -chisel -sverilog -rust -latex $(EXTENSIONS) -inst.chisel: $(ALL_OPCODES) parse_opcodes - cat $(ALL_OPCODES) | ./parse_opcodes -chisel > $@ +.PHONY : c +c: + @./parse.py -c $(EXTENSIONS) -inst.go: $(ALL_REAL_ILEN32_OPCODES) parse_opcodes - cat $(ALL_REAL_ILEN32_OPCODES) | ./parse_opcodes -go > $@ +.PHONY : chisel +chisel: + @./parse.py -chisel $(EXTENSIONS) -inst.rs: $(ALL_OPCODES) parse_opcodes - cat $(ALL_OPCODES) | ./parse_opcodes -rust > $@ +.PHONY : latex +latex: + @./parse.py -latex $(EXTENSIONS) -inst.sverilog: $(ALL_OPCODES) parse_opcodes - cat $(ALL_OPCODES) | ./parse_opcodes -sverilog > $@ +.PHONY : sverilog +sverilog: + @./parse.py -sverilog $(EXTENSIONS) -instr-table.tex: $(ALL_OPCODES) parse_opcodes - cat $(ALL_OPCODES) | ./parse_opcodes -tex > $@ +.PHONY : rust +rust: + @./parse.py -rust $(EXTENSIONS) -priv-instr-table.tex: $(ALL_OPCODES) parse_opcodes - cat $(ALL_OPCODES) | ./parse_opcodes -privtex > $@ +.PHONY : clean +clean: + rm -f inst* priv-instr-table.tex encoding.out.h .PHONY : install +install: c + set -e; for FILE in $(INSTALL_HEADER_FILES); do cp -f encoding.out.h $$FILE; done + -- cgit v1.1 From 314d83dc5a96e1091d897e67e09e0ca25aa72a1a Mon Sep 17 00:00:00 2001 From: Neel Gala Date: Mon, 2 May 2022 18:16:11 +0530 Subject: adding backward compatible makefile targets --- Makefile | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 828916f..b8cd4db 100644 --- a/Makefile +++ b/Makefile @@ -7,28 +7,31 @@ INSTALL_HEADER_FILES := $(ISASIM_H) $(PK_H) $(ENV_H) $(OPENOCD_H) default: everything +install: everything + set -e; for FILE in $(INSTALL_HEADER_FILES); do cp -f encoding.out.h $$FILE; done + .PHONY : everything everything: @./parse.py -c -chisel -sverilog -rust -latex $(EXTENSIONS) -.PHONY : c -c: +.PHONY : encoding.out.h +encoding.out.h: @./parse.py -c $(EXTENSIONS) -.PHONY : chisel -chisel: +.PHONY : inst.chisel +inst.chisel: @./parse.py -chisel $(EXTENSIONS) .PHONY : latex latex: @./parse.py -latex $(EXTENSIONS) -.PHONY : sverilog -sverilog: +.PHONY : inst.sverilog +inst.sverilog: @./parse.py -sverilog $(EXTENSIONS) -.PHONY : rust -rust: +.PHONY : inst.rs +inst.rs: @./parse.py -rust $(EXTENSIONS) .PHONY : clean @@ -39,3 +42,8 @@ clean: install: c set -e; for FILE in $(INSTALL_HEADER_FILES); do cp -f encoding.out.h $$FILE; done +.PHONY: instr-table.tex +instr-table.tex: latex + +.PHONY: priv-instr-table.tex +priv-instr-table.tex: latex -- cgit v1.1 From bc92b799d9e96b53a0e57e738bff8f12e6e1fc2d Mon Sep 17 00:00:00 2001 From: Neel Gala Date: Mon, 2 May 2022 18:28:53 +0530 Subject: adding support for spinalhdl code generation --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index b8cd4db..be917b4 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ install: everything .PHONY : everything everything: - @./parse.py -c -chisel -sverilog -rust -latex $(EXTENSIONS) + @./parse.py -c -chisel -sverilog -rust -latex -spinalhdl $(EXTENSIONS) .PHONY : encoding.out.h encoding.out.h: @@ -47,3 +47,7 @@ instr-table.tex: latex .PHONY: priv-instr-table.tex priv-instr-table.tex: latex + +.PHONY: inst.spinalhdl +inst.spinalhdl: + @./parse.py -spinalhdl $(EXTENSIONS) -- cgit v1.1