forked from riscv/riscv-opcodes
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
58 lines (41 loc) · 1.96 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
SHELL := /bin/sh
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-system
ALL_REAL_OPCODES := $(ALL_REAL_ILEN32_OPCODES) opcodes-rvc opcodes-rv32c opcodes-rv64c opcodes-custom #opcodes-rvv
# Add your opcodes here
include config.mk
MY_OPCODES ?= $(MEMPOOL_ISA)
ALL_OPCODES := opcodes-pseudo $(ALL_REAL_OPCODES) $(MY_OPCODES) opcodes-rvv-pseudo
# Opcodes to be discarded
DISCARDED_OPCODES := opcodes-frep_CUSTOM
OPCODES ?= $(filter-out $(sort $(DISCARDED_OPCODES)), $(sort $(ALL_OPCODES)))
all: encoding_out.h inst.sverilog
# Makefile inserted as prerequisite of every recipe because it can change due to DISCARDED_OPCODES
encoding_out.h: $(OPCODES) parse_opcodes encoding.h Makefile
echo "/*" > $@
echo " * This file is auto-generated by running 'make $@' in 'riscv-opcodes'" >> $@
echo " */" >> $@
echo >> $@
cat encoding.h >> $@
cat $(OPCODES) | ./parse_opcodes -c >> $@
inst.chisel: $(OPCODES) parse_opcodes Makefile
cat $(OPCODES) | ./parse_opcodes -chisel > $@
inst.go: $(ALL_REAL_ILEN32_OPCODES) parse_opcodes Makefile
cat $(ALL_REAL_ILEN32_OPCODES) | ./parse_opcodes -go > $@
inst.c: $(OPCODES) parse_opcodes Makefile
cat $(OPCODES) | ./parse_opcodes -c > $@
inst.sv: $(OPCODES) parse_opcodes Makefile
cat $(OPCODES) | ./parse_opcodes -sv > $@
inst.py: $(OPCODES) parse_opcodes Makefile
cat $(OPCODES) | ./parse_opcodes -py > $@
inst.rs: $(OPCODES) parse_opcodes Makefile
cat $(OPCODES) | ./parse_opcodes -rust > $@
rustfmt $@
inst.sverilog: $(OPCODES) parse_opcodes Makefile
cat $(OPCODES) | ./parse_opcodes -sverilog > $@
instr-table.tex: $(OPCODES) parse_opcodes Makefile
cat $(OPCODES) | ./parse_opcodes -tex > $@
priv-instr-table.tex: $(OPCODES) parse_opcodes Makefile
cat $(OPCODES) | ./parse_opcodes -privtex > $@
.PHONY : clean
clean :
-rm encoding_out.h inst.* priv-instr-table.tex