How to generate Trigger for 500ns in Verilog ?

OP #5448657
Rate this post
• ▲ useful
▼ not useful
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.
1
module counter(
2
    input clk,
3
    input reset,
4
    output [127:0] counter_out,
5
    output trig
6
    );
7
    
8
    reg trig=0;
9
    reg [127:0] counter_out=0;
10
    reg [7:0] temp=0;
11
    
12
    always@(posedge clk)
13
    begin
14
    if(~reset)
15
        begin
16
        trig<=0;
17
        counter_out<=0;
18
        end
19
    else
20
        begin
21
        counter_out<=counter_out+1;
22
        temp<=temp+1;
23
        if(temp==25)
24
            begin
25
            temp<=0;
26
            trig<=~trig;
27
            end
28
        end
29
    end
30
endmodule

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [vhdl]VHDL-Code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.