cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
head_up
Adventurer
Adventurer
3,691 Views
Registered: ‎10-11-2009

ISIM (11.4 WebPack): How to make simulation in two time domains?

Jump to solution

hi! i have a little problem: I have two time domains and i need to make simulation for two time domains. the processes are independent in every time domain, but there is point where one process must wait other to complete and again to go ahead independent. i write the test bench in this style:

 

 

module top_test_2td;

 

// uut description

....

....

 

initial begin

//simulation code - time domain 1

semaphore_p1 = false;

.....

.....

.....

//here process 1 must wait process 2 to complete first part of simulation

while(semaphore_p2 != true);

 

//if semaphore_p2 is true - next part of code is executed

semaphore_p1 = true;

......

......

......

end

 

initial begin

 //simulation code - time domain 2

semaphore_p2 = false;

......

......

......

//here process 2 set flag 

semaphore_p2 = true;

//i dont know who of process will complete first and must wait process 1 to complete if process 2 is faster.

while(semaphore_p1 != true);

 

//ok, process 1 and process 2 are "in time", execute next part of code

......

......

.....

end

 

endmodule

 

Ok, but simulation stops at  this line (red color in "code"). the process 2 is freeze and never reach this line (blue color in "code"). in my test process 2 look to be slower (absolutely time).

 

Please, can u help me with some example or explanation how to make semaphore in verilog code or is there some "time/task manager" in ISIM?

 

Excuse  me for my bad english.

 

 

 

0 Kudos
1 Solution

Accepted Solutions
ywu
Xilinx Employee
Xilinx Employee
4,395 Views
Registered: ‎11-28-2007

Try "wait" statement instead of "while". e.g.

 

wait  (semaphore_p2 != true);

 

 

Cheers,
Jim

View solution in original post

0 Kudos
2 Replies
ywu
Xilinx Employee
Xilinx Employee
4,396 Views
Registered: ‎11-28-2007

Try "wait" statement instead of "while". e.g.

 

wait  (semaphore_p2 != true);

 

 

Cheers,
Jim

View solution in original post

0 Kudos
head_up
Adventurer
Adventurer
3,652 Views
Registered: ‎10-11-2009
Thank you, jimwu! wait statement works fine with expression for comparison of bool type and with some little changes in testbench code make it usefull for me. i'm not sure: wait statement will work if the type in expression is not bool? semaphore with more states? i must try... at this time the problem is solved.
0 Kudos