request.hh revision 6214
12381SN/A/*
22381SN/A * Copyright (c) 2002-2005 The Regents of The University of Michigan
32381SN/A * All rights reserved.
42381SN/A *
52381SN/A * Redistribution and use in source and binary forms, with or without
62381SN/A * modification, are permitted provided that the following conditions are
72381SN/A * met: redistributions of source code must retain the above copyright
82381SN/A * notice, this list of conditions and the following disclaimer;
92381SN/A * redistributions in binary form must reproduce the above copyright
102381SN/A * notice, this list of conditions and the following disclaimer in the
112381SN/A * documentation and/or other materials provided with the distribution;
122381SN/A * neither the name of the copyright holders nor the names of its
132381SN/A * contributors may be used to endorse or promote products derived from
142381SN/A * this software without specific prior written permission.
152381SN/A *
162381SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172381SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182381SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192381SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202381SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212381SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222381SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232381SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242381SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252381SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262381SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272665Ssaidi@eecs.umich.edu *
282665Ssaidi@eecs.umich.edu * Authors: Ron Dreslinski
292665Ssaidi@eecs.umich.edu *          Steve Reinhardt
302665Ssaidi@eecs.umich.edu *          Ali Saidi
312381SN/A */
322381SN/A
332381SN/A/**
342982Sstever@eecs.umich.edu * @file
352982Sstever@eecs.umich.edu * Declaration of a request, the overall memory request consisting of
362381SN/A the parts of the request that are persistent throughout the transaction.
372381SN/A */
382381SN/A
392381SN/A#ifndef __MEM_REQUEST_HH__
402381SN/A#define __MEM_REQUEST_HH__
412381SN/A
425735Snate@binkert.org#include <cassert>
435735Snate@binkert.org
444610Ssaidi@eecs.umich.edu#include "base/fast_alloc.hh"
455735Snate@binkert.org#include "base/flags.hh"
465744Sgblack@eecs.umich.edu#include "base/misc.hh"
476214Snate@binkert.org#include "base/types.hh"
484167Sbinkertn@umich.edu#include "sim/core.hh"
492394SN/A
502394SN/Aclass Request;
512394SN/A
522394SN/Atypedef Request* RequestPtr;
532394SN/A
544610Ssaidi@eecs.umich.educlass Request : public FastAlloc
552381SN/A{
565735Snate@binkert.org  public:
575735Snate@binkert.org    typedef uint32_t FlagsType;
585735Snate@binkert.org    typedef ::Flags<FlagsType> Flags;
595735Snate@binkert.org
605735Snate@binkert.org    /** ASI information for this request if it exists. */
615735Snate@binkert.org    static const FlagsType ASI_BITS                    = 0x000000FF;
626133Ssteve.reinhardt@amd.com    /** The request was an instruction fetch. */
636133Ssteve.reinhardt@amd.com    static const FlagsType INST_FETCH                  = 0x00000100;
645735Snate@binkert.org    /** The virtual address is also the physical address. */
655735Snate@binkert.org    static const FlagsType PHYSICAL                    = 0x00000200;
665735Snate@binkert.org    /** The request is an ALPHA VPTE pal access (hw_ld). */
675735Snate@binkert.org    static const FlagsType VPTE                        = 0x00000400;
685735Snate@binkert.org    /** Use the alternate mode bits in ALPHA. */
695735Snate@binkert.org    static const FlagsType ALTMODE                     = 0x00000800;
705735Snate@binkert.org    /** The request is to an uncacheable address. */
715735Snate@binkert.org    static const FlagsType UNCACHEABLE                 = 0x00001000;
726133Ssteve.reinhardt@amd.com    /** This request is to a memory mapped register. */
736133Ssteve.reinhardt@amd.com    static const FlagsType MMAPED_IPR                  = 0x00002000;
746133Ssteve.reinhardt@amd.com
755735Snate@binkert.org    /** The request should not cause a page fault. */
766133Ssteve.reinhardt@amd.com    static const FlagsType NO_FAULT                    = 0x00010000;
776133Ssteve.reinhardt@amd.com    /** The request should ignore unaligned access faults */
786133Ssteve.reinhardt@amd.com    static const FlagsType NO_ALIGN_FAULT              = 0x00020000;
796133Ssteve.reinhardt@amd.com    /** The request should ignore unaligned access faults */
806133Ssteve.reinhardt@amd.com    static const FlagsType NO_HALF_WORD_ALIGN_FAULT    = 0x00040000;
815890Sgblack@eecs.umich.edu    /** The request should not cause a memory access. */
826133Ssteve.reinhardt@amd.com    static const FlagsType NO_ACCESS                   = 0x00080000;
836103Sgblack@eecs.umich.edu    /** This request will lock or unlock the accessed memory. When used with
846103Sgblack@eecs.umich.edu     * a load, the access locks the particular chunk of memory. When used
856103Sgblack@eecs.umich.edu     * with a store, it unlocks. The rule is that locked accesses have to be
866103Sgblack@eecs.umich.edu     * made up of a locked load, some operation on the data, and then a locked
876103Sgblack@eecs.umich.edu     * store.
886103Sgblack@eecs.umich.edu     */
896133Ssteve.reinhardt@amd.com    static const FlagsType LOCKED                      = 0x00100000;
906133Ssteve.reinhardt@amd.com    /** The request is a Load locked/store conditional. */
916133Ssteve.reinhardt@amd.com    static const FlagsType LLSC                        = 0x00200000;
925735Snate@binkert.org    /** This request is for a memory swap. */
936133Ssteve.reinhardt@amd.com    static const FlagsType MEM_SWAP                    = 0x00400000;
946133Ssteve.reinhardt@amd.com    static const FlagsType MEM_SWAP_COND               = 0x00800000;
956133Ssteve.reinhardt@amd.com
966106Ssteve.reinhardt@amd.com    /** The request is a prefetch. */
976106Ssteve.reinhardt@amd.com    static const FlagsType PREFETCH                    = 0x01000000;
986133Ssteve.reinhardt@amd.com    /** The request should be prefetched into the exclusive state. */
996133Ssteve.reinhardt@amd.com    static const FlagsType PF_EXCLUSIVE                = 0x02000000;
1006133Ssteve.reinhardt@amd.com    /** The request should be marked as LRU. */
1016133Ssteve.reinhardt@amd.com    static const FlagsType EVICT_NEXT                  = 0x04000000;
1025735Snate@binkert.org
1036104Ssteve.reinhardt@amd.com    /** These flags are *not* cleared when a Request object is reused
1046104Ssteve.reinhardt@amd.com       (assigned a new address). */
1056105Ssteve.reinhardt@amd.com    static const FlagsType STICKY_FLAGS = INST_FETCH;
1066104Ssteve.reinhardt@amd.com
1075735Snate@binkert.org  private:
1086104Ssteve.reinhardt@amd.com    typedef uint8_t PrivateFlagsType;
1096104Ssteve.reinhardt@amd.com    typedef ::Flags<PrivateFlagsType> PrivateFlags;
1105735Snate@binkert.org
1115735Snate@binkert.org    /** Whether or not the size is valid. */
1126104Ssteve.reinhardt@amd.com    static const PrivateFlagsType VALID_SIZE           = 0x00000001;
1135735Snate@binkert.org    /** Whether or not paddr is valid (has been written yet). */
1146104Ssteve.reinhardt@amd.com    static const PrivateFlagsType VALID_PADDR          = 0x00000002;
1155735Snate@binkert.org    /** Whether or not the vaddr & asid are valid. */
1166104Ssteve.reinhardt@amd.com    static const PrivateFlagsType VALID_VADDR          = 0x00000004;
1175735Snate@binkert.org    /** Whether or not the pc is valid. */
1186104Ssteve.reinhardt@amd.com    static const PrivateFlagsType VALID_PC             = 0x00000010;
1195735Snate@binkert.org    /** Whether or not the context ID is valid. */
1206104Ssteve.reinhardt@amd.com    static const PrivateFlagsType VALID_CONTEXT_ID     = 0x00000020;
1216104Ssteve.reinhardt@amd.com    static const PrivateFlagsType VALID_THREAD_ID      = 0x00000040;
1225735Snate@binkert.org    /** Whether or not the sc result is valid. */
1236104Ssteve.reinhardt@amd.com    static const PrivateFlagsType VALID_EXTRA_DATA     = 0x00000080;
1246104Ssteve.reinhardt@amd.com
1256104Ssteve.reinhardt@amd.com    /** These flags are *not* cleared when a Request object is reused
1266104Ssteve.reinhardt@amd.com       (assigned a new address). */
1276104Ssteve.reinhardt@amd.com    static const PrivateFlagsType STICKY_PRIVATE_FLAGS =
1286104Ssteve.reinhardt@amd.com        VALID_CONTEXT_ID | VALID_THREAD_ID;
1295735Snate@binkert.org
1302663Sstever@eecs.umich.edu  private:
1312663Sstever@eecs.umich.edu    /**
1322663Sstever@eecs.umich.edu     * The physical address of the request. Valid only if validPaddr
1335735Snate@binkert.org     * is set.
1345735Snate@binkert.org     */
1352663Sstever@eecs.umich.edu    Addr paddr;
1362532SN/A
1372663Sstever@eecs.umich.edu    /**
1382663Sstever@eecs.umich.edu     * The size of the request. This field must be set when vaddr or
1392663Sstever@eecs.umich.edu     * paddr is written via setVirt() or setPhys(), so it is always
1405735Snate@binkert.org     * valid as long as one of the address fields is valid.
1415735Snate@binkert.org     */
1422381SN/A    int size;
1432395SN/A
1442532SN/A    /** Flag structure for the request. */
1455735Snate@binkert.org    Flags flags;
1462384SN/A
1476104Ssteve.reinhardt@amd.com    /** Private flags for field validity checking. */
1486104Ssteve.reinhardt@amd.com    PrivateFlags privateFlags;
1496104Ssteve.reinhardt@amd.com
1502663Sstever@eecs.umich.edu    /**
1512663Sstever@eecs.umich.edu     * The time this request was started. Used to calculate
1522663Sstever@eecs.umich.edu     * latencies. This field is set to curTick any time paddr or vaddr
1535735Snate@binkert.org     * is written.
1545735Snate@binkert.org     */
1552663Sstever@eecs.umich.edu    Tick time;
1562384SN/A
1572384SN/A    /** The address space ID. */
1582384SN/A    int asid;
1593806Ssaidi@eecs.umich.edu
1602663Sstever@eecs.umich.edu    /** The virtual address of the request. */
1612663Sstever@eecs.umich.edu    Addr vaddr;
1622384SN/A
1635735Snate@binkert.org    /**
1645735Snate@binkert.org     * Extra data for the request, such as the return value of
1654040Ssaidi@eecs.umich.edu     * store conditional or the compare value for a CAS. */
1664040Ssaidi@eecs.umich.edu    uint64_t extraData;
1672384SN/A
1685714Shsul@eecs.umich.edu    /** The context ID (for statistics, typically). */
1695714Shsul@eecs.umich.edu    int _contextId;
1705714Shsul@eecs.umich.edu    /** The thread ID (id within this CPU) */
1715714Shsul@eecs.umich.edu    int _threadId;
1722384SN/A
1732381SN/A    /** program counter of initiating access; for tracing/debugging */
1742381SN/A    Addr pc;
1752663Sstever@eecs.umich.edu
1762532SN/A  public:
1772663Sstever@eecs.umich.edu    /** Minimal constructor.  No fields are initialized. */
1782663Sstever@eecs.umich.edu    Request()
1792663Sstever@eecs.umich.edu    {}
1802532SN/A
1812663Sstever@eecs.umich.edu    /**
1822663Sstever@eecs.umich.edu     * Constructor for physical (e.g. device) requests.  Initializes
1832663Sstever@eecs.umich.edu     * just physical address, size, flags, and timestamp (to curTick).
1845735Snate@binkert.org     * These fields are adequate to perform a request.
1855735Snate@binkert.org     */
1865735Snate@binkert.org    Request(Addr paddr, int size, Flags flags)
1875735Snate@binkert.org    {
1885735Snate@binkert.org        setPhys(paddr, size, flags);
1895735Snate@binkert.org    }
1902532SN/A
1915735Snate@binkert.org    Request(int asid, Addr vaddr, int size, Flags flags, Addr pc,
1925735Snate@binkert.org            int cid, int tid)
1932669Sktlim@umich.edu    {
1946104Ssteve.reinhardt@amd.com        setVirt(asid, vaddr, size, flags, pc);
1955735Snate@binkert.org        setThreadContext(cid, tid);
1962669Sktlim@umich.edu    }
1972669Sktlim@umich.edu
1984610Ssaidi@eecs.umich.edu    ~Request() {}  // for FastAlloc
1994610Ssaidi@eecs.umich.edu
2002663Sstever@eecs.umich.edu    /**
2015735Snate@binkert.org     * Set up CPU and thread numbers.
2025735Snate@binkert.org     */
2035735Snate@binkert.org    void
2045735Snate@binkert.org    setThreadContext(int context_id, int thread_id)
2052663Sstever@eecs.umich.edu    {
2065735Snate@binkert.org        _contextId = context_id;
2075735Snate@binkert.org        _threadId = thread_id;
2086104Ssteve.reinhardt@amd.com        privateFlags.set(VALID_CONTEXT_ID|VALID_THREAD_ID);
2092663Sstever@eecs.umich.edu    }
2102532SN/A
2112663Sstever@eecs.umich.edu    /**
2122663Sstever@eecs.umich.edu     * Set up a physical (e.g. device) request in a previously
2135735Snate@binkert.org     * allocated Request object.
2145735Snate@binkert.org     */
2155735Snate@binkert.org    void
2165735Snate@binkert.org    setPhys(Addr _paddr, int _size, Flags _flags)
2172663Sstever@eecs.umich.edu    {
2185731SSteve.Reinhardt@amd.com        assert(_size >= 0);
2192663Sstever@eecs.umich.edu        paddr = _paddr;
2202663Sstever@eecs.umich.edu        size = _size;
2212663Sstever@eecs.umich.edu        time = curTick;
2225735Snate@binkert.org
2236104Ssteve.reinhardt@amd.com        flags.clear(~STICKY_FLAGS);
2246104Ssteve.reinhardt@amd.com        flags.set(_flags);
2256104Ssteve.reinhardt@amd.com        privateFlags.clear(~STICKY_PRIVATE_FLAGS);
2266104Ssteve.reinhardt@amd.com        privateFlags.set(VALID_PADDR|VALID_SIZE);
2272663Sstever@eecs.umich.edu    }
2282532SN/A
2292663Sstever@eecs.umich.edu    /**
2302663Sstever@eecs.umich.edu     * Set up a virtual (e.g., CPU) request in a previously
2315735Snate@binkert.org     * allocated Request object.
2325735Snate@binkert.org     */
2335735Snate@binkert.org    void
2345735Snate@binkert.org    setVirt(int _asid, Addr _vaddr, int _size, Flags _flags, Addr _pc)
2352663Sstever@eecs.umich.edu    {
2365731SSteve.Reinhardt@amd.com        assert(_size >= 0);
2372663Sstever@eecs.umich.edu        asid = _asid;
2382663Sstever@eecs.umich.edu        vaddr = _vaddr;
2392663Sstever@eecs.umich.edu        size = _size;
2406104Ssteve.reinhardt@amd.com        flags = _flags;
2412663Sstever@eecs.umich.edu        pc = _pc;
2422663Sstever@eecs.umich.edu        time = curTick;
2435735Snate@binkert.org
2446104Ssteve.reinhardt@amd.com        flags.clear(~STICKY_FLAGS);
2456104Ssteve.reinhardt@amd.com        flags.set(_flags);
2466104Ssteve.reinhardt@amd.com        privateFlags.clear(~STICKY_PRIVATE_FLAGS);
2476104Ssteve.reinhardt@amd.com        privateFlags.set(VALID_VADDR|VALID_SIZE|VALID_PC);
2482663Sstever@eecs.umich.edu    }
2492532SN/A
2505735Snate@binkert.org    /**
2515735Snate@binkert.org     * Set just the physical address.  This should only be used to
2522663Sstever@eecs.umich.edu     * record the result of a translation, and thus the vaddr must be
2532663Sstever@eecs.umich.edu     * valid before this method is called.  Otherwise, use setPhys()
2542663Sstever@eecs.umich.edu     * to guarantee that the size and flags are also set.
2552663Sstever@eecs.umich.edu     */
2565735Snate@binkert.org    void
2575735Snate@binkert.org    setPaddr(Addr _paddr)
2582663Sstever@eecs.umich.edu    {
2596104Ssteve.reinhardt@amd.com        assert(privateFlags.isSet(VALID_VADDR));
2602663Sstever@eecs.umich.edu        paddr = _paddr;
2616104Ssteve.reinhardt@amd.com        privateFlags.set(VALID_PADDR);
2622663Sstever@eecs.umich.edu    }
2632532SN/A
2645735Snate@binkert.org    /**
2655744Sgblack@eecs.umich.edu     * Generate two requests as if this request had been split into two
2665744Sgblack@eecs.umich.edu     * pieces. The original request can't have been translated already.
2675744Sgblack@eecs.umich.edu     */
2685744Sgblack@eecs.umich.edu    void splitOnVaddr(Addr split_addr, RequestPtr &req1, RequestPtr &req2)
2695744Sgblack@eecs.umich.edu    {
2706104Ssteve.reinhardt@amd.com        assert(privateFlags.isSet(VALID_VADDR));
2716104Ssteve.reinhardt@amd.com        assert(privateFlags.noneSet(VALID_PADDR));
2725744Sgblack@eecs.umich.edu        assert(split_addr > vaddr && split_addr < vaddr + size);
2735744Sgblack@eecs.umich.edu        req1 = new Request;
2745744Sgblack@eecs.umich.edu        *req1 = *this;
2755744Sgblack@eecs.umich.edu        req2 = new Request;
2765744Sgblack@eecs.umich.edu        *req2 = *this;
2775744Sgblack@eecs.umich.edu        req1->size = split_addr - vaddr;
2785744Sgblack@eecs.umich.edu        req2->vaddr = split_addr;
2795744Sgblack@eecs.umich.edu        req2->size = size - req1->size;
2805744Sgblack@eecs.umich.edu    }
2815744Sgblack@eecs.umich.edu
2825744Sgblack@eecs.umich.edu    /**
2835735Snate@binkert.org     * Accessor for paddr.
2845735Snate@binkert.org     */
2856104Ssteve.reinhardt@amd.com    bool
2866104Ssteve.reinhardt@amd.com    hasPaddr()
2876104Ssteve.reinhardt@amd.com    {
2886104Ssteve.reinhardt@amd.com        return privateFlags.isSet(VALID_PADDR);
2896104Ssteve.reinhardt@amd.com    }
2906104Ssteve.reinhardt@amd.com
2915735Snate@binkert.org    Addr
2925735Snate@binkert.org    getPaddr()
2935735Snate@binkert.org    {
2946104Ssteve.reinhardt@amd.com        assert(privateFlags.isSet(VALID_PADDR));
2955735Snate@binkert.org        return paddr;
2965735Snate@binkert.org    }
2972663Sstever@eecs.umich.edu
2985735Snate@binkert.org    /**
2995735Snate@binkert.org     *  Accessor for size.
3005735Snate@binkert.org     */
3016104Ssteve.reinhardt@amd.com    bool
3026104Ssteve.reinhardt@amd.com    hasSize()
3036104Ssteve.reinhardt@amd.com    {
3046104Ssteve.reinhardt@amd.com        return privateFlags.isSet(VALID_SIZE);
3056104Ssteve.reinhardt@amd.com    }
3066104Ssteve.reinhardt@amd.com
3075735Snate@binkert.org    int
3085735Snate@binkert.org    getSize()
3095735Snate@binkert.org    {
3106104Ssteve.reinhardt@amd.com        assert(privateFlags.isSet(VALID_SIZE));
3115735Snate@binkert.org        return size;
3125735Snate@binkert.org    }
3135735Snate@binkert.org
3142663Sstever@eecs.umich.edu    /** Accessor for time. */
3155735Snate@binkert.org    Tick
3165735Snate@binkert.org    getTime()
3175735Snate@binkert.org    {
3186104Ssteve.reinhardt@amd.com        assert(privateFlags.isSet(VALID_PADDR|VALID_VADDR));
3195735Snate@binkert.org        return time;
3205735Snate@binkert.org    }
3215735Snate@binkert.org
3222663Sstever@eecs.umich.edu    /** Accessor for flags. */
3235735Snate@binkert.org    Flags
3245735Snate@binkert.org    getFlags()
3255735Snate@binkert.org    {
3266104Ssteve.reinhardt@amd.com        assert(privateFlags.isSet(VALID_PADDR|VALID_VADDR));
3276104Ssteve.reinhardt@amd.com        return flags;
3285735Snate@binkert.org    }
3295735Snate@binkert.org
3305735Snate@binkert.org    void
3315735Snate@binkert.org    setFlags(Flags _flags)
3325735Snate@binkert.org    {
3336104Ssteve.reinhardt@amd.com        assert(privateFlags.isSet(VALID_PADDR|VALID_VADDR));
3345735Snate@binkert.org        flags.set(_flags);
3355735Snate@binkert.org    }
3365735Snate@binkert.org
3372663Sstever@eecs.umich.edu    /** Accessor function for vaddr.*/
3385735Snate@binkert.org    Addr
3395735Snate@binkert.org    getVaddr()
3405735Snate@binkert.org    {
3416104Ssteve.reinhardt@amd.com        assert(privateFlags.isSet(VALID_VADDR));
3425735Snate@binkert.org        return vaddr;
3435735Snate@binkert.org    }
3442663Sstever@eecs.umich.edu
3452663Sstever@eecs.umich.edu    /** Accessor function for asid.*/
3465735Snate@binkert.org    int
3475735Snate@binkert.org    getAsid()
3485735Snate@binkert.org    {
3496104Ssteve.reinhardt@amd.com        assert(privateFlags.isSet(VALID_VADDR));
3505735Snate@binkert.org        return asid;
3515735Snate@binkert.org    }
3522663Sstever@eecs.umich.edu
3533804Ssaidi@eecs.umich.edu    /** Accessor function for asi.*/
3545735Snate@binkert.org    uint8_t
3555735Snate@binkert.org    getAsi()
3565735Snate@binkert.org    {
3576104Ssteve.reinhardt@amd.com        assert(privateFlags.isSet(VALID_VADDR));
3585735Snate@binkert.org        return flags & ASI_BITS;
3595735Snate@binkert.org    }
3603804Ssaidi@eecs.umich.edu
3616104Ssteve.reinhardt@amd.com    /** Accessor function for MMAPED_IPR flag. */
3625735Snate@binkert.org    bool
3635735Snate@binkert.org    isMmapedIpr()
3645735Snate@binkert.org    {
3656104Ssteve.reinhardt@amd.com        assert(privateFlags.isSet(VALID_PADDR));
3665764Snate@binkert.org        return flags.isSet(MMAPED_IPR);
3675735Snate@binkert.org    }
3683806Ssaidi@eecs.umich.edu
3695735Snate@binkert.org    void
3705735Snate@binkert.org    setMmapedIpr(bool r)
3715735Snate@binkert.org    {
3725735Snate@binkert.org        assert(VALID_VADDR);
3735735Snate@binkert.org        flags.set(MMAPED_IPR);
3745735Snate@binkert.org    }
3753804Ssaidi@eecs.umich.edu
3762679Sktlim@umich.edu    /** Accessor function to check if sc result is valid. */
3775735Snate@binkert.org    bool
3785735Snate@binkert.org    extraDataValid()
3795735Snate@binkert.org    {
3806104Ssteve.reinhardt@amd.com        return privateFlags.isSet(VALID_EXTRA_DATA);
3815735Snate@binkert.org    }
3825735Snate@binkert.org
3832663Sstever@eecs.umich.edu    /** Accessor function for store conditional return value.*/
3845735Snate@binkert.org    uint64_t
3855735Snate@binkert.org    getExtraData() const
3865735Snate@binkert.org    {
3876104Ssteve.reinhardt@amd.com        assert(privateFlags.isSet(VALID_EXTRA_DATA));
3885735Snate@binkert.org        return extraData;
3895735Snate@binkert.org    }
3905735Snate@binkert.org
3912663Sstever@eecs.umich.edu    /** Accessor function for store conditional return value.*/
3925735Snate@binkert.org    void
3935735Snate@binkert.org    setExtraData(uint64_t _extraData)
3945735Snate@binkert.org    {
3955735Snate@binkert.org        extraData = _extraData;
3966104Ssteve.reinhardt@amd.com        privateFlags.set(VALID_EXTRA_DATA);
3975735Snate@binkert.org    }
3982663Sstever@eecs.umich.edu
3996010Ssteve.reinhardt@amd.com    bool
4006010Ssteve.reinhardt@amd.com    hasContextId() const
4016010Ssteve.reinhardt@amd.com    {
4026104Ssteve.reinhardt@amd.com        return privateFlags.isSet(VALID_CONTEXT_ID);
4036010Ssteve.reinhardt@amd.com    }
4046010Ssteve.reinhardt@amd.com
4055714Shsul@eecs.umich.edu    /** Accessor function for context ID.*/
4065735Snate@binkert.org    int
4075735Snate@binkert.org    contextId() const
4085735Snate@binkert.org    {
4096104Ssteve.reinhardt@amd.com        assert(privateFlags.isSet(VALID_CONTEXT_ID));
4105735Snate@binkert.org        return _contextId;
4115735Snate@binkert.org    }
4125735Snate@binkert.org
4135714Shsul@eecs.umich.edu    /** Accessor function for thread ID. */
4145735Snate@binkert.org    int
4155735Snate@binkert.org    threadId() const
4165735Snate@binkert.org    {
4176104Ssteve.reinhardt@amd.com        assert(privateFlags.isSet(VALID_THREAD_ID));
4185735Snate@binkert.org        return _threadId;
4195735Snate@binkert.org    }
4202663Sstever@eecs.umich.edu
4215875Ssteve.reinhardt@amd.com    bool
4225875Ssteve.reinhardt@amd.com    hasPC() const
4235875Ssteve.reinhardt@amd.com    {
4246104Ssteve.reinhardt@amd.com        return privateFlags.isSet(VALID_PC);
4255875Ssteve.reinhardt@amd.com    }
4265875Ssteve.reinhardt@amd.com
4276010Ssteve.reinhardt@amd.com    /** Accessor function for pc.*/
4285735Snate@binkert.org    Addr
4295735Snate@binkert.org    getPC() const
4305735Snate@binkert.org    {
4316104Ssteve.reinhardt@amd.com        assert(privateFlags.isSet(VALID_PC));
4325735Snate@binkert.org        return pc;
4335735Snate@binkert.org    }
4342532SN/A
4352811Srdreslin@umich.edu    /** Accessor Function to Check Cacheability. */
4365764Snate@binkert.org    bool isUncacheable() const { return flags.isSet(UNCACHEABLE); }
4376105Ssteve.reinhardt@amd.com    bool isInstFetch() const { return flags.isSet(INST_FETCH); }
4386106Ssteve.reinhardt@amd.com    bool isPrefetch() const { return flags.isSet(PREFETCH); }
4396102Sgblack@eecs.umich.edu    bool isLLSC() const { return flags.isSet(LLSC); }
4406077Sgblack@eecs.umich.edu    bool isLocked() const { return flags.isSet(LOCKED); }
4415764Snate@binkert.org    bool isSwap() const { return flags.isSet(MEM_SWAP|MEM_SWAP_COND); }
4425764Snate@binkert.org    bool isCondSwap() const { return flags.isSet(MEM_SWAP_COND); }
4432811Srdreslin@umich.edu
4445735Snate@binkert.org    bool
4455735Snate@binkert.org    isMisaligned() const
4465735Snate@binkert.org    {
4475764Snate@binkert.org        if (flags.isSet(NO_ALIGN_FAULT))
4485735Snate@binkert.org            return false;
4493170Sstever@eecs.umich.edu
4505735Snate@binkert.org        if ((vaddr & 0x1))
4515735Snate@binkert.org            return true;
4522814Srdreslin@umich.edu
4535764Snate@binkert.org        if (flags.isSet(NO_HALF_WORD_ALIGN_FAULT))
4545735Snate@binkert.org            return false;
4554040Ssaidi@eecs.umich.edu
4565735Snate@binkert.org        if ((vaddr & 0x2))
4575735Snate@binkert.org            return true;
4584040Ssaidi@eecs.umich.edu
4595735Snate@binkert.org        return false;
4605735Snate@binkert.org    }
4612384SN/A};
4622381SN/A
4632381SN/A#endif // __MEM_REQUEST_HH__
464