sc_ext.cc revision 12047:8b269268312c
1955SN/A/* 2955SN/A * Copyright (c) 2015, University of Kaiserslautern 31762SN/A * Copyright (c) 2016, Dresden University of Technology (TU Dresden) 4955SN/A * All rights reserved. 5955SN/A * 6955SN/A * Redistribution and use in source and binary forms, with or without 7955SN/A * modification, are permitted provided that the following conditions are 8955SN/A * met: 9955SN/A * 10955SN/A * 1. Redistributions of source code must retain the above copyright notice, 11955SN/A * this list of conditions and the following disclaimer. 12955SN/A * 13955SN/A * 2. Redistributions in binary form must reproduce the above copyright 14955SN/A * notice, this list of conditions and the following disclaimer in the 15955SN/A * documentation and/or other materials provided with the distribution. 16955SN/A * 17955SN/A * 3. Neither the name of the copyright holder nor the names of its 18955SN/A * contributors may be used to endorse or promote products derived from 19955SN/A * this software without specific prior written permission. 20955SN/A * 21955SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22955SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 23955SN/A * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 24955SN/A * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 25955SN/A * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26955SN/A * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 27955SN/A * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 282665Ssaidi@eecs.umich.edu * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 294762Snate@binkert.org * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 30955SN/A * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 315522Snate@binkert.org * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 326143Snate@binkert.org * 334762Snate@binkert.org * Authors: 345522Snate@binkert.org * Matthias Jung 35955SN/A * Christian Menard 365522Snate@binkert.org */ 37955SN/A 385522Snate@binkert.org#include "sc_ext.hh" 394202Sbinkertn@umich.edu 405742Snate@binkert.orgusing namespace tlm; 41955SN/A 424381Sbinkertn@umich.edunamespace Gem5SystemC 434381Sbinkertn@umich.edu{ 448334Snate@binkert.org 45955SN/AGem5Extension::Gem5Extension(PacketPtr packet) 46955SN/A{ 474202Sbinkertn@umich.edu Packet = packet; 48955SN/A pipeThrough = false; 494382Sbinkertn@umich.edu} 504382Sbinkertn@umich.edu 514382Sbinkertn@umich.eduGem5Extension& Gem5Extension::getExtension(const tlm_generic_payload *payload) 526654Snate@binkert.org{ 535517Snate@binkert.org Gem5Extension *result = NULL; 548614Sgblack@eecs.umich.edu payload->get_extension(result); 557674Snate@binkert.org sc_assert(result!=NULL); 566143Snate@binkert.org return *result; 576143Snate@binkert.org} 586143Snate@binkert.org 598233Snate@binkert.orgGem5Extension& Gem5Extension::getExtension(const tlm_generic_payload &payload) 608233Snate@binkert.org{ 618233Snate@binkert.org return Gem5Extension::getExtension(&payload); 628233Snate@binkert.org} 638233Snate@binkert.org 648334Snate@binkert.orgPacketPtr Gem5Extension::getPacket() 658334Snate@binkert.org{ 6610453SAndrew.Bardsley@arm.com return Packet; 6710453SAndrew.Bardsley@arm.com} 688233Snate@binkert.org 698233Snate@binkert.orgtlm_extension_base* Gem5Extension::clone() const 708233Snate@binkert.org{ 718233Snate@binkert.org return new Gem5Extension(Packet); 728233Snate@binkert.org} 738233Snate@binkert.org 746143Snate@binkert.orgvoid Gem5Extension::copy_from(const tlm_extension_base& ext) 758233Snate@binkert.org{ 768233Snate@binkert.org const Gem5Extension& cpyFrom = static_cast<const Gem5Extension&>(ext); 778233Snate@binkert.org Packet = cpyFrom.Packet; 786143Snate@binkert.org} 796143Snate@binkert.org 806143Snate@binkert.org} 816143Snate@binkert.org