diff options
| author | Andrew Waterman <andrew@sifive.com> | 2026-04-29 10:58:27 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-29 10:58:27 -0700 |
| commit | b21cccdc5f4680d9c13a6bd7d9d00b75aea3cbb5 (patch) | |
| tree | 87c74cdee88663a7d7775799fc0006875a651b4b /riscv/insns/psshlr_hs.h | |
| parent | 632777d37139298f0af1ee8d2a001f3ab0bde98c (diff) | |
| parent | f2aa295a31f6d0de376e807b2dfab5a62418c8dc (diff) | |
| download | riscv-isa-sim-master.tar.gz riscv-isa-sim-master.tar.bz2 riscv-isa-sim-master.zip | |
rvp for rv32/rv64
Diffstat (limited to 'riscv/insns/psshlr_hs.h')
| -rw-r--r-- | riscv/insns/psshlr_hs.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/riscv/insns/psshlr_hs.h b/riscv/insns/psshlr_hs.h new file mode 100644 index 00000000..fd7df13d --- /dev/null +++ b/riscv/insns/psshlr_hs.h @@ -0,0 +1,22 @@ +sreg_t sshamt = P_FIELD(RS2, 0, 8); +P_RD_RS1_LOOP(16, 16, { + if (sshamt < 0) { + uint32_t shx; + if (sshamt < -16) + shx = 0; + else if (sshamt == -16) + shx = ((uint16_t)p_rs1 >> 15) & 1; + else + shx = ((uint32_t)(uint16_t)p_rs1 << 1) >> (-sshamt); + p_rd = (uint16_t)((shx + 1) >> 1); + } else { + uint32_t shx = (sshamt >= 16) ? ((uint32_t)(uint16_t)p_rs1 << 16) : ((uint32_t)(uint16_t)p_rs1 << sshamt); + if (shx > 0xFFFF) { + P.VU.vxsat->write(1); + p_rd = 0xFFFF; + } else { + p_rd = (uint16_t)shx; + } + } +}) + |
