slave_transactor.cc revision 12047:8b269268312c
16145Snate@binkert.org/* 26145Snate@binkert.org * Copyright (c) 2016, Dresden University of Technology (TU Dresden) 36145Snate@binkert.org * All rights reserved. 46145Snate@binkert.org * 56145Snate@binkert.org * Redistribution and use in source and binary forms, with or without 66145Snate@binkert.org * modification, are permitted provided that the following conditions are 76145Snate@binkert.org * met: 86145Snate@binkert.org * 96145Snate@binkert.org * 1. Redistributions of source code must retain the above copyright notice, 106145Snate@binkert.org * this list of conditions and the following disclaimer. 116145Snate@binkert.org * 126145Snate@binkert.org * 2. Redistributions in binary form must reproduce the above copyright 136145Snate@binkert.org * notice, this list of conditions and the following disclaimer in the 146145Snate@binkert.org * documentation and/or other materials provided with the distribution. 156145Snate@binkert.org * 166145Snate@binkert.org * 3. Neither the name of the copyright holder nor the names of its 176145Snate@binkert.org * contributors may be used to endorse or promote products derived from 186145Snate@binkert.org * this software without specific prior written permission. 196145Snate@binkert.org * 206145Snate@binkert.org * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 216145Snate@binkert.org * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 226145Snate@binkert.org * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 236145Snate@binkert.org * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 246145Snate@binkert.org * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 256145Snate@binkert.org * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 266145Snate@binkert.org * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 276145Snate@binkert.org * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 286145Snate@binkert.org * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 296154Snate@binkert.org * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 306154Snate@binkert.org * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 316145Snate@binkert.org * 326145Snate@binkert.org * Authors: Christian Menard 336145Snate@binkert.org */ 346145Snate@binkert.org 356145Snate@binkert.org#include "sc_slave_port.hh" 366145Snate@binkert.org#include "sim_control.hh" 377039Snate@binkert.org#include "slave_transactor.hh" 387039Snate@binkert.org 396145Snate@binkert.orgnamespace Gem5SystemC 407039Snate@binkert.org{ 416145Snate@binkert.org 426145Snate@binkert.orgGem5SlaveTransactor::Gem5SlaveTransactor(sc_core::sc_module_name name, 437039Snate@binkert.org const std::string& portName) 447039Snate@binkert.org : sc_core::sc_module(name), 456145Snate@binkert.org socket(portName.c_str()), 467039Snate@binkert.org sim_control("sim_control"), 477039Snate@binkert.org portName(portName) 487039Snate@binkert.org{ 497039Snate@binkert.org if (portName.empty()) { 506145Snate@binkert.org SC_REPORT_ERROR(name, "No port name specified!\n"); 516145Snate@binkert.org } 527039Snate@binkert.org} 537039Snate@binkert.org 546145Snate@binkert.orgvoid 557039Snate@binkert.orgGem5SlaveTransactor::before_end_of_elaboration() 567039Snate@binkert.org{ 576145Snate@binkert.org auto* port = sim_control->getSlavePort(portName); 586145Snate@binkert.org 597039Snate@binkert.org port->bindToTransactor(this); 607039Snate@binkert.org} 616145Snate@binkert.org 627039Snate@binkert.org} 637039Snate@binkert.org