tlm_master.py revision 12047
112047Schristian.menard@tu-dresden.de# 212047Schristian.menard@tu-dresden.de# Copyright (c) 2016, Dresden University of Technology (TU Dresden) 312047Schristian.menard@tu-dresden.de# All rights reserved. 412047Schristian.menard@tu-dresden.de# 512047Schristian.menard@tu-dresden.de# Redistribution and use in source and binary forms, with or without 612047Schristian.menard@tu-dresden.de# modification, are permitted provided that the following conditions are 712047Schristian.menard@tu-dresden.de# met: 812047Schristian.menard@tu-dresden.de# 912047Schristian.menard@tu-dresden.de# 1. Redistributions of source code must retain the above copyright notice, 1012047Schristian.menard@tu-dresden.de# this list of conditions and the following disclaimer. 1112047Schristian.menard@tu-dresden.de# 1212047Schristian.menard@tu-dresden.de# 2. Redistributions in binary form must reproduce the above copyright 1312047Schristian.menard@tu-dresden.de# notice, this list of conditions and the following disclaimer in the 1412047Schristian.menard@tu-dresden.de# documentation and/or other materials provided with the distribution. 1512047Schristian.menard@tu-dresden.de# 1612047Schristian.menard@tu-dresden.de# 3. Neither the name of the copyright holder nor the names of its 1712047Schristian.menard@tu-dresden.de# contributors may be used to endorse or promote products derived from 1812047Schristian.menard@tu-dresden.de# this software without specific prior written permission. 1912047Schristian.menard@tu-dresden.de# 2012047Schristian.menard@tu-dresden.de# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 2112047Schristian.menard@tu-dresden.de# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 2212047Schristian.menard@tu-dresden.de# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 2312047Schristian.menard@tu-dresden.de# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 2412047Schristian.menard@tu-dresden.de# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 2512047Schristian.menard@tu-dresden.de# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 2612047Schristian.menard@tu-dresden.de# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 2712047Schristian.menard@tu-dresden.de# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 2812047Schristian.menard@tu-dresden.de# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 2912047Schristian.menard@tu-dresden.de# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 3012047Schristian.menard@tu-dresden.de# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3112047Schristian.menard@tu-dresden.de# 3212047Schristian.menard@tu-dresden.de# Authors: Christian Menard 3312047Schristian.menard@tu-dresden.de# 3412047Schristian.menard@tu-dresden.de 3512047Schristian.menard@tu-dresden.deimport m5 3612047Schristian.menard@tu-dresden.defrom m5.objects import * 3712047Schristian.menard@tu-dresden.de 3812047Schristian.menard@tu-dresden.deimport os 3912047Schristian.menard@tu-dresden.de 4012047Schristian.menard@tu-dresden.de# Base System Architecture: 4112047Schristian.menard@tu-dresden.de# +-----+ ^ 4212047Schristian.menard@tu-dresden.de# | TLM | | TLM World 4312047Schristian.menard@tu-dresden.de# +--+--+ | (see main.cc) 4412047Schristian.menard@tu-dresden.de# | v 4512047Schristian.menard@tu-dresden.de# +----------v-----------+ External Port (see sc_master_port.*) 4612047Schristian.menard@tu-dresden.de# | Membus | ^ 4712047Schristian.menard@tu-dresden.de# +----------+-----------+ | 4812047Schristian.menard@tu-dresden.de# | | gem5 World 4912047Schristian.menard@tu-dresden.de# +---v----+ | 5012047Schristian.menard@tu-dresden.de# | Memory | | 5112047Schristian.menard@tu-dresden.de# +--------+ v 5212047Schristian.menard@tu-dresden.de# 5312047Schristian.menard@tu-dresden.de 5412047Schristian.menard@tu-dresden.de# Create a system with a Crossbar and a simple Memory: 5512047Schristian.menard@tu-dresden.desystem = System() 5612047Schristian.menard@tu-dresden.desystem.membus = IOXBar(width = 16) 5712047Schristian.menard@tu-dresden.desystem.physmem = SimpleMemory(range = AddrRange('512MB')) 5812047Schristian.menard@tu-dresden.desystem.clk_domain = SrcClockDomain(clock = '1.5GHz', 5912047Schristian.menard@tu-dresden.de voltage_domain = VoltageDomain(voltage = '1V')) 6012047Schristian.menard@tu-dresden.de 6112047Schristian.menard@tu-dresden.de# Create a external TLM port: 6212047Schristian.menard@tu-dresden.desystem.tlm = ExternalMaster() 6312047Schristian.menard@tu-dresden.desystem.tlm.port_type = "tlm_master" 6412047Schristian.menard@tu-dresden.desystem.tlm.port_data = "transactor" 6512047Schristian.menard@tu-dresden.de 6612047Schristian.menard@tu-dresden.de# Route the connections: 6712047Schristian.menard@tu-dresden.desystem.system_port = system.membus.slave 6812047Schristian.menard@tu-dresden.desystem.physmem.port = system.membus.master 6912047Schristian.menard@tu-dresden.desystem.tlm.port = system.membus.slave 7012047Schristian.menard@tu-dresden.desystem.mem_mode = 'timing' 7112047Schristian.menard@tu-dresden.de 7212047Schristian.menard@tu-dresden.de# Start the simulation: 7312047Schristian.menard@tu-dresden.deroot = Root(full_system = False, system = system) 7412047Schristian.menard@tu-dresden.dem5.instantiate() 7512047Schristian.menard@tu-dresden.dem5.simulate() 76