diff options
| author | Alejandro Soto <alejandro@34project.org> | 2023-10-22 00:16:40 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2023-10-22 00:16:50 -0600 |
| commit | c1c1f1e823099c82d02e94827a64d7a0b223048e (patch) | |
| tree | cc6466fad9a943bbde314feb151bbacadf5b338a /rtl/gfx/pipeline_flow.sv | |
| parent | a14fc04f3b9f5bcef941ea79c794532d7ca0e7fc (diff) | |
rtl/gfx: reimplement multiplier as a much smaller mat-vec pipeline
Diffstat (limited to 'rtl/gfx/pipeline_flow.sv')
| -rw-r--r-- | rtl/gfx/pipeline_flow.sv | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/rtl/gfx/pipeline_flow.sv b/rtl/gfx/pipeline_flow.sv new file mode 100644 index 0000000..2b9c891 --- /dev/null +++ b/rtl/gfx/pipeline_flow.sv @@ -0,0 +1,40 @@ +`include "gfx/gfx_defs.sv" + +module pipeline_flow +#(parameter STAGES=0) +( + input logic clk, + rst_n, + + input logic in_valid, + out_ready, + + output logic in_ready, + out_valid, + stall +); + + logic valid[STAGES]; + + assign stall = !in_ready; + assign in_ready = out_ready || !out_valid; + assign out_valid = valid[STAGES - 1]; + + always_ff @(posedge clk or negedge rst_n) + if (!rst_n) + valid[0] <= 0; + else if (in_ready) + valid[0] <= in_valid; + + genvar i; + generate + for (i = 1; i < STAGES; ++i) begin: pipeline + always_ff @(posedge clk or negedge rst_n) + if (!rst_n) + valid[i] <= 0; + else if (in_ready) + valid[i] <= valid[i - 1]; + end + endgenerate + +endmodule |
