TlmBridge.py revision 13874:290caa906b75
19657SN/A# Copyright 2019 Google, Inc. 29657SN/A# 39657SN/A# Redistribution and use in source and binary forms, with or without 49657SN/A# modification, are permitted provided that the following conditions are 59657SN/A# met: redistributions of source code must retain the above copyright 69657SN/A# notice, this list of conditions and the following disclaimer; 79657SN/A# redistributions in binary form must reproduce the above copyright 89657SN/A# notice, this list of conditions and the following disclaimer in the 99657SN/A# documentation and/or other materials provided with the distribution; 109657SN/A# neither the name of the copyright holders nor the names of its 119657SN/A# contributors may be used to endorse or promote products derived from 129657SN/A# this software without specific prior written permission. 139657SN/A# 149657SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 159657SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 169657SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 179657SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 189657SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 199657SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 209657SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 219657SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 229657SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 239657SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 249657SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 259657SN/A# 269657SN/A# Authors: Gabe Black 279657SN/A 289657SN/Afrom m5.objects.SystemC import SystemC_ScModule 299657SN/Afrom m5.params import * 309657SN/Afrom m5.proxy import * 319657SN/A 329657SN/Afrom m5.objects.Tlm import TlmTargetSocket, TlmInitiatorSocket 339657SN/A 349657SN/Aclass Gem5ToTlmBridgeBase(SystemC_ScModule): 359657SN/A type = 'Gem5ToTlmBridgeBase' 369657SN/A abstract = True 379657SN/A cxx_class = 'sc_gem5::Gem5ToTlmBridgeBase' 389657SN/A cxx_header = 'systemc/tlm_bridge/gem5_to_tlm.hh' 3914212Sgiacomo.travaglini@arm.com 409657SN/A system = Param.System(Parent.any, "system") 419657SN/A 429657SN/A gem5 = SlavePort('gem5 slave port') 4310857Sandreas.sandberg@arm.com addr_ranges = VectorParam.AddrRange([], 44 'Addresses served by this port\'s TLM side') 45 46class TlmToGem5BridgeBase(SystemC_ScModule): 47 type = 'TlmToGem5BridgeBase' 48 abstract = True 49 cxx_class = 'sc_gem5::TlmToGem5BridgeBase' 50 cxx_header = 'systemc/tlm_bridge/tlm_to_gem5.hh' 51 52 system = Param.System(Parent.any, "system") 53 54 gem5 = MasterPort('gem5 master port') 55 56 57class Gem5ToTlmBridge32(Gem5ToTlmBridgeBase): 58 type = 'Gem5ToTlmBridge32' 59 cxx_template_params = [ 'unsigned int BITWIDTH' ] 60 cxx_class = 'sc_gem5::Gem5ToTlmBridge<32>' 61 cxx_header = 'systemc/tlm_bridge/gem5_to_tlm.hh' 62 63 tlm = TlmInitiatorSocket(32, 'TLM initiator socket') 64 65class Gem5ToTlmBridge64(Gem5ToTlmBridgeBase): 66 type = 'Gem5ToTlmBridge64' 67 cxx_template_params = [ 'unsigned int BITWIDTH' ] 68 cxx_class = 'sc_gem5::Gem5ToTlmBridge<64>' 69 cxx_header = 'systemc/tlm_bridge/gem5_to_tlm.hh' 70 71 tlm = TlmInitiatorSocket(64, 'TLM initiator socket') 72 73 74class TlmToGem5Bridge32(TlmToGem5BridgeBase): 75 type = 'TlmToGem5Bridge32' 76 cxx_template_params = [ 'unsigned int BITWIDTH' ] 77 cxx_class = 'sc_gem5::TlmToGem5Bridge<32>' 78 cxx_header = 'systemc/tlm_bridge/tlm_to_gem5.hh' 79 80 tlm = TlmTargetSocket(32, 'TLM target socket') 81 82class TlmToGem5Bridge64(TlmToGem5BridgeBase): 83 type = 'TlmToGem5Bridge64' 84 cxx_template_params = [ 'unsigned int BITWIDTH' ] 85 cxx_class = 'sc_gem5::TlmToGem5Bridge<64>' 86 cxx_header = 'systemc/tlm_bridge/tlm_to_gem5.hh' 87 88 tlm = TlmTargetSocket(64, 'TLM target socket') 89