diff options
| author | cheapie <cheapiephp@gmail.com> | 2026-06-14 19:38:46 -0500 |
|---|---|---|
| committer | cheapie <cheapiephp@gmail.com> | 2026-06-14 19:38:46 -0500 |
| commit | 638c56796678da47fef836fbdd056cfb75a639fc (patch) | |
| tree | 02d29d929a72168853cd99c9a4af307a3997b561 /assembly/xh3bextm-test/xh3bextm-test.S | |
| parent | bc039700b6381040f9b907613654e201c83e17e5 (diff) | |
| download | rvcontroller-638c56796678da47fef836fbdd056cfb75a639fc.tar rvcontroller-638c56796678da47fef836fbdd056cfb75a639fc.tar.gz rvcontroller-638c56796678da47fef836fbdd056cfb75a639fc.tar.bz2 rvcontroller-638c56796678da47fef836fbdd056cfb75a639fc.tar.xz rvcontroller-638c56796678da47fef836fbdd056cfb75a639fc.zip | |
Add Xh3bextm extension from Hazard3
Diffstat (limited to 'assembly/xh3bextm-test/xh3bextm-test.S')
| -rw-r--r-- | assembly/xh3bextm-test/xh3bextm-test.S | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/assembly/xh3bextm-test/xh3bextm-test.S b/assembly/xh3bextm-test/xh3bextm-test.S new file mode 100644 index 0000000..20ae6c2 --- /dev/null +++ b/assembly/xh3bextm-test/xh3bextm-test.S @@ -0,0 +1,40 @@ +# Xh3bextm macros are from the Hazard3 reference manual, slightly modified +.macro h3.bextm rd rs1 rs2 nbits + .if (\nbits < 1) || (\nbits > 8) + .err + .endif + .insn r 0x0b, 0x0, (((\nbits - 1) & 0x7 ) << 1), \rd, \rs1, \rs2 +.endm + +.macro h3.bextmi rd rs1 shamt nbits + .if (\nbits < 1) || (\nbits > 8) + .err + .endif + .if (\shamt < 0) || (\shamt > 31) + .err + .endif + .insn i 0x0b, 0x4, \rd, \rs1, (\shamt & 0x1f) | (((\nbits - 1) & 0x7 ) << 6) +.endm + +li t0,0xdeadbeef +li t1,4 + +h3.bextm s0,t0,t1,6 + +# 0xDEADBEEF = 1101 1110 1010 1101 1011 1110 1110 1111 (rs1) +# vv vvvv +# 10 1110 = 0x2E +# |---6---| (imm) +# |--4-| (rs2) + + +h3.bextmi s1,t0,16,3 + +# 0xDEADBEEF = 1101 1110 1010 1101 1011 1110 1110 1111 (rs1) +# vvv +# 101 = 0x5 +# |-3-| (imm2) +# |--------16--------| (imm1) + +li a7,10 +ecall |
