0

I am starting with using SystemC, and studying example mentioned in Using existing unit test frameworks with SystemC

I do not really understand why forking is required, especially when one fork only waits the other. Is there something in the kernel that needs such multi-threading (especially the event handling)? (in other words: do I need this type of handling ONLY when I need concurrent testing, or also in the more simple cases)

Another question that in the linked answer I see the logo at the beginning

 SystemC 2.2.0 --- Feb 24 2011 15:01:50
        Copyright (c) 1996-2006 by all Contributors
                    ALL RIGHTS RESERVED
Running main() from gtest_main.cc

while in my case the logo is at the end of the output

Running main() from gtest_main.cc
[==========] Running 0 tests from 0 test cases.
[==========] 0 tests from 0 test cases ran. (0 ms total)
[  PASSED  ] 0 tests.
Hello World.

        SystemC 2.3.1-Accellera --- Mar 28 2017 21:08:36
        Copyright (c) 1996-2014 by all Contributors,
        ALL RIGHTS RESERVED

It is just because of the different versions, or it is an expected timely behavior?

Community
  • 1
  • 1
katang
  • 2,474
  • 5
  • 24
  • 48

2 Answers2

0

The way SystemC kernel is designed in it's current form it does not fully support dynamic creation/removal of simulation module's, once you have started the SystemC simulation with sc_start() and stopped the simulation with sc_stop() you need to completely destroy the SystemC simulation context.

Kindly look at the updated answer for better solution here.
Note: It is advisable to have separate executable for different simulation context as the simulator does not guarantee the results for the simulation in this kind of environment, kindly refer SystemC LRM for more details.

As for the SystemC logo differences it is due to different buffering of stdout, stderr in your system. You will see different results for every execution of the binary. (If it is consistent then maybe google test framework is handling the stdout and stderr streams internally.)

AmeyaVS
  • 814
  • 10
  • 26
0

I would go with using registry design pattern. I have already posted how you can do that with SystemC and GoogleTest in Using existing unit test frameworks with SystemC

tymonx
  • 71
  • 1
  • 5