Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CHERI CSRs and encodings #237

Draft
wants to merge 29 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
2e8019e
first attempt at CSRs and encodings for CHERI
tariqkurd-repo Dec 19, 2023
5a54e19
note that lr/b etc will be a separate extension eventually
tariqkurd-repo Dec 19, 2023
17a3dd7
resolve overlapping encodings
tariqkurd-repo Jan 4, 2024
a9c4551
remap cincoffsetimm to op-imm-32 and make cincoffset with rs2=x0 deco…
tariqkurd-repo Jan 8, 2024
2c62d98
add rs2 to csetmode
tariqkurd-repo Jan 24, 2024
6fefa7d
instruction renaming to match latest spec
tariqkurd-repo Feb 13, 2024
92a41e4
add extra debug CSRs
tariqkurd-repo Feb 14, 2024
b003edd
put cadd into OP
tariqkurd-repo Feb 19, 2024
20d441d
add CLIC+CHERI registers
tariqkurd-repo Mar 8, 2024
3ac3a8d
Merge branch 'riscv:master' into tariqkurd-repo/master
tariqkurd-repo Mar 8, 2024
edbd3c5
remove duplicate CSRS and add stid/util
tariqkurd-repo Apr 8, 2024
800d76a
remove CLIC duplicated, and reinstate DDC
tariqkurd-repo Apr 8, 2024
8a5cd20
make UTID/STID CSRs more consistent
tariqkurd-repo Apr 8, 2024
fa8a628
delete JALR.MODE
tariqkurd-repo Apr 8, 2024
239ce02
fix mnemonic name
tariqkurd-repo May 15, 2024
28e726e
Merge remote-tracking branch 'origin/master' into tariqkurd-repo/master
tariqkurd-repo May 16, 2024
0ff8471
add lr.c/sc.c
tariqkurd-repo May 20, 2024
4e2a3fd
avoid conflict between cycleh and utid
tariqkurd-repo Jun 3, 2024
acf7da3
make it read only
tariqkurd-repo Jun 3, 2024
29a9ab4
re-instate utid
tariqkurd-repo Jun 3, 2024
d2beb46
Merge branch 'riscv:master' into tariqkurd-repo/master
tariqkurd-repo Jun 4, 2024
d33cd80
update util, add mtid
tariqkurd-repo Jun 10, 2024
06d6b6f
separate cmv from caddi
tariqkurd-repo Jun 10, 2024
9b88c00
correctly split cmv from cadd not from caddi
tariqkurd-repo Jun 10, 2024
b6cb568
Merge branch 'riscv:master' into tariqkurd-repo/master
tariqkurd-repo Aug 29, 2024
c1d327e
add gcmode, gctype
tariqkurd-repo Aug 29, 2024
6fc6c5c
add stval2
tariqkurd-repo Sep 19, 2024
49f4fdf
add vstval2
tariqkurd-repo Sep 19, 2024
8b620fa
update MODESW
tariqkurd-repo Oct 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions arg_lut.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"rt", 19, 15
"rs1", 19, 15
"rs2", 24, 20
"rs2_n0", 24, 20
"rs3", 31, 27
"aqrl", 26, 25
"aq", 26, 26
Expand Down
1 change: 1 addition & 0 deletions constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
'c_mv': {'c_jr'},
'c_jalr': {'c_ebreak'},
'c_add': {'c_ebreak', 'c_jalr'},
'cadd': {'cmv'}
}

isa_regex = \
Expand Down
8 changes: 8 additions & 0 deletions csrs.csv
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
0x142, "scause"
0x143, "stval"
0x144, "sip"
0x14b, "stval2"
0x14D, "stimecmp"
0x14E, "sctrctl"
0x14F, "sctrstatus"
Expand All @@ -83,6 +84,7 @@
0x242, "vscause"
0x243, "vstval"
0x244, "vsip"
0x24b, "vstval2"
0x24D, "vstimecmp"
0x24E, "vsctrctl"
0x250, "vsiselect"
Expand All @@ -94,6 +96,9 @@
0x257, "vsireg6"
0x25C, "vstopei"
0x280, "vsatp"
0x480, "utid"
0x580, "stid"
0x780, "mtid"
0x600, "hstatus"
0x602, "hedeleg"
0x603, "hideleg"
Expand Down Expand Up @@ -246,6 +251,7 @@
0x3ed, "pmpaddr61"
0x3ee, "pmpaddr62"
0x3ef, "pmpaddr63"
0x416, "ddc"
0x747, "mseccfg"
0x7a0, "tselect"
0x7a1, "tdata1"
Expand All @@ -259,6 +265,8 @@
0x7b1, "dpc"
0x7b2, "dscratch0"
0x7b3, "dscratch1"
0x7bc, "dddc"
0x7bd, "dinfcap"
0xB00, "mcycle"
0xB02, "minstret"
0xB03, "mhpmcounter3"
Expand Down
52 changes: 52 additions & 0 deletions unratified/rv64_cheri
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
lc rd rs1 imm12 14..12=4 6..2=0x03 1..0=3
sc imm12hi rs1 rs2 imm12lo 14..12=4 6..2=0x08 1..0=3

