From e8933d269004750dce32eb5fabf1a44f3d75368d Mon Sep 17 00:00:00 2001 From: FavoritoHJS Date: Tue, 27 Aug 2024 13:14:21 -0400 Subject: [PATCH] Add diagnostic on values that cannot be cast to int --- src/project.v | 16 ++++++++-------- test/test.py | 8 ++++++-- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/project.v b/src/project.v index 7b7bd2c..e3a1264 100644 --- a/src/project.v +++ b/src/project.v @@ -84,8 +84,8 @@ module tt_um_favoritohjs_scroller ( .rst_n(rst_n), .vsync(vsync), .scanline(vcount), - .START_HEIGHT(116), - .LOOP_LENGTH(16), + .START_HEIGHT(10'd116), + .LOOP_LENGTH(5'd16), .val(cutoff1), .border(vborder1)); @@ -94,8 +94,8 @@ module tt_um_favoritohjs_scroller ( .rst_n(rst_n), .vsync(vsync), .scanline(vcount), - .START_HEIGHT(184), - .LOOP_LENGTH(8), + .START_HEIGHT(10'd184), + .LOOP_LENGTH(5'd8), .val(cutoff2), .border(vborder2)); @@ -175,7 +175,7 @@ module tt_um_favoritohjs_scroller ( //how it needs to be inlined with the main block to prevent //conflicting drivers if (visible) begin - if (l1 < cutoff1) begin + if ({1'b0, l1} < cutoff1) begin if (border1) begin rd <= 3'b011; gd <= 3'b011; @@ -185,7 +185,7 @@ module tt_um_favoritohjs_scroller ( gd <= 3'b110; bd <= 3'b101; end - end else if (l2 < cutoff2) begin + end else if ({1'b0, l2} < cutoff2) begin if (border2) begin rd <= 3'b010; gd <= 3'b010; @@ -224,7 +224,7 @@ module vertical_scheudler( output wire border ); reg started; - reg [3:0] blockline; + reg [4:0] blockline; reg [4:0] blockval; reg borderreg; assign val = blockval; @@ -237,7 +237,7 @@ module vertical_scheudler( borderreg <= 1'b0; end else begin if (scanline == START_HEIGHT) begin - started <= 1; + started <= 1'b1; end if (started) begin if (blockline == 0) begin diff --git a/test/test.py b/test/test.py index 31f2d12..6ca4869 100644 --- a/test/test.py +++ b/test/test.py @@ -24,7 +24,7 @@ async def test_project(dut): dut.ui_in.value = 0 dut.uio_in.value = 0 dut.rst_n.value = 0 - await ClockCycles(dut.clk, 100) + await ClockCycles(dut.clk, 10) dut.rst_n.value = 1 dut._log.info("Test project behavior") @@ -34,7 +34,11 @@ async def test_project(dut): row = [] for j in range(800): await ClockCycles(dut.clk, 1) - data = int(dut.uo_out) + try: + data = int(dut.uo_out) + except Exception: + dut._log.info(dut.uo_out.value) + raise row.append(data) frame.append(row) if use_pillow: