mirror of
https://github.com/rdolbeau/VexRiscvBPluginGenerator.git
synced 2025-04-18 18:44:42 -04:00
[zs]unpkd8xy
This commit is contained in:
parent
1554fc57e0
commit
72e26d4da7
4 changed files with 106 additions and 6 deletions
7
Makefile
7
Makefile
|
@ -95,7 +95,12 @@ PSlowDataProcess.scala: gen_plugin data_Zpn_2cycles.txt
|
|||
P64DataProcess.scala: gen_plugin data_Zp64.txt
|
||||
./gen_plugin -w -n P64DataProcess -i data_Zp64.txt -I '*' >| $@
|
||||
|
||||
B: BitManipZba.scala BitManipZbb.scala BitManipZbc.scala BitManipZbf.scala BitManipBFPonly.scala BitManipZbbZbp.scala BitManipZbs.scala BitManipZbt.scala
|
||||
|
||||
scala: CryptoZkne.scala CryptoZknh.scala BitManipZba.scala BitManipZbb.scala BitManipZbc.scala BitManipZbf.scala BitManipBFPonly.scala BitManipZbbZbp.scala BitManipZbs.scala BitManipZbt.scala
|
||||
P: PDataProcess.scala PSlowDataProcess.scala P64DataProcess.scala
|
||||
|
||||
Z: CryptoZkne.scala CryptoZknh.scala
|
||||
|
||||
scala: B P Z
|
||||
|
||||
include $(DEPXX)
|
||||
|
|
38
data_Zpn.txt
38
data_Zpn.txt
|
@ -63,11 +63,11 @@ I SMIN8 SMIN8 1000100----------000-----1110111 pdpicmp Zpn
|
|||
I SMIN16 SMIN16 1000000----------000-----1110111 pdpicmp Zpn
|
||||
I SUB8 SUB8 0100101----------000-----1110111 pdpiadd8 Zpn
|
||||
I SUB16 SUB16 0100001----------000-----1110111 pdpiadd16 Zpn
|
||||
//I SUNPKD810 SUNPKD810 101011001000-----000-----1110111 pdpicpct Zpn
|
||||
//I SUNPKD820 SUNPKD820 101011001001-----000-----1110111 pdpicpct Zpn
|
||||
//I SUNPKD830 SUNPKD830 101011001010-----000-----1110111 pdpicpct Zpn
|
||||
//I SUNPKD831 SUNPKD831 101011001011-----000-----1110111 pdpicpct Zpn
|
||||
//I SUNPKD832 SUNPKD832 101011010011-----000-----1110111 pdpicpct Zpn
|
||||
I SUNPKD810 SUNPKD8 101011001000-----000-----1110111 pdpicpct Zpn
|
||||
I SUNPKD820 SUNPKD8 101011001001-----000-----1110111 pdpicpct Zpn
|
||||
I SUNPKD830 SUNPKD8 101011001010-----000-----1110111 pdpicpct Zpn
|
||||
I SUNPKD831 SUNPKD8 101011001011-----000-----1110111 pdpicpct Zpn
|
||||
I SUNPKD832 SUNPKD8 101011010011-----000-----1110111 pdpicpct Zpn
|
||||
I SWAP8 SWAP8 101011011000-----000-----1110111 pdpibit Zpn
|
||||
I SWAP16 SWAP16 101011011001-----000-----1110111 pdpibit Zpn
|
||||
I UCMPLE8 UCMPLE8 0011111----------000-----1110111 pdpicmp Zpn
|
||||
|
@ -84,6 +84,11 @@ I URADDW URADDW 0011000----------001-----1110111 pdpiadd32 Zpn
|
|||
I URSUB8 URSUB8 0010101----------000-----1110111 pdpiadd8 Zpn
|
||||
I URSUB16 URSUB16 0010001----------000-----1110111 pdpiadd16 Zpn
|
||||
I URSUBW URSUBW 0011001----------001-----1110111 pdpiadd32 Zpn
|
||||
I ZUNPKD810 ZUNPKD8 101011001100-----000-----1110111 pdpicpct Zpn
|
||||
I ZUNPKD820 ZUNPKD8 101011001101-----000-----1110111 pdpicpct Zpn
|
||||
I ZUNPKD830 ZUNPKD8 101011001110-----000-----1110111 pdpicpct Zpn
|
||||
I ZUNPKD831 ZUNPKD8 101011001111-----000-----1110111 pdpicpct Zpn
|
||||
I ZUNPKD832 ZUNPKD8 101011010111-----000-----1110111 pdpicpct Zpn
|
||||
|
||||
// the following needs to read Rd, so need a patch to VexRiscv
|
||||
//INSB need the I in the name to get the immediate from the tool
|
||||
|
@ -146,6 +151,8 @@ S CLO8 "fun_clo8(input(SRC1))"
|
|||
S CLZ8 "fun_clz8(input(SRC1))"
|
||||
S SWAP8 "fun_swap8(input(SRC1))"
|
||||
S SWAP16 "fun_swap16(input(SRC1))"
|
||||
S SUNPKD8 "fun_sunpkd8(input(RS1), input(INSTRUCTION)(24 downto 23) ## input(INSTRUCTION)(21 downto 20))"
|
||||
S ZUNPKD8 "fun_zunpkd8(input(RS1), input(INSTRUCTION)(24 downto 23) ## input(INSTRUCTION)(21 downto 20))"
|
||||
// ternary
|
||||
S PBSADx "fun_pbsada(input(SRC1), input(SRC2), (input(INSTRUCTION)(25).asUInt === 0) ? U(0, 32 bits).asBits | input(SRC3))"
|
||||
S INSBI "fun_insb(input(SRC1), input(SRC2), input(SRC3))"
|
||||
|
@ -579,4 +586,25 @@ P """
|
|||
|
||||
r.asBits.resize(32) // return value
|
||||
}
|
||||
|
||||
def fun_zunpkd8(rs1: Bits, ctrl: Bits) : Bits = {
|
||||
val r = (ctrl).mux(
|
||||
default -> rs1(15 downto 8).resize(16) ## rs1( 7 downto 0).resize(16), // B"4'b0100"
|
||||
B"4'b0101" -> rs1(23 downto 16).resize(16) ## rs1( 7 downto 0).resize(16),
|
||||
B"4'b0110" -> rs1(31 downto 24).resize(16) ## rs1( 7 downto 0).resize(16),
|
||||
B"4'b0111" -> rs1(31 downto 24).resize(16) ## rs1(15 downto 8).resize(16),
|
||||
B"4'b1011" -> rs1(31 downto 24).resize(16) ## rs1(23 downto 16).resize(16)
|
||||
)
|
||||
r // return value
|
||||
}
|
||||
def fun_sunpkd8(rs1: Bits, ctrl: Bits) : Bits = {
|
||||
val r = (ctrl).mux(
|
||||
default -> rs1(15 downto 8).asSInt.resize(16).asBits ## rs1( 7 downto 0).asSInt.resize(16).asBits, // B"4'b0100"
|
||||
B"4'b0101" -> rs1(23 downto 16).asSInt.resize(16).asBits ## rs1( 7 downto 0).asSInt.resize(16).asBits,
|
||||
B"4'b0110" -> rs1(31 downto 24).asSInt.resize(16).asBits ## rs1( 7 downto 0).asSInt.resize(16).asBits,
|
||||
B"4'b0111" -> rs1(31 downto 24).asSInt.resize(16).asBits ## rs1(15 downto 8).asSInt.resize(16).asBits,
|
||||
B"4'b1011" -> rs1(31 downto 24).asSInt.resize(16).asBits ## rs1(23 downto 16).asSInt.resize(16).asBits
|
||||
)
|
||||
r // return value
|
||||
}
|
||||
"""
|
||||
|
|
|
@ -157,4 +157,26 @@ FUN3R(__rv__maddr32, MADDR32)
|
|||
ASM3RMACRO(MSUBR32, 0xc6000077)
|
||||
FUN3R(__rv__msubr32, MSUBR32)
|
||||
|
||||
ASM1MACRO(ZUNPKD810, 0xacc00077)
|
||||
FUN1(__rv__zunpkd810, ZUNPKD810)
|
||||
ASM1MACRO(ZUNPKD820, 0xacd00077)
|
||||
FUN1(__rv__zunpkd820, ZUNPKD820)
|
||||
ASM1MACRO(ZUNPKD830, 0xace00077)
|
||||
FUN1(__rv__zunpkd830, ZUNPKD830)
|
||||
ASM1MACRO(ZUNPKD831, 0xacf00077)
|
||||
FUN1(__rv__zunpkd831, ZUNPKD831)
|
||||
ASM1MACRO(ZUNPKD832, 0xad700077)
|
||||
FUN1(__rv__zunpkd832, ZUNPKD832)
|
||||
|
||||
ASM1MACRO(SUNPKD810, 0xac800077)
|
||||
FUN1(__rv__sunpkd810, SUNPKD810)
|
||||
ASM1MACRO(SUNPKD820, 0xac900077)
|
||||
FUN1(__rv__sunpkd820, SUNPKD820)
|
||||
ASM1MACRO(SUNPKD830, 0xaca00077)
|
||||
FUN1(__rv__sunpkd830, SUNPKD830)
|
||||
ASM1MACRO(SUNPKD831, 0xacb00077)
|
||||
FUN1(__rv__sunpkd831, SUNPKD831)
|
||||
ASM1MACRO(SUNPKD832, 0xad300077)
|
||||
FUN1(__rv__sunpkd832, SUNPKD832)
|
||||
|
||||
#endif // __NEW_INSTRUCTION_SUPPORT_P_H__
|
||||
|
|
45
test_p.c
45
test_p.c
|
@ -747,6 +747,40 @@ uint32_t __rv__maddr32(const uint32_t rs1, const uint32_t rs2, const uint32_t rs
|
|||
uint32_t __rv__msubr32(const uint32_t rs1, const uint32_t rs2, const uint32_t rs3) {
|
||||
return rs3 - (rs1 * rs2);
|
||||
}
|
||||
|
||||
#define GEN_SUNPKD8(x,y) \
|
||||
static inline uint32_t __rv__sunpkd8##x##y(const uint32_t rs1) { \
|
||||
int4x8_t a; \
|
||||
int2x16_t c; \
|
||||
uint32_t r; \
|
||||
memcpy(a, &rs1, 4); \
|
||||
c[1] = a[x]; \
|
||||
c[0] = a[y]; \
|
||||
memcpy(&r, c, 4); \
|
||||
return r; \
|
||||
}
|
||||
#define GEN_ZUNPKD8(x,y) \
|
||||
static inline uint32_t __rv__zunpkd8##x##y(const uint32_t rs1) { \
|
||||
uint4x8_t a; \
|
||||
uint2x16_t c; \
|
||||
uint32_t r; \
|
||||
memcpy(a, &rs1, 4); \
|
||||
c[1] = a[x]; \
|
||||
c[0] = a[y]; \
|
||||
memcpy(&r, c, 4); \
|
||||
return r; \
|
||||
}
|
||||
GEN_SUNPKD8(1,0)
|
||||
GEN_SUNPKD8(2,0)
|
||||
GEN_SUNPKD8(3,0)
|
||||
GEN_SUNPKD8(3,1)
|
||||
GEN_SUNPKD8(3,2)
|
||||
GEN_ZUNPKD8(1,0)
|
||||
GEN_ZUNPKD8(2,0)
|
||||
GEN_ZUNPKD8(3,0)
|
||||
GEN_ZUNPKD8(3,1)
|
||||
GEN_ZUNPKD8(3,2)
|
||||
|
||||
#endif // __riscv
|
||||
|
||||
unsigned int a = 0x01234567;
|
||||
|
@ -908,6 +942,17 @@ int main(int argc, char **argv) {
|
|||
|
||||
T3(__rv__maddr32);
|
||||
T3(__rv__msubr32);
|
||||
|
||||
T1(__rv__sunpkd810);
|
||||
T1(__rv__sunpkd820);
|
||||
T1(__rv__sunpkd830);
|
||||
T1(__rv__sunpkd831);
|
||||
T1(__rv__sunpkd832);
|
||||
T1(__rv__zunpkd810);
|
||||
T1(__rv__zunpkd820);
|
||||
T1(__rv__zunpkd830);
|
||||
T1(__rv__zunpkd831);
|
||||
T1(__rv__zunpkd832);
|
||||
|
||||
b = 0x0100F004 + index;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue