EmbDev.net

Forum: FPGA, VHDL & Verilog Determining signal


von Nimesh S. (Company: None) (nimesh13)


Attached files:

Rate this post
useful
not useful
I wish to monitor two signals and I wish to determine which of the two 
changed first and then do some work accordingly.
1
 module tb(input sel1,
2
                 input sel2);
3
4
//Determine which of the two changed first
5
if sel1 changed first :
6
     //Do some work
7
else :
8
     //Do some Other work'
9
endmodule
The above is a sample code. I have also attached a photo as an example. 
In the  photo, in the first instance sel1 changed first and the 2nd 
time, sel2 changed first, (NOTE : going from low to high is a change, 
according to the picture)
Can someone help me write a code which can help me to make out which of 
the signal changed first.
Thank you

von Darika (Guest)


Rate this post
useful
not useful
Nimesh S. wrote:
> The above is a sample code. I have also attached a photo as an example.

No, thats not code, it's just a useless snippet.
Also the module is useless, because it's missing any output,
Also a clock signal is missed, I would not start to design with latches 
because this is bad design practice.

von Nimesh S. (Company: None) (nimesh13)


Rate this post
useful
not useful
> Also the module is useless, because it's missing any output,

No, that code is not useless. There need not be any output in a module 
sometimes. I shall write a more specific code now.
1
module tb(input sel1,
2
          input sel2,
3
          input hsel,
4
          input data,
5
          input addr);
6
7
integer fd;
8
initial 
9
begin
10
fd= $fopen(fd,"w");
11
12
@(posedge hsel)
13
// Determining which of the inputs changed first
14
// if sel1 changed first
15
  $fwrite(fd,data);
16
else
17
   $fwrite(fd,addr);
18
19
$fclode(fd)
20
end
21
endmodule

The input is coming from a testing system which is put under 
verification.
Basically a design has been put under verification and it outputs some 
data which is being fed to this module and I need to record the output 
of the system under verification.

von Darika (Guest)


Rate this post
useful
not useful
It was not clear, that you are looking for a testbench simulation 
routine, which is not intended to be synthesized, because it was not 
mentioned in the task description.


For more details regarding evaluating time of events with verilog see:
http://www.testbench.in/SV_22_EVENTS.html

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.