diff options
| author | Alejandro Soto <alejandro@34project.org> | 2024-04-27 11:45:23 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2024-04-27 11:45:23 -0600 |
| commit | 45b5eabe868ac2f8a755379bde07c102caf74afb (patch) | |
| tree | 7b740cbc6b19b46d731e29ee145c2a8ad744e847 /rtl/fpu/float/fp_mac.sv | |
| parent | a61ee4b16157f3c6501d958b8dcde7f57f41110d (diff) | |
rtl/fpu: initial commit
Imported from https://github.com/taneroksuz/fpu-sp
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 |
