Discussion:
[gem5-users] How to add a SystemC module into the gem5?
Wen, Dave
2018-10-19 08:31:00 UTC
Permalink
Hi all,

According to the Readme.md under ext/systemc. I added a new sub-project
folder under src/ and also add a SConstruct file for my little project.

```python
env = Environment()

env.Append(CXXFLAGS=['-std=c++11'])
if env['PLATFORM'] == 'darwin':
env.Append(LINKFLAGS=['-undefined', 'dynamic_lookup'])

systemc = env.SConscript('<path_to_systemc>/src/SConscript',
exports=['env'])
env.Program('example', ['example.cc', systemc])
```
However, I'm confused at the path of the SConscript. Such <path_to_systemc>
represents the path to the ext/systemc? or somewhere else? There is one
SConscript under ext/systemc, but not ext/src/SConscript.

BTW, does any document or tutorial to point out the way how to add a
systemc module
into the Gem5 from scratch?

thanks,
Dave
Gabe Black
2018-10-19 09:53:11 UTC
Permalink
Hi Dave. Could you describe what you're trying to do? Are you trying to
build a systemc module into gem5, or use gem5 as a black box inside
systemc? The instructions you're looking at are for the later.

In those instructions, they're telling you to make a directory for your
project somewhere else, not under src. Then from that project you'd have
your own top level SConstruct and include the SConscript in
ext/systemc/src/ from it.

Gabe
Post by Wen, Dave
Hi all,
According to the Readme.md under ext/systemc. I added a new sub-project
folder under src/ and also add a SConstruct file for my little project.
```python
env = Environment()
env.Append(CXXFLAGS=['-std=c++11'])
env.Append(LINKFLAGS=['-undefined', 'dynamic_lookup'])
systemc = env.SConscript('<path_to_systemc>/src/SConscript',
exports=['env'])
env.Program('example', ['example.cc', systemc])
```
However, I'm confused at the path of the SConscript. Such
<path_to_systemc> represents the path to the ext/systemc? or somewhere
else? There is one SConscript under ext/systemc, but not ext/src/SConscript.
BTW, does any document or tutorial to point out the way how to add a
systemc module into the Gem5 from scratch?
thanks,
Dave
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
Christian Menard
2018-10-19 12:27:54 UTC
Permalink
Hi Dave,

sorry for the confusion. gem5/ext is for third-party libraries and as
such ext/systemc only contains a clone of Accellera's systemc that can be
build by scons. The README there is for general usage of this library
from scons. You can also find it here [1].

For instruction on how to combine gem5 with systemc, please have a look
at the examples and README in util/tlm. This is a small library that
allows you to place an gem5 instance within a systemc module and to
translate messages from TLM to gem5 and back. There is also a paper that
explains most of the details [2]. Let me know if you run into any
trouble.

Cheers,
Christian


[1] https://github.com/tud-ccc/systemc-scons
[2] https://cfaed.tu-dresden.de/files/Images/people/chair-cc/publications/1707_Menard_SAMOS.pdf
Post by Wen, Dave
Hi all,
According to the Readme.md under ext/systemc. I added a new sub-project
folder under src/ and also add a SConstruct file for my little project.
```python
env = Environment()
env.Append(CXXFLAGS=['-std=c++11'])
env.Append(LINKFLAGS=['-undefined', 'dynamic_lookup'])
systemc = env.SConscript('<path_to_systemc>/src/SConscript',
exports=['env'])
env.Program('example', ['example.cc', systemc])
```
However, I'm confused at the path of the SConscript. Such <path_to_systemc>
represents the path to the ext/systemc? or somewhere else? There is one
SConscript under ext/systemc, but not ext/src/SConscript.
BTW, does any document or tutorial to point out the way how to add a
systemc module
into the Gem5 from scratch?
thanks,
Dave
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
Wen, Dave
2018-10-22 02:57:22 UTC
Permalink
Hi Gabe,

Thanks for your reply. In fact, I'm trying to build a systemc module inside
the Gem5. yes, just under the src. However, for so reason, I also need such
systemc module can be standalone for verification or some purposes. So I'm
wondering what's the proper way to do it?

