tagged.cc revision 9288:3d6da8559605
1803SN/A/*
21363SN/A * Copyright (c) 2005 The Regents of The University of Michigan
3803SN/A * All rights reserved.
4803SN/A *
5803SN/A * Redistribution and use in source and binary forms, with or without
6803SN/A * modification, are permitted provided that the following conditions are
7803SN/A * met: redistributions of source code must retain the above copyright
8803SN/A * notice, this list of conditions and the following disclaimer;
9803SN/A * redistributions in binary form must reproduce the above copyright
10803SN/A * notice, this list of conditions and the following disclaimer in the
11803SN/A * documentation and/or other materials provided with the distribution;
12803SN/A * neither the name of the copyright holders nor the names of its
13803SN/A * contributors may be used to endorse or promote products derived from
14803SN/A * this software without specific prior written permission.
15803SN/A *
16803SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17803SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18803SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19803SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20803SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21803SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22803SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23803SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24803SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25803SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26803SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272665SN/A *
282665SN/A * Authors: Ron Dreslinski
292665SN/A */
302665SN/A
31803SN/A/**
32768SN/A * @file
331730SN/A * Describes a tagged prefetcher based on template policies.
34773SN/A */
35768SN/A
36768SN/A#include "mem/cache/prefetch/tagged.hh"
37773SN/A
38773SN/ATaggedPrefetcher::TaggedPrefetcher(const Params *p)
39768SN/A    : BasePrefetcher(p)
40768SN/A{
41768SN/A}
42768SN/A
434762Snate@binkert.orgvoid
44768SN/ATaggedPrefetcher::
452542SN/AcalculatePrefetch(PacketPtr &pkt, std::list<Addr> &addresses,
463540Sgblack@eecs.umich.edu                  std::list<Cycles> &delays)
473540Sgblack@eecs.umich.edu{
483540Sgblack@eecs.umich.edu    Addr blkAddr = pkt->getAddr() & ~(Addr)(blkSize-1);
493540Sgblack@eecs.umich.edu
503348SN/A    for (int d = 1; d <= degree; d++) {
513348SN/A        Addr newAddr = blkAddr + d*(blkSize);
522542SN/A        if (pageStop &&  !samePage(blkAddr, newAddr)) {
532542SN/A            // Spanned the page, so now stop
54768SN/A            pfSpanPage += degree - d + 1;
55768SN/A            return;
562107SN/A        } else {
572107SN/A            addresses.push_back(newAddr);
58773SN/A            delays.push_back(latency);
595606Snate@binkert.org        }
605606Snate@binkert.org    }
615606Snate@binkert.org}
621817SN/A
63772SN/A
64772SN/ATaggedPrefetcher*
654762Snate@binkert.orgTaggedPrefetcherParams::create()
665606Snate@binkert.org{
675606Snate@binkert.org   return new TaggedPrefetcher(this);
68768SN/A}
693846Shsul@eecs.umich.edu