request.hh revision 5890
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; 765890Sgblack@eecs.umich.edu /** The request should not cause a memory access. */ 775890Sgblack@eecs.umich.edu static const FlagsType NO_ACCESS = 0x00004000; 785735Snate@binkert.org /** The request should be prefetched into the exclusive state. */ 795735Snate@binkert.org static const FlagsType PF_EXCLUSIVE = 0x00010000; 805735Snate@binkert.org /** The request should be marked as LRU. */ 815735Snate@binkert.org static const FlagsType EVICT_NEXT = 0x00020000; 825735Snate@binkert.org /** The request should ignore unaligned access faults */ 835735Snate@binkert.org static const FlagsType NO_ALIGN_FAULT = 0x00040000; 845735Snate@binkert.org /** The request was an instruction read. */ 855735Snate@binkert.org static const FlagsType INST_READ = 0x00080000; 865735Snate@binkert.org /** This request is for a memory swap. */ 875735Snate@binkert.org static const FlagsType MEM_SWAP = 0x00100000; 885735Snate@binkert.org static const FlagsType MEM_SWAP_COND = 0x00200000; 895735Snate@binkert.org /** The request should ignore unaligned access faults */ 905735Snate@binkert.org static const FlagsType NO_HALF_WORD_ALIGN_FAULT = 0x00400000; 915735Snate@binkert.org /** This request is to a memory mapped register. */ 925735Snate@binkert.org static const FlagsType MMAPED_IPR = 0x00800000; 935735Snate@binkert.org 945735Snate@binkert.org private: 955735Snate@binkert.org static const FlagsType PUBLIC_FLAGS = 0x00FF3FFF; 965735Snate@binkert.org static const FlagsType PRIVATE_FLAGS = 0xFF000000; 975735Snate@binkert.org 985735Snate@binkert.org /** Whether or not the size is valid. */ 995735Snate@binkert.org static const FlagsType VALID_SIZE = 0x01000000; 1005735Snate@binkert.org /** Whether or not paddr is valid (has been written yet). */ 1015735Snate@binkert.org static const FlagsType VALID_PADDR = 0x02000000; 1025735Snate@binkert.org /** Whether or not the vaddr & asid are valid. */ 1035735Snate@binkert.org static const FlagsType VALID_VADDR = 0x04000000; 1045735Snate@binkert.org /** Whether or not the pc is valid. */ 1055735Snate@binkert.org static const FlagsType VALID_PC = 0x10000000; 1065735Snate@binkert.org /** Whether or not the context ID is valid. */ 1075735Snate@binkert.org static const FlagsType VALID_CONTEXT_ID = 0x20000000; 1085735Snate@binkert.org static const FlagsType VALID_THREAD_ID = 0x40000000; 1095735Snate@binkert.org /** Whether or not the sc result is valid. */ 1105735Snate@binkert.org static const FlagsType VALID_EXTRA_DATA = 0x80000000; 1115735Snate@binkert.org 1122663Sstever@eecs.umich.edu private: 1132663Sstever@eecs.umich.edu /** 1142663Sstever@eecs.umich.edu * The physical address of the request. Valid only if validPaddr 1155735Snate@binkert.org * is set. 1165735Snate@binkert.org */ 1172663Sstever@eecs.umich.edu Addr paddr; 1182532SN/A 1192663Sstever@eecs.umich.edu /** 1202663Sstever@eecs.umich.edu * The size of the request. This field must be set when vaddr or 1212663Sstever@eecs.umich.edu * paddr is written via setVirt() or setPhys(), so it is always 1225735Snate@binkert.org * valid as long as one of the address fields is valid. 1235735Snate@binkert.org */ 1242381SN/A int size; 1252395SN/A 1262532SN/A /** Flag structure for the request. */ 1275735Snate@binkert.org Flags flags; 1282384SN/A 1292663Sstever@eecs.umich.edu /** 1302663Sstever@eecs.umich.edu * The time this request was started. Used to calculate 1312663Sstever@eecs.umich.edu * latencies. This field is set to curTick any time paddr or vaddr 1325735Snate@binkert.org * is written. 1335735Snate@binkert.org */ 1342663Sstever@eecs.umich.edu Tick time; 1352384SN/A 1362384SN/A /** The address space ID. */ 1372384SN/A int asid; 1383806Ssaidi@eecs.umich.edu 1392663Sstever@eecs.umich.edu /** The virtual address of the request. */ 1402663Sstever@eecs.umich.edu Addr vaddr; 1412384SN/A 1425735Snate@binkert.org /** 1435735Snate@binkert.org * Extra data for the request, such as the return value of 1444040Ssaidi@eecs.umich.edu * store conditional or the compare value for a CAS. */ 1454040Ssaidi@eecs.umich.edu uint64_t extraData; 1462384SN/A 1475714Shsul@eecs.umich.edu /** The context ID (for statistics, typically). */ 1485714Shsul@eecs.umich.edu int _contextId; 1495714Shsul@eecs.umich.edu /** The thread ID (id within this CPU) */ 1505714Shsul@eecs.umich.edu int _threadId; 1512384SN/A 1522381SN/A /** program counter of initiating access; for tracing/debugging */ 1532381SN/A Addr pc; 1542663Sstever@eecs.umich.edu 1552532SN/A public: 1562663Sstever@eecs.umich.edu /** Minimal constructor. No fields are initialized. */ 1572663Sstever@eecs.umich.edu Request() 1582663Sstever@eecs.umich.edu {} 1592532SN/A 1602663Sstever@eecs.umich.edu /** 1612663Sstever@eecs.umich.edu * Constructor for physical (e.g. device) requests. Initializes 1622663Sstever@eecs.umich.edu * just physical address, size, flags, and timestamp (to curTick). 1635735Snate@binkert.org * These fields are adequate to perform a request. 1645735Snate@binkert.org */ 1655735Snate@binkert.org Request(Addr paddr, int size, Flags flags) 1665735Snate@binkert.org { 1675735Snate@binkert.org setPhys(paddr, size, flags); 1685735Snate@binkert.org } 1692532SN/A 1705735Snate@binkert.org Request(int asid, Addr vaddr, int size, Flags flags, Addr pc, 1715735Snate@binkert.org int cid, int tid) 1722669Sktlim@umich.edu { 1735735Snate@binkert.org setThreadContext(cid, tid); 1745735Snate@binkert.org setVirt(asid, vaddr, size, flags, pc); 1752669Sktlim@umich.edu } 1762669Sktlim@umich.edu 1774610Ssaidi@eecs.umich.edu ~Request() {} // for FastAlloc 1784610Ssaidi@eecs.umich.edu 1792663Sstever@eecs.umich.edu /** 1805735Snate@binkert.org * Set up CPU and thread numbers. 1815735Snate@binkert.org */ 1825735Snate@binkert.org void 1835735Snate@binkert.org setThreadContext(int context_id, int thread_id) 1842663Sstever@eecs.umich.edu { 1855735Snate@binkert.org _contextId = context_id; 1865735Snate@binkert.org _threadId = thread_id; 1875735Snate@binkert.org flags.set(VALID_CONTEXT_ID|VALID_THREAD_ID); 1882663Sstever@eecs.umich.edu } 1892532SN/A 1902663Sstever@eecs.umich.edu /** 1912663Sstever@eecs.umich.edu * Set up a physical (e.g. device) request in a previously 1925735Snate@binkert.org * allocated Request object. 1935735Snate@binkert.org */ 1945735Snate@binkert.org void 1955735Snate@binkert.org setPhys(Addr _paddr, int _size, Flags _flags) 1962663Sstever@eecs.umich.edu { 1975731SSteve.Reinhardt@amd.com assert(_size >= 0); 1982663Sstever@eecs.umich.edu paddr = _paddr; 1992663Sstever@eecs.umich.edu size = _size; 2002663Sstever@eecs.umich.edu time = curTick; 2015735Snate@binkert.org 2025735Snate@binkert.org flags.set(VALID_PADDR|VALID_SIZE); 2035735Snate@binkert.org flags.clear(VALID_VADDR|VALID_PC|VALID_EXTRA_DATA|MMAPED_IPR); 2045735Snate@binkert.org flags.update(_flags, PUBLIC_FLAGS); 2052663Sstever@eecs.umich.edu } 2062532SN/A 2072663Sstever@eecs.umich.edu /** 2082663Sstever@eecs.umich.edu * Set up a virtual (e.g., CPU) request in a previously 2095735Snate@binkert.org * allocated Request object. 2105735Snate@binkert.org */ 2115735Snate@binkert.org void 2125735Snate@binkert.org setVirt(int _asid, Addr _vaddr, int _size, Flags _flags, Addr _pc) 2132663Sstever@eecs.umich.edu { 2145731SSteve.Reinhardt@amd.com assert(_size >= 0); 2152663Sstever@eecs.umich.edu asid = _asid; 2162663Sstever@eecs.umich.edu vaddr = _vaddr; 2172663Sstever@eecs.umich.edu size = _size; 2182663Sstever@eecs.umich.edu pc = _pc; 2192663Sstever@eecs.umich.edu time = curTick; 2205735Snate@binkert.org 2215735Snate@binkert.org flags.set(VALID_VADDR|VALID_SIZE|VALID_PC); 2225735Snate@binkert.org flags.clear(VALID_PADDR|VALID_EXTRA_DATA|MMAPED_IPR); 2235735Snate@binkert.org flags.update(_flags, PUBLIC_FLAGS); 2242663Sstever@eecs.umich.edu } 2252532SN/A 2265735Snate@binkert.org /** 2275735Snate@binkert.org * Set just the physical address. This should only be used to 2282663Sstever@eecs.umich.edu * record the result of a translation, and thus the vaddr must be 2292663Sstever@eecs.umich.edu * valid before this method is called. Otherwise, use setPhys() 2302663Sstever@eecs.umich.edu * to guarantee that the size and flags are also set. 2312663Sstever@eecs.umich.edu */ 2325735Snate@binkert.org void 2335735Snate@binkert.org setPaddr(Addr _paddr) 2342663Sstever@eecs.umich.edu { 2355764Snate@binkert.org assert(flags.isSet(VALID_VADDR)); 2362663Sstever@eecs.umich.edu paddr = _paddr; 2375735Snate@binkert.org flags.set(VALID_PADDR); 2382663Sstever@eecs.umich.edu } 2392532SN/A 2405735Snate@binkert.org /** 2415744Sgblack@eecs.umich.edu * Generate two requests as if this request had been split into two 2425744Sgblack@eecs.umich.edu * pieces. The original request can't have been translated already. 2435744Sgblack@eecs.umich.edu */ 2445744Sgblack@eecs.umich.edu void splitOnVaddr(Addr split_addr, RequestPtr &req1, RequestPtr &req2) 2455744Sgblack@eecs.umich.edu { 2465764Snate@binkert.org assert(flags.isSet(VALID_VADDR)); 2475764Snate@binkert.org assert(flags.noneSet(VALID_PADDR)); 2485744Sgblack@eecs.umich.edu assert(split_addr > vaddr && split_addr < vaddr + size); 2495744Sgblack@eecs.umich.edu req1 = new Request; 2505744Sgblack@eecs.umich.edu *req1 = *this; 2515744Sgblack@eecs.umich.edu req2 = new Request; 2525744Sgblack@eecs.umich.edu *req2 = *this; 2535744Sgblack@eecs.umich.edu req1->size = split_addr - vaddr; 2545744Sgblack@eecs.umich.edu req2->vaddr = split_addr; 2555744Sgblack@eecs.umich.edu req2->size = size - req1->size; 2565744Sgblack@eecs.umich.edu } 2575744Sgblack@eecs.umich.edu 2585744Sgblack@eecs.umich.edu /** 2595735Snate@binkert.org * Accessor for paddr. 2605735Snate@binkert.org */ 2615735Snate@binkert.org Addr 2625735Snate@binkert.org getPaddr() 2635735Snate@binkert.org { 2645764Snate@binkert.org assert(flags.isSet(VALID_PADDR)); 2655735Snate@binkert.org return paddr; 2665735Snate@binkert.org } 2672663Sstever@eecs.umich.edu 2685735Snate@binkert.org /** 2695735Snate@binkert.org * Accessor for size. 2705735Snate@binkert.org */ 2715735Snate@binkert.org int 2725735Snate@binkert.org getSize() 2735735Snate@binkert.org { 2745764Snate@binkert.org assert(flags.isSet(VALID_SIZE)); 2755735Snate@binkert.org return size; 2765735Snate@binkert.org } 2775735Snate@binkert.org 2782663Sstever@eecs.umich.edu /** Accessor for time. */ 2795735Snate@binkert.org Tick 2805735Snate@binkert.org getTime() 2815735Snate@binkert.org { 2825764Snate@binkert.org assert(flags.isSet(VALID_PADDR|VALID_VADDR)); 2835735Snate@binkert.org return time; 2845735Snate@binkert.org } 2855735Snate@binkert.org 2865607Snate@binkert.org void 2875607Snate@binkert.org setTime(Tick when) 2885607Snate@binkert.org { 2895764Snate@binkert.org assert(flags.isSet(VALID_PADDR|VALID_VADDR)); 2905607Snate@binkert.org time = when; 2915607Snate@binkert.org } 2922663Sstever@eecs.umich.edu 2932663Sstever@eecs.umich.edu /** Accessor for flags. */ 2945735Snate@binkert.org Flags 2955735Snate@binkert.org getFlags() 2965735Snate@binkert.org { 2975764Snate@binkert.org assert(flags.isSet(VALID_PADDR|VALID_VADDR)); 2985735Snate@binkert.org return flags & PUBLIC_FLAGS; 2995735Snate@binkert.org } 3005735Snate@binkert.org 3015735Snate@binkert.org Flags 3025735Snate@binkert.org anyFlags(Flags _flags) 3035735Snate@binkert.org { 3045764Snate@binkert.org assert(flags.isSet(VALID_PADDR|VALID_VADDR)); 3055764Snate@binkert.org assert(_flags.noneSet(~PUBLIC_FLAGS)); 3065764Snate@binkert.org return flags.isSet(_flags); 3075735Snate@binkert.org } 3085735Snate@binkert.org 3095735Snate@binkert.org Flags 3105735Snate@binkert.org allFlags(Flags _flags) 3115735Snate@binkert.org { 3125764Snate@binkert.org assert(flags.isSet(VALID_PADDR|VALID_VADDR)); 3135764Snate@binkert.org assert(_flags.noneSet(~PUBLIC_FLAGS)); 3145764Snate@binkert.org return flags.allSet(_flags); 3155735Snate@binkert.org } 3165735Snate@binkert.org 3175735Snate@binkert.org /** Accessor for flags. */ 3185735Snate@binkert.org void 3195735Snate@binkert.org setFlags(Flags _flags) 3205735Snate@binkert.org { 3215764Snate@binkert.org assert(flags.isSet(VALID_PADDR|VALID_VADDR)); 3225764Snate@binkert.org assert(_flags.noneSet(~PUBLIC_FLAGS)); 3235735Snate@binkert.org flags.set(_flags); 3245735Snate@binkert.org } 3255735Snate@binkert.org 3265735Snate@binkert.org void 3275735Snate@binkert.org clearFlags(Flags _flags) 3285735Snate@binkert.org { 3295764Snate@binkert.org assert(flags.isSet(VALID_PADDR|VALID_VADDR)); 3305764Snate@binkert.org assert(_flags.noneSet(~PUBLIC_FLAGS)); 3315735Snate@binkert.org flags.clear(_flags); 3325735Snate@binkert.org } 3335735Snate@binkert.org 3345735Snate@binkert.org void 3355735Snate@binkert.org clearFlags() 3365735Snate@binkert.org { 3375764Snate@binkert.org assert(flags.isSet(VALID_PADDR|VALID_VADDR)); 3385735Snate@binkert.org flags.clear(PUBLIC_FLAGS); 3395735Snate@binkert.org } 3402663Sstever@eecs.umich.edu 3412663Sstever@eecs.umich.edu /** Accessor function for vaddr.*/ 3425735Snate@binkert.org Addr 3435735Snate@binkert.org getVaddr() 3445735Snate@binkert.org { 3455764Snate@binkert.org assert(flags.isSet(VALID_VADDR)); 3465735Snate@binkert.org return vaddr; 3475735Snate@binkert.org } 3482663Sstever@eecs.umich.edu 3492663Sstever@eecs.umich.edu /** Accessor function for asid.*/ 3505735Snate@binkert.org int 3515735Snate@binkert.org getAsid() 3525735Snate@binkert.org { 3535764Snate@binkert.org assert(flags.isSet(VALID_VADDR)); 3545735Snate@binkert.org return asid; 3555735Snate@binkert.org } 3562663Sstever@eecs.umich.edu 3573804Ssaidi@eecs.umich.edu /** Accessor function for asi.*/ 3585735Snate@binkert.org uint8_t 3595735Snate@binkert.org getAsi() 3605735Snate@binkert.org { 3615764Snate@binkert.org assert(flags.isSet(VALID_VADDR)); 3625735Snate@binkert.org return flags & ASI_BITS; 3635735Snate@binkert.org } 3643804Ssaidi@eecs.umich.edu 3653804Ssaidi@eecs.umich.edu /** Accessor function for asi.*/ 3665735Snate@binkert.org void 3675735Snate@binkert.org setAsi(uint8_t a) 3685735Snate@binkert.org { 3695764Snate@binkert.org assert(flags.isSet(VALID_VADDR)); 3705735Snate@binkert.org flags.update(a, ASI_BITS); 3715735Snate@binkert.org } 3723806Ssaidi@eecs.umich.edu 3733804Ssaidi@eecs.umich.edu /** Accessor function for asi.*/ 3745735Snate@binkert.org bool 3755735Snate@binkert.org isMmapedIpr() 3765735Snate@binkert.org { 3775764Snate@binkert.org assert(flags.isSet(VALID_PADDR)); 3785764Snate@binkert.org return flags.isSet(MMAPED_IPR); 3795735Snate@binkert.org } 3803806Ssaidi@eecs.umich.edu 3813806Ssaidi@eecs.umich.edu /** Accessor function for asi.*/ 3825735Snate@binkert.org void 3835735Snate@binkert.org setMmapedIpr(bool r) 3845735Snate@binkert.org { 3855735Snate@binkert.org assert(VALID_VADDR); 3865735Snate@binkert.org flags.set(MMAPED_IPR); 3875735Snate@binkert.org } 3883804Ssaidi@eecs.umich.edu 3892679Sktlim@umich.edu /** Accessor function to check if sc result is valid. */ 3905735Snate@binkert.org bool 3915735Snate@binkert.org extraDataValid() 3925735Snate@binkert.org { 3935764Snate@binkert.org return flags.isSet(VALID_EXTRA_DATA); 3945735Snate@binkert.org } 3955735Snate@binkert.org 3962663Sstever@eecs.umich.edu /** Accessor function for store conditional return value.*/ 3975735Snate@binkert.org uint64_t 3985735Snate@binkert.org getExtraData() const 3995735Snate@binkert.org { 4005764Snate@binkert.org assert(flags.isSet(VALID_EXTRA_DATA)); 4015735Snate@binkert.org return extraData; 4025735Snate@binkert.org } 4035735Snate@binkert.org 4042663Sstever@eecs.umich.edu /** Accessor function for store conditional return value.*/ 4055735Snate@binkert.org void 4065735Snate@binkert.org setExtraData(uint64_t _extraData) 4075735Snate@binkert.org { 4085735Snate@binkert.org extraData = _extraData; 4095735Snate@binkert.org flags.set(VALID_EXTRA_DATA); 4105735Snate@binkert.org } 4112663Sstever@eecs.umich.edu 4125714Shsul@eecs.umich.edu /** Accessor function for context ID.*/ 4135735Snate@binkert.org int 4145735Snate@binkert.org contextId() const 4155735Snate@binkert.org { 4165764Snate@binkert.org assert(flags.isSet(VALID_CONTEXT_ID)); 4175735Snate@binkert.org return _contextId; 4185735Snate@binkert.org } 4195735Snate@binkert.org 4205714Shsul@eecs.umich.edu /** Accessor function for thread ID. */ 4215735Snate@binkert.org int 4225735Snate@binkert.org threadId() const 4235735Snate@binkert.org { 4245764Snate@binkert.org assert(flags.isSet(VALID_THREAD_ID)); 4255735Snate@binkert.org return _threadId; 4265735Snate@binkert.org } 4272663Sstever@eecs.umich.edu 4282663Sstever@eecs.umich.edu /** Accessor function for pc.*/ 4295875Ssteve.reinhardt@amd.com bool 4305875Ssteve.reinhardt@amd.com hasPC() const 4315875Ssteve.reinhardt@amd.com { 4325875Ssteve.reinhardt@amd.com return flags.isSet(VALID_PC); 4335875Ssteve.reinhardt@amd.com } 4345875Ssteve.reinhardt@amd.com 4355735Snate@binkert.org Addr 4365735Snate@binkert.org getPC() const 4375735Snate@binkert.org { 4385764Snate@binkert.org assert(flags.isSet(VALID_PC)); 4395735Snate@binkert.org return pc; 4405735Snate@binkert.org } 4412532SN/A 4422811Srdreslin@umich.edu /** Accessor Function to Check Cacheability. */ 4435764Snate@binkert.org bool isUncacheable() const { return flags.isSet(UNCACHEABLE); } 4445764Snate@binkert.org bool isInstRead() const { return flags.isSet(INST_READ); } 4455764Snate@binkert.org bool isLocked() const { return flags.isSet(LOCKED); } 4465764Snate@binkert.org bool isSwap() const { return flags.isSet(MEM_SWAP|MEM_SWAP_COND); } 4475764Snate@binkert.org bool isCondSwap() const { return flags.isSet(MEM_SWAP_COND); } 4482811Srdreslin@umich.edu 4495735Snate@binkert.org bool 4505735Snate@binkert.org isMisaligned() const 4515735Snate@binkert.org { 4525764Snate@binkert.org if (flags.isSet(NO_ALIGN_FAULT)) 4535735Snate@binkert.org return false; 4543170Sstever@eecs.umich.edu 4555735Snate@binkert.org if ((vaddr & 0x1)) 4565735Snate@binkert.org return true; 4572814Srdreslin@umich.edu 4585764Snate@binkert.org if (flags.isSet(NO_HALF_WORD_ALIGN_FAULT)) 4595735Snate@binkert.org return false; 4604040Ssaidi@eecs.umich.edu 4615735Snate@binkert.org if ((vaddr & 0x2)) 4625735Snate@binkert.org return true; 4634040Ssaidi@eecs.umich.edu 4645735Snate@binkert.org return false; 4655735Snate@binkert.org } 4662384SN/A}; 4672381SN/A 4682381SN/A#endif // __MEM_REQUEST_HH__ 469