README revision 13463
12139SN/AThis directory contains a demo of C++ configuration of gem5.  The intention
22139SN/Ais to provide a mechanism to allow pre-generated config.ini files generated
32139SN/Aby Python-based gem5 to be reloaded in library-base versions of gem5
42139SN/Aembedded in other systems using C++ calls for simulation control.
52139SN/A
62139SN/AThis directory contain a demo of hosting a C++ configured version of gem5
72139SN/Aonto SystemC's event loop.  The hosting is achieved by replacing 'simulate'
82139SN/Awith a SystemC object which implements an event loop using SystemC scheduler
92139SN/Amechanisms.
102139SN/A
112139SN/AThe sc_... files here should probably be hosted in a diferent directory and
122139SN/Abuildable as a library.
132139SN/A
142139SN/AFiles:
152139SN/A
162139SN/A    main.cc                 -- demonstration top level
172139SN/A    sc_logger.{cc,hh}       -- rehosting of DPRINTF onto SC_REPORT
182139SN/A    sc_module.{cc,hh}       -- SystemC simulation loop base class
192139SN/A    sc_gem5_control.{cc,hh} -- Alternative extra wrapping to allow gem5
202139SN/A                                Systems to be instantiated as single
212139SN/A                                sc_module objects.
222139SN/A    stats.{cc,hh}           -- Stats dumping (copied from util/cxx_config)
232139SN/A
242139SN/ARead main.cc for more details of the implementation and sc_... files for
252139SN/A
262139SN/ATo build:
272139SN/A
282665Ssaidi@eecs.umich.eduFirst build gem5 as a library with cxx-config support and (optionally)
292665Ssaidi@eecs.umich.eduwithout python.  When building the library, disable gem5's native SystemC
302139SN/AAPI support, as that will conflict with the external version.  Also build a
314202Sbinkertn@umich.edunormal gem5 (cxx-config not needed, Python needed):
328961Sgblack@eecs.umich.edu
3310196SCurtis.Dunham@arm.com> cd ../../..
342139SN/A> scons build/ARM/gem5.opt
354202Sbinkertn@umich.edu> scons --with-cxx-config --without-python USE_SYSTEMC=0 \
362152SN/A>       build/ARM/libgem5_opt.so
372152SN/A> cd util/systemc
382139SN/A
392139SN/ANote: For MAC / OSX this command should be used:
402139SN/A> scons --with-cxx-config --without-python USE_SYSTEMC=0 \
412139SN/A>       build/ARM/libgem5_opt.dylib
422139SN/A
432152SN/ASet a proper LD_LIBRARY_PATH e.g. for bash:
442152SN/A> export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/path/to/gem5/build/ARM/"
452139SN/A
462139SN/Aor for MAC / OSX:
472139SN/A> export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:/path/to/gem5/build/ARM/"
489020Sgblack@eecs.umich.edu
494781Snate@binkert.org
507799Sgblack@eecs.umich.eduThen edit the Makefile to set the paths for SystemC, e.g:
514781Snate@binkert.org
524781Snate@binkert.org    Linux:
533170Sstever@eecs.umich.edu    SYSTEMC_INC = /opt/systemc/include
545664Sgblack@eecs.umich.edu    SYSTEMC_LIB = /opt/systemc/lib-linux64
558105Sgblack@eecs.umich.edu
566179Sksewell@umich.edu    MAC / OSX:
574781Snate@binkert.org    SYSTEMC_INC = /opt/systemc/include
5810553Salexandru.dutu@amd.com    SYSTEMC_LIB = /opt/systemc/lib-macosx64
596329Sgblack@eecs.umich.edu
604781Snate@binkert.orgThen run make:
614781Snate@binkert.org
624781Snate@binkert.org> make
634781Snate@binkert.org
644781Snate@binkert.orgMake a config file for the C++-configured gem5 using normal gem5
654781Snate@binkert.org
662139SN/A> ../../../build/ARM/gem5.opt ../../../configs/example/se.py -c \
672139SN/A>       ../../../tests/test-progs/hello/bin/arm/linux/hello
683546Sgblack@eecs.umich.edu
694202Sbinkertn@umich.eduThe binary 'gem5.opt.cxx' can now be used to load in the generated config
702152SN/Afile from the previous normal gem5 run.
712152SN/A
722152SN/ATry:
732152SN/A
742152SN/A> ./gem5.opt.cxx m5out/config.ini
752152SN/A
762152SN/AThis should print:
772152SN/A
782152SN/A> Hello world!
792152SN/A
802152SN/AThe .ini file can also be read by the Python .ini file reader example:
812152SN/A
822504SN/A> ../../../build/ARM/gem5.opt ../../../configs/example/read_ini.py \
832504SN/A>       m5out/config.ini
842504SN/A
852504SN/AIf you are interested in SystemC Transaction Level Modeling (TLM2) please have
862152SN/Aa look into /util/tlm.
872504SN/A