stride.hh revision 9288:3d6da8559605
12315SN/A/*
22332SN/A * Copyright (c) 2005 The Regents of The University of Michigan
32315SN/A * All rights reserved.
42315SN/A *
52315SN/A * Redistribution and use in source and binary forms, with or without
62315SN/A * modification, are permitted provided that the following conditions are
72315SN/A * met: redistributions of source code must retain the above copyright
82315SN/A * notice, this list of conditions and the following disclaimer;
92315SN/A * redistributions in binary form must reproduce the above copyright
102315SN/A * notice, this list of conditions and the following disclaimer in the
112315SN/A * documentation and/or other materials provided with the distribution;
122315SN/A * neither the name of the copyright holders nor the names of its
132315SN/A * contributors may be used to endorse or promote products derived from
142315SN/A * this software without specific prior written permission.
152315SN/A *
162315SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172315SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182315SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192315SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202315SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212315SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222315SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232315SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242315SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252315SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262315SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272689SN/A *
282689SN/A * Authors: Ron Dreslinski
292315SN/A */
302315SN/A
312315SN/A/**
322315SN/A * @file
332315SN/A * Describes a strided prefetcher.
342315SN/A */
356658Snate@binkert.org
362315SN/A#ifndef __MEM_CACHE_PREFETCH_STRIDE_PREFETCHER_HH__
372315SN/A#define __MEM_CACHE_PREFETCH_STRIDE_PREFETCHER_HH__
382683SN/A
392680SN/A#include <climits>
402315SN/A
412315SN/A#include "mem/cache/prefetch/base.hh"
422315SN/A#include "params/StridePrefetcher.hh"
432315SN/A
442315SN/Aclass StridePrefetcher : public BasePrefetcher
452315SN/A{
462315SN/A  protected:
472315SN/A
482315SN/A    static const int Max_Contexts = 64;
492315SN/A
502315SN/A    // These constants need to be changed with the type of the
512315SN/A    // 'confidence' field below.
522315SN/A    static const int Max_Conf = INT_MAX;
532315SN/A    static const int Min_Conf = INT_MIN;
542732SN/A
552315SN/A    class StrideEntry
562315SN/A    {
572315SN/A      public:
582332SN/A        Addr instAddr;
592332SN/A        Addr missAddr;
602332SN/A        int stride;
612332SN/A        int confidence;
622332SN/A    };
632315SN/A
642315SN/A    Addr *lastMissAddr[Max_Contexts];
652315SN/A
662315SN/A    std::list<StrideEntry*> table[Max_Contexts];
672315SN/A
682315SN/A  public:
692315SN/A
702315SN/A    StridePrefetcher(const Params *p)
712315SN/A        : BasePrefetcher(p)
722315SN/A    {
732315SN/A    }
742315SN/A
752315SN/A    ~StridePrefetcher() {}
762315SN/A
772315SN/A    void calculatePrefetch(PacketPtr &pkt, std::list<Addr> &addresses,
782315SN/A                           std::list<Cycles> &delays);
792315SN/A};
802315SN/A
812315SN/A#endif // __MEM_CACHE_PREFETCH_STRIDE_PREFETCHER_HH__
822315SN/A