Skip to content

Commit

Permalink
Adds missing opcodes for part. implemented xpulp sets
Browse files Browse the repository at this point in the history
- 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.<op1>.h.<op2> with ones of form pv.<op1>.<op2> 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)
  • Loading branch information
oakentling committed Mar 4, 2022
1 parent c7fad0b commit b845a1d
Show file tree
Hide file tree
Showing 8 changed files with 125 additions and 117 deletions.
30 changes: 15 additions & 15 deletions opcodes-xpulpbitop_CUSTOM_INC
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@
# <args> 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
Expand Down
4 changes: 2 additions & 2 deletions opcodes-xpulpclip_CUSTOM_INC
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
# 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
144 changes: 77 additions & 67 deletions opcodes-xpulpvect_CUSTOM_INC → opcodes-xpulpvect_CUSTOM
Original file line number Diff line number Diff line change
Expand Up @@ -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
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.<op1>.h.<op2> to pv.<op1>.<op2>; 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
22 changes: 22 additions & 0 deletions opcodes-xpulpvectshufflepack_CUSTOM
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# format of a line in this file:
# <instruction name> <args> <opcode>
#
# <opcode> 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)
#
# <args> 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
26 changes: 0 additions & 26 deletions opcodes-xpulpvectshufflepack_CUSTOM_INC

This file was deleted.

1 change: 1 addition & 0 deletions parse_opcodes
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b845a1d

Please sign in to comment.