diff options
Diffstat (limited to 'rtl/fpu/float/fp_mac.sv')
| -rw-r--r-- | rtl/fpu/float/fp_mac.sv | 21 |
1 files changed, 21 insertions, 0 deletions
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 |
