111818SChristian.Menard@tu-dresden.de/* 211818SChristian.Menard@tu-dresden.de * Copyright (c) 2015, University of Kaiserslautern 311818SChristian.Menard@tu-dresden.de * Copyright (c) 2016, Dresden University of Technology (TU Dresden) 411818SChristian.Menard@tu-dresden.de * All rights reserved. 511818SChristian.Menard@tu-dresden.de * 611818SChristian.Menard@tu-dresden.de * Redistribution and use in source and binary forms, with or without 711818SChristian.Menard@tu-dresden.de * modification, are permitted provided that the following conditions are 811818SChristian.Menard@tu-dresden.de * met: 911818SChristian.Menard@tu-dresden.de * 1011818SChristian.Menard@tu-dresden.de * 1. Redistributions of source code must retain the above copyright notice, 1111818SChristian.Menard@tu-dresden.de * this list of conditions and the following disclaimer. 1211818SChristian.Menard@tu-dresden.de * 1311818SChristian.Menard@tu-dresden.de * 2. Redistributions in binary form must reproduce the above copyright 1411818SChristian.Menard@tu-dresden.de * notice, this list of conditions and the following disclaimer in the 1511818SChristian.Menard@tu-dresden.de * documentation and/or other materials provided with the distribution. 1611818SChristian.Menard@tu-dresden.de * 1711818SChristian.Menard@tu-dresden.de * 3. Neither the name of the copyright holder nor the names of its 1811818SChristian.Menard@tu-dresden.de * contributors may be used to endorse or promote products derived from 1911818SChristian.Menard@tu-dresden.de * this software without specific prior written permission. 2011818SChristian.Menard@tu-dresden.de * 2111818SChristian.Menard@tu-dresden.de * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 2211818SChristian.Menard@tu-dresden.de * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 2311818SChristian.Menard@tu-dresden.de * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 2411818SChristian.Menard@tu-dresden.de * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 2511818SChristian.Menard@tu-dresden.de * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 2611818SChristian.Menard@tu-dresden.de * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 2711818SChristian.Menard@tu-dresden.de * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 2811818SChristian.Menard@tu-dresden.de * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 2911818SChristian.Menard@tu-dresden.de * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 3011818SChristian.Menard@tu-dresden.de * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 3111818SChristian.Menard@tu-dresden.de * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3211818SChristian.Menard@tu-dresden.de * 3311818SChristian.Menard@tu-dresden.de * Authors: Matthias Jung 3411818SChristian.Menard@tu-dresden.de * Christian Menard 3511818SChristian.Menard@tu-dresden.de * Abdul Mutaal Ahmad 3611818SChristian.Menard@tu-dresden.de */ 3711818SChristian.Menard@tu-dresden.de 3811818SChristian.Menard@tu-dresden.de/** 3911818SChristian.Menard@tu-dresden.de * @file 4011818SChristian.Menard@tu-dresden.de * 4111818SChristian.Menard@tu-dresden.de * Example top level file for SystemC-TLM integration with C++-only 4211818SChristian.Menard@tu-dresden.de * instantiation. 4311818SChristian.Menard@tu-dresden.de * 4411818SChristian.Menard@tu-dresden.de */ 4511818SChristian.Menard@tu-dresden.de 4611818SChristian.Menard@tu-dresden.de#include <systemc> 4711818SChristian.Menard@tu-dresden.de#include <tlm> 4811818SChristian.Menard@tu-dresden.de 4911821SChristian.Menard@tu-dresden.de#include "cli_parser.hh" 5011821SChristian.Menard@tu-dresden.de#include "report_handler.hh" 5111818SChristian.Menard@tu-dresden.de#include "sc_target.hh" 5211818SChristian.Menard@tu-dresden.de#include "sim_control.hh" 5311822SChristian.Menard@tu-dresden.de#include "slave_transactor.hh" 5411818SChristian.Menard@tu-dresden.de#include "stats.hh" 5511818SChristian.Menard@tu-dresden.de 5611818SChristian.Menard@tu-dresden.deint 5711818SChristian.Menard@tu-dresden.desc_main(int argc, char **argv) 5811818SChristian.Menard@tu-dresden.de{ 5911821SChristian.Menard@tu-dresden.de CliParser parser; 6011821SChristian.Menard@tu-dresden.de parser.parse(argc, argv); 6111821SChristian.Menard@tu-dresden.de 6211818SChristian.Menard@tu-dresden.de sc_core::sc_report_handler::set_handler(reportHandler); 6311818SChristian.Menard@tu-dresden.de 6411822SChristian.Menard@tu-dresden.de Gem5SystemC::Gem5SimControl sim_control("gem5", 6511821SChristian.Menard@tu-dresden.de parser.getConfigFile(), 6611821SChristian.Menard@tu-dresden.de parser.getSimulationEnd(), 6711821SChristian.Menard@tu-dresden.de parser.getDebugFlags()); 6811818SChristian.Menard@tu-dresden.de 6911821SChristian.Menard@tu-dresden.de unsigned long long int memorySize = 512*1024*1024ULL; 7011818SChristian.Menard@tu-dresden.de 7111822SChristian.Menard@tu-dresden.de Gem5SystemC::Gem5SlaveTransactor transactor("transactor", "transactor"); 7211822SChristian.Menard@tu-dresden.de Target memory("memory", 7311822SChristian.Menard@tu-dresden.de parser.getVerboseFlag(), 7411822SChristian.Menard@tu-dresden.de memorySize, 7511822SChristian.Menard@tu-dresden.de parser.getMemoryOffset()); 7611818SChristian.Menard@tu-dresden.de 7711822SChristian.Menard@tu-dresden.de memory.socket.bind(transactor.socket); 7811822SChristian.Menard@tu-dresden.de transactor.sim_control.bind(sim_control); 7911818SChristian.Menard@tu-dresden.de 8011821SChristian.Menard@tu-dresden.de SC_REPORT_INFO("sc_main", "Start of Simulation"); 8111821SChristian.Menard@tu-dresden.de 8211818SChristian.Menard@tu-dresden.de sc_core::sc_start(); 8311818SChristian.Menard@tu-dresden.de 8411818SChristian.Menard@tu-dresden.de SC_REPORT_INFO("sc_main", "End of Simulation"); 8511818SChristian.Menard@tu-dresden.de 8611818SChristian.Menard@tu-dresden.de CxxConfig::statsDump(); 8711818SChristian.Menard@tu-dresden.de 8811818SChristian.Menard@tu-dresden.de return EXIT_SUCCESS; 8911818SChristian.Menard@tu-dresden.de} 90