Deleted Added
sdiff udiff text old ( 2632:1bb2f91485ea ) new ( 2641:6d9d837e2032 )
full compact
1/*
2 * Copyright (c) 2002-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/**
30 * @file Decleration of a request, the overall memory request consisting of
31 the parts of the request that are persistent throughout the transaction.
32 */
33
34#ifndef __MEM_REQUEST_HH__
35#define __MEM_REQUEST_HH__
36
37#include "arch/isa_traits.hh"
38
39class Request;
40
41typedef Request* RequestPtr;
42
43/** The request is a Load locked/store conditional. */
44const unsigned LOCKED = 0x001;
45/** The virtual address is also the physical address. */
46const unsigned PHYSICAL = 0x002;
47/** The request is an ALPHA VPTE pal access (hw_ld). */
48const unsigned VPTE = 0x004;
49/** Use the alternate mode bits in ALPHA. */
50const unsigned ALTMODE = 0x008;
51/** The request is to an uncacheable address. */
52const unsigned UNCACHEABLE = 0x010;
53/** The request should not cause a page fault. */
54const unsigned NO_FAULT = 0x020;
55/** The request should be prefetched into the exclusive state. */
56const unsigned PF_EXCLUSIVE = 0x100;
57/** The request should be marked as LRU. */
58const unsigned EVICT_NEXT = 0x200;
59/** The request should ignore unaligned access faults */
60const unsigned NO_ALIGN_FAULT = 0x400;
61
62class Request
63{
64 //@todo Make Accesor functions, make these private.
65 public:
66 /** Constructor, needs a bool to signify if it is/isn't Cpu Request. */
67 Request(bool isCpu);
68
69 /** reset the request to it's initial state so it can be reused.*/
70 void resetAll(bool isCpu);
71
72 /** reset the request's addrs times, etc, so but not everything to same
73 * time. */
74 void resetMin();
75
76//First non-cpu request fields
77 private:
78 /** The physical address of the request. */
79 Addr paddr;
80 /** Wether or not paddr is valid (has been written yet). */
81 bool validPaddr;
82
83 /** The size of the request. */
84 int size;
85 /** Wether or not size is valid (has been written yet). */
86 bool validSize;
87
88 /** The time this request was started. Used to calculate latencies. */
89 Tick time;
90 /** Wether or not time is valid (has been written yet). */
91 bool validTime;
92
93 /** Destination address if this is a block copy. */
94 Addr copyDest;
95 /** Wether or not copyDest is valid (has been written yet). */
96 bool validCopyDest;
97
98 /** Flag structure for the request. */
99 uint32_t flags;
100
101//Accsesors for non-cpu request fields
102 public:
103 /** Accesor for paddr. */
104 Addr getPaddr();
105 /** Accesor for paddr. */
106 void setPaddr(Addr _paddr);
107
108 /** Accesor for size. */
109 int getSize();
110 /** Accesor for size. */
111 void setSize(int _size);
112
113 /** Accesor for time. */
114 Tick getTime();
115 /** Accesor for time. */
116 void setTime(Tick _time);
117
118 /** Accesor for copy dest. */
119 Addr getCopyDest();
120 /** Accesor for copy dest. */
121 void setCopyDest(Addr _copyDest);
122
123 /** Accesor for flags. */
124 uint32_t getFlags();
125 /** Accesor for paddr. */
126 void setFlags(uint32_t _flags);
127
128//Now cpu-request fields
129 private:
130 /** Bool to signify if this is a cpuRequest. */
131 bool cpuReq;
132
133 /** The virtual address of the request. */
134 Addr vaddr;
135 /** Wether or not the vaddr is valid. */
136 bool validVaddr;
137
138 /** The address space ID. */
139 int asid;
140 /** Wether or not the asid is valid. */
141 bool validAsid;
142
143 /** The return value of store conditional. */
144 uint64_t scResult;
145 /** Wether or not the sc result is valid. */
146 bool validScResult;
147
148 /** The cpu number for statistics. */
149 int cpuNum;
150 /** Wether or not the cpu number is valid. */
151 bool validCpuNum;
152
153 /** The requesting thread id. */
154 int threadNum;
155 /** Wether or not the thread id is valid. */
156 bool validThreadNum;
157
158 /** program counter of initiating access; for tracing/debugging */
159 Addr pc;
160 /** Wether or not the pc is valid. */
161 bool validPC;
162
163//Accessor Functions for cpu request fields
164 public:
165 /** Accesor function to determine if this is a cpu request or not.*/
166 bool isCpuRequest();
167
168 /** Accesor function for vaddr.*/
169 Addr getVaddr();
170 /** Accesor function for vaddr.*/
171 void setVaddr(Addr _vaddr);
172
173 /** Accesor function for asid.*/
174 int getAsid();
175 /** Accesor function for asid.*/
176 void setAsid(int _asid);
177
178 /** Accesor function for store conditional return value.*/
179 uint64_t getScResult();
180 /** Accesor function for store conditional return value.*/
181 void setScResult(uint64_t _scResult);
182
183 /** Accesor function for cpu number.*/
184 int getCpuNum();
185 /** Accesor function for cpu number.*/
186 void setCpuNum(int _cpuNum);
187
188 /** Accesor function for thread number.*/
189 int getThreadNum();
190 /** Accesor function for thread number.*/
191 void setThreadNum(int _threadNum);
192
193 /** Accesor function for pc.*/
194 Addr getPC();
195 /** Accesor function for pc.*/
196 void setPC(Addr _pc);
197
198};
199
200#endif // __MEM_REQUEST_HH__