-
Notifications
You must be signed in to change notification settings - Fork 1
Remove (almost) all verible warnings #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,16 +16,17 @@ module cannon_display #( | |
| $readmemb("src/rtl/single_barrel_cannon.hex", sprite_rom); | ||
| end | ||
|
|
||
| logic signed [10:0] rel_x, rel_y = 0; | ||
| logic signed [10:0] rel_x, rel_y; | ||
| logic in_sprite_bounds; | ||
|
|
||
| always_comb begin | ||
| rel_x = (10'(pix_x) - x_reg) / scale; | ||
| rel_y = (10'(pix_y) - CANNON_Y) / scale; | ||
| rel_x = (pix_x - x_reg) / scale; | ||
| rel_y = (pix_y - CANNON_Y) / scale; | ||
|
|
||
|
Comment on lines
22
to
25
|
||
| in_sprite_bounds = (rel_x >= 0) && (rel_x < SpriteW) && (rel_y >= 0) && (rel_y < SpriteH); | ||
|
|
||
| cannon_graphics = in_sprite_bounds ? ~sprite_rom[rel_y[3:0]][SpriteW-1-rel_x[3:0]] : 1'b0; | ||
| cannon_graphics = (in_sprite_bounds ? ~sprite_rom[rel_y[3:0]][SpriteW-1-rel_x[3:0]] : 1'b0) | ||
| & scale > 0; // scale = 0 -> invisible | ||
| end | ||
|
|
||
| endmodule | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ module character #( | |
| parameter logic [15:0] X_POS = 0, | ||
| parameter logic [15:0] Y_POS = 0 | ||
| ) ( | ||
| input logic [15:0] char_code, // ascii when letter | ||
| input logic [7:0] char_code, // ascii when letter | ||
| input logic [15:0] hpos, | ||
| input logic [15:0] vpos, | ||
|
|
||
|
|
@@ -25,9 +25,9 @@ module character #( | |
|
|
||
| logic is_digit, is_letter; | ||
|
|
||
| logic [15:0] letter_index; | ||
| logic [4:0] letter_index; | ||
|
|
||
| logic [15:0] rel_x, rel_y; | ||
| logic [2:0] rel_x, rel_y; | ||
|
|
||
| always_comb begin | ||
| graphics = 0; | ||
|
|
@@ -36,14 +36,14 @@ module character #( | |
| is_digit = (char_code <= 9); | ||
| is_letter = (char_code >= "A") && (char_code <= "Z"); | ||
|
|
||
| rel_x = (hpos - X_POS) / SCALING; | ||
| rel_y = (vpos - Y_POS) / SCALING; | ||
| rel_x = 3'((hpos - X_POS) / SCALING); | ||
| rel_y = 3'((vpos - Y_POS) / SCALING); | ||
|
|
||
| if (rel_y < SpriteHeight && rel_x < SpriteWidth) begin | ||
| if (is_digit) begin | ||
|
Comment on lines
+39
to
43
|
||
| graphics = digits_rom[char_code][rel_y][SpriteWidth-1-rel_x]; | ||
| graphics = digits_rom[4'(char_code)][rel_y][SpriteWidth-1-rel_x]; | ||
| end else if (is_letter) begin | ||
| letter_index = char_code[15:0] - "A"; | ||
| letter_index = 5'(char_code[7:0] - "A"); | ||
| graphics = letters_rom[letter_index][rel_y][SpriteWidth-1-rel_x]; | ||
| end | ||
| end | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -92,7 +92,7 @@ module hud #( | |
|
|
||
| localparam logic [15:0] LiveW = 16; | ||
| localparam logic [15:0] LiveGap = 4; | ||
| localparam logic [15:0] LiveScale = SCALE * 2; | ||
| localparam logic [3:0] LiveScale = SCALE * 2; | ||
| localparam logic [15:0] LiveStep = (LiveW + LiveGap) * LiveScale; | ||
|
Comment on lines
+95
to
96
|
||
|
|
||
| genvar life; | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,70 +1,51 @@ | ||||||
|
|
||||||
| `ifndef HVSYNC_GENERATOR_H | ||||||
| `define HVSYNC_GENERATOR_H | ||||||
|
|
||||||
| /* | ||||||
| Video sync generator, used to drive a VGA monitor. | ||||||
| Timing from: https://en.wikipedia.org/wiki/Video_Graphics_Array | ||||||
| To use: | ||||||
| - Wire the hsync and vsync signals to top level outputs | ||||||
| - Add a 3-bit (or more) "rgb" output to the top level | ||||||
| */ | ||||||
|
|
||||||
| module hvsync_generator(clk, reset, hsync, vsync, display_on, hpos, vpos); | ||||||
|
|
||||||
| input clk; | ||||||
| input reset; | ||||||
| output reg hsync, vsync; | ||||||
| output display_on; | ||||||
| output reg [9:0] hpos; | ||||||
| output reg [9:0] vpos; | ||||||
| module hvsync_generator ( | ||||||
| input clk, | ||||||
| input reset, | ||||||
| output logic hsync, | ||||||
| output logic vsync, | ||||||
| output logic display_on, | ||||||
| output logic [9:0] hpos, | ||||||
| output logic [9:0] vpos | ||||||
| ); | ||||||
|
|
||||||
| // declarations for TV-simulator sync parameters | ||||||
| // horizontal constants | ||||||
| parameter H_DISPLAY = 640; // horizontal display width | ||||||
| parameter H_BACK = 48; // horizontal left border (back porch) | ||||||
| parameter H_FRONT = 16; // horizontal right border (front porch) | ||||||
| parameter H_SYNC = 96; // horizontal sync width | ||||||
| // vertical constants | ||||||
| parameter V_DISPLAY = 480; // vertical display height | ||||||
| parameter V_TOP = 33; // vertical top border | ||||||
| parameter V_BOTTOM = 10; // vertical bottom border | ||||||
| parameter V_SYNC = 2; // vertical sync # lines | ||||||
| localparam logic [15:0] HDisplay = 640; // horizontal display width | ||||||
| localparam logic [15:0] HBack = 48; // horizontal left border (back porch) | ||||||
| localparam logic [15:0] HFront = 16; // horizontal right border (front porch) | ||||||
| localparam logic [15:0] HSync = 96; // horizontal sync width | ||||||
| // verticallogic constants | ||||||
|
||||||
| // verticallogic constants | |
| // vertical constants |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scaleis used as a divisor unconditionally. Even though you later mask output withscale > 0,rel_x/rel_yare still computed via/ scale, soscale == 0causes division-by-zero behavior. Handlescale == 0explicitly (e.g., setcannon_graphics = 0and skip the division / bounds logic).