113700Sjavier.bueno@metempsy.com/**
213700Sjavier.bueno@metempsy.com * Copyright (c) 2018 Metempsy Technology Consulting
313700Sjavier.bueno@metempsy.com * All rights reserved.
413700Sjavier.bueno@metempsy.com *
513700Sjavier.bueno@metempsy.com * Redistribution and use in source and binary forms, with or without
613700Sjavier.bueno@metempsy.com * modification, are permitted provided that the following conditions are
713700Sjavier.bueno@metempsy.com * met: redistributions of source code must retain the above copyright
813700Sjavier.bueno@metempsy.com * notice, this list of conditions and the following disclaimer;
913700Sjavier.bueno@metempsy.com * redistributions in binary form must reproduce the above copyright
1013700Sjavier.bueno@metempsy.com * notice, this list of conditions and the following disclaimer in the
1113700Sjavier.bueno@metempsy.com * documentation and/or other materials provided with the distribution;
1213700Sjavier.bueno@metempsy.com * neither the name of the copyright holders nor the names of its
1313700Sjavier.bueno@metempsy.com * contributors may be used to endorse or promote products derived from
1413700Sjavier.bueno@metempsy.com * this software without specific prior written permission.
1513700Sjavier.bueno@metempsy.com *
1613700Sjavier.bueno@metempsy.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1713700Sjavier.bueno@metempsy.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1813700Sjavier.bueno@metempsy.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1913700Sjavier.bueno@metempsy.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2013700Sjavier.bueno@metempsy.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2113700Sjavier.bueno@metempsy.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2213700Sjavier.bueno@metempsy.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2313700Sjavier.bueno@metempsy.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2413700Sjavier.bueno@metempsy.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2513700Sjavier.bueno@metempsy.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2613700Sjavier.bueno@metempsy.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2713700Sjavier.bueno@metempsy.com *
2813700Sjavier.bueno@metempsy.com * Authors: Javier Bueno
2913700Sjavier.bueno@metempsy.com */
3013700Sjavier.bueno@metempsy.com
3113700Sjavier.bueno@metempsy.com#include "mem/cache/prefetch/slim_ampm.hh"
3213700Sjavier.bueno@metempsy.com
3313700Sjavier.bueno@metempsy.com#include "params/SlimAMPMPrefetcher.hh"
3413700Sjavier.bueno@metempsy.com
3513700Sjavier.bueno@metempsy.comSlimAMPMPrefetcher::SlimAMPMPrefetcher(const SlimAMPMPrefetcherParams* p)
3613700Sjavier.bueno@metempsy.com  : QueuedPrefetcher(p), ampm(*p->ampm), dcpt(*p->dcpt)
3713700Sjavier.bueno@metempsy.com{
3813700Sjavier.bueno@metempsy.com}
3913700Sjavier.bueno@metempsy.com
4013700Sjavier.bueno@metempsy.comvoid
4113700Sjavier.bueno@metempsy.comSlimAMPMPrefetcher::calculatePrefetch(const PrefetchInfo &pfi,
4213700Sjavier.bueno@metempsy.com                  std::vector<AddrPriority> &addresses)
4313700Sjavier.bueno@metempsy.com{
4413700Sjavier.bueno@metempsy.com    dcpt.calculatePrefetch(pfi, addresses);
4513700Sjavier.bueno@metempsy.com    if (addresses.empty()) {
4613700Sjavier.bueno@metempsy.com        ampm.calculatePrefetch(pfi, addresses);
4713700Sjavier.bueno@metempsy.com    }
4813700Sjavier.bueno@metempsy.com}
4913700Sjavier.bueno@metempsy.com
5013700Sjavier.bueno@metempsy.comSlimAMPMPrefetcher*
5113700Sjavier.bueno@metempsy.comSlimAMPMPrefetcherParams::create()
5213700Sjavier.bueno@metempsy.com{
5313700Sjavier.bueno@metempsy.com    return new SlimAMPMPrefetcher(this);
5413700Sjavier.bueno@metempsy.com}
55