diff options
| author | Alejandro Soto <alejandro@34project.org> | 2023-11-02 22:19:26 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2023-11-10 01:43:02 -0600 |
| commit | d5de20fade70a0d454e3aa0087313ca715ff8759 (patch) | |
| tree | 55751c829e989500972c56f05a7b0cb5e4e07621 /rtl/gfx/gfx_fp_add.sv | |
| parent | 09fcdbe01553385658fe437dcb1777008c0ceb39 (diff) | |
rtl/gfx: rename modules
Diffstat (limited to 'rtl/gfx/gfx_fp_add.sv')
| -rw-r--r-- | rtl/gfx/gfx_fp_add.sv | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/rtl/gfx/gfx_fp_add.sv b/rtl/gfx/gfx_fp_add.sv new file mode 100644 index 0000000..6ba7b1c --- /dev/null +++ b/rtl/gfx/gfx_fp_add.sv @@ -0,0 +1,40 @@ +`include "gfx/gfx_defs.sv" + +module gfx_fp_add +( + input logic clk, + + input fp a, + b, + input logic stall, + + output fp q +); + +`ifndef VERILATOR + ip_fp_add ip_add + ( + .en(!stall), + .areset(0), + .* + ); +`else + fp a_pipeline[`FP_ADD_STAGES - 1], b_pipeline[`FP_ADD_STAGES - 1]; + + integer i; + + always_ff @(posedge clk) + if (!stall) begin + a_pipeline[0] <= a; + b_pipeline[0] <= b; + + for (i = 1; i < `FP_ADD_STAGES - 1; ++i) begin + a_pipeline[i] <= a_pipeline[i - 1]; + b_pipeline[i] <= b_pipeline[i - 1]; + end + + q <= $c("taller::fp_add(", a_pipeline[`FP_ADD_STAGES - 2], ", ", b_pipeline[`FP_ADD_STAGES - 2], ")"); + end +`endif + +endmodule |
