request.hh revision 6077
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. */ 656076Sgblack@eecs.umich.edu static const FlagsType LLSC = 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; 786077Sgblack@eecs.umich.edu /** This request will lock or unlock the accessed memory. */ 796077Sgblack@eecs.umich.edu static const FlagsType LOCKED = 0x00008000; 805735Snate@binkert.org /** The request should be prefetched into the exclusive state. */ 815735Snate@binkert.org static const FlagsType PF_EXCLUSIVE = 0x00010000; 825735Snate@binkert.org /** The request should be marked as LRU. */ 835735Snate@binkert.org static const FlagsType EVICT_NEXT = 0x00020000; 845735Snate@binkert.org /** The request should ignore unaligned access faults */ 855735Snate@binkert.org static const FlagsType NO_ALIGN_FAULT = 0x00040000; 865735Snate@binkert.org /** The request was an instruction read. */ 875735Snate@binkert.org static const FlagsType INST_READ = 0x00080000; 885735Snate@binkert.org /** This request is for a memory swap. */ 895735Snate@binkert.org static const FlagsType MEM_SWAP = 0x00100000; 905735Snate@binkert.org static const FlagsType MEM_SWAP_COND = 0x00200000; 915735Snate@binkert.org /** The request should ignore unaligned access faults */ 925735Snate@binkert.org static const FlagsType NO_HALF_WORD_ALIGN_FAULT = 0x00400000; 935735Snate@binkert.org /** This request is to a memory mapped register. */ 945735Snate@binkert.org static const FlagsType MMAPED_IPR = 0x00800000; 955735Snate@binkert.org 965735Snate@binkert.org private: 976077Sgblack@eecs.umich.edu static const FlagsType PUBLIC_FLAGS = 0x00FFFFFF; 985735Snate@binkert.org static const FlagsType PRIVATE_FLAGS = 0xFF000000; 995735Snate@binkert.org 1005735Snate@binkert.org /** Whether or not the size is valid. */ 1015735Snate@binkert.org static const FlagsType VALID_SIZE = 0x01000000; 1025735Snate@binkert.org /** Whether or not paddr is valid (has been written yet). */ 1035735Snate@binkert.org static const FlagsType VALID_PADDR = 0x02000000; 1045735Snate@binkert.org /** Whether or not the vaddr & asid are valid. */ 1055735Snate@binkert.org static const FlagsType VALID_VADDR = 0x04000000; 1065735Snate@binkert.org /** Whether or not the pc is valid. */ 1075735Snate@binkert.org static const FlagsType VALID_PC = 0x10000000; 1085735Snate@binkert.org /** Whether or not the context ID is valid. */ 1095735Snate@binkert.org static const FlagsType VALID_CONTEXT_ID = 0x20000000; 1105735Snate@binkert.org static const FlagsType VALID_THREAD_ID = 0x40000000; 1115735Snate@binkert.org /** Whether or not the sc result is valid. */ 1125735Snate@binkert.org static const FlagsType VALID_EXTRA_DATA = 0x80000000; 1135735Snate@binkert.org 1142663Sstever@eecs.umich.edu private: 1152663Sstever@eecs.umich.edu /** 1162663Sstever@eecs.umich.edu * The physical address of the request. Valid only if validPaddr 1175735Snate@binkert.org * is set. 1185735Snate@binkert.org */ 1192663Sstever@eecs.umich.edu Addr paddr; 1202532SN/A 1212663Sstever@eecs.umich.edu /** 1222663Sstever@eecs.umich.edu * The size of the request. This field must be set when vaddr or 1232663Sstever@eecs.umich.edu * paddr is written via setVirt() or setPhys(), so it is always 1245735Snate@binkert.org * valid as long as one of the address fields is valid. 1255735Snate@binkert.org */ 1262381SN/A int size; 1272395SN/A 1282532SN/A /** Flag structure for the request. */ 1295735Snate@binkert.org Flags flags; 1302384SN/A 1312663Sstever@eecs.umich.edu /** 1322663Sstever@eecs.umich.edu * The time this request was started. Used to calculate 1332663Sstever@eecs.umich.edu * latencies. This field is set to curTick any time paddr or vaddr 1345735Snate@binkert.org * is written. 1355735Snate@binkert.org */ 1362663Sstever@eecs.umich.edu Tick time; 1372384SN/A 1382384SN/A /** The address space ID. */ 1392384SN/A int asid; 1403806Ssaidi@eecs.umich.edu 1412663Sstever@eecs.umich.edu /** The virtual address of the request. */ 1422663Sstever@eecs.umich.edu Addr vaddr; 1432384SN/A 1445735Snate@binkert.org /** 1455735Snate@binkert.org * Extra data for the request, such as the return value of 1464040Ssaidi@eecs.umich.edu * store conditional or the compare value for a CAS. */ 1474040Ssaidi@eecs.umich.edu uint64_t extraData; 1482384SN/A 1495714Shsul@eecs.umich.edu /** The context ID (for statistics, typically). */ 1505714Shsul@eecs.umich.edu int _contextId; 1515714Shsul@eecs.umich.edu /** The thread ID (id within this CPU) */ 1525714Shsul@eecs.umich.edu int _threadId; 1532384SN/A 1542381SN/A /** program counter of initiating access; for tracing/debugging */ 1552381SN/A Addr pc; 1562663Sstever@eecs.umich.edu 1572532SN/A public: 1582663Sstever@eecs.umich.edu /** Minimal constructor. No fields are initialized. */ 1592663Sstever@eecs.umich.edu Request() 1602663Sstever@eecs.umich.edu {} 1612532SN/A 1622663Sstever@eecs.umich.edu /** 1632663Sstever@eecs.umich.edu * Constructor for physical (e.g. device) requests. Initializes 1642663Sstever@eecs.umich.edu * just physical address, size, flags, and timestamp (to curTick). 1655735Snate@binkert.org * These fields are adequate to perform a request. 1665735Snate@binkert.org */ 1675735Snate@binkert.org Request(Addr paddr, int size, Flags flags) 1685735Snate@binkert.org { 1695735Snate@binkert.org setPhys(paddr, size, flags); 1705735Snate@binkert.org } 1712532SN/A 1725735Snate@binkert.org Request(int asid, Addr vaddr, int size, Flags flags, Addr pc, 1735735Snate@binkert.org int cid, int tid) 1742669Sktlim@umich.edu { 1755735Snate@binkert.org setThreadContext(cid, tid); 1765735Snate@binkert.org setVirt(asid, vaddr, size, flags, pc); 1772669Sktlim@umich.edu } 1782669Sktlim@umich.edu 1794610Ssaidi@eecs.umich.edu ~Request() {} // for FastAlloc 1804610Ssaidi@eecs.umich.edu 1812663Sstever@eecs.umich.edu /** 1825735Snate@binkert.org * Set up CPU and thread numbers. 1835735Snate@binkert.org */ 1845735Snate@binkert.org void 1855735Snate@binkert.org setThreadContext(int context_id, int thread_id) 1862663Sstever@eecs.umich.edu { 1875735Snate@binkert.org _contextId = context_id; 1885735Snate@binkert.org _threadId = thread_id; 1895735Snate@binkert.org flags.set(VALID_CONTEXT_ID|VALID_THREAD_ID); 1902663Sstever@eecs.umich.edu } 1912532SN/A 1922663Sstever@eecs.umich.edu /** 1932663Sstever@eecs.umich.edu * Set up a physical (e.g. device) request in a previously 1945735Snate@binkert.org * allocated Request object. 1955735Snate@binkert.org */ 1965735Snate@binkert.org void 1975735Snate@binkert.org setPhys(Addr _paddr, int _size, Flags _flags) 1982663Sstever@eecs.umich.edu { 1995731SSteve.Reinhardt@amd.com assert(_size >= 0); 2002663Sstever@eecs.umich.edu paddr = _paddr; 2012663Sstever@eecs.umich.edu size = _size; 2022663Sstever@eecs.umich.edu time = curTick; 2035735Snate@binkert.org 2045735Snate@binkert.org flags.set(VALID_PADDR|VALID_SIZE); 2055735Snate@binkert.org flags.clear(VALID_VADDR|VALID_PC|VALID_EXTRA_DATA|MMAPED_IPR); 2065735Snate@binkert.org flags.update(_flags, PUBLIC_FLAGS); 2072663Sstever@eecs.umich.edu } 2082532SN/A 2092663Sstever@eecs.umich.edu /** 2102663Sstever@eecs.umich.edu * Set up a virtual (e.g., CPU) request in a previously 2115735Snate@binkert.org * allocated Request object. 2125735Snate@binkert.org */ 2135735Snate@binkert.org void 2145735Snate@binkert.org setVirt(int _asid, Addr _vaddr, int _size, Flags _flags, Addr _pc) 2152663Sstever@eecs.umich.edu { 2165731SSteve.Reinhardt@amd.com assert(_size >= 0); 2172663Sstever@eecs.umich.edu asid = _asid; 2182663Sstever@eecs.umich.edu vaddr = _vaddr; 2192663Sstever@eecs.umich.edu size = _size; 2202663Sstever@eecs.umich.edu pc = _pc; 2212663Sstever@eecs.umich.edu time = curTick; 2225735Snate@binkert.org 2235735Snate@binkert.org flags.set(VALID_VADDR|VALID_SIZE|VALID_PC); 2245735Snate@binkert.org flags.clear(VALID_PADDR|VALID_EXTRA_DATA|MMAPED_IPR); 2255735Snate@binkert.org flags.update(_flags, PUBLIC_FLAGS); 2262663Sstever@eecs.umich.edu } 2272532SN/A 2285735Snate@binkert.org /** 2295735Snate@binkert.org * Set just the physical address. This should only be used to 2302663Sstever@eecs.umich.edu * record the result of a translation, and thus the vaddr must be 2312663Sstever@eecs.umich.edu * valid before this method is called. Otherwise, use setPhys() 2322663Sstever@eecs.umich.edu * to guarantee that the size and flags are also set. 2332663Sstever@eecs.umich.edu */ 2345735Snate@binkert.org void 2355735Snate@binkert.org setPaddr(Addr _paddr) 2362663Sstever@eecs.umich.edu { 2375764Snate@binkert.org assert(flags.isSet(VALID_VADDR)); 2382663Sstever@eecs.umich.edu paddr = _paddr; 2395735Snate@binkert.org flags.set(VALID_PADDR); 2402663Sstever@eecs.umich.edu } 2412532SN/A 2425735Snate@binkert.org /** 2435744Sgblack@eecs.umich.edu * Generate two requests as if this request had been split into two 2445744Sgblack@eecs.umich.edu * pieces. The original request can't have been translated already. 2455744Sgblack@eecs.umich.edu */ 2465744Sgblack@eecs.umich.edu void splitOnVaddr(Addr split_addr, RequestPtr &req1, RequestPtr &req2) 2475744Sgblack@eecs.umich.edu { 2485764Snate@binkert.org assert(flags.isSet(VALID_VADDR)); 2495764Snate@binkert.org assert(flags.noneSet(VALID_PADDR)); 2505744Sgblack@eecs.umich.edu assert(split_addr > vaddr && split_addr < vaddr + size); 2515744Sgblack@eecs.umich.edu req1 = new Request; 2525744Sgblack@eecs.umich.edu *req1 = *this; 2535744Sgblack@eecs.umich.edu req2 = new Request; 2545744Sgblack@eecs.umich.edu *req2 = *this; 2555744Sgblack@eecs.umich.edu req1->size = split_addr - vaddr; 2565744Sgblack@eecs.umich.edu req2->vaddr = split_addr; 2575744Sgblack@eecs.umich.edu req2->size = size - req1->size; 2585744Sgblack@eecs.umich.edu } 2595744Sgblack@eecs.umich.edu 2605744Sgblack@eecs.umich.edu /** 2615735Snate@binkert.org * Accessor for paddr. 2625735Snate@binkert.org */ 2635735Snate@binkert.org Addr 2645735Snate@binkert.org getPaddr() 2655735Snate@binkert.org { 2665764Snate@binkert.org assert(flags.isSet(VALID_PADDR)); 2675735Snate@binkert.org return paddr; 2685735Snate@binkert.org } 2692663Sstever@eecs.umich.edu 2705735Snate@binkert.org /** 2715735Snate@binkert.org * Accessor for size. 2725735Snate@binkert.org */ 2735735Snate@binkert.org int 2745735Snate@binkert.org getSize() 2755735Snate@binkert.org { 2765764Snate@binkert.org assert(flags.isSet(VALID_SIZE)); 2775735Snate@binkert.org return size; 2785735Snate@binkert.org } 2795735Snate@binkert.org 2802663Sstever@eecs.umich.edu /** Accessor for time. */ 2815735Snate@binkert.org Tick 2825735Snate@binkert.org getTime() 2835735Snate@binkert.org { 2845764Snate@binkert.org assert(flags.isSet(VALID_PADDR|VALID_VADDR)); 2855735Snate@binkert.org return time; 2865735Snate@binkert.org } 2875735Snate@binkert.org 2885607Snate@binkert.org void 2895607Snate@binkert.org setTime(Tick when) 2905607Snate@binkert.org { 2915764Snate@binkert.org assert(flags.isSet(VALID_PADDR|VALID_VADDR)); 2925607Snate@binkert.org time = when; 2935607Snate@binkert.org } 2942663Sstever@eecs.umich.edu 2952663Sstever@eecs.umich.edu /** Accessor for flags. */ 2965735Snate@binkert.org Flags 2975735Snate@binkert.org getFlags() 2985735Snate@binkert.org { 2995764Snate@binkert.org assert(flags.isSet(VALID_PADDR|VALID_VADDR)); 3005735Snate@binkert.org return flags & PUBLIC_FLAGS; 3015735Snate@binkert.org } 3025735Snate@binkert.org 3035735Snate@binkert.org Flags 3045735Snate@binkert.org anyFlags(Flags _flags) 3055735Snate@binkert.org { 3065764Snate@binkert.org assert(flags.isSet(VALID_PADDR|VALID_VADDR)); 3075764Snate@binkert.org assert(_flags.noneSet(~PUBLIC_FLAGS)); 3085764Snate@binkert.org return flags.isSet(_flags); 3095735Snate@binkert.org } 3105735Snate@binkert.org 3115735Snate@binkert.org Flags 3125735Snate@binkert.org allFlags(Flags _flags) 3135735Snate@binkert.org { 3145764Snate@binkert.org assert(flags.isSet(VALID_PADDR|VALID_VADDR)); 3155764Snate@binkert.org assert(_flags.noneSet(~PUBLIC_FLAGS)); 3165764Snate@binkert.org return flags.allSet(_flags); 3175735Snate@binkert.org } 3185735Snate@binkert.org 3195735Snate@binkert.org /** Accessor for flags. */ 3205735Snate@binkert.org void 3215735Snate@binkert.org setFlags(Flags _flags) 3225735Snate@binkert.org { 3235764Snate@binkert.org assert(flags.isSet(VALID_PADDR|VALID_VADDR)); 3245764Snate@binkert.org assert(_flags.noneSet(~PUBLIC_FLAGS)); 3255735Snate@binkert.org flags.set(_flags); 3265735Snate@binkert.org } 3275735Snate@binkert.org 3285735Snate@binkert.org void 3295735Snate@binkert.org clearFlags(Flags _flags) 3305735Snate@binkert.org { 3315764Snate@binkert.org assert(flags.isSet(VALID_PADDR|VALID_VADDR)); 3325764Snate@binkert.org assert(_flags.noneSet(~PUBLIC_FLAGS)); 3335735Snate@binkert.org flags.clear(_flags); 3345735Snate@binkert.org } 3355735Snate@binkert.org 3365735Snate@binkert.org void 3375735Snate@binkert.org clearFlags() 3385735Snate@binkert.org { 3395764Snate@binkert.org assert(flags.isSet(VALID_PADDR|VALID_VADDR)); 3405735Snate@binkert.org flags.clear(PUBLIC_FLAGS); 3415735Snate@binkert.org } 3422663Sstever@eecs.umich.edu 3432663Sstever@eecs.umich.edu /** Accessor function for vaddr.*/ 3445735Snate@binkert.org Addr 3455735Snate@binkert.org getVaddr() 3465735Snate@binkert.org { 3475764Snate@binkert.org assert(flags.isSet(VALID_VADDR)); 3485735Snate@binkert.org return vaddr; 3495735Snate@binkert.org } 3502663Sstever@eecs.umich.edu 3512663Sstever@eecs.umich.edu /** Accessor function for asid.*/ 3525735Snate@binkert.org int 3535735Snate@binkert.org getAsid() 3545735Snate@binkert.org { 3555764Snate@binkert.org assert(flags.isSet(VALID_VADDR)); 3565735Snate@binkert.org return asid; 3575735Snate@binkert.org } 3582663Sstever@eecs.umich.edu 3593804Ssaidi@eecs.umich.edu /** Accessor function for asi.*/ 3605735Snate@binkert.org uint8_t 3615735Snate@binkert.org getAsi() 3625735Snate@binkert.org { 3635764Snate@binkert.org assert(flags.isSet(VALID_VADDR)); 3645735Snate@binkert.org return flags & ASI_BITS; 3655735Snate@binkert.org } 3663804Ssaidi@eecs.umich.edu 3673804Ssaidi@eecs.umich.edu /** Accessor function for asi.*/ 3685735Snate@binkert.org void 3695735Snate@binkert.org setAsi(uint8_t a) 3705735Snate@binkert.org { 3715764Snate@binkert.org assert(flags.isSet(VALID_VADDR)); 3725735Snate@binkert.org flags.update(a, ASI_BITS); 3735735Snate@binkert.org } 3743806Ssaidi@eecs.umich.edu 3753804Ssaidi@eecs.umich.edu /** Accessor function for asi.*/ 3765735Snate@binkert.org bool 3775735Snate@binkert.org isMmapedIpr() 3785735Snate@binkert.org { 3795764Snate@binkert.org assert(flags.isSet(VALID_PADDR)); 3805764Snate@binkert.org return flags.isSet(MMAPED_IPR); 3815735Snate@binkert.org } 3823806Ssaidi@eecs.umich.edu 3833806Ssaidi@eecs.umich.edu /** Accessor function for asi.*/ 3845735Snate@binkert.org void 3855735Snate@binkert.org setMmapedIpr(bool r) 3865735Snate@binkert.org { 3875735Snate@binkert.org assert(VALID_VADDR); 3885735Snate@binkert.org flags.set(MMAPED_IPR); 3895735Snate@binkert.org } 3903804Ssaidi@eecs.umich.edu 3912679Sktlim@umich.edu /** Accessor function to check if sc result is valid. */ 3925735Snate@binkert.org bool 3935735Snate@binkert.org extraDataValid() 3945735Snate@binkert.org { 3955764Snate@binkert.org return flags.isSet(VALID_EXTRA_DATA); 3965735Snate@binkert.org } 3975735Snate@binkert.org 3982663Sstever@eecs.umich.edu /** Accessor function for store conditional return value.*/ 3995735Snate@binkert.org uint64_t 4005735Snate@binkert.org getExtraData() const 4015735Snate@binkert.org { 4025764Snate@binkert.org assert(flags.isSet(VALID_EXTRA_DATA)); 4035735Snate@binkert.org return extraData; 4045735Snate@binkert.org } 4055735Snate@binkert.org 4062663Sstever@eecs.umich.edu /** Accessor function for store conditional return value.*/ 4075735Snate@binkert.org void 4085735Snate@binkert.org setExtraData(uint64_t _extraData) 4095735Snate@binkert.org { 4105735Snate@binkert.org extraData = _extraData; 4115735Snate@binkert.org flags.set(VALID_EXTRA_DATA); 4125735Snate@binkert.org } 4132663Sstever@eecs.umich.edu 4146010Ssteve.reinhardt@amd.com bool 4156010Ssteve.reinhardt@amd.com hasContextId() const 4166010Ssteve.reinhardt@amd.com { 4176010Ssteve.reinhardt@amd.com return flags.isSet(VALID_CONTEXT_ID); 4186010Ssteve.reinhardt@amd.com } 4196010Ssteve.reinhardt@amd.com 4205714Shsul@eecs.umich.edu /** Accessor function for context ID.*/ 4215735Snate@binkert.org int 4225735Snate@binkert.org contextId() const 4235735Snate@binkert.org { 4245764Snate@binkert.org assert(flags.isSet(VALID_CONTEXT_ID)); 4255735Snate@binkert.org return _contextId; 4265735Snate@binkert.org } 4275735Snate@binkert.org 4285714Shsul@eecs.umich.edu /** Accessor function for thread ID. */ 4295735Snate@binkert.org int 4305735Snate@binkert.org threadId() const 4315735Snate@binkert.org { 4325764Snate@binkert.org assert(flags.isSet(VALID_THREAD_ID)); 4335735Snate@binkert.org return _threadId; 4345735Snate@binkert.org } 4352663Sstever@eecs.umich.edu 4365875Ssteve.reinhardt@amd.com bool 4375875Ssteve.reinhardt@amd.com hasPC() const 4385875Ssteve.reinhardt@amd.com { 4395875Ssteve.reinhardt@amd.com return flags.isSet(VALID_PC); 4405875Ssteve.reinhardt@amd.com } 4415875Ssteve.reinhardt@amd.com 4426010Ssteve.reinhardt@amd.com /** Accessor function for pc.*/ 4435735Snate@binkert.org Addr 4445735Snate@binkert.org getPC() const 4455735Snate@binkert.org { 4465764Snate@binkert.org assert(flags.isSet(VALID_PC)); 4475735Snate@binkert.org return pc; 4485735Snate@binkert.org } 4492532SN/A 4502811Srdreslin@umich.edu /** Accessor Function to Check Cacheability. */ 4515764Snate@binkert.org bool isUncacheable() const { return flags.isSet(UNCACHEABLE); } 4525764Snate@binkert.org bool isInstRead() const { return flags.isSet(INST_READ); } 4536076Sgblack@eecs.umich.edu bool isLlsc() const { return flags.isSet(LLSC); } 4546077Sgblack@eecs.umich.edu bool isLocked() const { return flags.isSet(LOCKED); } 4555764Snate@binkert.org bool isSwap() const { return flags.isSet(MEM_SWAP|MEM_SWAP_COND); } 4565764Snate@binkert.org bool isCondSwap() const { return flags.isSet(MEM_SWAP_COND); } 4572811Srdreslin@umich.edu 4585735Snate@binkert.org bool 4595735Snate@binkert.org isMisaligned() const 4605735Snate@binkert.org { 4615764Snate@binkert.org if (flags.isSet(NO_ALIGN_FAULT)) 4625735Snate@binkert.org return false; 4633170Sstever@eecs.umich.edu 4645735Snate@binkert.org if ((vaddr & 0x1)) 4655735Snate@binkert.org return true; 4662814Srdreslin@umich.edu 4675764Snate@binkert.org if (flags.isSet(NO_HALF_WORD_ALIGN_FAULT)) 4685735Snate@binkert.org return false; 4694040Ssaidi@eecs.umich.edu 4705735Snate@binkert.org if ((vaddr & 0x2)) 4715735Snate@binkert.org return true; 4724040Ssaidi@eecs.umich.edu 4735735Snate@binkert.org return false; 4745735Snate@binkert.org } 4752384SN/A}; 4762381SN/A 4772381SN/A#endif // __MEM_REQUEST_HH__ 478