request.hh revision 8551
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. */
738105Sgblack@eecs.umich.edu    static const FlagsType MMAPPED_IPR                  = 0x00002000;
747612SGene.Wu@arm.com    /** This request is a clear exclusive. */
757705Sgblack@eecs.umich.edu    static const FlagsType CLEAR_LL                    = 0x00004000;
766133Ssteve.reinhardt@amd.com
775890Sgblack@eecs.umich.edu    /** The request should not cause a memory access. */
786133Ssteve.reinhardt@amd.com    static const FlagsType NO_ACCESS                   = 0x00080000;
796103Sgblack@eecs.umich.edu    /** This request will lock or unlock the accessed memory. When used with
806103Sgblack@eecs.umich.edu     * a load, the access locks the particular chunk of memory. When used
816103Sgblack@eecs.umich.edu     * with a store, it unlocks. The rule is that locked accesses have to be
826103Sgblack@eecs.umich.edu     * made up of a locked load, some operation on the data, and then a locked
836103Sgblack@eecs.umich.edu     * store.
846103Sgblack@eecs.umich.edu     */
856133Ssteve.reinhardt@amd.com    static const FlagsType LOCKED                      = 0x00100000;
866133Ssteve.reinhardt@amd.com    /** The request is a Load locked/store conditional. */
876133Ssteve.reinhardt@amd.com    static const FlagsType LLSC                        = 0x00200000;
885735Snate@binkert.org    /** This request is for a memory swap. */
896133Ssteve.reinhardt@amd.com    static const FlagsType MEM_SWAP                    = 0x00400000;
906133Ssteve.reinhardt@amd.com    static const FlagsType MEM_SWAP_COND               = 0x00800000;
916133Ssteve.reinhardt@amd.com
926106Ssteve.reinhardt@amd.com    /** The request is a prefetch. */
936106Ssteve.reinhardt@amd.com    static const FlagsType PREFETCH                    = 0x01000000;
946133Ssteve.reinhardt@amd.com    /** The request should be prefetched into the exclusive state. */
956133Ssteve.reinhardt@amd.com    static const FlagsType PF_EXCLUSIVE                = 0x02000000;
966133Ssteve.reinhardt@amd.com    /** The request should be marked as LRU. */
976133Ssteve.reinhardt@amd.com    static const FlagsType EVICT_NEXT                  = 0x04000000;
985735Snate@binkert.org
996104Ssteve.reinhardt@amd.com    /** These flags are *not* cleared when a Request object is reused
1006104Ssteve.reinhardt@amd.com       (assigned a new address). */
1016105Ssteve.reinhardt@amd.com    static const FlagsType STICKY_FLAGS = INST_FETCH;
1026104Ssteve.reinhardt@amd.com
1035735Snate@binkert.org  private:
1046104Ssteve.reinhardt@amd.com    typedef uint8_t PrivateFlagsType;
1056104Ssteve.reinhardt@amd.com    typedef ::Flags<PrivateFlagsType> PrivateFlags;
1065735Snate@binkert.org
1075735Snate@binkert.org    /** Whether or not the size is valid. */
1086104Ssteve.reinhardt@amd.com    static const PrivateFlagsType VALID_SIZE           = 0x00000001;
1095735Snate@binkert.org    /** Whether or not paddr is valid (has been written yet). */
1106104Ssteve.reinhardt@amd.com    static const PrivateFlagsType VALID_PADDR          = 0x00000002;
1115735Snate@binkert.org    /** Whether or not the vaddr & asid are valid. */
1126104Ssteve.reinhardt@amd.com    static const PrivateFlagsType VALID_VADDR          = 0x00000004;
1135735Snate@binkert.org    /** Whether or not the pc is valid. */
1146104Ssteve.reinhardt@amd.com    static const PrivateFlagsType VALID_PC             = 0x00000010;
1155735Snate@binkert.org    /** Whether or not the context ID is valid. */
1166104Ssteve.reinhardt@amd.com    static const PrivateFlagsType VALID_CONTEXT_ID     = 0x00000020;
1176104Ssteve.reinhardt@amd.com    static const PrivateFlagsType VALID_THREAD_ID      = 0x00000040;
1185735Snate@binkert.org    /** Whether or not the sc result is valid. */
1196104Ssteve.reinhardt@amd.com    static const PrivateFlagsType VALID_EXTRA_DATA     = 0x00000080;
1206104Ssteve.reinhardt@amd.com
1216104Ssteve.reinhardt@amd.com    /** These flags are *not* cleared when a Request object is reused
1226104Ssteve.reinhardt@amd.com       (assigned a new address). */
1236104Ssteve.reinhardt@amd.com    static const PrivateFlagsType STICKY_PRIVATE_FLAGS =
1246104Ssteve.reinhardt@amd.com        VALID_CONTEXT_ID | VALID_THREAD_ID;
1255735Snate@binkert.org
1262663Sstever@eecs.umich.edu  private:
1272663Sstever@eecs.umich.edu    /**
1282663Sstever@eecs.umich.edu     * The physical address of the request. Valid only if validPaddr
1295735Snate@binkert.org     * is set.
1305735Snate@binkert.org     */
1316427Ssteve.reinhardt@amd.com    Addr _paddr;
1322532SN/A
1332663Sstever@eecs.umich.edu    /**
1342663Sstever@eecs.umich.edu     * The size of the request. This field must be set when vaddr or
1352663Sstever@eecs.umich.edu     * paddr is written via setVirt() or setPhys(), so it is always
1365735Snate@binkert.org     * valid as long as one of the address fields is valid.
1375735Snate@binkert.org     */
1386427Ssteve.reinhardt@amd.com    int _size;
1392395SN/A
1402532SN/A    /** Flag structure for the request. */
1416427Ssteve.reinhardt@amd.com    Flags _flags;
1422384SN/A
1436104Ssteve.reinhardt@amd.com    /** Private flags for field validity checking. */
1446104Ssteve.reinhardt@amd.com    PrivateFlags privateFlags;
1456104Ssteve.reinhardt@amd.com
1462663Sstever@eecs.umich.edu    /**
1472663Sstever@eecs.umich.edu     * The time this request was started. Used to calculate
1487823Ssteve.reinhardt@amd.com     * latencies. This field is set to curTick() any time paddr or vaddr
1495735Snate@binkert.org     * is written.
1505735Snate@binkert.org     */
1516223Snate@binkert.org    Tick _time;
1522384SN/A
1532384SN/A    /** The address space ID. */
1546427Ssteve.reinhardt@amd.com    int _asid;
1553806Ssaidi@eecs.umich.edu
1562663Sstever@eecs.umich.edu    /** The virtual address of the request. */
1576427Ssteve.reinhardt@amd.com    Addr _vaddr;
1582384SN/A
1595735Snate@binkert.org    /**
1605735Snate@binkert.org     * Extra data for the request, such as the return value of
1614040Ssaidi@eecs.umich.edu     * store conditional or the compare value for a CAS. */
1626427Ssteve.reinhardt@amd.com    uint64_t _extraData;
1632384SN/A
1645714Shsul@eecs.umich.edu    /** The context ID (for statistics, typically). */
1655714Shsul@eecs.umich.edu    int _contextId;
1665714Shsul@eecs.umich.edu    /** The thread ID (id within this CPU) */
1675714Shsul@eecs.umich.edu    int _threadId;
1682384SN/A
1692381SN/A    /** program counter of initiating access; for tracing/debugging */
1706427Ssteve.reinhardt@amd.com    Addr _pc;
1712663Sstever@eecs.umich.edu
1722532SN/A  public:
1736427Ssteve.reinhardt@amd.com    /** Minimal constructor.  No fields are initialized.
1746427Ssteve.reinhardt@amd.com     *  (Note that _flags and privateFlags are cleared by Flags
1756427Ssteve.reinhardt@amd.com     *  default constructor.)
1766427Ssteve.reinhardt@amd.com     */
1772663Sstever@eecs.umich.edu    Request()
1782663Sstever@eecs.umich.edu    {}
1792532SN/A
1802663Sstever@eecs.umich.edu    /**
1812663Sstever@eecs.umich.edu     * Constructor for physical (e.g. device) requests.  Initializes
1827823Ssteve.reinhardt@amd.com     * just physical address, size, flags, and timestamp (to curTick()).
1835735Snate@binkert.org     * These fields are adequate to perform a request.
1845735Snate@binkert.org     */
1855735Snate@binkert.org    Request(Addr paddr, int size, Flags flags)
1865735Snate@binkert.org    {
1875735Snate@binkert.org        setPhys(paddr, size, flags);
1885735Snate@binkert.org    }
1892532SN/A
1906223Snate@binkert.org    Request(Addr paddr, int size, Flags flags, Tick time)
1916223Snate@binkert.org    {
1926223Snate@binkert.org        setPhys(paddr, size, flags, time);
1936223Snate@binkert.org    }
1946223Snate@binkert.org
1956899SBrad.Beckmann@amd.com    Request(Addr paddr, int size, Flags flags, Tick time, Addr pc)
1966899SBrad.Beckmann@amd.com    {
1976899SBrad.Beckmann@amd.com        setPhys(paddr, size, flags, time);
1986899SBrad.Beckmann@amd.com        privateFlags.set(VALID_PC);
1996899SBrad.Beckmann@amd.com        _pc = pc;
2006899SBrad.Beckmann@amd.com    }
2016899SBrad.Beckmann@amd.com
2025735Snate@binkert.org    Request(int asid, Addr vaddr, int size, Flags flags, Addr pc,
2036221Snate@binkert.org            int cid, ThreadID tid)
2042669Sktlim@umich.edu    {
2056104Ssteve.reinhardt@amd.com        setVirt(asid, vaddr, size, flags, pc);
2065735Snate@binkert.org        setThreadContext(cid, tid);
2072669Sktlim@umich.edu    }
2082669Sktlim@umich.edu
2094610Ssaidi@eecs.umich.edu    ~Request() {}  // for FastAlloc
2104610Ssaidi@eecs.umich.edu
2112663Sstever@eecs.umich.edu    /**
2125735Snate@binkert.org     * Set up CPU and thread numbers.
2135735Snate@binkert.org     */
2145735Snate@binkert.org    void
2156221Snate@binkert.org    setThreadContext(int context_id, ThreadID tid)
2162663Sstever@eecs.umich.edu    {
2175735Snate@binkert.org        _contextId = context_id;
2186221Snate@binkert.org        _threadId = tid;
2196104Ssteve.reinhardt@amd.com        privateFlags.set(VALID_CONTEXT_ID|VALID_THREAD_ID);
2202663Sstever@eecs.umich.edu    }
2212532SN/A
2222663Sstever@eecs.umich.edu    /**
2232663Sstever@eecs.umich.edu     * Set up a physical (e.g. device) request in a previously
2245735Snate@binkert.org     * allocated Request object.
2255735Snate@binkert.org     */
2265735Snate@binkert.org    void
2276427Ssteve.reinhardt@amd.com    setPhys(Addr paddr, int size, Flags flags, Tick time)
2282663Sstever@eecs.umich.edu    {
2296427Ssteve.reinhardt@amd.com        assert(size >= 0);
2306427Ssteve.reinhardt@amd.com        _paddr = paddr;
2316427Ssteve.reinhardt@amd.com        _size = size;
2326223Snate@binkert.org        _time = time;
2335735Snate@binkert.org
2346427Ssteve.reinhardt@amd.com        _flags.clear(~STICKY_FLAGS);
2356427Ssteve.reinhardt@amd.com        _flags.set(flags);
2366104Ssteve.reinhardt@amd.com        privateFlags.clear(~STICKY_PRIVATE_FLAGS);
2376104Ssteve.reinhardt@amd.com        privateFlags.set(VALID_PADDR|VALID_SIZE);
2382663Sstever@eecs.umich.edu    }
2392532SN/A
2406223Snate@binkert.org    void
2416427Ssteve.reinhardt@amd.com    setPhys(Addr paddr, int size, Flags flags)
2426223Snate@binkert.org    {
2437823Ssteve.reinhardt@amd.com        setPhys(paddr, size, flags, curTick());
2446223Snate@binkert.org    }
2456223Snate@binkert.org
2462663Sstever@eecs.umich.edu    /**
2472663Sstever@eecs.umich.edu     * Set up a virtual (e.g., CPU) request in a previously
2485735Snate@binkert.org     * allocated Request object.
2495735Snate@binkert.org     */
2505735Snate@binkert.org    void
2516427Ssteve.reinhardt@amd.com    setVirt(int asid, Addr vaddr, int size, Flags flags, Addr pc)
2522663Sstever@eecs.umich.edu    {
2536427Ssteve.reinhardt@amd.com        assert(size >= 0);
2546427Ssteve.reinhardt@amd.com        _asid = asid;
2556427Ssteve.reinhardt@amd.com        _vaddr = vaddr;
2566427Ssteve.reinhardt@amd.com        _size = size;
2576427Ssteve.reinhardt@amd.com        _pc = pc;
2587823Ssteve.reinhardt@amd.com        _time = curTick();
2595735Snate@binkert.org
2606427Ssteve.reinhardt@amd.com        _flags.clear(~STICKY_FLAGS);
2616427Ssteve.reinhardt@amd.com        _flags.set(flags);
2626104Ssteve.reinhardt@amd.com        privateFlags.clear(~STICKY_PRIVATE_FLAGS);
2636104Ssteve.reinhardt@amd.com        privateFlags.set(VALID_VADDR|VALID_SIZE|VALID_PC);
2642663Sstever@eecs.umich.edu    }
2652532SN/A
2665735Snate@binkert.org    /**
2675735Snate@binkert.org     * Set just the physical address.  This should only be used to
2682663Sstever@eecs.umich.edu     * record the result of a translation, and thus the vaddr must be
2692663Sstever@eecs.umich.edu     * valid before this method is called.  Otherwise, use setPhys()
2702663Sstever@eecs.umich.edu     * to guarantee that the size and flags are also set.
2712663Sstever@eecs.umich.edu     */
2725735Snate@binkert.org    void
2736427Ssteve.reinhardt@amd.com    setPaddr(Addr paddr)
2742663Sstever@eecs.umich.edu    {
2756104Ssteve.reinhardt@amd.com        assert(privateFlags.isSet(VALID_VADDR));
2766427Ssteve.reinhardt@amd.com        _paddr = paddr;
2776104Ssteve.reinhardt@amd.com        privateFlags.set(VALID_PADDR);
2782663Sstever@eecs.umich.edu    }
2792532SN/A
2805735Snate@binkert.org    /**
2815744Sgblack@eecs.umich.edu     * Generate two requests as if this request had been split into two
2825744Sgblack@eecs.umich.edu     * pieces. The original request can't have been translated already.
2835744Sgblack@eecs.umich.edu     */
2845744Sgblack@eecs.umich.edu    void splitOnVaddr(Addr split_addr, RequestPtr &req1, RequestPtr &req2)
2855744Sgblack@eecs.umich.edu    {
2866104Ssteve.reinhardt@amd.com        assert(privateFlags.isSet(VALID_VADDR));
2876104Ssteve.reinhardt@amd.com        assert(privateFlags.noneSet(VALID_PADDR));
2886427Ssteve.reinhardt@amd.com        assert(split_addr > _vaddr && split_addr < _vaddr + _size);
2895744Sgblack@eecs.umich.edu        req1 = new Request;
2905744Sgblack@eecs.umich.edu        *req1 = *this;
2915744Sgblack@eecs.umich.edu        req2 = new Request;
2925744Sgblack@eecs.umich.edu        *req2 = *this;
2936427Ssteve.reinhardt@amd.com        req1->_size = split_addr - _vaddr;
2946427Ssteve.reinhardt@amd.com        req2->_vaddr = split_addr;
2956427Ssteve.reinhardt@amd.com        req2->_size = _size - req1->_size;
2965744Sgblack@eecs.umich.edu    }
2975744Sgblack@eecs.umich.edu
2985744Sgblack@eecs.umich.edu    /**
2995735Snate@binkert.org     * Accessor for paddr.
3005735Snate@binkert.org     */
3016104Ssteve.reinhardt@amd.com    bool
3026104Ssteve.reinhardt@amd.com    hasPaddr()
3036104Ssteve.reinhardt@amd.com    {
3046104Ssteve.reinhardt@amd.com        return privateFlags.isSet(VALID_PADDR);
3056104Ssteve.reinhardt@amd.com    }
3066104Ssteve.reinhardt@amd.com
3075735Snate@binkert.org    Addr
3085735Snate@binkert.org    getPaddr()
3095735Snate@binkert.org    {
3106104Ssteve.reinhardt@amd.com        assert(privateFlags.isSet(VALID_PADDR));
3116427Ssteve.reinhardt@amd.com        return _paddr;
3125735Snate@binkert.org    }
3132663Sstever@eecs.umich.edu
3145735Snate@binkert.org    /**
3155735Snate@binkert.org     *  Accessor for size.
3165735Snate@binkert.org     */
3176104Ssteve.reinhardt@amd.com    bool
3186104Ssteve.reinhardt@amd.com    hasSize()
3196104Ssteve.reinhardt@amd.com    {
3206104Ssteve.reinhardt@amd.com        return privateFlags.isSet(VALID_SIZE);
3216104Ssteve.reinhardt@amd.com    }
3226104Ssteve.reinhardt@amd.com
3235735Snate@binkert.org    int
3245735Snate@binkert.org    getSize()
3255735Snate@binkert.org    {
3266104Ssteve.reinhardt@amd.com        assert(privateFlags.isSet(VALID_SIZE));
3276427Ssteve.reinhardt@amd.com        return _size;
3285735Snate@binkert.org    }
3295735Snate@binkert.org
3302663Sstever@eecs.umich.edu    /** Accessor for time. */
3315735Snate@binkert.org    Tick
3326223Snate@binkert.org    time() const
3335735Snate@binkert.org    {
3346104Ssteve.reinhardt@amd.com        assert(privateFlags.isSet(VALID_PADDR|VALID_VADDR));
3356223Snate@binkert.org        return _time;
3366223Snate@binkert.org    }
3376223Snate@binkert.org
3386223Snate@binkert.org    void
3396223Snate@binkert.org    time(Tick time)
3406223Snate@binkert.org    {
3416223Snate@binkert.org        assert(privateFlags.isSet(VALID_PADDR|VALID_VADDR));
3426223Snate@binkert.org        _time = time;
3435735Snate@binkert.org    }
3445735Snate@binkert.org
3452663Sstever@eecs.umich.edu    /** Accessor for flags. */
3465735Snate@binkert.org    Flags
3475735Snate@binkert.org    getFlags()
3485735Snate@binkert.org    {
3496104Ssteve.reinhardt@amd.com        assert(privateFlags.isSet(VALID_PADDR|VALID_VADDR));
3506427Ssteve.reinhardt@amd.com        return _flags;
3515735Snate@binkert.org    }
3525735Snate@binkert.org
3536428Ssteve.reinhardt@amd.com    /** Note that unlike other accessors, this function sets *specific
3546428Ssteve.reinhardt@amd.com       flags* (ORs them in); it does not assign its argument to the
3556428Ssteve.reinhardt@amd.com       _flags field.  Thus this method should rightly be called
3566428Ssteve.reinhardt@amd.com       setFlags() and not just flags(). */
3575735Snate@binkert.org    void
3586427Ssteve.reinhardt@amd.com    setFlags(Flags flags)
3595735Snate@binkert.org    {
3606104Ssteve.reinhardt@amd.com        assert(privateFlags.isSet(VALID_PADDR|VALID_VADDR));
3616427Ssteve.reinhardt@amd.com        _flags.set(flags);
3625735Snate@binkert.org    }
3635735Snate@binkert.org
3642663Sstever@eecs.umich.edu    /** Accessor function for vaddr.*/
3655735Snate@binkert.org    Addr
3665735Snate@binkert.org    getVaddr()
3675735Snate@binkert.org    {
3686104Ssteve.reinhardt@amd.com        assert(privateFlags.isSet(VALID_VADDR));
3696427Ssteve.reinhardt@amd.com        return _vaddr;
3705735Snate@binkert.org    }
3712663Sstever@eecs.umich.edu
3722663Sstever@eecs.umich.edu    /** Accessor function for asid.*/
3735735Snate@binkert.org    int
3745735Snate@binkert.org    getAsid()
3755735Snate@binkert.org    {
3766104Ssteve.reinhardt@amd.com        assert(privateFlags.isSet(VALID_VADDR));
3776427Ssteve.reinhardt@amd.com        return _asid;
3785735Snate@binkert.org    }
3792663Sstever@eecs.umich.edu
3808551Sdaniel.johnson@arm.com    /** Accessor function for asid.*/
3818551Sdaniel.johnson@arm.com    void
3828551Sdaniel.johnson@arm.com    setAsid(int asid)
3838551Sdaniel.johnson@arm.com    {
3848551Sdaniel.johnson@arm.com        _asid = asid;
3858551Sdaniel.johnson@arm.com    }
3868551Sdaniel.johnson@arm.com
3873804Ssaidi@eecs.umich.edu    /** Accessor function for asi.*/
3885735Snate@binkert.org    uint8_t
3895735Snate@binkert.org    getAsi()
3905735Snate@binkert.org    {
3916104Ssteve.reinhardt@amd.com        assert(privateFlags.isSet(VALID_VADDR));
3926427Ssteve.reinhardt@amd.com        return _flags & ASI_BITS;
3935735Snate@binkert.org    }
3943804Ssaidi@eecs.umich.edu
3952679Sktlim@umich.edu    /** Accessor function to check if sc result is valid. */
3965735Snate@binkert.org    bool
3975735Snate@binkert.org    extraDataValid()
3985735Snate@binkert.org    {
3996104Ssteve.reinhardt@amd.com        return privateFlags.isSet(VALID_EXTRA_DATA);
4005735Snate@binkert.org    }
4015735Snate@binkert.org
4022663Sstever@eecs.umich.edu    /** Accessor function for store conditional return value.*/
4035735Snate@binkert.org    uint64_t
4045735Snate@binkert.org    getExtraData() const
4055735Snate@binkert.org    {
4066104Ssteve.reinhardt@amd.com        assert(privateFlags.isSet(VALID_EXTRA_DATA));
4076427Ssteve.reinhardt@amd.com        return _extraData;
4085735Snate@binkert.org    }
4095735Snate@binkert.org
4102663Sstever@eecs.umich.edu    /** Accessor function for store conditional return value.*/
4115735Snate@binkert.org    void
4126427Ssteve.reinhardt@amd.com    setExtraData(uint64_t extraData)
4135735Snate@binkert.org    {
4146427Ssteve.reinhardt@amd.com        _extraData = extraData;
4156104Ssteve.reinhardt@amd.com        privateFlags.set(VALID_EXTRA_DATA);
4165735Snate@binkert.org    }
4172663Sstever@eecs.umich.edu
4186010Ssteve.reinhardt@amd.com    bool
4196010Ssteve.reinhardt@amd.com    hasContextId() const
4206010Ssteve.reinhardt@amd.com    {
4216104Ssteve.reinhardt@amd.com        return privateFlags.isSet(VALID_CONTEXT_ID);
4226010Ssteve.reinhardt@amd.com    }
4236010Ssteve.reinhardt@amd.com
4245714Shsul@eecs.umich.edu    /** Accessor function for context ID.*/
4255735Snate@binkert.org    int
4265735Snate@binkert.org    contextId() const
4275735Snate@binkert.org    {
4286104Ssteve.reinhardt@amd.com        assert(privateFlags.isSet(VALID_CONTEXT_ID));
4295735Snate@binkert.org        return _contextId;
4305735Snate@binkert.org    }
4315735Snate@binkert.org
4325714Shsul@eecs.umich.edu    /** Accessor function for thread ID. */
4335735Snate@binkert.org    int
4345735Snate@binkert.org    threadId() const
4355735Snate@binkert.org    {
4366104Ssteve.reinhardt@amd.com        assert(privateFlags.isSet(VALID_THREAD_ID));
4375735Snate@binkert.org        return _threadId;
4385735Snate@binkert.org    }
4392663Sstever@eecs.umich.edu
4405875Ssteve.reinhardt@amd.com    bool
4415875Ssteve.reinhardt@amd.com    hasPC() const
4425875Ssteve.reinhardt@amd.com    {
4436104Ssteve.reinhardt@amd.com        return privateFlags.isSet(VALID_PC);
4445875Ssteve.reinhardt@amd.com    }
4455875Ssteve.reinhardt@amd.com
4466010Ssteve.reinhardt@amd.com    /** Accessor function for pc.*/
4475735Snate@binkert.org    Addr
4485735Snate@binkert.org    getPC() const
4495735Snate@binkert.org    {
4506104Ssteve.reinhardt@amd.com        assert(privateFlags.isSet(VALID_PC));
4516427Ssteve.reinhardt@amd.com        return _pc;
4525735Snate@binkert.org    }
4532532SN/A
4546428Ssteve.reinhardt@amd.com    /** Accessor functions for flags.  Note that these are for testing
4556428Ssteve.reinhardt@amd.com       only; setting flags should be done via setFlags(). */
4566427Ssteve.reinhardt@amd.com    bool isUncacheable() const { return _flags.isSet(UNCACHEABLE); }
4576427Ssteve.reinhardt@amd.com    bool isInstFetch() const { return _flags.isSet(INST_FETCH); }
4586427Ssteve.reinhardt@amd.com    bool isPrefetch() const { return _flags.isSet(PREFETCH); }
4596427Ssteve.reinhardt@amd.com    bool isLLSC() const { return _flags.isSet(LLSC); }
4606427Ssteve.reinhardt@amd.com    bool isLocked() const { return _flags.isSet(LOCKED); }
4616427Ssteve.reinhardt@amd.com    bool isSwap() const { return _flags.isSet(MEM_SWAP|MEM_SWAP_COND); }
4626427Ssteve.reinhardt@amd.com    bool isCondSwap() const { return _flags.isSet(MEM_SWAP_COND); }
4638105Sgblack@eecs.umich.edu    bool isMmappedIpr() const { return _flags.isSet(MMAPPED_IPR); }
4647705Sgblack@eecs.umich.edu    bool isClearLL() const { return _flags.isSet(CLEAR_LL); }
4652384SN/A};
4662381SN/A
4672381SN/A#endif // __MEM_REQUEST_HH__
468