Saraswathy S. wrote:
> Because i am unable to collect the edge value (counter value) of Trigger
> signal.
You are generating that value. So it should be very easy to do any
processing there.
> assign temp2=temp1&&clk;
> always @(posedge temp2 or posedge rst)
It is no good design practice to use gated clocks. Absolutely not! A
hint for the beginner: use only 1 clock in the whole FPGA and do all
enabling inside the clock processing, somewhat like this:
1 | always @(posedge clk or posedge rst)
|
2 | begin
|
3 | if (rst)
|
4 | begin
|
5 | counter_result<=0;
|
6 | end
|
7 | else begin
|
8 | // do the clock-enabling here
|
9 | if (clock_enable)
|
10 | counter_result<=counter_result+1;
|
11 | end
|
12 | end
|
13 | end
|
> always @(posedge detect
It is no good design practice to use any random input as a clock source.
Treat that "detect" signal as a simple input and synchronize it to the
OneAndOnly-FPGA-Clock. Then store it in two flipflops one after the
other and compare the values of those two flipflops to detect an edge of
that input signal. This is called synchronous design. And thats the only
thing that works reliably in the real world...
Saraswathy S. wrote:
> Please debug my code.
Whats the problem with it?
> Because i am unable to collect the edge value of Trigger signal.
How did you find that out? What do you expect of that code? And what do
you get instead?
Where in your description is a repetition of the Trigger Signal? I can't
find no one.
Saraswathy S. wrote:
> 1. Generating Trigger Signal for 500ns -Output Port trig_out
So only one Trigger pulse must be generated.
> 2. Generating counter data (counter_result)
From what? When should the counter stop?
> 3. collecting and Storing counter data (Final_Value) at every Positive
> edge of trigger signal.
According to 1. there is only 1 Trigger Signal active once for 500ns.
Shoul the trigger start later on once more? After a certain time? Or a
certain event?
Can you draw a sketch of that timing of those few signals and the
desired reaction?