111184Serfan.azarkhish@unibo.it/*
211184Serfan.azarkhish@unibo.it * Copyright (c) 2011-2013 ARM Limited
311184Serfan.azarkhish@unibo.it * All rights reserved
411184Serfan.azarkhish@unibo.it *
511184Serfan.azarkhish@unibo.it * The license below extends only to copyright in the software and shall
611184Serfan.azarkhish@unibo.it * not be construed as granting a license to any other intellectual
711184Serfan.azarkhish@unibo.it * property including but not limited to intellectual property relating
811184Serfan.azarkhish@unibo.it * to a hardware implementation of the functionality of the software
911184Serfan.azarkhish@unibo.it * licensed hereunder.  You may use the software subject to the license
1011184Serfan.azarkhish@unibo.it * terms below provided that you ensure that this notice is replicated
1111184Serfan.azarkhish@unibo.it * unmodified and in its entirety in all distributions of the software,
1211184Serfan.azarkhish@unibo.it * modified or unmodified, in source code or in binary form.
1311184Serfan.azarkhish@unibo.it *
1411184Serfan.azarkhish@unibo.it * Copyright (c) 2015 The University of Bologna
1511184Serfan.azarkhish@unibo.it * All rights reserved.
1611184Serfan.azarkhish@unibo.it *
1711184Serfan.azarkhish@unibo.it * Redistribution and use in source and binary forms, with or without
1811184Serfan.azarkhish@unibo.it * modification, are permitted provided that the following conditions are
1911184Serfan.azarkhish@unibo.it * met: redistributions of source code must retain the above copyright
2011184Serfan.azarkhish@unibo.it * notice, this list of conditions and the following disclaimer;
2111184Serfan.azarkhish@unibo.it * redistributions in binary form must reproduce the above copyright
2211184Serfan.azarkhish@unibo.it * notice, this list of conditions and the following disclaimer in the
2311184Serfan.azarkhish@unibo.it * documentation and/or other materials provided with the distribution;
2411184Serfan.azarkhish@unibo.it * neither the name of the copyright holders nor the names of its
2511184Serfan.azarkhish@unibo.it * contributors may be used to endorse or promote products derived from
2611184Serfan.azarkhish@unibo.it * this software without specific prior written permission.
2711184Serfan.azarkhish@unibo.it *
2811184Serfan.azarkhish@unibo.it * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2911184Serfan.azarkhish@unibo.it * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3011184Serfan.azarkhish@unibo.it * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3111184Serfan.azarkhish@unibo.it * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3211184Serfan.azarkhish@unibo.it * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3311184Serfan.azarkhish@unibo.it * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3411184Serfan.azarkhish@unibo.it * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3511184Serfan.azarkhish@unibo.it * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3611184Serfan.azarkhish@unibo.it * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3711184Serfan.azarkhish@unibo.it * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3811184Serfan.azarkhish@unibo.it * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3911184Serfan.azarkhish@unibo.it *
4011184Serfan.azarkhish@unibo.it * Authors: Erfan Azarkhish
4111184Serfan.azarkhish@unibo.it */
4211184Serfan.azarkhish@unibo.it
4311184Serfan.azarkhish@unibo.it
4411184Serfan.azarkhish@unibo.it/**
4511184Serfan.azarkhish@unibo.it * @file
4611184Serfan.azarkhish@unibo.it * HMCController declaration
4711184Serfan.azarkhish@unibo.it */
4811184Serfan.azarkhish@unibo.it
4912492Sodanrc@yahoo.com.br#ifndef __MEM_HMC_CONTROLLER_HH__
5012492Sodanrc@yahoo.com.br#define __MEM_HMC_CONTROLLER_HH__
5111184Serfan.azarkhish@unibo.it
5211184Serfan.azarkhish@unibo.it#include "mem/noncoherent_xbar.hh"
5311184Serfan.azarkhish@unibo.it#include "mem/port.hh"
5411184Serfan.azarkhish@unibo.it#include "params/HMCController.hh"
5511184Serfan.azarkhish@unibo.it
5611184Serfan.azarkhish@unibo.it/**
5711184Serfan.azarkhish@unibo.it * HMC Controller, in general, is responsible for translating the host
5811184Serfan.azarkhish@unibo.it * protocol (AXI for example) to serial links protocol. Plus, it should have
5911184Serfan.azarkhish@unibo.it * large internal buffers to hide the access latency of the cube. It is also
6011184Serfan.azarkhish@unibo.it * inferred from the standard [1] and the literature [2] that serial links
6111184Serfan.azarkhish@unibo.it * share the same address range and packets can travel over any of them, so a
6211184Serfan.azarkhish@unibo.it * load distribution mechanism is required.
6311184Serfan.azarkhish@unibo.it * This model simply queues the incoming transactions (using a Bridge) and
6411184Serfan.azarkhish@unibo.it * schedules them to the serial links using a simple round robin mechanism to
6511184Serfan.azarkhish@unibo.it * balance the load among them. More advanced global scheduling policies and
6611184Serfan.azarkhish@unibo.it * reordering and steering of transactions can be added to this model if
6711184Serfan.azarkhish@unibo.it * required [3].
6811184Serfan.azarkhish@unibo.it * [1] http://www.hybridmemorycube.org/specification-download/
6911184Serfan.azarkhish@unibo.it * [2] Low-Power Hybrid Memory Cubes With Link Power Manageme and Two-Level
7011184Serfan.azarkhish@unibo.it * Prefetching (J. Ahn et. al)
7111184Serfan.azarkhish@unibo.it * [3] The Open-Silicon HMC Controller IP
7211184Serfan.azarkhish@unibo.it * http://www.open-silicon.com/open-silicon-ips/hmc/
7311184Serfan.azarkhish@unibo.it */
7411184Serfan.azarkhish@unibo.it
7511184Serfan.azarkhish@unibo.itclass HMCController : public NoncoherentXBar
7611184Serfan.azarkhish@unibo.it{
7711184Serfan.azarkhish@unibo.itpublic:
7811184Serfan.azarkhish@unibo.it
7911184Serfan.azarkhish@unibo.it    HMCController(const HMCControllerParams *p);
8011184Serfan.azarkhish@unibo.it
8111184Serfan.azarkhish@unibo.itprivate:
8211184Serfan.azarkhish@unibo.it
8311184Serfan.azarkhish@unibo.it    // Receive range change only on one of the ports (because they all have
8411184Serfan.azarkhish@unibo.it    //  the same range)
8511184Serfan.azarkhish@unibo.it    virtual void recvRangeChange(PortID master_port_id);
8611184Serfan.azarkhish@unibo.it
8711184Serfan.azarkhish@unibo.it    // Receive a request and distribute it among slave ports
8811184Serfan.azarkhish@unibo.it    //  Simply forwards the packet to the next serial link based on a
8911184Serfan.azarkhish@unibo.it    //  Round-robin counter
9011184Serfan.azarkhish@unibo.it    virtual bool recvTimingReq(PacketPtr pkt, PortID slave_port_id);
9111184Serfan.azarkhish@unibo.it
9211184Serfan.azarkhish@unibo.it    int n_master_ports;
9311184Serfan.azarkhish@unibo.it
9411184Serfan.azarkhish@unibo.it    // The round-robin counter
9511184Serfan.azarkhish@unibo.it    int rr_counter;
9611184Serfan.azarkhish@unibo.it    /**
9711184Serfan.azarkhish@unibo.it     * Function for rotating the round robin counter
9811184Serfan.azarkhish@unibo.it     * @return the next value of the counter
9911184Serfan.azarkhish@unibo.it     */
10011184Serfan.azarkhish@unibo.it    int rotate_counter();
10111184Serfan.azarkhish@unibo.it};
10211184Serfan.azarkhish@unibo.it
10312492Sodanrc@yahoo.com.br#endif //__MEM_HMC_CONTROLLER_HH__
104