MessageBuffer.py revision 13062
111021Sjthestness@gmail.com# Copyright (c) 2015 Mark D. Hill and David A. Wood. 211021Sjthestness@gmail.com# All rights reserved. 311021Sjthestness@gmail.com# 411021Sjthestness@gmail.com# Redistribution and use in source and binary forms, with or without 511021Sjthestness@gmail.com# modification, are permitted provided that the following conditions are 611021Sjthestness@gmail.com# met: redistributions of source code must retain the above copyright 711021Sjthestness@gmail.com# notice, this list of conditions and the following disclaimer; 811021Sjthestness@gmail.com# redistributions in binary form must reproduce the above copyright 911021Sjthestness@gmail.com# notice, this list of conditions and the following disclaimer in the 1011021Sjthestness@gmail.com# documentation and/or other materials provided with the distribution; 1111021Sjthestness@gmail.com# neither the name of the copyright holders nor the names of its 1211021Sjthestness@gmail.com# contributors may be used to endorse or promote products derived from 1311021Sjthestness@gmail.com# this software without specific prior written permission. 1411021Sjthestness@gmail.com# 1511021Sjthestness@gmail.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1611021Sjthestness@gmail.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1711021Sjthestness@gmail.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1811021Sjthestness@gmail.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 1911021Sjthestness@gmail.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2011021Sjthestness@gmail.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2111021Sjthestness@gmail.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2211021Sjthestness@gmail.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2311021Sjthestness@gmail.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2411021Sjthestness@gmail.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2511021Sjthestness@gmail.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2611021Sjthestness@gmail.com# 2711021Sjthestness@gmail.com# Authors: Joel Hestness 2811021Sjthestness@gmail.com 2911021Sjthestness@gmail.comfrom m5.params import * 3011021Sjthestness@gmail.comfrom m5.proxy import * 3111021Sjthestness@gmail.comfrom m5.SimObject import SimObject 3211021Sjthestness@gmail.com 3311021Sjthestness@gmail.comclass MessageBuffer(SimObject): 3411021Sjthestness@gmail.com type = 'MessageBuffer' 3511021Sjthestness@gmail.com cxx_class = 'MessageBuffer' 3611021Sjthestness@gmail.com cxx_header = "mem/ruby/network/MessageBuffer.hh" 3711021Sjthestness@gmail.com ordered = Param.Bool(False, "Whether the buffer is ordered") 3811021Sjthestness@gmail.com buffer_size = Param.Unsigned(0, "Maximum number of entries to buffer \ 3911021Sjthestness@gmail.com (0 allows infinite entries)") 4013062Sxianwei.zhang@amd.com randomization = Param.Bool(False, "Insert random delays on message \ 4113062Sxianwei.zhang@amd.com enqueue times (enforced to have \ 4213062Sxianwei.zhang@amd.com random delays if RubySystem \ 4313062Sxianwei.zhang@amd.com randomization flag is True)") 4411021Sjthestness@gmail.com 4511021Sjthestness@gmail.com master = MasterPort("Master port to MessageBuffer receiver") 4611021Sjthestness@gmail.com slave = SlavePort("Slave port from MessageBuffer sender") 47