From 45b5eabe868ac2f8a755379bde07c102caf74afb Mon Sep 17 00:00:00 2001 From: Alejandro Soto Date: Sat, 27 Apr 2024 11:45:23 -0600 Subject: rtl/fpu: initial commit Imported from https://github.com/taneroksuz/fpu-sp --- rtl/fpu/float/fp_mac.sv | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 rtl/fpu/float/fp_mac.sv (limited to 'rtl/fpu/float/fp_mac.sv') diff --git a/rtl/fpu/float/fp_mac.sv b/rtl/fpu/float/fp_mac.sv new file mode 100644 index 0000000..a471e36 --- /dev/null +++ b/rtl/fpu/float/fp_mac.sv @@ -0,0 +1,21 @@ +import fp_wire::*; + +module fp_mac ( + input reset, + input clock, + input fp_mac_in_type fp_mac_i, + output fp_mac_out_type fp_mac_o +); + + logic [109:0] add; + logic [111:0] mul; + logic [109:0] mac; + logic [109:0] res; + + assign add = {fp_mac_i.a, 54'h0}; + assign mul = $signed(fp_mac_i.b) * $signed(fp_mac_i.c); + assign mac = (fp_mac_i.op == 0) ? mul[109:0] : -mul[109:0]; + assign res = add + mac; + assign fp_mac_o.d = res; + +endmodule -- cgit v1.2.3