BasicRouter.hh revision 9465:4ae4f3f4b870
112837Sgabeblack@google.com/*
212837Sgabeblack@google.com * Copyright (c) 2011 Advanced Micro Devices, Inc.
312837Sgabeblack@google.com * All rights reserved.
412837Sgabeblack@google.com *
512837Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without
612837Sgabeblack@google.com * modification, are permitted provided that the following conditions are
712837Sgabeblack@google.com * met: redistributions of source code must retain the above copyright
812837Sgabeblack@google.com * notice, this list of conditions and the following disclaimer;
912837Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright
1012837Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the
1112837Sgabeblack@google.com * documentation and/or other materials provided with the distribution;
1212837Sgabeblack@google.com * neither the name of the copyright holders nor the names of its
1312837Sgabeblack@google.com * contributors may be used to endorse or promote products derived from
1412837Sgabeblack@google.com * this software without specific prior written permission.
1512837Sgabeblack@google.com *
1612837Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1712837Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1812837Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1912837Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2012837Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2112837Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2212837Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2312837Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2412837Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2512837Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2612837Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2712837Sgabeblack@google.com */
2812837Sgabeblack@google.com
2912837Sgabeblack@google.com#ifndef __MEM_RUBY_NETWORK_BASIC_ROUTER_HH__
3012901Sgabeblack@google.com#define __MEM_RUBY_NETWORK_BASIC_ROUTER_HH__
3113135Sgabeblack@google.com
3212901Sgabeblack@google.com#include <iostream>
3312901Sgabeblack@google.com#include <string>
3413280Sgabeblack@google.com#include <vector>
3512982Sgabeblack@google.com
3612951Sgabeblack@google.com#include "params/BasicRouter.hh"
3713280Sgabeblack@google.com#include "sim/clocked_object.hh"
3813288Sgabeblack@google.com
3912953Sgabeblack@google.comclass BasicRouter : public ClockedObject
4013260Sgabeblack@google.com{
4113288Sgabeblack@google.com  public:
4213288Sgabeblack@google.com    typedef BasicRouterParams Params;
4313288Sgabeblack@google.com    BasicRouter(const Params *p);
4413155Sgabeblack@google.com    const Params *params() const { return (const Params *)_params; }
4513317Sgabeblack@google.com
4612837Sgabeblack@google.com    void init();
4712951Sgabeblack@google.com
4813155Sgabeblack@google.com    void print(std::ostream& out) const;
4913135Sgabeblack@google.com
5012837Sgabeblack@google.com    friend class Topology;
5112952Sgabeblack@google.com
5212952Sgabeblack@google.com  protected:
5312952Sgabeblack@google.com    //
5412952Sgabeblack@google.com    // ID in relation to other routers in the system
5512952Sgabeblack@google.com    //
5612952Sgabeblack@google.com    uint32_t m_id;
5713135Sgabeblack@google.com};
5813135Sgabeblack@google.com
5913135Sgabeblack@google.cominline std::ostream&
6013135Sgabeblack@google.comoperator<<(std::ostream& out, const BasicRouter& obj)
6113317Sgabeblack@google.com{
6213317Sgabeblack@google.com    obj.print(out);
6313135Sgabeblack@google.com    out << std::flush;
6413135Sgabeblack@google.com    return out;
6512993Sgabeblack@google.com}
6612993Sgabeblack@google.com
6712952Sgabeblack@google.com#endif // __MEM_RUBY_NETWORK_BASIC_ROUTER_HH__
6812952Sgabeblack@google.com