Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

fork join does not wokr!

Status
Not open for further replies.

b01010101

Junior Member level 1
Joined
Apr 29, 2009
Messages
15
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,408
I use the "fork join" in my testbench, but I find that the modelsim execute the first part firstly, when all the N times are finished, the second part is then executed.
I think the fork join doesn't work in my code.

Can anybody tell me why? Thank you.

The following is my code:

....
fork
begin
///////////////// first part////////////////
for(cnt=0; cnt<N; cnt=cnt+1) begin
for(i=0;i<=5;i=i+1) begin h=$random; end
x00=$random;x01=$random;x02=$random;x03=$random;x04=$random;
x10=$random;x11=$random;x12=$random;x13=$random;x14=$random;
x20=$random;x21=$random;x22=$random;x23=$random;x24=$random;
x30=$random;x31=$random;x32=$random;x33=$random;x34=$random;
x40=$random;x41=$random;x42=$random;x43=$random;x44=$random
full_result =x00*h[0]+(x01+x04+x10+x40)*h[1]+
(x02+x20+x03+x30)*h[2]+(x11+x14+x41+x44)*h[3]+
(x12+x13+x21+x31+x24+x34+x42+x43)*h[4]+
(x22+x23+x32+x33)*h[5];
right_result[0]=full_result[36:21]; // high 16bits
for(j=0;j<DELTA;j=j+1) begin
@(posedge clk);
end
end
end

///////////////// second part////////////////
begin
for(i=0;i<LAMDA;i=i+1) begin
@(posedge clk);
end
for(cnt2=0; cnt2<Times; cnt2=cnt2+1) begin
if(right_result[LAMDA-1]!=dout) begin
$display ("Caculate Error!\n");
$stop;
end
end
$display ("Test Successful!\n");
$stop;
end
join
...
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top