Skip to content

Commit d0a31b2

Browse files
chihminchaocolluca
authored andcommitted
ext-p : update table to v0.20 (riscv#413)
Quoted from spec "This version (020) differs from the previous one (019) with the addition of: * SHL instructions (shift left or right, logical) that are unsigned versions of the SHA instructions (shift left or right, arithmetic); and * for RV64 only, ‘P’-suffi x versions of PNCLIP instructions that are similar to RV32 PNCLIP instructions without shifting or rounding. The complete set of instructions added for RV32 are: PSSHL.HS SSHL PSSHL.DHS PSSHL.DWS PSSHLR.HS SSHLR PSSHLR.DHS PSSHLR.DWS And for RV64: PSSHL.HS PSSHL.WS SHL PNCLIPP.B PNCLIPP.H PNCLIPP.W PSSHLR.HS PSSHLR.WS SHLR PNCLIPUP.B PNCLIPUP.H PNCLIPUP.W" reference: https://www.jhauser.us/RISCV/ext-P/RVP-instrEncodings-020.pdf Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
1 parent 8c59242 commit d0a31b2

4 files changed

Lines changed: 24 additions & 0 deletions

File tree

extensions/unratified/rv32_p

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ $pseudo_op rv64_p::psslai.w sslai 31=1 30..28=0x5 27=0 26..25=0x
1010

1111

1212
# Page 7: Scalar Operand Shift Instructions - Pseudo-instructions
13+
$pseudo_op rv64_p::psshl.ws sshl 31=1 30..28=0x2 27=1 26..25=0x1 rs2 rs1 14..12=0x2 rd 6..0=0x1b
14+
$pseudo_op rv64_p::psshlr.ws sshlr 31=1 30..28=0x3 27=1 26..25=0x1 rs2 rs1 14..12=0x2 rd 6..0=0x1b
1315
$pseudo_op rv64_p::pssha.ws ssha 31=1 30..28=0x6 27=1 26..25=0x1 rs2 rs1 14..12=0x2 rd 6..0=0x1b
1416
$pseudo_op rv64_p::psshar.ws sshar 31=1 30..28=0x7 27=1 26..25=0x1 rs2 rs1 14..12=0x2 rd 6..0=0x1b
1517

@@ -272,6 +274,11 @@ padd.dhs 31=0 30..28=0x1 27=1 26..25=0x0 rs2 p_rs1_p 15..12=0x6 p_rd_
272274
padd.dws 31=0 30..28=0x1 27=1 26..25=0x1 rs2 p_rs1_p 15..12=0x6 p_rd_p 7..0=0x1b
273275
padd.dbs 31=0 30..28=0x1 27=1 26..25=0x2 rs2 p_rs1_p 15..12=0x6 p_rd_p 7..0=0x1b
274276

277+
psshl.dhs 31=0 30..28=0x2 27=1 26..25=0x0 rs2 p_rs1_p 15..12=0x6 p_rd_p 7..0=0x1b
278+
psshl.dws 31=0 30..28=0x2 27=1 26..25=0x1 rs2 p_rs1_p 15..12=0x6 p_rd_p 7..0=0x1b
279+
psshlr.dhs 31=0 30..28=0x3 27=1 26..25=0x0 rs2 p_rs1_p 15..12=0x6 p_rd_p 7..0=0x1b
280+
psshlr.dws 31=0 30..28=0x3 27=1 26..25=0x1 rs2 p_rs1_p 15..12=0x6 p_rd_p 7..0=0x1b
281+
275282
pssha.dhs 31=0 30..28=0x6 27=1 26..25=0x0 rs2 p_rs1_p 15..12=0x6 p_rd_p 7..0=0x1b
276283
pssha.dws 31=0 30..28=0x6 27=1 26..25=0x1 rs2 p_rs1_p 15..12=0x6 p_rd_p 7..0=0x1b
277284

extensions/unratified/rv64_p

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,14 @@ pli.w 31=1 30..28=0x3 27=0 26..25=0x1 p_imm10 14..12=0x2 rd 6..
1818
psll.ws 31=1 30..28=0x0 27=1 26..25=0x1 rs2 rs1 14..12=0x2 rd 6..0=0x1b
1919
padd.ws 31=1 30..28=0x1 27=1 26..25=0x1 rs2 rs1 14..12=0x2 rd 6..0=0x1b
2020

21+
psshl.ws 31=1 30..28=0x2 27=1 26..25=0x1 rs2 rs1 14..12=0x2 rd 6..0=0x1b
22+
psshlr.ws 31=1 30..28=0x3 27=1 26..25=0x1 rs2 rs1 14..12=0x2 rd 6..0=0x1b
2123
pssha.ws 31=1 30..28=0x6 27=1 26..25=0x1 rs2 rs1 14..12=0x2 rd 6..0=0x1b
2224
sha 31=1 30..28=0x6 27=1 26..25=0x3 rs2 rs1 14..12=0x2 rd 6..0=0x1b
2325
psshar.ws 31=1 30..28=0x7 27=1 26..25=0x1 rs2 rs1 14..12=0x2 rd 6..0=0x1b
2426
shar 31=1 30..28=0x7 27=1 26..25=0x3 rs2 rs1 14..12=0x2 rd 6..0=0x1b
27+
shl 31=1 30..28=0x2 27=1 26..25=0x3 rs2 rs1 14..12=0x2 rd 6..0=0x1b
28+
shlr 31=1 30..28=0x3 27=1 26..25=0x3 rs2 rs1 14..12=0x2 rd 6..0=0x1b
2529

2630

2731
# Page 6: Unary Instructions & PLUI (OP-IMM-32, funct3=010)
@@ -69,8 +73,17 @@ pmaccu.w.h01 31=1 30..27=0x7 26..25=0x1 rs2 rs1 14..12=0x1 rd 6..0=0x3b
6973
maccu.w01 31=1 30..27=0x7 26..25=0x3 rs2 rs1 14..12=0x1 rd 6..0=0x3b
7074

7175
# Page 11: Shift-Add & ZIP/UNZIP Instructions (OP-32, funct3=010)
76+
pnclipup.b 31=1 30..28=0x0 27=0 26..25=0x0 rs2 rs1 14..12=0x2 rd 6..0=0x3b
77+
pnclipup.h 31=1 30..28=0x0 27=0 26..25=0x1 rs2 rs1 14..12=0x2 rd 6..0=0x3b
78+
pnclipup.w 31=1 30..28=0x0 27=0 26..25=0x3 rs2 rs1 14..12=0x2 rd 6..0=0x3b
79+
7280
psh1add.w 31=1 30..28=0x2 27=0 26..25=0x1 rs2 rs1 14..12=0x2 rd 6..0=0x3b
7381
pssh1sadd.w 31=1 30..28=0x3 27=0 26..25=0x1 rs2 rs1 14..12=0x2 rd 6..0=0x3b
82+
83+
pnclipp.b 31=1 30..28=0x4 27=0 26..25=0x0 rs2 rs1 14..12=0x2 rd 6..0=0x3b
84+
pnclipp.h 31=1 30..28=0x4 27=0 26..25=0x1 rs2 rs1 14..12=0x2 rd 6..0=0x3b
85+
pnclipp.w 31=1 30..28=0x4 27=0 26..25=0x3 rs2 rs1 14..12=0x2 rd 6..0=0x3b
86+
7487
unzip8p 31=1 30..28=0x6 27=0 26..25=0x0 rs2 rs1 14..12=0x2 rd 6..0=0x3b
7588
unzip16p 31=1 30..28=0x6 27=0 26..25=0x1 rs2 rs1 14..12=0x2 rd 6..0=0x3b
7689
unzip8hp 31=1 30..28=0x6 27=0 26..25=0x2 rs2 rs1 14..12=0x2 rd 6..0=0x3b

extensions/unratified/rv_p

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ plui.h 31..27=0x1e 26..25=0x0 p_imm10 14..12=0x2 rd 6..0=0x1b
2929
# Page 7: Scalar Operand Shift/Add Instructions (OP-IMM-32, funct3=010)
3030
psll.hs 31=1 30..28=0x0 27=1 26..25=0x0 rs2 rs1 14..12=0x2 rd 6..0=0x1b
3131
psll.bs 31=1 30..28=0x0 27=1 26..25=0x2 rs2 rs1 14..12=0x2 rd 6..0=0x1b
32+
psshl.hs 31=1 30..28=0x2 27=1 26..25=0x0 rs2 rs1 14..12=0x2 rd 6..0=0x1b
33+
psshlr.hs 31=1 30..28=0x3 27=1 26..25=0x0 rs2 rs1 14..12=0x2 rd 6..0=0x1b
3234

3335
# Page 9: Packed Add/Sub Instructions (OP-32, funct3=000)
3436
padd.hs 31=1 30..28=0x1 27=1 26..25=0x0 rs2 rs1 14..12=0x2 rd 6..0=0x1b

src/riscv_opcodes/constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,8 @@ def read_arg_lut_csv(filename: str) -> "dict[str, tuple[int, int]]":
327327
"srari_rv32",
328328
"ssha",
329329
"sshar",
330+
"sshl",
331+
"sshlr",
330332
"sslai",
331333
"ssub",
332334
"ssubu",

0 commit comments

Comments
 (0)