README revision 13372
1This directory contains a demo of C++ configuration of gem5. The intention 2is to provide a mechanism to allow pre-generated config.ini files generated 3by Python-based gem5 to be reloaded in library-base versions of gem5 4embedded in other systems using C++ calls for simulation control. 5 6This directory contain a demo of hosting a C++ configured version of gem5 7onto SystemC's event loop. The hosting is achieved by replacing 'simulate' 8with a SystemC object which implements an event loop using SystemC scheduler 9mechanisms. 10 11The sc_... files here should probably be hosted in a diferent directory and 12buildable as a library. 13 14Files: 15 16 main.cc -- demonstration top level 17 sc_logger.{cc,hh} -- rehosting of DPRINTF onto SC_REPORT 18 sc_module.{cc,hh} -- SystemC simulation loop base class 19 sc_gem5_control.{cc,hh} -- Alternative extra wrapping to allow gem5 20 Systems to be instantiated as single 21 sc_module objects. 22 stats.{cc,hh} -- Stats dumping (copied from util/cxx_config) 23 24Read main.cc for more details of the implementation and sc_... files for 25 26To build: 27 28First build gem5 as a library with cxx-config support and (optionally) 29without python. Also build a normal gem5 (cxx-config not needed, Python 30needed): 31 32> cd ../../.. 33> scons build/ARM/gem5.opt 34> scons --with-cxx-config --without-python build/ARM/libgem5_opt.so 35> cd util/systemc 36 37Note: For MAC / OSX this command should be used: 38> scons --with-cxx-config --without-python build/ARM/libgem5_opt.dylib 39 40Set a proper LD_LIBRARY_PATH e.g. for bash: 41> export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/path/to/gem5/build/ARM/" 42 43or for MAC / OSX: 44> export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:/path/to/gem5/build/ARM/" 45 46 47Then edit the Makefile to set the paths for SystemC, e.g: 48 49 Linux: 50 SYSTEMC_INC = /opt/systemc/include 51 SYSTEMC_LIB = /opt/systemc/lib-linux64 52 53 MAC / OSX: 54 SYSTEMC_INC = /opt/systemc/include 55 SYSTEMC_LIB = /opt/systemc/lib-macosx64 56 57Then run make: 58 59> make 60 61Make a config file for the C++-configured gem5 using normal gem5 62 63> ../../../build/ARM/gem5.opt ../../../configs/example/se.py -c \ 64> ../../../tests/test-progs/hello/bin/arm/linux/hello 65 66The binary 'gem5.opt.cxx' can now be used to load in the generated config 67file from the previous normal gem5 run. 68 69Try: 70 71> ./gem5.opt.cxx m5out/config.ini 72 73This should print: 74 75> Hello world! 76 77The .ini file can also be read by the Python .ini file reader example: 78 79> ../../../build/ARM/gem5.opt ../../../configs/example/read_ini.py \ 80> m5out/config.ini 81 82If you are interested in SystemC Transaction Level Modeling (TLM2) please have 83a look into /util/tlm. 84