Created register for gating pipeline stage results

This commit is contained in:
riley committed 2026-10-29 15:34:31 +11:00
1 parent 8b48084fa5
commit b046ad7db0
1 file changed
+16
+16
View File
@@ -0,0 +1,16 @@
module gatereg #(width)(
input logic [0:0] clk, input logic [0:0] rst, input logic en[0:0],
input logic [2**width-1:0] in, output logic [2**width-1:0] out
);
logic [2**width-1:0] hold_value;
assign out = hold_value;
always_ff @( posedge clk ) begin
if (rst) begin
hold_value <= {(2**width){0}};
end else if (en) begin
hold_value <= in;
end
end
endmodule