In addition, I noticed your recently systemc commits. According to your
commits. I found you reimplement ( and improvement) the entire systemc library
in Gem5. Could you tell me what/why this for? (why not just working under
src and linking the systemc lib in ext?)

thanks,
Dave

Hi Dave. Could you describe what you're trying to do? Are you trying to
build a systemc module into gem5, or use gem5 as a black box inside
systemc? The instructions you're looking at are for the later.

In those instructions, they're telling you to make a directory for your
project somewhere else, not under src. Then from that project you'd have
your own top level SConstruct and include the SConscript in
ext/systemc/src/ from it.

Gabe
Post by Wen, Dave
Hi all,
According to the Readme.md under ext/systemc. I added a new sub-project
folder under src/ and also add a SConstruct file for my little project.
```python
env = Environment()
env.Append(CXXFLAGS=['-std=c++11'])
env.Append(LINKFLAGS=['-undefined', 'dynamic_lookup'])
systemc = env.SConscript('<path_to_systemc>/src/SConscript',
exports=['env'])
env.Program('example', ['example.cc', systemc])
```
However, I'm confused at the path of the SConscript. Such
<path_to_systemc> represents the path to the ext/systemc? or somewhere
else? There is one SConscript under ext/systemc, but not
ext/src/SConscript.
Post by Wen, Dave
BTW, does any document or tutorial to point out the way how to add a
systemc module into the Gem5 from scratch?
thanks,
Dave
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
Gabe Black
2018-10-22 04:07:40 UTC
Permalink
Putting your module in ext/systemc/src isn't what you should be doing
regardless of what you're trying to accomplish. If you want to build a
systemc module which you can use inside of gem5 (hooking up to the memory
system isn't available yet, but is in progress) you can follow these
examples:

https://gem5-review.googlesource.com/c/public/gem5/+/13376

If you want to use gem5 (with its own CPUs, etc., within it) as a component
inside a systemc simulation, you can use the approach Christian mentioned.

Whichever you choose depends on what works best for your situation. For
instance, if you want to be able to configure your component or other gem5
components at run time, you could use the first approach. If you want to
hook up the memory system you could (at least for right now) use the second
approach.

Which one you choose also determines which system is running things under
the hood. In the first case, gem5 provides the foundation which is used to
implement the systemc mechanisms. In the second case, gem5's mechanisms are
powered by the systemc kernel.

Gabe
Post by Wen, Dave
Hi Gabe,
Thanks for your reply. In fact, I'm trying to build a systemc module
inside the Gem5. yes, just under the src. However, for so reason, I also
need such systemc module can be standalone for verification or some
purposes. So I'm wondering what's the proper way to do it?
In addition, I noticed your recently systemc commits. According to your
commits. I found you reimplement ( and improvement) the entire systemc library
in Gem5. Could you tell me what/why this for? (why not just working under
src and linking the systemc lib in ext?)
thanks,
Dave
Hi Dave. Could you describe what you're trying to do? Are you trying to
build a systemc module into gem5, or use gem5 as a black box inside
systemc? The instructions you're looking at are for the later.
In those instructions, they're telling you to make a directory for your
project somewhere else, not under src. Then from that project you'd have
your own top level SConstruct and include the SConscript in
ext/systemc/src/ from it.
Gabe
Post by Wen, Dave
Hi all,
According to the Readme.md under ext/systemc. I added a new sub-project
folder under src/ and also add a SConstruct file for my little project.
```python
env = Environment()
env.Append(CXXFLAGS=['-std=c++11'])
env.Append(LINKFLAGS=['-undefined', 'dynamic_lookup'])
systemc = env.SConscript('<path_to_systemc>/src/SConscript',
exports=['env'])
env.Program('example', ['example.cc', systemc])
```
However, I'm confused at the path of the SConscript. Such
<path_to_systemc> represents the path to the ext/systemc? or somewhere
else? There is one SConscript under ext/systemc, but not
ext/src/SConscript.
Post by Wen, Dave
BTW, does any document or tutorial to point out the way how to add a
systemc module into the Gem5 from scratch?
thanks,
Dave
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
Loading...