#next to ADDIW
caddi rd rs1 imm12 14..12=2 6..2=0x06 1..0=3

#5-bit immediate and 25 says whether to shift it
scbndsi rd rs1 imm5 31..26=1 14..12=5 6..2=0x04 1..0=3

#if rs2=x0 decode as cmove
cadd rd rs1 rs2_n0 31..25=6 14..12=0 6..2=0x0C 1..0=3
cmv rd rs1 24..20=0x0 31..25=6 14..12=0 6..2=0x0C 1..0=3
scaddr rd rs1 rs2 31..25=6 14..12=1 6..2=0x0C 1..0=3
acperm rd rs1 rs2 31..25=6 14..12=2 6..2=0x0C 1..0=3
schi rd rs1 rs2 31..25=6 14..12=3 6..2=0x0C 1..0=3
sceq rd rs1 rs2 31..25=6 14..12=4 6..2=0x0C 1..0=3
cbld rd rs1 rs2 31..25=6 14..12=5 6..2=0x0C 1..0=3
scss rd rs1 rs2 31..25=6 14..12=6 6..2=0x0C 1..0=3
scmode rd rs1 rs2 31..25=6 14..12=7 6..2=0x0C 1..0=3

scbnds rd rs1 rs2 31..25=7 14..12=0 6..2=0x0C 1..0=3
scbndsr rd rs1 rs2 31..25=7 14..12=1 6..2=0x0C 1..0=3

gctag rd rs1 31..25=8 24..20=0 14..12=0 6..2=0x0C 1..0=3
gcperm rd rs1 31..25=8 24..20=1 14..12=0 6..2=0x0C 1..0=3
gctype rd rs1 31..25=8 24..20=2 14..12=0 6..2=0x0C 1..0=3
gcmode rd rs1 31..25=8 24..20=3 14..12=0 6..2=0x0C 1..0=3
gchi rd rs1 31..25=8 24..20=4 14..12=0 6..2=0x0C 1..0=3
gcbase rd rs1 31..25=8 24..20=5 14..12=0 6..2=0x0C 1..0=3
gclen rd rs1 31..25=8 24..20=6 14..12=0 6..2=0x0C 1..0=3
cram rd rs1 31..25=8 24..20=7 14..12=0 6..2=0x0C 1..0=3
sentry rd rs1 31..25=8 24..20=8 14..12=0 6..2=0x0C 1..0=3

modesw.cap 31..25=9 24..15=0 14..12=1 11..7=0 6..2=0x0C 1..0=3
modesw.int 31..25=10 24..15=0 14..12=1 11..7=0 6..2=0x0C 1..0=3

#adjacent to sh[123]add
sh4add rd rs1 rs2 31..25=16 14..12=7 6..2=0x0C 1..0=3

#adjacent to sh[123]add.uw
sh4add.uw rd rs1 rs2 31..25=16 14..12=7 6..2=0x0E 1..0=3

#regular encodings - will become a separate extension
lr.b rd rs1 24..20=0 aq rl 31..29=0 28..27=2 14..12=0 6..2=0x0B 1..0=3
lr.h rd rs1 24..20=0 aq rl 31..29=0 28..27=2 14..12=1 6..2=0x0B 1..0=3
sc.b rd rs1 rs2 aq rl 31..29=0 28..27=3 14..12=0 6..2=0x0B 1..0=3
sc.h rd rs1 rs2 aq rl 31..29=0 28..27=3 14..12=1 6..2=0x0B 1..0=3

#regular encodings for double width datatype
amoswap.c rd rs1 rs2 aq rl 31..29=0 28..27=1 14..12=4 6..2=0x0B 1..0=3
lr.c rd rs1 24..20=0 aq rl 31..29=0 28..27=2 14..12=4 6..2=0x0B 1..0=3
sc.c rd rs1 rs2 aq rl 31..29=0 28..27=3 14..12=4 6..2=0x0B 1..0=3
Loading