master_transactor.cc revision 12047
112837Sgabeblack@google.com/* 212837Sgabeblack@google.com * Copyright (c) 2016, Dresden University of Technology (TU Dresden) 312837Sgabeblack@google.com * All rights reserved. 412837Sgabeblack@google.com * 512837Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without 612837Sgabeblack@google.com * modification, are permitted provided that the following conditions are 712837Sgabeblack@google.com * met: 812837Sgabeblack@google.com * 912837Sgabeblack@google.com * 1. Redistributions of source code must retain the above copyright notice, 1012837Sgabeblack@google.com * this list of conditions and the following disclaimer. 1112837Sgabeblack@google.com * 1212837Sgabeblack@google.com * 2. Redistributions in binary form must reproduce the above copyright 1312837Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the 1412837Sgabeblack@google.com * documentation and/or other materials provided with the distribution. 1512837Sgabeblack@google.com * 1612837Sgabeblack@google.com * 3. Neither the name of the copyright holder nor the names of its 1712837Sgabeblack@google.com * contributors may be used to endorse or promote products derived from 1812837Sgabeblack@google.com * this software without specific prior written permission. 1912837Sgabeblack@google.com * 2012837Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 2112837Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 2212837Sgabeblack@google.com * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 2312837Sgabeblack@google.com * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 2412837Sgabeblack@google.com * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 2512837Sgabeblack@google.com * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 2612837Sgabeblack@google.com * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 2712837Sgabeblack@google.com * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 2812837Sgabeblack@google.com * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 2912837Sgabeblack@google.com * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 3012837Sgabeblack@google.com * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3112957Sgabeblack@google.com * 3213210Sgabeblack@google.com * Authors: Christian Menard 3313210Sgabeblack@google.com */ 3413210Sgabeblack@google.com 3513317Sgabeblack@google.com#include "master_transactor.hh" 3612957Sgabeblack@google.com#include "sc_master_port.hh" 3713211Sgabeblack@google.com#include "sim_control.hh" 3812837Sgabeblack@google.com 3913211Sgabeblack@google.comnamespace Gem5SystemC 4012837Sgabeblack@google.com{ 4112837Sgabeblack@google.com 4212837Sgabeblack@google.comGem5MasterTransactor::Gem5MasterTransactor(sc_core::sc_module_name name, 4312837Sgabeblack@google.com const std::string& portName) 4413211Sgabeblack@google.com : sc_core::sc_module(name), 4513211Sgabeblack@google.com socket(portName.c_str()), 4613211Sgabeblack@google.com sim_control("sim_control"), 4713211Sgabeblack@google.com portName(portName) 4813211Sgabeblack@google.com{ 4913211Sgabeblack@google.com if (portName.empty()) { 5013211Sgabeblack@google.com SC_REPORT_ERROR(name, "No port name specified!\n"); 5113317Sgabeblack@google.com } 5213211Sgabeblack@google.com} 5313211Sgabeblack@google.com 5413211Sgabeblack@google.comvoid 5513211Sgabeblack@google.comGem5MasterTransactor::before_end_of_elaboration() 5612952Sgabeblack@google.com{ 5712952Sgabeblack@google.com auto* port = sim_control->getMasterPort(portName); 5812837Sgabeblack@google.com 5912957Sgabeblack@google.com port->bindToTransactor(this); 6012837Sgabeblack@google.com} 6113211Sgabeblack@google.com 6213207Sgabeblack@google.com} 6312837Sgabeblack@google.com