master_transactor.cc revision 12047:8b269268312c
111308Santhony.gutierrez@amd.com/*
211308Santhony.gutierrez@amd.com * Copyright (c) 2016, Dresden University of Technology (TU Dresden)
311308Santhony.gutierrez@amd.com * All rights reserved.
411308Santhony.gutierrez@amd.com *
511308Santhony.gutierrez@amd.com * Redistribution and use in source and binary forms, with or without
611308Santhony.gutierrez@amd.com * modification, are permitted provided that the following conditions are
711308Santhony.gutierrez@amd.com * met:
811308Santhony.gutierrez@amd.com *
911308Santhony.gutierrez@amd.com * 1. Redistributions of source code must retain the above copyright notice,
1011308Santhony.gutierrez@amd.com *    this list of conditions and the following disclaimer.
1111308Santhony.gutierrez@amd.com *
1211308Santhony.gutierrez@amd.com * 2. Redistributions in binary form must reproduce the above copyright
1311308Santhony.gutierrez@amd.com *    notice, this list of conditions and the following disclaimer in the
1411308Santhony.gutierrez@amd.com *    documentation and/or other materials provided with the distribution.
1511308Santhony.gutierrez@amd.com *
1611308Santhony.gutierrez@amd.com * 3. Neither the name of the copyright holder nor the names of its
1711308Santhony.gutierrez@amd.com *    contributors may be used to endorse or promote products derived from
1811308Santhony.gutierrez@amd.com *    this software without specific prior written permission.
1911308Santhony.gutierrez@amd.com *
2011308Santhony.gutierrez@amd.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2111308Santhony.gutierrez@amd.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2211308Santhony.gutierrez@amd.com * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2311308Santhony.gutierrez@amd.com * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
2411308Santhony.gutierrez@amd.com * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
2511308Santhony.gutierrez@amd.com * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
2611308Santhony.gutierrez@amd.com * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
2711308Santhony.gutierrez@amd.com * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
2811308Santhony.gutierrez@amd.com * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
2911308Santhony.gutierrez@amd.com * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
3011308Santhony.gutierrez@amd.com * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3111308Santhony.gutierrez@amd.com *
3211308Santhony.gutierrez@amd.com * Authors: Christian Menard
3311308Santhony.gutierrez@amd.com */
3411308Santhony.gutierrez@amd.com
3511534Sjohn.kalamatianos@amd.com#include "master_transactor.hh"
3611308Santhony.gutierrez@amd.com#include "sc_master_port.hh"
3711534Sjohn.kalamatianos@amd.com#include "sim_control.hh"
3811308Santhony.gutierrez@amd.com
3911308Santhony.gutierrez@amd.comnamespace Gem5SystemC
4011308Santhony.gutierrez@amd.com{
4111308Santhony.gutierrez@amd.com
4211308Santhony.gutierrez@amd.comGem5MasterTransactor::Gem5MasterTransactor(sc_core::sc_module_name name,
4311308Santhony.gutierrez@amd.com                                           const std::string& portName)
4411308Santhony.gutierrez@amd.com    : sc_core::sc_module(name),
4511308Santhony.gutierrez@amd.com      socket(portName.c_str()),
4611308Santhony.gutierrez@amd.com      sim_control("sim_control"),
4711308Santhony.gutierrez@amd.com      portName(portName)
4811308Santhony.gutierrez@amd.com{
4911308Santhony.gutierrez@amd.com    if (portName.empty()) {
5011308Santhony.gutierrez@amd.com        SC_REPORT_ERROR(name, "No port name specified!\n");
5111308Santhony.gutierrez@amd.com    }
5211308Santhony.gutierrez@amd.com}
5311308Santhony.gutierrez@amd.com
5411308Santhony.gutierrez@amd.comvoid
5511308Santhony.gutierrez@amd.comGem5MasterTransactor::before_end_of_elaboration()
5611308Santhony.gutierrez@amd.com{
5711308Santhony.gutierrez@amd.com    auto* port = sim_control->getMasterPort(portName);
5811308Santhony.gutierrez@amd.com
5911308Santhony.gutierrez@amd.com    port->bindToTransactor(this);
6011308Santhony.gutierrez@amd.com}
6111308Santhony.gutierrez@amd.com
6211308Santhony.gutierrez@amd.com}
6311308Santhony.gutierrez@amd.com