111819SChristian.Menard@tu-dresden.de/*
211819SChristian.Menard@tu-dresden.de * Copyright (c) 2016, Dresden University of Technology (TU Dresden)
311819SChristian.Menard@tu-dresden.de * All rights reserved.
411819SChristian.Menard@tu-dresden.de *
511819SChristian.Menard@tu-dresden.de * Redistribution and use in source and binary forms, with or without
611819SChristian.Menard@tu-dresden.de * modification, are permitted provided that the following conditions are
711819SChristian.Menard@tu-dresden.de * met:
811819SChristian.Menard@tu-dresden.de *
911819SChristian.Menard@tu-dresden.de * 1. Redistributions of source code must retain the above copyright notice,
1011819SChristian.Menard@tu-dresden.de *    this list of conditions and the following disclaimer.
1111819SChristian.Menard@tu-dresden.de *
1211819SChristian.Menard@tu-dresden.de * 2. Redistributions in binary form must reproduce the above copyright
1311819SChristian.Menard@tu-dresden.de *    notice, this list of conditions and the following disclaimer in the
1411819SChristian.Menard@tu-dresden.de *    documentation and/or other materials provided with the distribution.
1511819SChristian.Menard@tu-dresden.de *
1611819SChristian.Menard@tu-dresden.de * 3. Neither the name of the copyright holder nor the names of its
1711819SChristian.Menard@tu-dresden.de *    contributors may be used to endorse or promote products derived from
1811819SChristian.Menard@tu-dresden.de *    this software without specific prior written permission.
1911819SChristian.Menard@tu-dresden.de *
2011819SChristian.Menard@tu-dresden.de * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2111819SChristian.Menard@tu-dresden.de * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2211819SChristian.Menard@tu-dresden.de * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2311819SChristian.Menard@tu-dresden.de * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
2411819SChristian.Menard@tu-dresden.de * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
2511819SChristian.Menard@tu-dresden.de * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
2611819SChristian.Menard@tu-dresden.de * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
2711819SChristian.Menard@tu-dresden.de * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
2811819SChristian.Menard@tu-dresden.de * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
2911819SChristian.Menard@tu-dresden.de * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
3011819SChristian.Menard@tu-dresden.de * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3111819SChristian.Menard@tu-dresden.de *
3211819SChristian.Menard@tu-dresden.de * Authors: Christian Menard
3311819SChristian.Menard@tu-dresden.de */
3411819SChristian.Menard@tu-dresden.de
3511819SChristian.Menard@tu-dresden.de#include <systemc>
3611819SChristian.Menard@tu-dresden.de#include <tlm>
3711819SChristian.Menard@tu-dresden.de
3811821SChristian.Menard@tu-dresden.de#include "cli_parser.hh"
3911822SChristian.Menard@tu-dresden.de#include "master_transactor.hh"
4011821SChristian.Menard@tu-dresden.de#include "report_handler.hh"
4111819SChristian.Menard@tu-dresden.de#include "sim_control.hh"
4211819SChristian.Menard@tu-dresden.de#include "stats.hh"
4311819SChristian.Menard@tu-dresden.de#include "traffic_generator.hh"
4411819SChristian.Menard@tu-dresden.de
4511819SChristian.Menard@tu-dresden.deint
4611819SChristian.Menard@tu-dresden.desc_main(int argc, char** argv)
4711819SChristian.Menard@tu-dresden.de{
4811821SChristian.Menard@tu-dresden.de    CliParser parser;
4911821SChristian.Menard@tu-dresden.de    parser.parse(argc, argv);
5011821SChristian.Menard@tu-dresden.de
5111819SChristian.Menard@tu-dresden.de    sc_core::sc_report_handler::set_handler(reportHandler);
5211819SChristian.Menard@tu-dresden.de
5311822SChristian.Menard@tu-dresden.de    Gem5SystemC::Gem5SimControl sim_control("gem5",
5411822SChristian.Menard@tu-dresden.de                                            parser.getConfigFile(),
5511822SChristian.Menard@tu-dresden.de                                            parser.getSimulationEnd(),
5611822SChristian.Menard@tu-dresden.de                                            parser.getDebugFlags());
5711821SChristian.Menard@tu-dresden.de
5811819SChristian.Menard@tu-dresden.de    TrafficGenerator trafficGenerator("traffic_generator");
5911822SChristian.Menard@tu-dresden.de    Gem5SystemC::Gem5MasterTransactor transactor("transactor", "transactor");
6011819SChristian.Menard@tu-dresden.de
6111822SChristian.Menard@tu-dresden.de    trafficGenerator.socket.bind(transactor.socket);
6211822SChristian.Menard@tu-dresden.de    transactor.sim_control.bind(sim_control);
6311819SChristian.Menard@tu-dresden.de
6411821SChristian.Menard@tu-dresden.de    SC_REPORT_INFO("sc_main", "Start of Simulation");
6511819SChristian.Menard@tu-dresden.de
6611819SChristian.Menard@tu-dresden.de    sc_core::sc_start(); // Run to end of simulation
6711819SChristian.Menard@tu-dresden.de
6811819SChristian.Menard@tu-dresden.de    SC_REPORT_INFO("sc_main", "End of Simulation");
6911819SChristian.Menard@tu-dresden.de
7011819SChristian.Menard@tu-dresden.de    CxxConfig::statsDump();
7111819SChristian.Menard@tu-dresden.de
7211819SChristian.Menard@tu-dresden.de    return EXIT_SUCCESS;
7311819SChristian.Menard@tu-dresden.de}
74