BasicLink.hh revision 13773
113821Sgabeblack@google.com/* 213821Sgabeblack@google.com * Copyright (c) 2011 Advanced Micro Devices, Inc. 313821Sgabeblack@google.com * All rights reserved. 413821Sgabeblack@google.com * 513821Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without 613821Sgabeblack@google.com * modification, are permitted provided that the following conditions are 713821Sgabeblack@google.com * met: redistributions of source code must retain the above copyright 813821Sgabeblack@google.com * notice, this list of conditions and the following disclaimer; 913821Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright 1013821Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the 1113821Sgabeblack@google.com * documentation and/or other materials provided with the distribution; 1213821Sgabeblack@google.com * neither the name of the copyright holders nor the names of its 1313821Sgabeblack@google.com * contributors may be used to endorse or promote products derived from 1413821Sgabeblack@google.com * this software without specific prior written permission. 1513821Sgabeblack@google.com * 1613821Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1713821Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1813821Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1913821Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 2013821Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2113821Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2213821Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2313821Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2413821Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2513821Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2613821Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2713821Sgabeblack@google.com */ 2813821Sgabeblack@google.com 2913821Sgabeblack@google.com#ifndef __MEM_RUBY_NETWORK_BASICLINK_HH__ 3013821Sgabeblack@google.com#define __MEM_RUBY_NETWORK_BASICLINK_HH__ 3113821Sgabeblack@google.com 3213821Sgabeblack@google.com#include <iostream> 3313821Sgabeblack@google.com#include <string> 3413821Sgabeblack@google.com#include <vector> 3513821Sgabeblack@google.com 3613821Sgabeblack@google.com#include "mem/ruby/network/BasicRouter.hh" 3713821Sgabeblack@google.com#include "mem/ruby/slicc_interface/AbstractController.hh" 3813821Sgabeblack@google.com#include "params/BasicExtLink.hh" 3913821Sgabeblack@google.com#include "params/BasicIntLink.hh" 4013821Sgabeblack@google.com#include "params/BasicLink.hh" 4113821Sgabeblack@google.com#include "sim/sim_object.hh" 4213821Sgabeblack@google.com 4313821Sgabeblack@google.comclass Topology; 4413821Sgabeblack@google.com 4513821Sgabeblack@google.comclass BasicLink : public SimObject 4613821Sgabeblack@google.com{ 4713821Sgabeblack@google.com public: 4813821Sgabeblack@google.com typedef BasicLinkParams Params; 4913821Sgabeblack@google.com BasicLink(const Params *p); 5013821Sgabeblack@google.com const Params *params() const { return (const Params *)_params; } 5113821Sgabeblack@google.com 5213821Sgabeblack@google.com void init(); 5313821Sgabeblack@google.com 5413821Sgabeblack@google.com void print(std::ostream& out) const; 5513821Sgabeblack@google.com 5613821Sgabeblack@google.com Cycles m_latency; 5713821Sgabeblack@google.com int m_bandwidth_factor; 5813821Sgabeblack@google.com int m_weight; 5913821Sgabeblack@google.com}; 6013821Sgabeblack@google.com 6113821Sgabeblack@google.cominline std::ostream& 6213821Sgabeblack@google.comoperator<<(std::ostream& out, const BasicLink& obj) 6313821Sgabeblack@google.com{ 6413821Sgabeblack@google.com obj.print(out); 6513821Sgabeblack@google.com out << std::flush; 6613823Sgabeblack@google.com return out; 6713823Sgabeblack@google.com} 6813821Sgabeblack@google.com 6913821Sgabeblack@google.comclass BasicExtLink : public BasicLink 7013821Sgabeblack@google.com{ 7113821Sgabeblack@google.com public: 7213821Sgabeblack@google.com typedef BasicExtLinkParams Params; 7313821Sgabeblack@google.com BasicExtLink(const Params *p); 7413821Sgabeblack@google.com const Params *params() const { return (const Params *)_params; } 7513821Sgabeblack@google.com 7613821Sgabeblack@google.com friend class Topology; 7713821Sgabeblack@google.com}; 7813821Sgabeblack@google.com 7913821Sgabeblack@google.comclass BasicIntLink : public BasicLink 8013821Sgabeblack@google.com{ 8113821Sgabeblack@google.com public: 8213821Sgabeblack@google.com typedef BasicIntLinkParams Params; 8313821Sgabeblack@google.com BasicIntLink(const Params *p); 8413821Sgabeblack@google.com const Params *params() const { return (const Params *)_params; } 8513821Sgabeblack@google.com 8613821Sgabeblack@google.com friend class Topology; 8713821Sgabeblack@google.com}; 8813821Sgabeblack@google.com 8913821Sgabeblack@google.com#endif //__MEM_RUBY_NETWORK_BASICLINK_HH__ 9013821Sgabeblack@google.com