diff options
| author | Alejandro Soto <alejandro@34project.org> | 2023-11-02 20:36:51 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2023-11-10 01:42:47 -0600 |
| commit | 85fc7268a690e38ecb7f3b04dbfb8d70f2570a79 (patch) | |
| tree | 5e7ba468b1c8e68c3835c59c83a10d285787ea37 /rtl/gfx/gfx_perspective_flow.sv | |
| parent | 814eb9d024a928380815a8a830eee3b86d71cf75 (diff) | |
rtl/gfx: implement perspective division
Diffstat (limited to '')
| -rw-r--r-- | rtl/gfx/gfx_perspective_flow.sv | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/rtl/gfx/gfx_perspective_flow.sv b/rtl/gfx/gfx_perspective_flow.sv new file mode 100644 index 0000000..ecacc65 --- /dev/null +++ b/rtl/gfx/gfx_perspective_flow.sv @@ -0,0 +1,50 @@ +`include "gfx/gfx_defs.sv" + +module gfx_perspective_flow +( + input logic clk, + rst_n, + + input logic vertex_start, + output logic stall, + in_start, + out_start, + + input logic in_valid, + out_ready, + + output logic in_ready, + out_valid + stall +); + + localparam STAGES = `FP_INV_STAGES + `FP_MUL_STAGES; + + logic[STAGES - 1:0] start_pipes; + + assign in_start = start_pipes[`FP_INV_STAGES - 1]; + assign out_start = start_pipes[STAGES - 1]; + + pipeline_flow #(.STAGES(STAGES)) flow + ( + .* + ); + + always_ff @(posedge clk or negedge rst_n) + if (!rst_n) + start_pipes[0] <= 0; + else if (!stall) + start_pipes[0] <= in_valid && vertex_start; + + genvar i; + generate + for (i = 1; i < STAGES; ++i) begin: pipeline + always_ff @(posedge clk or negedge rst_n) + if (!rst_n) + start_pipes[i] <= 0; + else if (!stall) + start_pipes[i] <= start_pipes[i - 1]; + end + endgenerate + +endmodule |
