M
Maj55
Guest
I am learning verilog using a Nexys 4 board. I have written the code below for audio output from the board. I am sending a square wave to the audio port, but there is no audio output. What am I doing wrong here?
`timescale 1ns / 1ps
module soundtest(
input clk,
input hush,
input [3:0] note,
output ampPWM, //speaker port
output vcc,
reg [15:0] counter //binary counter; 16 bits wide
);
// The audio amplifier needs to be enabled, by
// default it will be disabled without this:
localparam TCQ = 1;
always @ (posedge clk or negedge hush)
if ( hush == 1'b0)
counter <= 'b0;
else
counter <= counter + 1;
assign ampPWM = counter[15];
endmodule
`timescale 1ns / 1ps
module soundtest(
input clk,
input hush,
input [3:0] note,
output ampPWM, //speaker port
output vcc,
reg [15:0] counter //binary counter; 16 bits wide
);
// The audio amplifier needs to be enabled, by
// default it will be disabled without this:
localparam TCQ = 1;
always @ (posedge clk or negedge hush)
if ( hush == 1'b0)
counter <= 'b0;
else
counter <= counter + 1;
assign ampPWM = counter[15];
endmodule