All checks were successful
ci/woodpecker/push/test-workflow Pipeline was successful
added x16 fast forward speed to playback_controller.sv corrected dates on pwn.sv, playback_controller.sv, display_converter.sv, and seconds_display.sv
50 lines
909 B
Systemverilog
50 lines
909 B
Systemverilog
/****
|
|
* pwm.sv - [must edit in future]
|
|
*
|
|
* @author: Dilanthi Prentice, Waylon Cude
|
|
* @date: [not sure when due yet]
|
|
*
|
|
*
|
|
* */
|
|
module pwm(
|
|
input logic clk, reset,
|
|
// Load control signal, if this is high we should load a new sample
|
|
input logic load,
|
|
// The audio sample to play back
|
|
input logic [15:0] sample,
|
|
// The audio output pin
|
|
output wire pwm_pin
|
|
);
|
|
|
|
logic [15:0] pulse_counter;
|
|
logic [15:0] sample_buffer;
|
|
logic should_output;
|
|
|
|
always_ff @(posedge clk)
|
|
begin
|
|
if (reset)
|
|
begin
|
|
pulse_counter <= 0;
|
|
sample_buffer <= 0;
|
|
end
|
|
|
|
else
|
|
begin
|
|
if (load)
|
|
sample_buffer <= sample;
|
|
|
|
pulse_counter <= pulse_counter + 1;
|
|
|
|
if (pulse_counter < sample_buffer)
|
|
should_output <= 1;
|
|
else
|
|
should_output <= 0;
|
|
end
|
|
|
|
end
|
|
|
|
assign pwm_pin = should_output ? 'z : '0;
|
|
|
|
|
|
endmodule
|