summaryrefslogtreecommitdiff
path: root/tb
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2023-10-31 17:52:27 -0600
committerAlejandro Soto <alejandro@34project.org>2023-11-02 22:20:23 -0600
commit814eb9d024a928380815a8a830eee3b86d71cf75 (patch)
tree3fe80bd9dd5aabe1d944fe24935d2f2c2fb239e3 /tb
parenteed877444f9af85d6e4596853d8f188e61f6c4ed (diff)
ip: add ip_fp_inv
Diffstat (limited to 'tb')
-rw-r--r--tb/verilator.hpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/tb/verilator.hpp b/tb/verilator.hpp
index ff2e9c0..d1d78ff 100644
--- a/tb/verilator.hpp
+++ b/tb/verilator.hpp
@@ -30,6 +30,15 @@ namespace taller
q_bits.fp16 = a_bits.fp16 * b_bits.fp16;
return q_bits.u16;
}
+
+ static inline std::uint16_t fp_inv(std::uint16_t a) noexcept
+ {
+ fp16_bits a_bits, q_bits;
+ a_bits.u16 = a;
+
+ q_bits.fp16 = 1 / a_bits.fp16;
+ return q_bits.u16;
+ }
}
#endif