packet.cc (12347:c4bb52d1aba4) packet.cc (12652:bae1a1865204)
1/*
1/*
2 * Copyright (c) 2011-2017 ARM Limited
2 * Copyright (c) 2011-2018 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated

--- 40 unchanged lines hidden (view full) ---

51#include "mem/packet.hh"
52
53#include <cstring>
54#include <iostream>
55
56#include "base/cprintf.hh"
57#include "base/logging.hh"
58#include "base/trace.hh"
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated

--- 40 unchanged lines hidden (view full) ---

51#include "mem/packet.hh"
52
53#include <cstring>
54#include <iostream>
55
56#include "base/cprintf.hh"
57#include "base/logging.hh"
58#include "base/trace.hh"
59#include "mem/packet_access.hh"
59
60using namespace std;
61
62// The one downside to bitsets is that static initializers can get ugly.
63#define SET1(a1) (1 << (a1))
64#define SET2(a1, a2) (SET1(a1) | SET1(a2))
65#define SET3(a1, a2, a3) (SET2(a1, a2) | SET1(a3))
66#define SET4(a1, a2, a3, a4) (SET3(a1, a2, a3) | SET1(a4))

--- 292 unchanged lines hidden (view full) ---

359{
360 assert(senderState != NULL);
361 SenderState *sender_state = senderState;
362 senderState = sender_state->predecessor;
363 sender_state->predecessor = NULL;
364 return sender_state;
365}
366
60
61using namespace std;
62
63// The one downside to bitsets is that static initializers can get ugly.
64#define SET1(a1) (1 << (a1))
65#define SET2(a1, a2) (SET1(a1) | SET1(a2))
66#define SET3(a1, a2, a3) (SET2(a1, a2) | SET1(a3))
67#define SET4(a1, a2, a3, a4) (SET3(a1, a2, a3) | SET1(a4))

--- 292 unchanged lines hidden (view full) ---

360{
361 assert(senderState != NULL);
362 SenderState *sender_state = senderState;
363 senderState = sender_state->predecessor;
364 sender_state->predecessor = NULL;
365 return sender_state;
366}
367
368uint64_t
369Packet::getUintX(ByteOrder endian) const
370{
371 switch(getSize()) {
372 case 1:
373 return (uint64_t)get<uint8_t>(endian);
374 case 2:
375 return (uint64_t)get<uint16_t>(endian);
376 case 4:
377 return (uint64_t)get<uint32_t>(endian);
378 case 8:
379 return (uint64_t)get<uint64_t>(endian);
380 default:
381 panic("%i isn't a supported word size.\n", getSize());
382 }
383}
384
367void
385void
386Packet::setUintX(uint64_t w, ByteOrder endian)
387{
388 switch(getSize()) {
389 case 1:
390 set<uint8_t>((uint8_t)w, endian);
391 break;
392 case 2:
393 set<uint16_t>((uint16_t)w, endian);
394 break;
395 case 4:
396 set<uint32_t>((uint32_t)w, endian);
397 break;
398 case 8:
399 set<uint64_t>((uint64_t)w, endian);
400 break;
401 default:
402 panic("%i isn't a supported word size.\n", getSize());
403 }
404
405}
406
407void
368Packet::print(ostream &o, const int verbosity, const string &prefix) const
369{
370 ccprintf(o, "%s%s [%x:%x]%s%s%s%s%s%s", prefix, cmdString(),
371 getAddr(), getAddr() + getSize() - 1,
372 req->isSecure() ? " (s)" : "",
373 req->isInstFetch() ? " IF" : "",
374 req->isUncacheable() ? " UC" : "",
375 isExpressSnoop() ? " ES" : "",

--- 70 unchanged lines hidden ---
408Packet::print(ostream &o, const int verbosity, const string &prefix) const
409{
410 ccprintf(o, "%s%s [%x:%x]%s%s%s%s%s%s", prefix, cmdString(),
411 getAddr(), getAddr() + getSize() - 1,
412 req->isSecure() ? " (s)" : "",
413 req->isInstFetch() ? " IF" : "",
414 req->isUncacheable() ? " UC" : "",
415 isExpressSnoop() ? " ES" : "",

--- 70 unchanged lines hidden ---