Determining signal

OP (Company: None) #6303516
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
Attached files:
Guest #6303529
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.
OP (Company: None) #6303571
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.

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.