aboutsummaryrefslogtreecommitdiff
path: root/riscv/insns/fli_d.h
diff options
context:
space:
mode:
authorPhilipp Tomsich <philipp.tomsich@vrull.eu>2023-03-17 20:38:34 +0100
committerPhilipp Tomsich <philipp.tomsich@vrull.eu>2023-04-03 16:55:14 -0700
commit09140c07e13ddd3951c231e1fb7cbe2d3d41f7aa (patch)
tree36b92616ad46d34ab23606a883f6e835a11f0f2d /riscv/insns/fli_d.h
parentf002b931d076af91c35dad05dd54580112b4a9d6 (diff)
downloadriscv-isa-sim-09140c07e13ddd3951c231e1fb7cbe2d3d41f7aa.zip
riscv-isa-sim-09140c07e13ddd3951c231e1fb7cbe2d3d41f7aa.tar.gz
riscv-isa-sim-09140c07e13ddd3951c231e1fb7cbe2d3d41f7aa.tar.bz2
Implement Zfa.
This passes our developer test suite, when comparing output (signature) against the SAIL implementation. If any corner-cases require additional changes after ACT goes upstream, we can apply an add-on patch.
Diffstat (limited to 'riscv/insns/fli_d.h')
-rw-r--r--riscv/insns/fli_d.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/riscv/insns/fli_d.h b/riscv/insns/fli_d.h
new file mode 100644
index 0000000..090e88c
--- /dev/null
+++ b/riscv/insns/fli_d.h
@@ -0,0 +1,40 @@
+require_extension('D');
+require_extension(EXT_ZFA);
+require_fp;
+{
+ const uint64_t bits[32] = {
+ [0b00000] = 0xbff0000000000000ull, /* -1.0 */
+ [0b00001] = 0x0010000000000000ull, /* minimum positive normal */
+ [0b00010] = 0x3ef0000000000000ull, /* 1.0 * 2^-16 */
+ [0b00011] = 0x3f00000000000000ull, /* 1.0 * 2^-15 */
+ [0b00100] = 0x3f70000000000000ull, /* 1.0 * 2^-8 */
+ [0b00101] = 0x3f80000000000000ull, /* 1.0 * 2^-7 */
+ [0b00110] = 0x3fb0000000000000ull, /* 1.0 * 2^-4 */
+ [0b00111] = 0x3fc0000000000000ull, /* 1.0 * 2^-3 */
+ [0b01000] = 0x3fd0000000000000ull, /* 0.25 */
+ [0b01001] = 0x3fd4000000000000ull, /* 0.3125 */
+ [0b01010] = 0x3fd8000000000000ull, /* 0.375 */
+ [0b01011] = 0x3fdc000000000000ull, /* 0.4375 */
+ [0b01100] = 0x3fe0000000000000ull, /* 0.5 */
+ [0b01101] = 0x3fe4000000000000ull, /* 0.625 */
+ [0b01110] = 0x3fe8000000000000ull, /* 0.75 */
+ [0b01111] = 0x3fec000000000000ull, /* 0.875 */
+ [0b10000] = 0x3ff0000000000000ull, /* 1.0 */
+ [0b10001] = 0x3ff4000000000000ull, /* 1.25 */
+ [0b10010] = 0x3ff8000000000000ull, /* 1.5 */
+ [0b10011] = 0x3ffc000000000000ull, /* 1.75 */
+ [0b10100] = 0x4000000000000000ull, /* 2.0 */
+ [0b10101] = 0x4004000000000000ull, /* 2.5 */
+ [0b10110] = 0x4008000000000000ull, /* 3 */
+ [0b10111] = 0x4010000000000000ull, /* 4 */
+ [0b11000] = 0x4020000000000000ull, /* 8 */
+ [0b11001] = 0x4030000000000000ull, /* 16 */
+ [0b11010] = 0x4060000000000000ull, /* 2^7 */
+ [0b11011] = 0x4070000000000000ull, /* 2^8 */
+ [0b11100] = 0x40e0000000000000ull, /* 2^15 */
+ [0b11101] = 0x40f0000000000000ull, /* 2^16 */
+ [0b11110] = 0x7ff0000000000000ull, /* +inf */
+ [0b11111] = defaultNaNF64UI
+ };
+ WRITE_FRD_D(f64(bits[insn.rs1()]));
+}