From cbe05f99f01d17db70139b5f91d6d0a7d91db3bb Mon Sep 17 00:00:00 2001 From: mole99 Date: Fri, 19 Apr 2024 16:21:16 +0200 Subject: [PATCH] Add debug mode --- info.yaml | 12 ++++++------ src/tiny_shader_top.sv | 16 +++++++++++++++- src/tt_um_tiny_shader_mole99.sv | 34 ++++++++++++++++++++------------- 3 files changed, 42 insertions(+), 20 deletions(-) diff --git a/info.yaml b/info.yaml index 02502e7..6db901a 100644 --- a/info.yaml +++ b/info.yaml @@ -27,8 +27,8 @@ project: pinout: # Inputs ui[0]: "mode" - ui[1]: "" - ui[2]: "" + ui[1]: "debug_i[0]" + ui[2]: "debug_i[1]" ui[3]: "" ui[4]: "" ui[5]: "" @@ -50,10 +50,10 @@ pinout: uio[1]: "MOSI" uio[2]: "MISO" uio[3]: "SCK" - uio[4]: "" - uio[5]: "" - uio[6]: "" - uio[7]: "" + uio[4]: "next_vertical" + uio[5]: "next_frame" + uio[6]: "debug_o[0]" + uio[7]: "debug_o[1]" # Do not change! yaml_version: 6 diff --git a/src/tiny_shader_top.sv b/src/tiny_shader_top.sv index f5ac17d..ac19fd9 100644 --- a/src/tiny_shader_top.sv +++ b/src/tiny_shader_top.sv @@ -23,7 +23,11 @@ module tiny_shader_top ( output logic hsync_o, output logic vsync_o, output logic next_vertical_o, - output logic next_frame_o + output logic next_frame_o, + + // Debug signals + output logic [1:0] debug_i, + output logic [1:0] debug_o ); /* Tiny Shader Settings */ @@ -304,5 +308,15 @@ module tiny_shader_top ( next_frame_o <= next_frame; end + /* Debug */ + + always_comb begin + case (debug_i) + 2'b00: debug_o = {cur_time[1], cur_time[0]}; + 2'b01: debug_o = {cur_time[8], cur_time[7]}; + 2'b10: debug_o = {execute_shader_x, execute_shader_y}; + 2'b11: debug_o = {memory_shift, memory_load}; + endcase + end endmodule diff --git a/src/tt_um_tiny_shader_mole99.sv b/src/tt_um_tiny_shader_mole99.sv index a6d5821..9c5ee3d 100644 --- a/src/tt_um_tiny_shader_mole99.sv +++ b/src/tt_um_tiny_shader_mole99.sv @@ -20,12 +20,6 @@ module tt_um_tiny_shader_mole99 ( rst_n_sync <= rst_n; end - logic [5:0] rrggbb; - logic hsync; - logic vsync; - logic next_vertical; - logic next_frame; - logic spi_sclk; logic spi_mosi; logic spi_miso; @@ -33,6 +27,15 @@ module tt_um_tiny_shader_mole99 ( logic mode; + logic [5:0] rrggbb; + logic hsync; + logic vsync; + logic next_vertical; + logic next_frame; + + logic [1:0] debug_i; + logic [1:0] debug_o; + tiny_shader_top #( ) tiny_shader_top_inst ( @@ -53,7 +56,11 @@ module tt_um_tiny_shader_mole99 ( .hsync_o (hsync), .vsync_o (vsync), .next_vertical_o (next_vertical), - .next_frame_o (next_frame) + .next_frame_o (next_frame), + + // Debug signals + .debug_i (debug_i), + .debug_o (debug_o) ); logic [1:0] R; @@ -84,16 +91,17 @@ module tt_um_tiny_shader_mole99 ( assign spi_sclk = uio_in[3]; assign uio_oe[3] = 1'b0; assign uio_out[3] = 1'b0; // Bottom row - assign uio_out[4] = 1'b0; assign uio_oe[4] = 1'b0; - assign uio_out[5] = 1'b0; assign uio_oe[5] = 1'b0; - assign uio_out[6] = 1'b0; assign uio_oe[6] = 1'b0; - assign uio_out[7] = 1'b0; assign uio_oe[7] = 1'b0; + assign uio_out[4] = next_vertical; assign uio_oe[4] = 1'b1; + assign uio_out[5] = next_frame; assign uio_oe[5] = 1'b1; + assign uio_out[6] = debug_o[0]; assign uio_oe[6] = 1'b0; + assign uio_out[7] = debug_o[1]; assign uio_oe[7] = 1'b0; // Input PMOD - mode assign mode = ui_in[0]; - /*ui_in[1] - ui_in[2] + assign debug_i[0] = ui_in[1]; + assign debug_i[1] = ui_in[2]; + /* ui_in[3] ui_in[4] ui_in[5]