Fixed up debouncer and added some assertions

I moved around where packages are. I couldn't find any evidence of where
other people put them, but for now they are in the `lib/` folder. Other
infrastructure changes are that all the weird includes we need to make
the linter happy are gated behind ifdefs, so they don't mess with
vivado.

I kinda can't believe concurrent assertions work because there's so
little info about them, good to ssee they actually do something
This commit is contained in:
2025-05-30 13:56:52 -07:00
parent d4bedd06ce
commit a50efdc6c6
12 changed files with 170 additions and 102 deletions
+3 -1
View File
@@ -1,4 +1,6 @@
`include "sdvd_defs.sv"
`ifdef VERILATOR
`include "sdvd_defs.sv"
`endif
import sdvd_defs::SPEED;
//this interfaces with block ram
+11 -16
View File
@@ -1,27 +1,22 @@
//NOTE: you should drive this with a slow clock to actually debounce input
module debouncer(input logic clk, input reset, input source, output wire out);
module debouncer(input logic clk, input reset, input source, output logic out);
logic pressed;
assign out = pressed;
always_ff @(posedge clk) begin
if (reset)
pressed <= 0;
else if (!pressed && source)
pressed <= 1;
else if (pressed && !source)
pressed <= 0;
else if (pressed && source)
pressed <= 0;
else if (!pressed && !source)
if (!source) begin
pressed <= 0;
out <= 0;
end
else
if (pressed)
out <= 0;
else begin
pressed <= 1;
out <= 1;
end
end
//always_ff (@posedge clk) begin
//
//end
endmodule
+3 -1
View File
@@ -1,4 +1,6 @@
`include "sdvd_defs.sv"
`ifdef VERILATOR
`include "sdvd_defs.sv"
`endif
import sdvd_defs::SPEED;
// Takes in a 100MHz clock and generates the very low freq signals needed
// for driving the control logic
+3 -1
View File
@@ -1,4 +1,6 @@
`include "sdvd_defs.sv"
`ifdef VERILATOR
`include "sdvd_defs.sv"
`endif
import sdvd_defs::SPEED;
module nexys_a7_top(
input logic CLK100MHZ, CPU_RESETN,
+3 -1
View File
@@ -9,7 +9,9 @@
*
* */
`include "sdvd_defs.sv"
`ifdef VERILATOR
`include "sdvd_defs.sv"
`endif
import sdvd_defs::SPEED;
module playback_controller(
-7
View File
@@ -1,7 +0,0 @@
`ifndef SDVD_DEFS
`define SDVD_DEFS
package sdvd_defs;
// Playback speed type
typedef logic [3:0] SPEED;
endpackage
`endif