summaryrefslogtreecommitdiff
path: root/rtl/gfx/pipelined_flow.sv
diff options
context:
space:
mode:
Diffstat (limited to 'rtl/gfx/pipelined_flow.sv')
-rw-r--r--rtl/gfx/pipelined_flow.sv26
1 files changed, 26 insertions, 0 deletions
diff --git a/rtl/gfx/pipelined_flow.sv b/rtl/gfx/pipelined_flow.sv
new file mode 100644
index 0000000..1e3c1ce
--- /dev/null
+++ b/rtl/gfx/pipelined_flow.sv
@@ -0,0 +1,26 @@
+module pipelined_flow
+#(parameter STAGES=0)
+(
+ input logic clk,
+ rst_n,
+
+ input logic start,
+ output logic done
+);
+
+ logic valid[STAGES];
+
+ assign done = valid[STAGES - 1];
+
+ always_ff @(posedge clk or negedge rst_n)
+ valid[0] <= !rst_n ? 0 : start;
+
+ genvar i;
+ generate
+ for (i = 1; i < STAGES; ++i) begin: pipeline
+ always_ff @(posedge clk or negedge rst_n)
+ valid[i] <= !rst_n ? 0 : valid[i - 1];
+ end
+ endgenerate
+
+endmodule