README revision 13463
14202Sbinkertn@umich.eduThis directory contains a demo of C++ configuration of gem5. The intention 24202Sbinkertn@umich.eduis to provide a mechanism to allow pre-generated config.ini files generated 34202Sbinkertn@umich.eduby Python-based gem5 to be reloaded in library-base versions of gem5 44202Sbinkertn@umich.eduembedded in other systems using C++ calls for simulation control. 54202Sbinkertn@umich.edu 64202Sbinkertn@umich.eduThis directory contain a demo of hosting a C++ configured version of gem5 74202Sbinkertn@umich.eduonto SystemC's event loop. The hosting is achieved by replacing 'simulate' 84202Sbinkertn@umich.eduwith a SystemC object which implements an event loop using SystemC scheduler 94202Sbinkertn@umich.edumechanisms. 104202Sbinkertn@umich.edu 114202Sbinkertn@umich.eduThe sc_... files here should probably be hosted in a diferent directory and 124202Sbinkertn@umich.edubuildable as a library. 134202Sbinkertn@umich.edu 144202Sbinkertn@umich.eduFiles: 154202Sbinkertn@umich.edu 164202Sbinkertn@umich.edu main.cc -- demonstration top level 174202Sbinkertn@umich.edu sc_logger.{cc,hh} -- rehosting of DPRINTF onto SC_REPORT 184202Sbinkertn@umich.edu sc_module.{cc,hh} -- SystemC simulation loop base class 194202Sbinkertn@umich.edu sc_gem5_control.{cc,hh} -- Alternative extra wrapping to allow gem5 204202Sbinkertn@umich.edu Systems to be instantiated as single 214202Sbinkertn@umich.edu sc_module objects. 224202Sbinkertn@umich.edu stats.{cc,hh} -- Stats dumping (copied from util/cxx_config) 234202Sbinkertn@umich.edu 244202Sbinkertn@umich.eduRead main.cc for more details of the implementation and sc_... files for 254202Sbinkertn@umich.edu 264202Sbinkertn@umich.eduTo build: 274202Sbinkertn@umich.edu 284202Sbinkertn@umich.eduFirst build gem5 as a library with cxx-config support and (optionally) 294202Sbinkertn@umich.eduwithout python. When building the library, disable gem5's native SystemC 304202Sbinkertn@umich.eduAPI support, as that will conflict with the external version. Also build a 314202Sbinkertn@umich.edunormal gem5 (cxx-config not needed, Python needed): 324202Sbinkertn@umich.edu 334486Sbinkertn@umich.edu> cd ../../.. 344486Sbinkertn@umich.edu> scons build/ARM/gem5.opt 356165Ssanchezd@stanford.edu> scons --with-cxx-config --without-python USE_SYSTEMC=0 \ 366168Snate@binkert.org> build/ARM/libgem5_opt.so 374202Sbinkertn@umich.edu> cd util/systemc 384202Sbinkertn@umich.edu 394202Sbinkertn@umich.eduNote: For MAC / OSX this command should be used: 408761Sgblack@eecs.umich.edu> scons --with-cxx-config --without-python USE_SYSTEMC=0 \ 414202Sbinkertn@umich.edu> build/ARM/libgem5_opt.dylib 424202Sbinkertn@umich.edu 434202Sbinkertn@umich.eduSet a proper LD_LIBRARY_PATH e.g. for bash: 448799Sgblack@eecs.umich.edu> export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/path/to/gem5/build/ARM/" 458799Sgblack@eecs.umich.edu 466168Snate@binkert.orgor for MAC / OSX: 477768SAli.Saidi@ARM.com> export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:/path/to/gem5/build/ARM/" 487768SAli.Saidi@ARM.com 497768SAli.Saidi@ARM.com 508763Sgblack@eecs.umich.eduThen edit the Makefile to set the paths for SystemC, e.g: 517768SAli.Saidi@ARM.com 527768SAli.Saidi@ARM.com Linux: 538335Snate@binkert.org SYSTEMC_INC = /opt/systemc/include 548335Snate@binkert.org SYSTEMC_LIB = /opt/systemc/lib-linux64 558335Snate@binkert.org 568335Snate@binkert.org MAC / OSX: 578335Snate@binkert.org SYSTEMC_INC = /opt/systemc/include 588335Snate@binkert.org SYSTEMC_LIB = /opt/systemc/lib-macosx64 597780Snilay@cs.wisc.edu 608335Snate@binkert.orgThen run make: 618335Snate@binkert.org 628683Snilay@cs.wisc.edu> make 638335Snate@binkert.org 648335Snate@binkert.orgMake a config file for the C++-configured gem5 using normal gem5 658335Snate@binkert.org 668335Snate@binkert.org> ../../../build/ARM/gem5.opt ../../../configs/example/se.py -c \ 678335Snate@binkert.org> ../../../tests/test-progs/hello/bin/arm/linux/hello 688335Snate@binkert.org 698615Snilay@cs.wisc.eduThe binary 'gem5.opt.cxx' can now be used to load in the generated config 708335Snate@binkert.orgfile from the previous normal gem5 run. 718687Snilay@cs.wisc.edu 728335Snate@binkert.orgTry: 737780Snilay@cs.wisc.edu 747780Snilay@cs.wisc.edu> ./gem5.opt.cxx m5out/config.ini 758687Snilay@cs.wisc.edu 768683Snilay@cs.wisc.eduThis should print: 77 78> Hello world! 79 80The .ini file can also be read by the Python .ini file reader example: 81 82> ../../../build/ARM/gem5.opt ../../../configs/example/read_ini.py \ 83> m5out/config.ini 84 85If you are interested in SystemC Transaction Level Modeling (TLM2) please have 86a look into /util/tlm. 87