Forum Discussion
Altera_Forum
Honored Contributor
17 years agowhy the simulation result is differenct between fork join and begin end?
this is the testbench in an495.
why can not use begin ... end. initial begin arst <= 1'b0; // resetting the contoller initially # 250 arst <= 1'b1; iderst <= 1'b0; ideen <= 1'b1; pioiordyen <= 1'b1; piorqst <= 1'b1; pioaddr <= 4'b0111; piodatain <= 16'b1111111100000000; piowe <= 1'b1; # 600 piowe <= 1'b0; ddi <= 16'b0000000011111111; iordy <= 1'b1; intrq <= 1'b1; flag <= 1'b0; //if error occured in the test procedure,then asserted # 5000 $stop; end use the fork join,the result is right fork arst = 1'b0; // resetting the contoller initially # 250 arst = 1'b1; iderst = 1'b0; ideen = 1'b1; pioiordyen = 1'b1; piorqst = 1'b1; pioaddr = 4'b0111; piodatain = 16'b1111111100000000; piowe = 1'b1; # 600 piowe = 1'b0; ddi = 16'b0000000011111111; iordy = 1'b1; intrq = 1'b1; flag = 1'b0; //if error occured in the test procedure,then asserted # 5000 $stop; join2 Replies
- Altera_Forum
Honored Contributor
The begin-end-block also assigns the values to the nets simultaneously if non-blocking assignments are used (as it's the case in the example). The difference is that all timing assignments are with respect to the block entry time in case of fork-join and with respect to the previous timing assignment in case of begin-end.
- Altera_Forum
Honored Contributor
The difference between "begin-end" and "fork-join" is that in initial block "begin-end" operations work step-by-step, but in "fork-join" they work simultaneously. You can rewrite the testbench using "begin-end". For example,
begin arst <= 1'b0; // resetting the contoller initially iderst <= 1'b0; ideen <= 1'b1; pioiordyen <= 1'b1; piorqst <= 1'b1; pioaddr <= 4'b0111; piodatain <= 16'b1111111100000000; piowe <= 1'b1; iordy <= 1'b1; intrq <= 1'b1; flag <= 1'b0; //if error occured in the test procedure,then asserted ddi <= 16'b0000000011111111; # 250 arst <= 1'b1; # 350 piowe <= 1'b0; # 4400 $stop; end I believe, it will work like original "fork-join"