- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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; joinLink Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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"- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page