Skip to content

Commit

Permalink
Add debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
mole99 committed Apr 19, 2024
1 parent 71e936f commit cbe05f9
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 20 deletions.
12 changes: 6 additions & 6 deletions info.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]: ""
Expand All @@ -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
16 changes: 15 additions & 1 deletion src/tiny_shader_top.sv
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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
34 changes: 21 additions & 13 deletions src/tt_um_tiny_shader_mole99.sv
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,22 @@ 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;
logic spi_cs;

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 (
Expand All @@ -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;
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit cbe05f9

Please sign in to comment.