Interview Question: Verilog Code To Find Duration Of Clock

Status
Not open for further replies.

spartanthewarrior

Full Member level 2
Joined
Jun 13, 2007
Messages
122
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,296
Activity points
2,142
Hi All,

Can anybody help me answering a question.

Note:- Don't as Jitter, Set-Up, Hold Time Values. I need Verilog logic.

How can i find a duration of a given (Clock) using Verilog. There are two cases when

1) Duty Cycle is 50%

2) Duty Cycle is 30%

Please help me it's important
 

It should look something like this:

initial begin
#500; // wait clock to be stable
@(posedge clk) t1 = $time;
@(posedge clk) t2 = $time;
$write ("The period is : %t", t2-t1);
end
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…