46#ifndef __MEM_RUBY_SLICC_INTERFACE_RUBYSLICC_UTIL_HH__
47#define __MEM_RUBY_SLICC_INTERFACE_RUBYSLICC_UTIL_HH__
52#include "debug/RubyProtocol.hh"
53#include "debug/RubySlicc.hh"
60#include "mem/ruby/protocol/RubyRequestType.hh"
91 assert(!(
addr & 0xffffffff00000000));
98 assert(!(
addr & 0xffffffff00000000));
116 if ((
type == RubyRequestType_ST) ||
117 (
type == RubyRequestType_ATOMIC) ||
118 (
type == RubyRequestType_RMW_Read) ||
119 (
type == RubyRequestType_RMW_Write) ||
120 (
type == RubyRequestType_Store_Conditional) ||
121 (
type == RubyRequestType_Locked_RMW_Read) ||
122 (
type == RubyRequestType_Locked_RMW_Write) ||
123 (
type == RubyRequestType_FLUSH)) {
133 if ((
type == RubyRequestType_LD) ||
134 (
type == RubyRequestType_Load_Linked)) {
145 (
type == RubyRequestType_IFETCH)) {
155 if ((
type == RubyRequestType_HTM_Start) ||
156 (
type == RubyRequestType_HTM_Commit) ||
157 (
type == RubyRequestType_HTM_Cancel) ||
158 (
type == RubyRequestType_HTM_Abort)) {
168 if ((
type == RubyRequestType_TLBI) ||
169 (
type == RubyRequestType_TLBI_SYNC) ||
170 (
type == RubyRequestType_TLBI_EXT_SYNC) ||
171 (
type == RubyRequestType_TLBI_EXT_SYNC_COMP)) {
178inline RubyRequestType
181 if (pkt->
req->isHTMStart()) {
182 return RubyRequestType_HTM_Start;
183 }
else if (pkt->
req->isHTMCommit()) {
184 return RubyRequestType_HTM_Commit;
185 }
else if (pkt->
req->isHTMCancel()) {
186 return RubyRequestType_HTM_Cancel;
187 }
else if (pkt->
req->isHTMAbort()) {
188 return RubyRequestType_HTM_Abort;
191 panic(
"invalid ruby packet type\n");
195inline RubyRequestType
198 if (pkt->
req->isTlbi()) {
199 return RubyRequestType_TLBI;
200 }
else if (pkt->
req->isTlbiSync()) {
201 return RubyRequestType_TLBI_SYNC;
202 }
else if (pkt->
req->isTlbiExtSync()) {
203 return RubyRequestType_TLBI_EXT_SYNC;
204 }
else if (pkt->
req->isTlbiExtSyncComp()) {
205 return RubyRequestType_TLBI_EXT_SYNC_COMP;
207 panic(
"invalid ruby packet type\n");
239 if (pktLineAddr == lineAddr) {
241 unsigned int size_in_bytes = pkt->
getSize();
242 unsigned startByte = pkt->
getAddr() - lineAddr;
244 for (
unsigned i = 0;
i < size_in_bytes; ++
i) {
265 if (pktLineAddr == lineAddr) {
267 unsigned int size_in_bytes = pkt->
getSize();
268 unsigned startByte = pkt->
getAddr() - lineAddr;
269 bool was_read =
false;
271 for (
unsigned i = 0;
i < size_in_bytes; ++
i) {
272 if (
mask.test(
i + startByte)) {
294 if (pktLineAddr == lineAddr) {
296 unsigned int size_in_bytes = pkt->
getSize();
297 unsigned startByte = pkt->
getAddr() - lineAddr;
299 for (
unsigned i = 0;
i < size_in_bytes; ++
i) {
311 for (
const bool e: bVec) {
322 return req->requestorId();
Cycles is a wrapper class for representing cycle counts, i.e.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
T * getPtr()
get a pointer to the data ptr.
RequestPtr req
A pointer to the original request.
const T * getConstPtr() const
uint8_t getByte(int whichByte) const
void setByte(int whichByte, uint8_t data)
#define panic(...)
This implements a cprintf based panic() function.
NodeID intToID(int nodenum)
bool testAndRead(Addr addr, DataBlock &blk, Packet *pkt)
This function accepts an address, a data block and a packet.
Cycles intToCycles(int c)
int countBoolVec(BoolVec bVec)
bool testAndWrite(Addr addr, DataBlock &blk, Packet *pkt)
This function accepts an address, a data block and a packet.
bool isWriteRequest(RubyRequestType type)
bool isReadRequest(RubyRequestType type)
RubyRequestType tlbiCmdToRubyRequestType(const Packet *pkt)
Addr intToAddress(int addr)
bool isTlbiCmdRequest(RubyRequestType type)
RequestorID getRequestorID(RequestPtr req)
Addr makeLineAddress(Addr addr)
int addressToInt(Addr addr)
RubyRequestType htmCmdToRubyRequestType(const Packet *pkt)
bool testAndReadMask(Addr addr, DataBlock &blk, WriteMask &mask, Packet *pkt)
This function accepts an address, a data block, a write mask and a packet.
bool isDataReadRequest(RubyRequestType type)
int addressOffset(Addr addr, Addr base)
bool isHtmCmdRequest(RubyRequestType type)
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
std::shared_ptr< Request > RequestPtr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
uint64_t Tick
Tick count type.
Declaration of the Packet class.