From 0a4f977b5b8616f39cd6c0cf7a9d28066024cd3a Mon Sep 17 00:00:00 2001 From: Johan Euphrosine Date: Fri, 31 May 2024 17:13:28 +0900 Subject: [PATCH] examples/stripes: handle reset on vsync posedge --- src/examples/stripes/project.v | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/examples/stripes/project.v b/src/examples/stripes/project.v index ff0aa4a..f63027e 100644 --- a/src/examples/stripes/project.v +++ b/src/examples/stripes/project.v @@ -54,14 +54,12 @@ module tt_um_vga_example( assign G = video_active ? {moving_x[6], pix_y[2]} : 2'b00; assign B = video_active ? {moving_x[7], pix_y[5]} : 2'b00; - always @(posedge clk) begin + always @(posedge vsync) begin if (~rst_n) begin counter <= 0; + end else begin + counter <= counter + 1; end end - - always @(posedge vsync) begin - counter <= counter + 1; - end endmodule