request.hh revision 5764
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"
472980Sgblack@eecs.umich.edu#include "sim/host.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{
565745Snate@binkert.org    friend class Packet;
575745Snate@binkert.org
585735Snate@binkert.org  public:
595735Snate@binkert.org    typedef uint32_t FlagsType;
605735Snate@binkert.org    typedef ::Flags<FlagsType> Flags;
615735Snate@binkert.org
625735Snate@binkert.org    /** ASI information for this request if it exists. */
635735Snate@binkert.org    static const FlagsType ASI_BITS                    = 0x000000FF;
645735Snate@binkert.org    /** The request is a Load locked/store conditional. */
655735Snate@binkert.org    static const FlagsType LOCKED                      = 0x00000100;
665735Snate@binkert.org    /** The virtual address is also the physical address. */
675735Snate@binkert.org    static const FlagsType PHYSICAL                    = 0x00000200;
685735Snate@binkert.org    /** The request is an ALPHA VPTE pal access (hw_ld). */
695735Snate@binkert.org    static const FlagsType VPTE                        = 0x00000400;
705735Snate@binkert.org    /** Use the alternate mode bits in ALPHA. */
715735Snate@binkert.org    static const FlagsType ALTMODE                     = 0x00000800;
725735Snate@binkert.org    /** The request is to an uncacheable address. */
735735Snate@binkert.org    static const FlagsType UNCACHEABLE                 = 0x00001000;
745735Snate@binkert.org    /** The request should not cause a page fault. */
755735Snate@binkert.org    static const FlagsType NO_FAULT                    = 0x00002000;
765735Snate@binkert.org    /** The request should be prefetched into the exclusive state. */
775735Snate@binkert.org    static const FlagsType PF_EXCLUSIVE                = 0x00010000;
785735Snate@binkert.org    /** The request should be marked as LRU. */
795735Snate@binkert.org    static const FlagsType EVICT_NEXT                  = 0x00020000;
805735Snate@binkert.org    /** The request should ignore unaligned access faults */
815735Snate@binkert.org    static const FlagsType NO_ALIGN_FAULT              = 0x00040000;
825735Snate@binkert.org    /** The request was an instruction read. */
835735Snate@binkert.org    static const FlagsType INST_READ                   = 0x00080000;
845735Snate@binkert.org    /** This request is for a memory swap. */
855735Snate@binkert.org    static const FlagsType MEM_SWAP                    = 0x00100000;
865735Snate@binkert.org    static const FlagsType MEM_SWAP_COND               = 0x00200000;
875735Snate@binkert.org    /** The request should ignore unaligned access faults */
885735Snate@binkert.org    static const FlagsType NO_HALF_WORD_ALIGN_FAULT    = 0x00400000;
895735Snate@binkert.org    /** This request is to a memory mapped register. */
905735Snate@binkert.org    static const FlagsType MMAPED_IPR                  = 0x00800000;
915735Snate@binkert.org
925735Snate@binkert.org  private:
935735Snate@binkert.org    static const FlagsType PUBLIC_FLAGS                = 0x00FF3FFF;
945735Snate@binkert.org    static const FlagsType PRIVATE_FLAGS               = 0xFF000000;
955735Snate@binkert.org
965735Snate@binkert.org    /** Whether or not the size is valid. */
975735Snate@binkert.org    static const FlagsType VALID_SIZE                  = 0x01000000;
985735Snate@binkert.org    /** Whether or not paddr is valid (has been written yet). */
995735Snate@binkert.org    static const FlagsType VALID_PADDR                 = 0x02000000;
1005735Snate@binkert.org    /** Whether or not the vaddr & asid are valid. */
1015735Snate@binkert.org    static const FlagsType VALID_VADDR                 = 0x04000000;
1025735Snate@binkert.org    /** Whether or not the pc is valid. */
1035735Snate@binkert.org    static const FlagsType VALID_PC                    = 0x10000000;
1045735Snate@binkert.org    /** Whether or not the context ID is valid. */
1055735Snate@binkert.org    static const FlagsType VALID_CONTEXT_ID            = 0x20000000;
1065735Snate@binkert.org    static const FlagsType VALID_THREAD_ID             = 0x40000000;
1075735Snate@binkert.org    /** Whether or not the sc result is valid. */
1085735Snate@binkert.org    static const FlagsType VALID_EXTRA_DATA            = 0x80000000;
1095735Snate@binkert.org
1102663Sstever@eecs.umich.edu  private:
1112663Sstever@eecs.umich.edu    /**
1122663Sstever@eecs.umich.edu     * The physical address of the request. Valid only if validPaddr
1135735Snate@binkert.org     * is set.
1145735Snate@binkert.org     */
1152663Sstever@eecs.umich.edu    Addr paddr;
1162532SN/A
1172663Sstever@eecs.umich.edu    /**
1182663Sstever@eecs.umich.edu     * The size of the request. This field must be set when vaddr or
1192663Sstever@eecs.umich.edu     * paddr is written via setVirt() or setPhys(), so it is always
1205735Snate@binkert.org     * valid as long as one of the address fields is valid.
1215735Snate@binkert.org     */
1222381SN/A    int size;
1232395SN/A
1242532SN/A    /** Flag structure for the request. */
1255735Snate@binkert.org    Flags flags;
1262384SN/A
1272663Sstever@eecs.umich.edu    /**
1282663Sstever@eecs.umich.edu     * The time this request was started. Used to calculate
1292663Sstever@eecs.umich.edu     * latencies. This field is set to curTick any time paddr or vaddr
1305735Snate@binkert.org     * is written.
1315735Snate@binkert.org     */
1322663Sstever@eecs.umich.edu    Tick time;
1332384SN/A
1342384SN/A    /** The address space ID. */
1352384SN/A    int asid;
1363806Ssaidi@eecs.umich.edu
1372663Sstever@eecs.umich.edu    /** The virtual address of the request. */
1382663Sstever@eecs.umich.edu    Addr vaddr;
1392384SN/A
1405735Snate@binkert.org    /**
1415735Snate@binkert.org     * Extra data for the request, such as the return value of
1424040Ssaidi@eecs.umich.edu     * store conditional or the compare value for a CAS. */
1434040Ssaidi@eecs.umich.edu    uint64_t extraData;
1442384SN/A
1455714Shsul@eecs.umich.edu    /** The context ID (for statistics, typically). */
1465714Shsul@eecs.umich.edu    int _contextId;
1475714Shsul@eecs.umich.edu    /** The thread ID (id within this CPU) */
1485714Shsul@eecs.umich.edu    int _threadId;
1492384SN/A
1502381SN/A    /** program counter of initiating access; for tracing/debugging */
1512381SN/A    Addr pc;
1522663Sstever@eecs.umich.edu
1532532SN/A  public:
1542663Sstever@eecs.umich.edu    /** Minimal constructor.  No fields are initialized. */
1552663Sstever@eecs.umich.edu    Request()
1562663Sstever@eecs.umich.edu    {}
1572532SN/A
1582663Sstever@eecs.umich.edu    /**
1592663Sstever@eecs.umich.edu     * Constructor for physical (e.g. device) requests.  Initializes
1602663Sstever@eecs.umich.edu     * just physical address, size, flags, and timestamp (to curTick).
1615735Snate@binkert.org     * These fields are adequate to perform a request.
1625735Snate@binkert.org     */
1635735Snate@binkert.org    Request(Addr paddr, int size, Flags flags)
1645735Snate@binkert.org    {
1655735Snate@binkert.org        setPhys(paddr, size, flags);
1665735Snate@binkert.org    }
1672532SN/A
1685735Snate@binkert.org    Request(int asid, Addr vaddr, int size, Flags flags, Addr pc,
1695735Snate@binkert.org            int cid, int tid)
1702669Sktlim@umich.edu    {
1715735Snate@binkert.org        setThreadContext(cid, tid);
1725735Snate@binkert.org        setVirt(asid, vaddr, size, flags, pc);
1732669Sktlim@umich.edu    }
1742669Sktlim@umich.edu
1754610Ssaidi@eecs.umich.edu    ~Request() {}  // for FastAlloc
1764610Ssaidi@eecs.umich.edu
1772663Sstever@eecs.umich.edu    /**
1785735Snate@binkert.org     * Set up CPU and thread numbers.
1795735Snate@binkert.org     */
1805735Snate@binkert.org    void
1815735Snate@binkert.org    setThreadContext(int context_id, int thread_id)
1822663Sstever@eecs.umich.edu    {
1835735Snate@binkert.org        _contextId = context_id;
1845735Snate@binkert.org        _threadId = thread_id;
1855735Snate@binkert.org        flags.set(VALID_CONTEXT_ID|VALID_THREAD_ID);
1862663Sstever@eecs.umich.edu    }
1872532SN/A
1882663Sstever@eecs.umich.edu    /**
1892663Sstever@eecs.umich.edu     * Set up a physical (e.g. device) request in a previously
1905735Snate@binkert.org     * allocated Request object.
1915735Snate@binkert.org     */
1925735Snate@binkert.org    void
1935735Snate@binkert.org    setPhys(Addr _paddr, int _size, Flags _flags)
1942663Sstever@eecs.umich.edu    {
1955731SSteve.Reinhardt@amd.com        assert(_size >= 0);
1962663Sstever@eecs.umich.edu        paddr = _paddr;
1972663Sstever@eecs.umich.edu        size = _size;
1982663Sstever@eecs.umich.edu        time = curTick;
1995735Snate@binkert.org
2005735Snate@binkert.org        flags.set(VALID_PADDR|VALID_SIZE);
2015735Snate@binkert.org        flags.clear(VALID_VADDR|VALID_PC|VALID_EXTRA_DATA|MMAPED_IPR);
2025735Snate@binkert.org        flags.update(_flags, PUBLIC_FLAGS);
2032663Sstever@eecs.umich.edu    }
2042532SN/A
2052663Sstever@eecs.umich.edu    /**
2062663Sstever@eecs.umich.edu     * Set up a virtual (e.g., CPU) request in a previously
2075735Snate@binkert.org     * allocated Request object.
2085735Snate@binkert.org     */
2095735Snate@binkert.org    void
2105735Snate@binkert.org    setVirt(int _asid, Addr _vaddr, int _size, Flags _flags, Addr _pc)
2112663Sstever@eecs.umich.edu    {
2125731SSteve.Reinhardt@amd.com        assert(_size >= 0);
2132663Sstever@eecs.umich.edu        asid = _asid;
2142663Sstever@eecs.umich.edu        vaddr = _vaddr;
2152663Sstever@eecs.umich.edu        size = _size;
2162663Sstever@eecs.umich.edu        pc = _pc;
2172663Sstever@eecs.umich.edu        time = curTick;
2185735Snate@binkert.org
2195735Snate@binkert.org        flags.set(VALID_VADDR|VALID_SIZE|VALID_PC);
2205735Snate@binkert.org        flags.clear(VALID_PADDR|VALID_EXTRA_DATA|MMAPED_IPR);
2215735Snate@binkert.org        flags.update(_flags, PUBLIC_FLAGS);
2222663Sstever@eecs.umich.edu    }
2232532SN/A
2245735Snate@binkert.org    /**
2255735Snate@binkert.org     * Set just the physical address.  This should only be used to
2262663Sstever@eecs.umich.edu     * record the result of a translation, and thus the vaddr must be
2272663Sstever@eecs.umich.edu     * valid before this method is called.  Otherwise, use setPhys()
2282663Sstever@eecs.umich.edu     * to guarantee that the size and flags are also set.
2292663Sstever@eecs.umich.edu     */
2305735Snate@binkert.org    void
2315735Snate@binkert.org    setPaddr(Addr _paddr)
2322663Sstever@eecs.umich.edu    {
2335764Snate@binkert.org        assert(flags.isSet(VALID_VADDR));
2342663Sstever@eecs.umich.edu        paddr = _paddr;
2355735Snate@binkert.org        flags.set(VALID_PADDR);
2362663Sstever@eecs.umich.edu    }
2372532SN/A
2385735Snate@binkert.org    /**
2395744Sgblack@eecs.umich.edu     * Generate two requests as if this request had been split into two
2405744Sgblack@eecs.umich.edu     * pieces. The original request can't have been translated already.
2415744Sgblack@eecs.umich.edu     */
2425744Sgblack@eecs.umich.edu    void splitOnVaddr(Addr split_addr, RequestPtr &req1, RequestPtr &req2)
2435744Sgblack@eecs.umich.edu    {
2445764Snate@binkert.org        assert(flags.isSet(VALID_VADDR));
2455764Snate@binkert.org        assert(flags.noneSet(VALID_PADDR));
2465744Sgblack@eecs.umich.edu        assert(split_addr > vaddr && split_addr < vaddr + size);
2475744Sgblack@eecs.umich.edu        req1 = new Request;
2485744Sgblack@eecs.umich.edu        *req1 = *this;
2495744Sgblack@eecs.umich.edu        req2 = new Request;
2505744Sgblack@eecs.umich.edu        *req2 = *this;
2515744Sgblack@eecs.umich.edu        req1->size = split_addr - vaddr;
2525744Sgblack@eecs.umich.edu        req2->vaddr = split_addr;
2535744Sgblack@eecs.umich.edu        req2->size = size - req1->size;
2545744Sgblack@eecs.umich.edu    }
2555744Sgblack@eecs.umich.edu
2565744Sgblack@eecs.umich.edu    /**
2575735Snate@binkert.org     * Accessor for paddr.
2585735Snate@binkert.org     */
2595735Snate@binkert.org    Addr
2605735Snate@binkert.org    getPaddr()
2615735Snate@binkert.org    {
2625764Snate@binkert.org        assert(flags.isSet(VALID_PADDR));
2635735Snate@binkert.org        return paddr;
2645735Snate@binkert.org    }
2652663Sstever@eecs.umich.edu
2665735Snate@binkert.org    /**
2675735Snate@binkert.org     *  Accessor for size.
2685735Snate@binkert.org     */
2695735Snate@binkert.org    int
2705735Snate@binkert.org    getSize()
2715735Snate@binkert.org    {
2725764Snate@binkert.org        assert(flags.isSet(VALID_SIZE));
2735735Snate@binkert.org        return size;
2745735Snate@binkert.org    }
2755735Snate@binkert.org
2762663Sstever@eecs.umich.edu    /** Accessor for time. */
2775735Snate@binkert.org    Tick
2785735Snate@binkert.org    getTime()
2795735Snate@binkert.org    {
2805764Snate@binkert.org        assert(flags.isSet(VALID_PADDR|VALID_VADDR));
2815735Snate@binkert.org        return time;
2825735Snate@binkert.org    }
2835735Snate@binkert.org
2845607Snate@binkert.org    void
2855607Snate@binkert.org    setTime(Tick when)
2865607Snate@binkert.org    {
2875764Snate@binkert.org        assert(flags.isSet(VALID_PADDR|VALID_VADDR));
2885607Snate@binkert.org        time = when;
2895607Snate@binkert.org    }
2902663Sstever@eecs.umich.edu
2912663Sstever@eecs.umich.edu    /** Accessor for flags. */
2925735Snate@binkert.org    Flags
2935735Snate@binkert.org    getFlags()
2945735Snate@binkert.org    {
2955764Snate@binkert.org        assert(flags.isSet(VALID_PADDR|VALID_VADDR));
2965735Snate@binkert.org        return flags & PUBLIC_FLAGS;
2975735Snate@binkert.org    }
2985735Snate@binkert.org
2995735Snate@binkert.org    Flags
3005735Snate@binkert.org    anyFlags(Flags _flags)
3015735Snate@binkert.org    {
3025764Snate@binkert.org        assert(flags.isSet(VALID_PADDR|VALID_VADDR));
3035764Snate@binkert.org        assert(_flags.noneSet(~PUBLIC_FLAGS));
3045764Snate@binkert.org        return flags.isSet(_flags);
3055735Snate@binkert.org    }
3065735Snate@binkert.org
3075735Snate@binkert.org    Flags
3085735Snate@binkert.org    allFlags(Flags _flags)
3095735Snate@binkert.org    {
3105764Snate@binkert.org        assert(flags.isSet(VALID_PADDR|VALID_VADDR));
3115764Snate@binkert.org        assert(_flags.noneSet(~PUBLIC_FLAGS));
3125764Snate@binkert.org        return flags.allSet(_flags);
3135735Snate@binkert.org    }
3145735Snate@binkert.org
3155735Snate@binkert.org    /** Accessor for flags. */
3165735Snate@binkert.org    void
3175735Snate@binkert.org    setFlags(Flags _flags)
3185735Snate@binkert.org    {
3195764Snate@binkert.org        assert(flags.isSet(VALID_PADDR|VALID_VADDR));
3205764Snate@binkert.org        assert(_flags.noneSet(~PUBLIC_FLAGS));
3215735Snate@binkert.org        flags.set(_flags);
3225735Snate@binkert.org    }
3235735Snate@binkert.org
3245735Snate@binkert.org    void
3255735Snate@binkert.org    clearFlags(Flags _flags)
3265735Snate@binkert.org    {
3275764Snate@binkert.org        assert(flags.isSet(VALID_PADDR|VALID_VADDR));
3285764Snate@binkert.org        assert(_flags.noneSet(~PUBLIC_FLAGS));
3295735Snate@binkert.org        flags.clear(_flags);
3305735Snate@binkert.org    }
3315735Snate@binkert.org
3325735Snate@binkert.org    void
3335735Snate@binkert.org    clearFlags()
3345735Snate@binkert.org    {
3355764Snate@binkert.org        assert(flags.isSet(VALID_PADDR|VALID_VADDR));
3365735Snate@binkert.org        flags.clear(PUBLIC_FLAGS);
3375735Snate@binkert.org    }
3382663Sstever@eecs.umich.edu
3392663Sstever@eecs.umich.edu    /** Accessor function for vaddr.*/
3405735Snate@binkert.org    Addr
3415735Snate@binkert.org    getVaddr()
3425735Snate@binkert.org    {
3435764Snate@binkert.org        assert(flags.isSet(VALID_VADDR));
3445735Snate@binkert.org        return vaddr;
3455735Snate@binkert.org    }
3462663Sstever@eecs.umich.edu
3472663Sstever@eecs.umich.edu    /** Accessor function for asid.*/
3485735Snate@binkert.org    int
3495735Snate@binkert.org    getAsid()
3505735Snate@binkert.org    {
3515764Snate@binkert.org        assert(flags.isSet(VALID_VADDR));
3525735Snate@binkert.org        return asid;
3535735Snate@binkert.org    }
3542663Sstever@eecs.umich.edu
3553804Ssaidi@eecs.umich.edu    /** Accessor function for asi.*/
3565735Snate@binkert.org    uint8_t
3575735Snate@binkert.org    getAsi()
3585735Snate@binkert.org    {
3595764Snate@binkert.org        assert(flags.isSet(VALID_VADDR));
3605735Snate@binkert.org        return flags & ASI_BITS;
3615735Snate@binkert.org    }
3623804Ssaidi@eecs.umich.edu
3633804Ssaidi@eecs.umich.edu    /** Accessor function for asi.*/
3645735Snate@binkert.org    void
3655735Snate@binkert.org    setAsi(uint8_t a)
3665735Snate@binkert.org    {
3675764Snate@binkert.org        assert(flags.isSet(VALID_VADDR));
3685735Snate@binkert.org        flags.update(a, ASI_BITS);
3695735Snate@binkert.org    }
3703806Ssaidi@eecs.umich.edu
3713804Ssaidi@eecs.umich.edu    /** Accessor function for asi.*/
3725735Snate@binkert.org    bool
3735735Snate@binkert.org    isMmapedIpr()
3745735Snate@binkert.org    {
3755764Snate@binkert.org        assert(flags.isSet(VALID_PADDR));
3765764Snate@binkert.org        return flags.isSet(MMAPED_IPR);
3775735Snate@binkert.org    }
3783806Ssaidi@eecs.umich.edu
3793806Ssaidi@eecs.umich.edu    /** Accessor function for asi.*/
3805735Snate@binkert.org    void
3815735Snate@binkert.org    setMmapedIpr(bool r)
3825735Snate@binkert.org    {
3835735Snate@binkert.org        assert(VALID_VADDR);
3845735Snate@binkert.org        flags.set(MMAPED_IPR);
3855735Snate@binkert.org    }
3863804Ssaidi@eecs.umich.edu
3872679Sktlim@umich.edu    /** Accessor function to check if sc result is valid. */
3885735Snate@binkert.org    bool
3895735Snate@binkert.org    extraDataValid()
3905735Snate@binkert.org    {
3915764Snate@binkert.org        return flags.isSet(VALID_EXTRA_DATA);
3925735Snate@binkert.org    }
3935735Snate@binkert.org
3942663Sstever@eecs.umich.edu    /** Accessor function for store conditional return value.*/
3955735Snate@binkert.org    uint64_t
3965735Snate@binkert.org    getExtraData() const
3975735Snate@binkert.org    {
3985764Snate@binkert.org        assert(flags.isSet(VALID_EXTRA_DATA));
3995735Snate@binkert.org        return extraData;
4005735Snate@binkert.org    }
4015735Snate@binkert.org
4022663Sstever@eecs.umich.edu    /** Accessor function for store conditional return value.*/
4035735Snate@binkert.org    void
4045735Snate@binkert.org    setExtraData(uint64_t _extraData)
4055735Snate@binkert.org    {
4065735Snate@binkert.org        extraData = _extraData;
4075735Snate@binkert.org        flags.set(VALID_EXTRA_DATA);
4085735Snate@binkert.org    }
4092663Sstever@eecs.umich.edu
4105714Shsul@eecs.umich.edu    /** Accessor function for context ID.*/
4115735Snate@binkert.org    int
4125735Snate@binkert.org    contextId() const
4135735Snate@binkert.org    {
4145764Snate@binkert.org        assert(flags.isSet(VALID_CONTEXT_ID));
4155735Snate@binkert.org        return _contextId;
4165735Snate@binkert.org    }
4175735Snate@binkert.org
4185714Shsul@eecs.umich.edu    /** Accessor function for thread ID. */
4195735Snate@binkert.org    int
4205735Snate@binkert.org    threadId() const
4215735Snate@binkert.org    {
4225764Snate@binkert.org        assert(flags.isSet(VALID_THREAD_ID));
4235735Snate@binkert.org        return _threadId;
4245735Snate@binkert.org    }
4252663Sstever@eecs.umich.edu
4262663Sstever@eecs.umich.edu    /** Accessor function for pc.*/
4275735Snate@binkert.org    Addr
4285735Snate@binkert.org    getPC() const
4295735Snate@binkert.org    {
4305764Snate@binkert.org        assert(flags.isSet(VALID_PC));
4315735Snate@binkert.org        return pc;
4325735Snate@binkert.org    }
4332532SN/A
4342811Srdreslin@umich.edu    /** Accessor Function to Check Cacheability. */
4355764Snate@binkert.org    bool isUncacheable() const { return flags.isSet(UNCACHEABLE); }
4365764Snate@binkert.org    bool isInstRead() const { return flags.isSet(INST_READ); }
4375764Snate@binkert.org    bool isLocked() const { return flags.isSet(LOCKED); }
4385764Snate@binkert.org    bool isSwap() const { return flags.isSet(MEM_SWAP|MEM_SWAP_COND); }
4395764Snate@binkert.org    bool isCondSwap() const { return flags.isSet(MEM_SWAP_COND); }
4402811Srdreslin@umich.edu
4415735Snate@binkert.org    bool
4425735Snate@binkert.org    isMisaligned() const
4435735Snate@binkert.org    {
4445764Snate@binkert.org        if (flags.isSet(NO_ALIGN_FAULT))
4455735Snate@binkert.org            return false;
4463170Sstever@eecs.umich.edu
4475735Snate@binkert.org        if ((vaddr & 0x1))
4485735Snate@binkert.org            return true;
4492814Srdreslin@umich.edu
4505764Snate@binkert.org        if (flags.isSet(NO_HALF_WORD_ALIGN_FAULT))
4515735Snate@binkert.org            return false;
4524040Ssaidi@eecs.umich.edu
4535735Snate@binkert.org        if ((vaddr & 0x2))
4545735Snate@binkert.org            return true;
4554040Ssaidi@eecs.umich.edu
4565735Snate@binkert.org        return false;
4575735Snate@binkert.org    }
4582384SN/A};
4592381SN/A
4602381SN/A#endif // __MEM_REQUEST_HH__
461