# Concurrent VS Sequential coding to speed up the simulation run time

**URL:** <https://verificationacademy.com/forums/t/concurrent-vs-sequential-coding-to-speed-up-the-simulation-run-time/31174>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog, Sequential-sequence, simulation-profile, Verilog, runtime-speed\
**Created:** [October 30, 2015, 8:55am UTC](https://verificationacademy.com/forums/t/concurrent-vs-sequential-coding-to-speed-up-the-simulation-run-time/31174 "2015-10-30T08:55:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BibinPaul](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/b/e56c9b/32.png) [@BibinPaul](https://verificationacademy.com/forums/u/BibinPaul)\
**Post date:** [October 30, 2015, 8:55am UTC](https://verificationacademy.com/forums/t/concurrent-vs-sequential-coding-to-speed-up-the-simulation-run-time/31174/1 "2015-10-30T08:55:42Z")

</div>

Hi,

Could you please let me know, if I write a particular logic using concurrent way or in sequential way , which will be execute faster/slower . ? Which has advantage over the other ?

Here we have 2 events

1. Increment a counter
2. Display the value of the counter.

Example code snippets for the requirements :

Code1:

```verilog
fork 
forever (@posedge clk) begin
   if (en) begin
     count = count +1;
     display("new count value")
   end
end
join_none 

```

VS:  
Code2:

Now lets assume the count is incrementing in some other parallel block, to display the value of count we are using a parallel thread like below .

```verilog
fork 
  forever@(posedge clk) begin
   if (en) begin
     count = count +1;
   end
 end
join_none

fork 
  forever @count
  display("new count value") 
join_none 

```

Which among the 2 codes will make the simulator run faster ? if so why. Actual case I have is much more complex, but I just tried to illustrate my problem with this basic code.

Thanks

---

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [November 2, 2015, 5:35am UTC](https://verificationacademy.com/forums/t/concurrent-vs-sequential-coding-to-speed-up-the-simulation-run-time/31174/2 "2015-11-02T05:35:55Z")

</div>

The first code example will probably execute faster because there is only one process and no overhead in communication between the two processes. But simulators have a lot of optimizations that could change the answer to your question depending on the actual code. It’s also hard to comment on the advantages of either style without seeing more code.
