Obligatory: I'm new to Verilog. I have two individual, working verilog modules: a nios-ii ADC and a counter module. The nios-ii controlled ADC qsys is properly instantiated in the main module. I am trying to instantiate the counter inside the main module as well. Quartus throws no errors, but nothing appears on the outputs where the counter should be outputting. The main module code is below:
module niosADCv2(
input CLOCK,
input ADC1IN1, // Voltage Level 2.5 V
input ADC1IN2, // Voltage Level 2.5 V
input RESET_N // Voltage Level 2.5 V
);
niosADCv2_qsys u0 (
.clk_clk (CLOCK), // clk.clk
.reset_reset_n (RESET_N) // reset.reset_n
);
verilog_counter verilog_counter_c0(
.CLOCK (CLOCK),
.usec (usec),
.nsec (nsec)
);
endmodule
In a separate verilog file is my verliog_counter module:
module verilog_counter(CLOCK, usec, nsec);
input CLOCK;
output reg [7:0] usec;
output reg [5:0] nsec; //counts by 20nsecs (50MHz clock)
wire CLOCK;
always @ (posedge CLOCK)
if (nsec == 6'b110001) begin //if count is 49 (980ns)
nsec <= 7'b0; //reset 20nsec count
usec <= usec + 7'b1; //incriment usec count
end
else nsec <= nsec + 8'b1; //if a usec not reached, incriment 20ns counter
endmodule
Any ideas why the counter output doesn't appear? Am I instantiating the counter module wrong or can I not have them in separate files? Any help is appreciated