From b845a1d30bbacd916604864058cc90b6cff75acf Mon Sep 17 00:00:00 2001 From: oswaldlo1 Date: Fri, 4 Mar 2022 12:00:23 +0100 Subject: [PATCH] Adds missing opcodes for part. implemented xpulp sets - immediate for xpulpbitop and xpulpclip are not in [CORE-V Instruction Set Extensions](https://cv32e40p.readthedocs.io/en/latest/instruction_set_extensions/#simd-alu-encoding) and therefore not encoded - for xpulpvect replaced opcodes for form pv..h. with ones of form pv.. for op1={add,sub} and op2={div2,div4,div8} - for xpulpminmax used p.addN, p.adduN instead of p.avg, p.avgu as suggested in [Pulp Extensions](https://iis-people.ee.ethz.ch/~balasr/pulp-ext/pulp.html#xpulpminmax) --- opcodes-xpulpbitop_CUSTOM_INC | 30 ++-- ...STOM_INC => opcodes-xpulpbitopsmall_CUSTOM | 11 +- opcodes-xpulpclip_CUSTOM_INC | 4 +- ...x_CUSTOM_INC => opcodes-xpulpminmax_CUSTOM | 4 +- ...ect_CUSTOM_INC => opcodes-xpulpvect_CUSTOM | 144 ++++++++++-------- opcodes-xpulpvectshufflepack_CUSTOM | 22 +++ opcodes-xpulpvectshufflepack_CUSTOM_INC | 26 ---- parse_opcodes | 1 + 8 files changed, 125 insertions(+), 117 deletions(-) rename opcodes-xpulpbitopsmall_CUSTOM_INC => opcodes-xpulpbitopsmall_CUSTOM (63%) rename opcodes-xpulpminmax_CUSTOM_INC => opcodes-xpulpminmax_CUSTOM (75%) rename opcodes-xpulpvect_CUSTOM_INC => opcodes-xpulpvect_CUSTOM (65%) create mode 100644 opcodes-xpulpvectshufflepack_CUSTOM delete mode 100644 opcodes-xpulpvectshufflepack_CUSTOM_INC diff --git a/opcodes-xpulpbitop_CUSTOM_INC b/opcodes-xpulpbitop_CUSTOM_INC index 7c44644c..826aa502 100644 --- a/opcodes-xpulpbitop_CUSTOM_INC +++ b/opcodes-xpulpbitop_CUSTOM_INC @@ -13,23 +13,23 @@ p.extbs rd rs1 31..25=8 24..20=0 14..12=6 6..2=0x0C 1..0=3 p.extbz rd rs1 31..25=8 24..20=0 14..12=7 6..2=0x0C 1..0=3 # missing -# p.extract +p.extract rd rs1 Luimm5 imm5 31..30=3 14..12=0 6..2=0x0C 1..0=3 # p.extracti -# p.extractr -# p.extractu +p.extractr rd rs1 rs2 31..30=2 29..25=0 14..12=0 6..2=0x0C 1..0=3 +p.extractu rd rs1 Luimm5 imm5 31..30=3 14..12=1 6..2=0x0C 1..0=3 # p.extractui -# p.extractur -# p.insert +p.extractur rd rs1 rs2 31..30=2 29..25=0 14..12=1 6..2=0x0C 1..0=3 +p.insert rd rs1 Luimm5 imm5 31..30=3 14..12=2 6..2=0x0C 1..0=3 # p.inserti -# p.insertr -# p.bset +p.insertr rd rs1 rs2 31..30=2 29..25=0 14..12=2 6..2=0x0C 1..0=3 +p.bset rd rs1 Luimm5 imm5 31..30=3 14..12=4 6..2=0x0C 1..0=3 # p.bseti -# p.bsetr -# p.bclr +p.bsetr rd rs1 rs2 31..30=2 29..25=0 14..12=4 6..2=0x0C 1..0=3 +p.bclr rd rs1 Luimm5 imm5 31..30=3 14..12=3 6..2=0x0C 1..0=3 # p.bclri -# p.bclrr -# p.cnt -# p.clb -# p.fl1 -# p.ff1 -# p.ror \ No newline at end of file +p.bclrr rd rs1 rs2 31..30=2 29..25=0 14..12=3 6..2=0x0C 1..0=3 +p.cnt rd rs1 rs2 31..25=8 14..12=3 6..2=0x0C 1..0=3 +p.clb rd rs1 31..25=8 24..20=0 14..12=2 6..2=0x0C 1..0=3 +p.fl1 rd rs1 31..25=8 24..20=0 14..12=1 6..2=0x0C 1..0=3 +p.ff1 rd rs1 31..25=8 24..20=0 14..12=0 6..2=0x0C 1..0=3 +p.ror rd rs1 31..25=4 24..20=0 14..12=5 6..2=0x0C 1..0=3 \ No newline at end of file diff --git a/opcodes-xpulpbitopsmall_CUSTOM_INC b/opcodes-xpulpbitopsmall_CUSTOM similarity index 63% rename from opcodes-xpulpbitopsmall_CUSTOM_INC rename to opcodes-xpulpbitopsmall_CUSTOM index d8fad5eb..05fb624a 100644 --- a/opcodes-xpulpbitopsmall_CUSTOM_INC +++ b/opcodes-xpulpbitopsmall_CUSTOM @@ -7,12 +7,11 @@ # is one of rd, rs1, rs2, rs3, imm20, imm12, imm12lo, imm12hi, # shamtw, shamt, rm -# missing -# p.cnt -# p.clb -# p.fl1 -# p.ff1 -# p.ror +p.cnt rd rs1 rs2 31..25=8 14..12=3 6..2=0x0C 1..0=3 +p.clb rd rs1 31..25=8 24..20=0 14..12=2 6..2=0x0C 1..0=3 +p.fl1 rd rs1 31..25=8 24..20=0 14..12=1 6..2=0x0C 1..0=3 +p.ff1 rd rs1 31..25=8 24..20=0 14..12=0 6..2=0x0C 1..0=3 +p.ror rd rs1 31..25=4 24..20=0 14..12=5 6..2=0x0C 1..0=3 p.exths rd rs1 31..25=8 24..20=0 14..12=4 6..2=0x0C 1..0=3 p.exthz rd rs1 31..25=8 24..20=0 14..12=5 6..2=0x0C 1..0=3 diff --git a/opcodes-xpulpclip_CUSTOM_INC b/opcodes-xpulpclip_CUSTOM_INC index b82e472b..42fc32f2 100644 --- a/opcodes-xpulpclip_CUSTOM_INC +++ b/opcodes-xpulpclip_CUSTOM_INC @@ -9,11 +9,11 @@ p.clip rd rs1 imm5 31..25=10 14..12=1 6..2=0x0C 1..0=3 -# missing p.clipi +# missing p.clipi; not in cv32e40p user manual p.clipu rd rs1 imm5 31..25=10 14..12=2 6..2=0x0C 1..0=3 p.clipr rd rs1 rs2 31..25=10 14..12=5 6..2=0x0C 1..0=3 -# missing p.clipui +# missing p.clipui; not in cv32e40p user manual p.clipur rd rs1 rs2 31..25=10 14..12=6 6..2=0x0C 1..0=3 \ No newline at end of file diff --git a/opcodes-xpulpminmax_CUSTOM_INC b/opcodes-xpulpminmax_CUSTOM similarity index 75% rename from opcodes-xpulpminmax_CUSTOM_INC rename to opcodes-xpulpminmax_CUSTOM index d3835945..8185540e 100644 --- a/opcodes-xpulpminmax_CUSTOM_INC +++ b/opcodes-xpulpminmax_CUSTOM @@ -11,4 +11,6 @@ p.min rd rs1 rs2 31..25=2 14..12=4 6..2=0x0C 1..0=3 p.minu rd rs1 rs2 31..25=2 14..12=5 6..2=0x0C 1..0=3 p.max rd rs1 rs2 31..25=2 14..12=6 6..2=0x0C 1..0=3 p.maxu rd rs1 rs2 31..25=2 14..12=7 6..2=0x0C 1..0=3 -# might be missing p.avg, p.avgu respectively p.addN, p.adduN \ No newline at end of file +# might be missing p.avg, p.avgu respectively p.addN, p.adduN +p.addN rd rs1 rs2 31..30=0 Luimm5 14..12=2 6..=0x16 1..0=3 +p.adduN rd rs1 rs2 31..30=2 Luimm5 14..12=2 6..=0x16 1..0=3 \ No newline at end of file diff --git a/opcodes-xpulpvect_CUSTOM_INC b/opcodes-xpulpvect_CUSTOM similarity index 65% rename from opcodes-xpulpvect_CUSTOM_INC rename to opcodes-xpulpvect_CUSTOM index 6d671587..4468e497 100644 --- a/opcodes-xpulpvect_CUSTOM_INC +++ b/opcodes-xpulpvect_CUSTOM @@ -149,70 +149,80 @@ pv.sdotusp.b rd rs1 rs2 31..27=21 26=0 25=0 14..12=1 6..2=0x15 1..0=3 pv.sdotusp.sc.b rd rs1 rs2 31..27=21 26=0 25=0 14..12=5 6..2=0x15 1..0=3 pv.sdotusp.sci.b rd rs1 imm6 31..27=21 26=0 14..12=7 6..2=0x15 1..0=3 -# missing -# pv.cmpeq.h -# pv.cmpeq.sc.h -# pv.cmpeq.sci.h -# pv.cmpeq.b -# pv.cmpeq.sc.b -# pv.cmpeq.sci.b -# pv.cmpne.h -# pv.cmpne.sc.h -# pv.cmpne.sci.h -# pv.cmpne.b -# pv.cmpne.sc.b -# pv.cmpne.sci.b -# pv.cmpgt.h -# pv.cmpgt.sc.h -# pv.cmpgt.sci.h -# pv.cmpgt.b -# pv.cmpgt.sc.b -# pv.cmpgt.sci.b -# pv.cmpge.h -# pv.cmpge.sc.h -# pv.cmpge.sci.h -# pv.cmpge.b -# pv.cmpge.sc.b -# pv.cmpge.sci.b -# pv.cmplt.h -# pv.cmplt.sc.h -# pv.cmplt.sci.h -# pv.cmplt.b -# pv.cmplt.sc.b -# pv.cmplt.sci.b -# pv.cmple.h -# pv.cmple.sc.h -# pv.cmple.sci.h -# pv.cmple.b -# pv.cmple.sc.b -# pv.cmple.sci.b -# pv.cmpgtu.h -# pv.cmpgtu.sc.h -# pv.cmpgtu.sci.h -# pv.cmpgtu.b -# pv.cmpgtu.sc.b -# pv.cmpgtu.sci.b -# pv.cmpgeu.h -# pv.cmpgeu.sc.h -# pv.cmpgeu.sci.h -# pv.cmpgeu.b -# pv.cmpgeu.sc.b -# pv.cmpgeu.sci.b -# pv.cmpltu.h -# pv.cmpltu.sc.h -# pv.cmpltu.sci.h -# pv.cmpltu.b -# pv.cmpltu.sc.b -# pv.cmpltu.sci.b -# pv.cmpleu.h -# pv.cmpleu.sc.h -# pv.cmpleu.sci.h -# pv.cmpleu.b -# pv.cmpleu.sc.b -# pv.cmpleu.sci.b -# pv.add.h.div2 -# pv.add.h.div4 -# pv.add.h.div8 -# pv.sub.h.div2 -# pv.sub.h.div4 -# pv.sub.h.div8 \ No newline at end of file +pv.cmpeq.h rd rs1 rs2 31..27=0 26=1 25=0 14..12=0 6..2=0x15 1..0=3 +pv.cmpeq.sc.h rd rs1 rs2 31..27=0 26=1 25=0 14..12=4 6..2=0x15 1..0=3 +pv.cmpeq.sci.h rd rs1 imm6 31..27=0 26=1 14..12=6 6..2=0x15 1..0=3 +pv.cmpeq.b rd rs1 rs2 31..27=0 26=1 25=0 14..12=1 6..2=0x15 1..0=3 +pv.cmpeq.sc.b rd rs1 rs2 31..27=0 26=1 25=0 14..12=5 6..2=0x15 1..0=3 +pv.cmpeq.sci.b rd rs1 imm6 31..27=0 26=1 14..12=7 6..2=0x15 1..0=3 + +pv.cmpne.h rd rs1 rs2 31..27=1 26=1 25=0 14..12=0 6..2=0x15 1..0=3 +pv.cmpne.sc.h rd rs1 rs2 31..27=1 26=1 25=0 14..12=4 6..2=0x15 1..0=3 +pv.cmpne.sci.h rd rs1 imm6 31..27=1 26=1 14..12=6 6..2=0x15 1..0=3 +pv.cmpne.b rd rs1 rs2 31..27=1 26=1 25=0 14..12=1 6..2=0x15 1..0=3 +pv.cmpne.sc.b rd rs1 rs2 31..27=1 26=1 25=0 14..12=5 6..2=0x15 1..0=3 +pv.cmpne.sci.b rd rs1 imm6 31..27=1 26=1 14..12=7 6..2=0x15 1..0=3 + +pv.cmpgt.h rd rs1 rs2 31..27=2 26=1 25=0 14..12=0 6..2=0x15 1..0=3 +pv.cmpgt.sc.h rd rs1 rs2 31..27=2 26=1 25=0 14..12=4 6..2=0x15 1..0=3 +pv.cmpgt.sci.h rd rs1 imm6 31..27=2 26=1 14..12=6 6..2=0x15 1..0=3 +pv.cmpgt.b rd rs1 rs2 31..27=2 26=1 25=0 14..12=1 6..2=0x15 1..0=3 +pv.cmpgt.sc.b rd rs1 rs2 31..27=2 26=1 25=0 14..12=5 6..2=0x15 1..0=3 +pv.cmpgt.sci.b rd rs1 imm6 31..27=2 26=1 14..12=7 6..2=0x15 1..0=3 + +pv.cmpge.h rd rs1 rs2 31..27=3 26=1 25=0 14..12=0 6..2=0x15 1..0=3 +pv.cmpge.sc.h rd rs1 rs2 31..27=3 26=1 25=0 14..12=4 6..2=0x15 1..0=3 +pv.cmpge.sci.h rd rs1 imm6 31..27=3 26=1 14..12=6 6..2=0x15 1..0=3 +pv.cmpge.b rd rs1 rs2 31..27=3 26=1 25=0 14..12=1 6..2=0x15 1..0=3 +pv.cmpge.sc.b rd rs1 rs2 31..27=3 26=1 25=0 14..12=5 6..2=0x15 1..0=3 +pv.cmpge.sci.b rd rs1 imm6 31..27=3 26=1 14..12=7 6..2=0x15 1..0=3 + +pv.cmplt.h rd rs1 rs2 31..27=4 26=1 25=0 14..12=0 6..2=0x15 1..0=3 +pv.cmplt.sc.h rd rs1 rs2 31..27=4 26=1 25=0 14..12=4 6..2=0x15 1..0=3 +pv.cmplt.sci.h rd rs1 imm6 31..27=4 26=1 14..12=6 6..2=0x15 1..0=3 +pv.cmplt.b rd rs1 rs2 31..27=4 26=1 25=0 14..12=1 6..2=0x15 1..0=3 +pv.cmplt.sc.b rd rs1 rs2 31..27=4 26=1 25=0 14..12=5 6..2=0x15 1..0=3 +pv.cmplt.sci.b rd rs1 imm6 31..27=4 26=1 14..12=7 6..2=0x15 1..0=3 + +pv.cmple.h rd rs1 rs2 31..27=5 26=1 25=0 14..12=0 6..2=0x15 1..0=3 +pv.cmple.sc.h rd rs1 rs2 31..27=5 26=1 25=0 14..12=4 6..2=0x15 1..0=3 +pv.cmple.sci.h rd rs1 imm6 31..27=5 26=1 14..12=6 6..2=0x15 1..0=3 +pv.cmple.b rd rs1 rs2 31..27=5 26=1 25=0 14..12=1 6..2=0x15 1..0=3 +pv.cmple.sc.b rd rs1 rs2 31..27=5 26=1 25=0 14..12=5 6..2=0x15 1..0=3 +pv.cmple.sci.b rd rs1 imm6 31..27=5 26=1 14..12=7 6..2=0x15 1..0=3 + +pv.cmpgtu.h rd rs1 rs2 31..27=6 26=1 25=0 14..12=0 6..2=0x15 1..0=3 +pv.cmpgtu.sc.h rd rs1 rs2 31..27=6 26=1 25=0 14..12=4 6..2=0x15 1..0=3 +pv.cmpgtu.sci.h rd rs1 imm6 31..27=6 26=1 14..12=6 6..2=0x15 1..0=3 +pv.cmpgtu.b rd rs1 rs2 31..27=6 26=1 25=0 14..12=1 6..2=0x15 1..0=3 +pv.cmpgtu.sc.b rd rs1 rs2 31..27=6 26=1 25=0 14..12=5 6..2=0x15 1..0=3 +pv.cmpgtu.sci.b rd rs1 imm6 31..27=6 26=1 14..12=7 6..2=0x15 1..0=3 + +pv.cmpgeu.h rd rs1 rs2 31..27=7 26=1 25=0 14..12=0 6..2=0x15 1..0=3 +pv.cmpgeu.sc.h rd rs1 rs2 31..27=7 26=1 25=0 14..12=4 6..2=0x15 1..0=3 +pv.cmpgeu.sci.h rd rs1 imm6 31..27=7 26=1 14..12=6 6..2=0x15 1..0=3 +pv.cmpgeu.b rd rs1 rs2 31..27=7 26=1 25=0 14..12=1 6..2=0x15 1..0=3 +pv.cmpgeu.sc.b rd rs1 rs2 31..27=7 26=1 25=0 14..12=5 6..2=0x15 1..0=3 +pv.cmpgeu.sci.b rd rs1 imm6 31..27=7 26=1 14..12=7 6..2=0x15 1..0=3 + +pv.cmpltu.h rd rs1 rs2 31..27=8 26=1 25=0 14..12=0 6..2=0x15 1..0=3 +pv.cmpltu.sc.h rd rs1 rs2 31..27=8 26=1 25=0 14..12=4 6..2=0x15 1..0=3 +pv.cmpltu.sci.h rd rs1 imm6 31..27=8 26=1 14..12=6 6..2=0x15 1..0=3 +pv.cmpltu.b rd rs1 rs2 31..27=8 26=1 25=0 14..12=1 6..2=0x15 1..0=3 +pv.cmpltu.sc.b rd rs1 rs2 31..27=8 26=1 25=0 14..12=5 6..2=0x15 1..0=3 +pv.cmpltu.sci.b rd rs1 imm6 31..27=8 26=1 14..12=7 6..2=0x15 1..0=3 + +pv.cmpleu.h rd rs1 rs2 31..27=9 26=1 25=0 14..12=0 6..2=0x15 1..0=3 +pv.cmpleu.sc.h rd rs1 rs2 31..27=9 26=1 25=0 14..12=4 6..2=0x15 1..0=3 +pv.cmpleu.sci.h rd rs1 imm6 31..27=9 26=1 14..12=6 6..2=0x15 1..0=3 +pv.cmpleu.b rd rs1 rs2 31..27=9 26=1 25=0 14..12=1 6..2=0x15 1..0=3 +pv.cmpleu.sc.b rd rs1 rs2 31..27=9 26=1 25=0 14..12=5 6..2=0x15 1..0=3 +pv.cmpleu.sci.b rd rs1 imm6 31..27=9 26=1 14..12=7 6..2=0x15 1..0=3 + +#might have been renamed from pv..h. to pv..; added those +pv.add.div2 rd rs1 rs2 31..27=14 26=1 25=0 14..12=2 6..2=0x15 1..0=3 +pv.add.div4 rd rs1 rs2 31..27=14 26=1 25=0 14..12=4 6..2=0x15 1..0=3 +pv.add.div8 rd rs1 rs2 31..27=14 26=1 25=0 14..12=6 6..2=0x15 1..0=3 +pv.sub.div2 rd rs1 rs2 31..27=12 26=1 25=0 14..12=2 6..2=0x15 1..0=3 +pv.sub.div4 rd rs1 rs2 31..27=12 26=1 25=0 14..12=4 6..2=0x15 1..0=3 +pv.sub.div8 rd rs1 rs2 31..27=12 26=1 25=0 14..12=6 6..2=0x15 1..0=3 \ No newline at end of file diff --git a/opcodes-xpulpvectshufflepack_CUSTOM b/opcodes-xpulpvectshufflepack_CUSTOM new file mode 100644 index 00000000..1fd0b32a --- /dev/null +++ b/opcodes-xpulpvectshufflepack_CUSTOM @@ -0,0 +1,22 @@ +# format of a line in this file: +# +# +# is given by specifying one or more range/value pairs: +# hi..lo=value or bit=value or arg=value (e.g. 6..2=0x45 10=1 rd=0) +# +# is one of rd, rs1, rs2, rs3, imm20, imm12, imm12lo, imm12hi, +# shamtw, shamt, rm + +pv.shuffle.h rd rs1 rs2 31..27=24 26=0 25=0 14..12=0 6..2=0x15 1..0=3 +pv.shuffle.sci.h rd rs1 imm6 31..27=24 26=0 14..12=6 6..2=0x15 1..0=3 +pv.shuffle.b rd rs1 rs2 31..27=24 26=0 25=0 14..12=1 6..2=0x15 1..0=3 +pv.shufflei0.sci.b rd rs1 imm6 31..27=24 26=0 14..12=7 6..2=0x15 1..0=3 +pv.shufflei1.sci.b rd rs1 imm6 31..27=29 26=0 14..12=7 6..2=0x15 1..0=3 +pv.shufflei2.sci.b rd rs1 imm6 31..27=30 26=0 14..12=7 6..2=0x15 1..0=3 +pv.shufflei3.sci.b rd rs1 imm6 31..27=31 26=0 14..12=7 6..2=0x15 1..0=3 +pv.shuffle.h rd rs1 rs2 31..27=24 26=0 25=0 14..12=0 6..2=0x15 1..0=3 +pv.shuffle.b rd rs1 rs2 31..27=24 26=0 25=0 14..12=1 6..2=0x15 1..0=3 +pv.pack rd rs1 rs2 31..27=26 26=0 25=0 14..12=0 6..2=0x15 1..0=3 +pv.pack.h rd rs1 rs2 31..27=26 26=0 25=1 14..12=0 6..2=0x15 1..0=3 +pv.packhi.b rd rs1 rs2 31..27=27 26=0 25=0 14..12=1 6..2=0x15 1..0=3 +pv.packlo.b rd rs1 rs2 31..27=28 26=0 25=0 14..12=1 6..2=0x15 1..0=3 \ No newline at end of file diff --git a/opcodes-xpulpvectshufflepack_CUSTOM_INC b/opcodes-xpulpvectshufflepack_CUSTOM_INC deleted file mode 100644 index e39cf83e..00000000 --- a/opcodes-xpulpvectshufflepack_CUSTOM_INC +++ /dev/null @@ -1,26 +0,0 @@ -# format of a line in this file: -# -# -# is given by specifying one or more range/value pairs: -# hi..lo=value or bit=value or arg=value (e.g. 6..2=0x45 10=1 rd=0) -# -# is one of rd, rs1, rs2, rs3, imm20, imm12, imm12lo, imm12hi, -# shamtw, shamt, rm - -# missing -# pv.shuffle.h -# pv.shuffle.sci.h -# pv.shuffle.b -# pv.shufflei0.sci.b -# pv.shufflei1.sci.b -# pv.shufflei2.sci.b -# pv.shufflei3.sci.b - -pv.shuffle.h rd rs1 rs2 31..27=24 26=0 25=0 14..12=0 6..2=0x15 1..0=3 -pv.shuffle.b rd rs1 rs2 31..27=24 26=0 25=0 14..12=1 6..2=0x15 1..0=3 - -# missing -# pv.pack -# pv.pack.h -# pv.packhi.b -# pv.packlo.b \ No newline at end of file diff --git a/parse_opcodes b/parse_opcodes index bc8b94e1..e359f7d9 100755 --- a/parse_opcodes +++ b/parse_opcodes @@ -42,6 +42,7 @@ arglut['prs3'] = (11,7) arglut['imm6'] = (25,20) arglut['L'] = (7,7) arglut['uimms'] = (19,15) +arglut['Luimm5'] = (29,25) # for vectors arglut['vd'] = (11,7)