CrossbarSwitch.hh revision 11666
15086Sgblack@eecs.umich.edu/*
25086Sgblack@eecs.umich.edu * Copyright (c) 2008 Princeton University
38466Snilay@cs.wisc.edu * Copyright (c) 2016 Georgia Institute of Technology
45086Sgblack@eecs.umich.edu * All rights reserved.
55086Sgblack@eecs.umich.edu *
67087Snate@binkert.org * Redistribution and use in source and binary forms, with or without
77087Snate@binkert.org * modification, are permitted provided that the following conditions are
87087Snate@binkert.org * met: redistributions of source code must retain the above copyright
97087Snate@binkert.org * notice, this list of conditions and the following disclaimer;
107087Snate@binkert.org * redistributions in binary form must reproduce the above copyright
117087Snate@binkert.org * notice, this list of conditions and the following disclaimer in the
127087Snate@binkert.org * documentation and/or other materials provided with the distribution;
137087Snate@binkert.org * neither the name of the copyright holders nor the names of its
145086Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from
157087Snate@binkert.org * this software without specific prior written permission.
167087Snate@binkert.org *
177087Snate@binkert.org * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
187087Snate@binkert.org * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
197087Snate@binkert.org * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
207087Snate@binkert.org * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
217087Snate@binkert.org * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
227087Snate@binkert.org * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
235086Sgblack@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
247087Snate@binkert.org * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
255086Sgblack@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
265086Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
275086Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
285086Sgblack@eecs.umich.edu *
295086Sgblack@eecs.umich.edu * Authors: Niket Agarwal
305086Sgblack@eecs.umich.edu *          Tushar Krishna
315086Sgblack@eecs.umich.edu */
325086Sgblack@eecs.umich.edu
335086Sgblack@eecs.umich.edu
345086Sgblack@eecs.umich.edu#ifndef __MEM_RUBY_NETWORK_GARNET_CROSSBAR_SWITCH_HH__
355086Sgblack@eecs.umich.edu#define __MEM_RUBY_NETWORK_GARNET_CROSSBAR_SWITCH_HH__
365086Sgblack@eecs.umich.edu
375086Sgblack@eecs.umich.edu#include <iostream>
385086Sgblack@eecs.umich.edu#include <vector>
395086Sgblack@eecs.umich.edu
405086Sgblack@eecs.umich.edu#include "mem/ruby/common/Consumer.hh"
4111793Sbrandon.potter@amd.com#include "mem/ruby/network/garnet2.0/CommonTypes.hh"
4211793Sbrandon.potter@amd.com#include "mem/ruby/network/garnet2.0/flitBuffer.hh"
435647Sgblack@eecs.umich.edu
448466Snilay@cs.wisc.educlass Router;
455135Sgblack@eecs.umich.educlass OutputUnit;
465647Sgblack@eecs.umich.edu
479889Sandreas@sandberg.pp.seclass CrossbarSwitch : public Consumer
4811800Sbrandon.potter@amd.com{
495086Sgblack@eecs.umich.edu  public:
505086Sgblack@eecs.umich.edu    CrossbarSwitch(Router *router);
515086Sgblack@eecs.umich.edu    ~CrossbarSwitch();
527707Sgblack@eecs.umich.edu    void wakeup();
537707Sgblack@eecs.umich.edu    void init();
547707Sgblack@eecs.umich.edu    void print(std::ostream& out) const {};
5510553Salexandru.dutu@amd.com
569887Sandreas@sandberg.pp.se    inline void update_sw_winner(int inport, flit *t_flit)
579887Sandreas@sandberg.pp.se    { m_switch_buffer[inport]->insert(t_flit); }
589887Sandreas@sandberg.pp.se
599887Sandreas@sandberg.pp.se    inline double get_crossbar_activity() { return m_crossbar_activity; }
609887Sandreas@sandberg.pp.se
619887Sandreas@sandberg.pp.se    uint32_t functionalWrite(Packet *pkt);
629887Sandreas@sandberg.pp.se
639887Sandreas@sandberg.pp.se  private:
649887Sandreas@sandberg.pp.se    int m_num_vcs;
659887Sandreas@sandberg.pp.se    int m_num_inports;
669887Sandreas@sandberg.pp.se    double m_crossbar_activity;
679887Sandreas@sandberg.pp.se    Router *m_router;
689887Sandreas@sandberg.pp.se    std::vector<flitBuffer *> m_switch_buffer;
699887Sandreas@sandberg.pp.se    std::vector<OutputUnit *> m_output_unit;
709887Sandreas@sandberg.pp.se};
719887Sandreas@sandberg.pp.se
725086Sgblack@eecs.umich.edu#endif // __MEM_RUBY_NETWORK_GARNET_CROSSBAR_SWITCH_HH__
735135Sgblack@eecs.umich.edu