GarnetLink.hh revision 12492
113510Sjairo.balart@metempsy.com/*
214179Sadrian.herrera@arm.com * Copyright (c) 2008 Princeton University
313510Sjairo.balart@metempsy.com * Copyright (c) 2016 Georgia Institute of Technology
413510Sjairo.balart@metempsy.com * All rights reserved.
513510Sjairo.balart@metempsy.com *
613510Sjairo.balart@metempsy.com * Redistribution and use in source and binary forms, with or without
713510Sjairo.balart@metempsy.com * modification, are permitted provided that the following conditions are
813510Sjairo.balart@metempsy.com * met: redistributions of source code must retain the above copyright
913510Sjairo.balart@metempsy.com * notice, this list of conditions and the following disclaimer;
1013510Sjairo.balart@metempsy.com * redistributions in binary form must reproduce the above copyright
1113510Sjairo.balart@metempsy.com * notice, this list of conditions and the following disclaimer in the
1213510Sjairo.balart@metempsy.com * documentation and/or other materials provided with the distribution;
1313510Sjairo.balart@metempsy.com * neither the name of the copyright holders nor the names of its
1413510Sjairo.balart@metempsy.com * contributors may be used to endorse or promote products derived from
1513510Sjairo.balart@metempsy.com * this software without specific prior written permission.
1613510Sjairo.balart@metempsy.com *
1713510Sjairo.balart@metempsy.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1813510Sjairo.balart@metempsy.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1913510Sjairo.balart@metempsy.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2013510Sjairo.balart@metempsy.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2113510Sjairo.balart@metempsy.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2213510Sjairo.balart@metempsy.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2313510Sjairo.balart@metempsy.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2413510Sjairo.balart@metempsy.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2513510Sjairo.balart@metempsy.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2613510Sjairo.balart@metempsy.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2713510Sjairo.balart@metempsy.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2813510Sjairo.balart@metempsy.com *
2913510Sjairo.balart@metempsy.com * Authors: Niket Agarwal
3013510Sjairo.balart@metempsy.com *          Tushar Krishna
3113510Sjairo.balart@metempsy.com */
3213510Sjairo.balart@metempsy.com
3313510Sjairo.balart@metempsy.com
3413510Sjairo.balart@metempsy.com#ifndef __MEM_RUBY_NETWORK_GARNET2_0_GARNETLINK_HH__
3513510Sjairo.balart@metempsy.com#define __MEM_RUBY_NETWORK_GARNET2_0_GARNETLINK_HH__
3613510Sjairo.balart@metempsy.com
3713510Sjairo.balart@metempsy.com#include <iostream>
3813510Sjairo.balart@metempsy.com#include <string>
3913510Sjairo.balart@metempsy.com#include <vector>
4013510Sjairo.balart@metempsy.com
4113510Sjairo.balart@metempsy.com#include "mem/ruby/network/BasicLink.hh"
4214179Sadrian.herrera@arm.com#include "mem/ruby/network/garnet2.0/CreditLink.hh"
4313510Sjairo.balart@metempsy.com#include "mem/ruby/network/garnet2.0/NetworkLink.hh"
4413879Sgiacomo.travaglini@arm.com#include "params/GarnetExtLink.hh"
4513510Sjairo.balart@metempsy.com#include "params/GarnetIntLink.hh"
4613879Sgiacomo.travaglini@arm.com
4713510Sjairo.balart@metempsy.comclass GarnetIntLink : public BasicIntLink
4813510Sjairo.balart@metempsy.com{
4913510Sjairo.balart@metempsy.com  public:
5013510Sjairo.balart@metempsy.com    typedef GarnetIntLinkParams Params;
5113510Sjairo.balart@metempsy.com    GarnetIntLink(const Params *p);
5213510Sjairo.balart@metempsy.com
5313510Sjairo.balart@metempsy.com    void init();
5413510Sjairo.balart@metempsy.com
5513510Sjairo.balart@metempsy.com    void print(std::ostream& out) const;
5613510Sjairo.balart@metempsy.com
5713510Sjairo.balart@metempsy.com    friend class GarnetNetwork;
5813510Sjairo.balart@metempsy.com
5914114Schunchenhsu@google.com  protected:
6014114Schunchenhsu@google.com    NetworkLink* m_network_link;
6113510Sjairo.balart@metempsy.com    CreditLink* m_credit_link;
6213510Sjairo.balart@metempsy.com};
6313510Sjairo.balart@metempsy.com
6413510Sjairo.balart@metempsy.cominline std::ostream&
6513510Sjairo.balart@metempsy.comoperator<<(std::ostream& out, const GarnetIntLink& obj)
6613510Sjairo.balart@metempsy.com{
6713510Sjairo.balart@metempsy.com    obj.print(out);
6813510Sjairo.balart@metempsy.com    out << std::flush;
6913510Sjairo.balart@metempsy.com    return out;
7013510Sjairo.balart@metempsy.com}
7113510Sjairo.balart@metempsy.com
7213510Sjairo.balart@metempsy.comclass GarnetExtLink : public BasicExtLink
7313510Sjairo.balart@metempsy.com{
7413510Sjairo.balart@metempsy.com  public:
7513510Sjairo.balart@metempsy.com    typedef GarnetExtLinkParams Params;
7613510Sjairo.balart@metempsy.com    GarnetExtLink(const Params *p);
7713510Sjairo.balart@metempsy.com
7813510Sjairo.balart@metempsy.com    void init();
7913510Sjairo.balart@metempsy.com
8013510Sjairo.balart@metempsy.com    void print(std::ostream& out) const;
8113510Sjairo.balart@metempsy.com
8213510Sjairo.balart@metempsy.com    friend class GarnetNetwork;
8313510Sjairo.balart@metempsy.com
8413510Sjairo.balart@metempsy.com  protected:
8513510Sjairo.balart@metempsy.com    NetworkLink* m_network_links[2];
8613510Sjairo.balart@metempsy.com    CreditLink* m_credit_links[2];
8713510Sjairo.balart@metempsy.com};
8813510Sjairo.balart@metempsy.com
8913510Sjairo.balart@metempsy.cominline std::ostream&
9013510Sjairo.balart@metempsy.comoperator<<(std::ostream& out, const GarnetExtLink& obj)
9113510Sjairo.balart@metempsy.com{
9213510Sjairo.balart@metempsy.com    obj.print(out);
9313510Sjairo.balart@metempsy.com    out << std::flush;
9413510Sjairo.balart@metempsy.com    return out;
9513510Sjairo.balart@metempsy.com}
9613510Sjairo.balart@metempsy.com
9713510Sjairo.balart@metempsy.com#endif //__MEM_RUBY_NETWORK_GARNET2_0_GARNETLINK_HH__
9813510Sjairo.balart@metempsy.com