AbinayaSivam
Member level 1
Hi,
I am working with FPGA board. For my test, i am going to add the trigger logic in one side [One PC], and in other side the counter design will be added in XILIXN VIVADO and should start to give its counter after receiving the trigger signal.
For every trigger [500ns], the counter should start. To execute this task, i need the verilog code for Creating the Trigger Signal.
I am not very much familiar with Verilog code. So please can anyone the below code. If it is wrong, please update.
I am working with FPGA board. For my test, i am going to add the trigger logic in one side [One PC], and in other side the counter design will be added in XILIXN VIVADO and should start to give its counter after receiving the trigger signal.
For every trigger [500ns], the counter should start. To execute this task, i need the verilog code for Creating the Trigger Signal.
I am not very much familiar with Verilog code. So please can anyone the below code. If it is wrong, please update.
Code:
module counter(
input clk,
input reset,
output [127:0] counter_out, // Output : 0 to 127 pins
output trig
);
reg trig=0;
reg [127:0] counter_out=0;
reg [7:0] temp=0;
always@(posedge clk)
begin
if(~reset)
begin
trig<=0;
counter_out<=0;
end
else
begin
counter_out<=counter_out+1;
temp<=temp+1;
if(temp==25)
begin
temp<=0;
trig<=~trig;
end
end
end
endmodule