request.hh revision 7612
12381SN/A/* 22381SN/A * Copyright (c) 2002-2005 The Regents of The University of Michigan 32381SN/A * All rights reserved. 42381SN/A * 52381SN/A * Redistribution and use in source and binary forms, with or without 62381SN/A * modification, are permitted provided that the following conditions are 72381SN/A * met: redistributions of source code must retain the above copyright 82381SN/A * notice, this list of conditions and the following disclaimer; 92381SN/A * redistributions in binary form must reproduce the above copyright 102381SN/A * notice, this list of conditions and the following disclaimer in the 112381SN/A * documentation and/or other materials provided with the distribution; 122381SN/A * neither the name of the copyright holders nor the names of its 132381SN/A * contributors may be used to endorse or promote products derived from 142381SN/A * this software without specific prior written permission. 152381SN/A * 162381SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 172381SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 182381SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 192381SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 202381SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 212381SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 222381SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 232381SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 242381SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 252381SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 262381SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272665Ssaidi@eecs.umich.edu * 282665Ssaidi@eecs.umich.edu * Authors: Ron Dreslinski 292665Ssaidi@eecs.umich.edu * Steve Reinhardt 302665Ssaidi@eecs.umich.edu * Ali Saidi 312381SN/A */ 322381SN/A 332381SN/A/** 342982Sstever@eecs.umich.edu * @file 352982Sstever@eecs.umich.edu * Declaration of a request, the overall memory request consisting of 362381SN/A the parts of the request that are persistent throughout the transaction. 372381SN/A */ 382381SN/A 392381SN/A#ifndef __MEM_REQUEST_HH__ 402381SN/A#define __MEM_REQUEST_HH__ 412381SN/A 425735Snate@binkert.org#include <cassert> 435735Snate@binkert.org 444610Ssaidi@eecs.umich.edu#include "base/fast_alloc.hh" 455735Snate@binkert.org#include "base/flags.hh" 465744Sgblack@eecs.umich.edu#include "base/misc.hh" 476214Snate@binkert.org#include "base/types.hh" 484167Sbinkertn@umich.edu#include "sim/core.hh" 492394SN/A 502394SN/Aclass Request; 512394SN/A 522394SN/Atypedef Request* RequestPtr; 532394SN/A 544610Ssaidi@eecs.umich.educlass Request : public FastAlloc 552381SN/A{ 565735Snate@binkert.org public: 575735Snate@binkert.org typedef uint32_t FlagsType; 585735Snate@binkert.org typedef ::Flags<FlagsType> Flags; 595735Snate@binkert.org 605735Snate@binkert.org /** ASI information for this request if it exists. */ 615735Snate@binkert.org static const FlagsType ASI_BITS = 0x000000FF; 626133Ssteve.reinhardt@amd.com /** The request was an instruction fetch. */ 636133Ssteve.reinhardt@amd.com static const FlagsType INST_FETCH = 0x00000100; 645735Snate@binkert.org /** The virtual address is also the physical address. */ 655735Snate@binkert.org static const FlagsType PHYSICAL = 0x00000200; 665735Snate@binkert.org /** The request is an ALPHA VPTE pal access (hw_ld). */ 675735Snate@binkert.org static const FlagsType VPTE = 0x00000400; 685735Snate@binkert.org /** Use the alternate mode bits in ALPHA. */ 695735Snate@binkert.org static const FlagsType ALTMODE = 0x00000800; 705735Snate@binkert.org /** The request is to an uncacheable address. */ 715735Snate@binkert.org static const FlagsType UNCACHEABLE = 0x00001000; 726133Ssteve.reinhardt@amd.com /** This request is to a memory mapped register. */ 736133Ssteve.reinhardt@amd.com static const FlagsType MMAPED_IPR = 0x00002000; 747612SGene.Wu@arm.com /** This request is a clear exclusive. */ 757612SGene.Wu@arm.com static const FlagsType CLREX = 0x00004000; 766133Ssteve.reinhardt@amd.com 776133Ssteve.reinhardt@amd.com /** The request should ignore unaligned access faults */ 786133Ssteve.reinhardt@amd.com static const FlagsType NO_ALIGN_FAULT = 0x00020000; 796133Ssteve.reinhardt@amd.com /** The request should ignore unaligned access faults */ 806133Ssteve.reinhardt@amd.com static const FlagsType NO_HALF_WORD_ALIGN_FAULT = 0x00040000; 815890Sgblack@eecs.umich.edu /** The request should not cause a memory access. */ 826133Ssteve.reinhardt@amd.com static const FlagsType NO_ACCESS = 0x00080000; 836103Sgblack@eecs.umich.edu /** This request will lock or unlock the accessed memory. When used with 846103Sgblack@eecs.umich.edu * a load, the access locks the particular chunk of memory. When used 856103Sgblack@eecs.umich.edu * with a store, it unlocks. The rule is that locked accesses have to be 866103Sgblack@eecs.umich.edu * made up of a locked load, some operation on the data, and then a locked 876103Sgblack@eecs.umich.edu * store. 886103Sgblack@eecs.umich.edu */ 896133Ssteve.reinhardt@amd.com static const FlagsType LOCKED = 0x00100000; 906133Ssteve.reinhardt@amd.com /** The request is a Load locked/store conditional. */ 916133Ssteve.reinhardt@amd.com static const FlagsType LLSC = 0x00200000; 925735Snate@binkert.org /** This request is for a memory swap. */ 936133Ssteve.reinhardt@amd.com static const FlagsType MEM_SWAP = 0x00400000; 946133Ssteve.reinhardt@amd.com static const FlagsType MEM_SWAP_COND = 0x00800000; 956133Ssteve.reinhardt@amd.com 966106Ssteve.reinhardt@amd.com /** The request is a prefetch. */ 976106Ssteve.reinhardt@amd.com static const FlagsType PREFETCH = 0x01000000; 986133Ssteve.reinhardt@amd.com /** The request should be prefetched into the exclusive state. */ 996133Ssteve.reinhardt@amd.com static const FlagsType PF_EXCLUSIVE = 0x02000000; 1006133Ssteve.reinhardt@amd.com /** The request should be marked as LRU. */ 1016133Ssteve.reinhardt@amd.com static const FlagsType EVICT_NEXT = 0x04000000; 1025735Snate@binkert.org 1036104Ssteve.reinhardt@amd.com /** These flags are *not* cleared when a Request object is reused 1046104Ssteve.reinhardt@amd.com (assigned a new address). */ 1056105Ssteve.reinhardt@amd.com static const FlagsType STICKY_FLAGS = INST_FETCH; 1066104Ssteve.reinhardt@amd.com 1075735Snate@binkert.org private: 1086104Ssteve.reinhardt@amd.com typedef uint8_t PrivateFlagsType; 1096104Ssteve.reinhardt@amd.com typedef ::Flags<PrivateFlagsType> PrivateFlags; 1105735Snate@binkert.org 1115735Snate@binkert.org /** Whether or not the size is valid. */ 1126104Ssteve.reinhardt@amd.com static const PrivateFlagsType VALID_SIZE = 0x00000001; 1135735Snate@binkert.org /** Whether or not paddr is valid (has been written yet). */ 1146104Ssteve.reinhardt@amd.com static const PrivateFlagsType VALID_PADDR = 0x00000002; 1155735Snate@binkert.org /** Whether or not the vaddr & asid are valid. */ 1166104Ssteve.reinhardt@amd.com static const PrivateFlagsType VALID_VADDR = 0x00000004; 1175735Snate@binkert.org /** Whether or not the pc is valid. */ 1186104Ssteve.reinhardt@amd.com static const PrivateFlagsType VALID_PC = 0x00000010; 1195735Snate@binkert.org /** Whether or not the context ID is valid. */ 1206104Ssteve.reinhardt@amd.com static const PrivateFlagsType VALID_CONTEXT_ID = 0x00000020; 1216104Ssteve.reinhardt@amd.com static const PrivateFlagsType VALID_THREAD_ID = 0x00000040; 1225735Snate@binkert.org /** Whether or not the sc result is valid. */ 1236104Ssteve.reinhardt@amd.com static const PrivateFlagsType VALID_EXTRA_DATA = 0x00000080; 1246104Ssteve.reinhardt@amd.com 1256104Ssteve.reinhardt@amd.com /** These flags are *not* cleared when a Request object is reused 1266104Ssteve.reinhardt@amd.com (assigned a new address). */ 1276104Ssteve.reinhardt@amd.com static const PrivateFlagsType STICKY_PRIVATE_FLAGS = 1286104Ssteve.reinhardt@amd.com VALID_CONTEXT_ID | VALID_THREAD_ID; 1295735Snate@binkert.org 1302663Sstever@eecs.umich.edu private: 1312663Sstever@eecs.umich.edu /** 1322663Sstever@eecs.umich.edu * The physical address of the request. Valid only if validPaddr 1335735Snate@binkert.org * is set. 1345735Snate@binkert.org */ 1356427Ssteve.reinhardt@amd.com Addr _paddr; 1362532SN/A 1372663Sstever@eecs.umich.edu /** 1382663Sstever@eecs.umich.edu * The size of the request. This field must be set when vaddr or 1392663Sstever@eecs.umich.edu * paddr is written via setVirt() or setPhys(), so it is always 1405735Snate@binkert.org * valid as long as one of the address fields is valid. 1415735Snate@binkert.org */ 1426427Ssteve.reinhardt@amd.com int _size; 1432395SN/A 1442532SN/A /** Flag structure for the request. */ 1456427Ssteve.reinhardt@amd.com Flags _flags; 1462384SN/A 1476104Ssteve.reinhardt@amd.com /** Private flags for field validity checking. */ 1486104Ssteve.reinhardt@amd.com PrivateFlags privateFlags; 1496104Ssteve.reinhardt@amd.com 1502663Sstever@eecs.umich.edu /** 1512663Sstever@eecs.umich.edu * The time this request was started. Used to calculate 1522663Sstever@eecs.umich.edu * latencies. This field is set to curTick any time paddr or vaddr 1535735Snate@binkert.org * is written. 1545735Snate@binkert.org */ 1556223Snate@binkert.org Tick _time; 1562384SN/A 1572384SN/A /** The address space ID. */ 1586427Ssteve.reinhardt@amd.com int _asid; 1593806Ssaidi@eecs.umich.edu 1602663Sstever@eecs.umich.edu /** The virtual address of the request. */ 1616427Ssteve.reinhardt@amd.com Addr _vaddr; 1622384SN/A 1635735Snate@binkert.org /** 1645735Snate@binkert.org * Extra data for the request, such as the return value of 1654040Ssaidi@eecs.umich.edu * store conditional or the compare value for a CAS. */ 1666427Ssteve.reinhardt@amd.com uint64_t _extraData; 1672384SN/A 1685714Shsul@eecs.umich.edu /** The context ID (for statistics, typically). */ 1695714Shsul@eecs.umich.edu int _contextId; 1705714Shsul@eecs.umich.edu /** The thread ID (id within this CPU) */ 1715714Shsul@eecs.umich.edu int _threadId; 1722384SN/A 1732381SN/A /** program counter of initiating access; for tracing/debugging */ 1746427Ssteve.reinhardt@amd.com Addr _pc; 1752663Sstever@eecs.umich.edu 1762532SN/A public: 1776427Ssteve.reinhardt@amd.com /** Minimal constructor. No fields are initialized. 1786427Ssteve.reinhardt@amd.com * (Note that _flags and privateFlags are cleared by Flags 1796427Ssteve.reinhardt@amd.com * default constructor.) 1806427Ssteve.reinhardt@amd.com */ 1812663Sstever@eecs.umich.edu Request() 1822663Sstever@eecs.umich.edu {} 1832532SN/A 1842663Sstever@eecs.umich.edu /** 1852663Sstever@eecs.umich.edu * Constructor for physical (e.g. device) requests. Initializes 1862663Sstever@eecs.umich.edu * just physical address, size, flags, and timestamp (to curTick). 1875735Snate@binkert.org * These fields are adequate to perform a request. 1885735Snate@binkert.org */ 1895735Snate@binkert.org Request(Addr paddr, int size, Flags flags) 1905735Snate@binkert.org { 1915735Snate@binkert.org setPhys(paddr, size, flags); 1925735Snate@binkert.org } 1932532SN/A 1946223Snate@binkert.org Request(Addr paddr, int size, Flags flags, Tick time) 1956223Snate@binkert.org { 1966223Snate@binkert.org setPhys(paddr, size, flags, time); 1976223Snate@binkert.org } 1986223Snate@binkert.org 1996899SBrad.Beckmann@amd.com Request(Addr paddr, int size, Flags flags, Tick time, Addr pc) 2006899SBrad.Beckmann@amd.com { 2016899SBrad.Beckmann@amd.com setPhys(paddr, size, flags, time); 2026899SBrad.Beckmann@amd.com privateFlags.set(VALID_PC); 2036899SBrad.Beckmann@amd.com _pc = pc; 2046899SBrad.Beckmann@amd.com } 2056899SBrad.Beckmann@amd.com 2065735Snate@binkert.org Request(int asid, Addr vaddr, int size, Flags flags, Addr pc, 2076221Snate@binkert.org int cid, ThreadID tid) 2082669Sktlim@umich.edu { 2096104Ssteve.reinhardt@amd.com setVirt(asid, vaddr, size, flags, pc); 2105735Snate@binkert.org setThreadContext(cid, tid); 2112669Sktlim@umich.edu } 2122669Sktlim@umich.edu 2134610Ssaidi@eecs.umich.edu ~Request() {} // for FastAlloc 2144610Ssaidi@eecs.umich.edu 2152663Sstever@eecs.umich.edu /** 2165735Snate@binkert.org * Set up CPU and thread numbers. 2175735Snate@binkert.org */ 2185735Snate@binkert.org void 2196221Snate@binkert.org setThreadContext(int context_id, ThreadID tid) 2202663Sstever@eecs.umich.edu { 2215735Snate@binkert.org _contextId = context_id; 2226221Snate@binkert.org _threadId = tid; 2236104Ssteve.reinhardt@amd.com privateFlags.set(VALID_CONTEXT_ID|VALID_THREAD_ID); 2242663Sstever@eecs.umich.edu } 2252532SN/A 2262663Sstever@eecs.umich.edu /** 2272663Sstever@eecs.umich.edu * Set up a physical (e.g. device) request in a previously 2285735Snate@binkert.org * allocated Request object. 2295735Snate@binkert.org */ 2305735Snate@binkert.org void 2316427Ssteve.reinhardt@amd.com setPhys(Addr paddr, int size, Flags flags, Tick time) 2322663Sstever@eecs.umich.edu { 2336427Ssteve.reinhardt@amd.com assert(size >= 0); 2346427Ssteve.reinhardt@amd.com _paddr = paddr; 2356427Ssteve.reinhardt@amd.com _size = size; 2366223Snate@binkert.org _time = time; 2375735Snate@binkert.org 2386427Ssteve.reinhardt@amd.com _flags.clear(~STICKY_FLAGS); 2396427Ssteve.reinhardt@amd.com _flags.set(flags); 2406104Ssteve.reinhardt@amd.com privateFlags.clear(~STICKY_PRIVATE_FLAGS); 2416104Ssteve.reinhardt@amd.com privateFlags.set(VALID_PADDR|VALID_SIZE); 2422663Sstever@eecs.umich.edu } 2432532SN/A 2446223Snate@binkert.org void 2456427Ssteve.reinhardt@amd.com setPhys(Addr paddr, int size, Flags flags) 2466223Snate@binkert.org { 2476427Ssteve.reinhardt@amd.com setPhys(paddr, size, flags, curTick); 2486223Snate@binkert.org } 2496223Snate@binkert.org 2502663Sstever@eecs.umich.edu /** 2512663Sstever@eecs.umich.edu * Set up a virtual (e.g., CPU) request in a previously 2525735Snate@binkert.org * allocated Request object. 2535735Snate@binkert.org */ 2545735Snate@binkert.org void 2556427Ssteve.reinhardt@amd.com setVirt(int asid, Addr vaddr, int size, Flags flags, Addr pc) 2562663Sstever@eecs.umich.edu { 2576427Ssteve.reinhardt@amd.com assert(size >= 0); 2586427Ssteve.reinhardt@amd.com _asid = asid; 2596427Ssteve.reinhardt@amd.com _vaddr = vaddr; 2606427Ssteve.reinhardt@amd.com _size = size; 2616427Ssteve.reinhardt@amd.com _pc = pc; 2626223Snate@binkert.org _time = curTick; 2635735Snate@binkert.org 2646427Ssteve.reinhardt@amd.com _flags.clear(~STICKY_FLAGS); 2656427Ssteve.reinhardt@amd.com _flags.set(flags); 2666104Ssteve.reinhardt@amd.com privateFlags.clear(~STICKY_PRIVATE_FLAGS); 2676104Ssteve.reinhardt@amd.com privateFlags.set(VALID_VADDR|VALID_SIZE|VALID_PC); 2682663Sstever@eecs.umich.edu } 2692532SN/A 2705735Snate@binkert.org /** 2715735Snate@binkert.org * Set just the physical address. This should only be used to 2722663Sstever@eecs.umich.edu * record the result of a translation, and thus the vaddr must be 2732663Sstever@eecs.umich.edu * valid before this method is called. Otherwise, use setPhys() 2742663Sstever@eecs.umich.edu * to guarantee that the size and flags are also set. 2752663Sstever@eecs.umich.edu */ 2765735Snate@binkert.org void 2776427Ssteve.reinhardt@amd.com setPaddr(Addr paddr) 2782663Sstever@eecs.umich.edu { 2796104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_VADDR)); 2806427Ssteve.reinhardt@amd.com _paddr = paddr; 2816104Ssteve.reinhardt@amd.com privateFlags.set(VALID_PADDR); 2822663Sstever@eecs.umich.edu } 2832532SN/A 2845735Snate@binkert.org /** 2855744Sgblack@eecs.umich.edu * Generate two requests as if this request had been split into two 2865744Sgblack@eecs.umich.edu * pieces. The original request can't have been translated already. 2875744Sgblack@eecs.umich.edu */ 2885744Sgblack@eecs.umich.edu void splitOnVaddr(Addr split_addr, RequestPtr &req1, RequestPtr &req2) 2895744Sgblack@eecs.umich.edu { 2906104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_VADDR)); 2916104Ssteve.reinhardt@amd.com assert(privateFlags.noneSet(VALID_PADDR)); 2926427Ssteve.reinhardt@amd.com assert(split_addr > _vaddr && split_addr < _vaddr + _size); 2935744Sgblack@eecs.umich.edu req1 = new Request; 2945744Sgblack@eecs.umich.edu *req1 = *this; 2955744Sgblack@eecs.umich.edu req2 = new Request; 2965744Sgblack@eecs.umich.edu *req2 = *this; 2976427Ssteve.reinhardt@amd.com req1->_size = split_addr - _vaddr; 2986427Ssteve.reinhardt@amd.com req2->_vaddr = split_addr; 2996427Ssteve.reinhardt@amd.com req2->_size = _size - req1->_size; 3005744Sgblack@eecs.umich.edu } 3015744Sgblack@eecs.umich.edu 3025744Sgblack@eecs.umich.edu /** 3035735Snate@binkert.org * Accessor for paddr. 3045735Snate@binkert.org */ 3056104Ssteve.reinhardt@amd.com bool 3066104Ssteve.reinhardt@amd.com hasPaddr() 3076104Ssteve.reinhardt@amd.com { 3086104Ssteve.reinhardt@amd.com return privateFlags.isSet(VALID_PADDR); 3096104Ssteve.reinhardt@amd.com } 3106104Ssteve.reinhardt@amd.com 3115735Snate@binkert.org Addr 3125735Snate@binkert.org getPaddr() 3135735Snate@binkert.org { 3146104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_PADDR)); 3156427Ssteve.reinhardt@amd.com return _paddr; 3165735Snate@binkert.org } 3172663Sstever@eecs.umich.edu 3185735Snate@binkert.org /** 3195735Snate@binkert.org * Accessor for size. 3205735Snate@binkert.org */ 3216104Ssteve.reinhardt@amd.com bool 3226104Ssteve.reinhardt@amd.com hasSize() 3236104Ssteve.reinhardt@amd.com { 3246104Ssteve.reinhardt@amd.com return privateFlags.isSet(VALID_SIZE); 3256104Ssteve.reinhardt@amd.com } 3266104Ssteve.reinhardt@amd.com 3275735Snate@binkert.org int 3285735Snate@binkert.org getSize() 3295735Snate@binkert.org { 3306104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_SIZE)); 3316427Ssteve.reinhardt@amd.com return _size; 3325735Snate@binkert.org } 3335735Snate@binkert.org 3342663Sstever@eecs.umich.edu /** Accessor for time. */ 3355735Snate@binkert.org Tick 3366223Snate@binkert.org time() const 3375735Snate@binkert.org { 3386104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_PADDR|VALID_VADDR)); 3396223Snate@binkert.org return _time; 3406223Snate@binkert.org } 3416223Snate@binkert.org 3426223Snate@binkert.org void 3436223Snate@binkert.org time(Tick time) 3446223Snate@binkert.org { 3456223Snate@binkert.org assert(privateFlags.isSet(VALID_PADDR|VALID_VADDR)); 3466223Snate@binkert.org _time = time; 3475735Snate@binkert.org } 3485735Snate@binkert.org 3492663Sstever@eecs.umich.edu /** Accessor for flags. */ 3505735Snate@binkert.org Flags 3515735Snate@binkert.org getFlags() 3525735Snate@binkert.org { 3536104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_PADDR|VALID_VADDR)); 3546427Ssteve.reinhardt@amd.com return _flags; 3555735Snate@binkert.org } 3565735Snate@binkert.org 3576428Ssteve.reinhardt@amd.com /** Note that unlike other accessors, this function sets *specific 3586428Ssteve.reinhardt@amd.com flags* (ORs them in); it does not assign its argument to the 3596428Ssteve.reinhardt@amd.com _flags field. Thus this method should rightly be called 3606428Ssteve.reinhardt@amd.com setFlags() and not just flags(). */ 3615735Snate@binkert.org void 3626427Ssteve.reinhardt@amd.com setFlags(Flags flags) 3635735Snate@binkert.org { 3646104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_PADDR|VALID_VADDR)); 3656427Ssteve.reinhardt@amd.com _flags.set(flags); 3665735Snate@binkert.org } 3675735Snate@binkert.org 3682663Sstever@eecs.umich.edu /** Accessor function for vaddr.*/ 3695735Snate@binkert.org Addr 3705735Snate@binkert.org getVaddr() 3715735Snate@binkert.org { 3726104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_VADDR)); 3736427Ssteve.reinhardt@amd.com return _vaddr; 3745735Snate@binkert.org } 3752663Sstever@eecs.umich.edu 3762663Sstever@eecs.umich.edu /** Accessor function for asid.*/ 3775735Snate@binkert.org int 3785735Snate@binkert.org getAsid() 3795735Snate@binkert.org { 3806104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_VADDR)); 3816427Ssteve.reinhardt@amd.com return _asid; 3825735Snate@binkert.org } 3832663Sstever@eecs.umich.edu 3843804Ssaidi@eecs.umich.edu /** Accessor function for asi.*/ 3855735Snate@binkert.org uint8_t 3865735Snate@binkert.org getAsi() 3875735Snate@binkert.org { 3886104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_VADDR)); 3896427Ssteve.reinhardt@amd.com return _flags & ASI_BITS; 3905735Snate@binkert.org } 3913804Ssaidi@eecs.umich.edu 3922679Sktlim@umich.edu /** Accessor function to check if sc result is valid. */ 3935735Snate@binkert.org bool 3945735Snate@binkert.org extraDataValid() 3955735Snate@binkert.org { 3966104Ssteve.reinhardt@amd.com return privateFlags.isSet(VALID_EXTRA_DATA); 3975735Snate@binkert.org } 3985735Snate@binkert.org 3992663Sstever@eecs.umich.edu /** Accessor function for store conditional return value.*/ 4005735Snate@binkert.org uint64_t 4015735Snate@binkert.org getExtraData() const 4025735Snate@binkert.org { 4036104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_EXTRA_DATA)); 4046427Ssteve.reinhardt@amd.com return _extraData; 4055735Snate@binkert.org } 4065735Snate@binkert.org 4072663Sstever@eecs.umich.edu /** Accessor function for store conditional return value.*/ 4085735Snate@binkert.org void 4096427Ssteve.reinhardt@amd.com setExtraData(uint64_t extraData) 4105735Snate@binkert.org { 4116427Ssteve.reinhardt@amd.com _extraData = extraData; 4126104Ssteve.reinhardt@amd.com privateFlags.set(VALID_EXTRA_DATA); 4135735Snate@binkert.org } 4142663Sstever@eecs.umich.edu 4156010Ssteve.reinhardt@amd.com bool 4166010Ssteve.reinhardt@amd.com hasContextId() const 4176010Ssteve.reinhardt@amd.com { 4186104Ssteve.reinhardt@amd.com return privateFlags.isSet(VALID_CONTEXT_ID); 4196010Ssteve.reinhardt@amd.com } 4206010Ssteve.reinhardt@amd.com 4215714Shsul@eecs.umich.edu /** Accessor function for context ID.*/ 4225735Snate@binkert.org int 4235735Snate@binkert.org contextId() const 4245735Snate@binkert.org { 4256104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_CONTEXT_ID)); 4265735Snate@binkert.org return _contextId; 4275735Snate@binkert.org } 4285735Snate@binkert.org 4295714Shsul@eecs.umich.edu /** Accessor function for thread ID. */ 4305735Snate@binkert.org int 4315735Snate@binkert.org threadId() const 4325735Snate@binkert.org { 4336104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_THREAD_ID)); 4345735Snate@binkert.org return _threadId; 4355735Snate@binkert.org } 4362663Sstever@eecs.umich.edu 4375875Ssteve.reinhardt@amd.com bool 4385875Ssteve.reinhardt@amd.com hasPC() const 4395875Ssteve.reinhardt@amd.com { 4406104Ssteve.reinhardt@amd.com return privateFlags.isSet(VALID_PC); 4415875Ssteve.reinhardt@amd.com } 4425875Ssteve.reinhardt@amd.com 4436010Ssteve.reinhardt@amd.com /** Accessor function for pc.*/ 4445735Snate@binkert.org Addr 4455735Snate@binkert.org getPC() const 4465735Snate@binkert.org { 4476104Ssteve.reinhardt@amd.com assert(privateFlags.isSet(VALID_PC)); 4486427Ssteve.reinhardt@amd.com return _pc; 4495735Snate@binkert.org } 4502532SN/A 4516428Ssteve.reinhardt@amd.com /** Accessor functions for flags. Note that these are for testing 4526428Ssteve.reinhardt@amd.com only; setting flags should be done via setFlags(). */ 4536427Ssteve.reinhardt@amd.com bool isUncacheable() const { return _flags.isSet(UNCACHEABLE); } 4546427Ssteve.reinhardt@amd.com bool isInstFetch() const { return _flags.isSet(INST_FETCH); } 4556427Ssteve.reinhardt@amd.com bool isPrefetch() const { return _flags.isSet(PREFETCH); } 4566427Ssteve.reinhardt@amd.com bool isLLSC() const { return _flags.isSet(LLSC); } 4576427Ssteve.reinhardt@amd.com bool isLocked() const { return _flags.isSet(LOCKED); } 4586427Ssteve.reinhardt@amd.com bool isSwap() const { return _flags.isSet(MEM_SWAP|MEM_SWAP_COND); } 4596427Ssteve.reinhardt@amd.com bool isCondSwap() const { return _flags.isSet(MEM_SWAP_COND); } 4606428Ssteve.reinhardt@amd.com bool isMmapedIpr() const { return _flags.isSet(MMAPED_IPR); } 4617612SGene.Wu@arm.com bool isClrex() const { return _flags.isSet(CLREX); } 4622811Srdreslin@umich.edu 4635735Snate@binkert.org bool 4645735Snate@binkert.org isMisaligned() const 4655735Snate@binkert.org { 4666427Ssteve.reinhardt@amd.com if (_flags.isSet(NO_ALIGN_FAULT)) 4675735Snate@binkert.org return false; 4683170Sstever@eecs.umich.edu 4696427Ssteve.reinhardt@amd.com if ((_vaddr & 0x1)) 4705735Snate@binkert.org return true; 4712814Srdreslin@umich.edu 4726427Ssteve.reinhardt@amd.com if (_flags.isSet(NO_HALF_WORD_ALIGN_FAULT)) 4735735Snate@binkert.org return false; 4744040Ssaidi@eecs.umich.edu 4756427Ssteve.reinhardt@amd.com if ((_vaddr & 0x2)) 4765735Snate@binkert.org return true; 4774040Ssaidi@eecs.umich.edu 4785735Snate@binkert.org return false; 4795735Snate@binkert.org } 4802384SN/A}; 4812381SN/A 4822381SN/A#endif // __MEM_REQUEST_HH__ 483