// }
PacketPtr pkt = new Packet(req, cmd);
- uint8_t* writeData = new uint8_t;
+ uint8_t *writeData = new uint8_t;
*writeData = m_value + m_store_count;
pkt->dataDynamic(writeData);
req->setThreadContext(index, 0);
PacketPtr pkt = new Packet(req, MemCmd::ReadReq);
- uint8_t* dataArray = new uint8_t[CHECK_SIZE];
+ uint8_t *dataArray = new uint8_t[CHECK_SIZE];
pkt->dataDynamicArray(dataArray);
// push the subblock onto the sender state. The sequencer will
DPRINTF(RubyTest, "Check callback\n");
// Perform load/check
for (int byte_number=0; byte_number<CHECK_SIZE; byte_number++) {
- if (uint8(m_value + byte_number) != data->getByte(byte_number)) {
+ if (uint8_t(m_value + byte_number) != data->getByte(byte_number)) {
panic("Action/check failure: proc: %d address: %s data: %s "
"byte_number: %d m_value+byte_number: %d byte: %d %s"
"Time: %d\n",
void debugPrint();
TesterStatus m_status;
- uint8 m_value;
+ uint8_t m_value;
int m_store_count;
NodeID m_initiatingNode;
Address m_address;
DataBlock::DataBlock(const DataBlock &cp)
{
- m_data = new uint8[RubySystem::getBlockSizeBytes()];
+ m_data = new uint8_t[RubySystem::getBlockSizeBytes()];
memcpy(m_data, cp.m_data, RubySystem::getBlockSizeBytes());
m_alloc = true;
}
void
DataBlock::alloc()
{
- m_data = new uint8[RubySystem::getBlockSizeBytes()];
+ m_data = new uint8_t[RubySystem::getBlockSizeBytes()];
m_alloc = true;
clear();
}
out << dec << "]" << flush;
}
-const uint8*
+const uint8_t*
DataBlock::getData(int offset, int len) const
{
assert(offset + len <= RubySystem::getBlockSizeBytes());
}
void
-DataBlock::setData(uint8* data, int offset, int len)
+DataBlock::setData(uint8_t *data, int offset, int len)
{
assert(offset + len <= RubySystem::getBlockSizeBytes());
memcpy(&m_data[offset], data, len);
#ifndef __MEM_RUBY_COMMON_DATABLOCK_HH__
#define __MEM_RUBY_COMMON_DATABLOCK_HH__
+#include <inttypes.h>
+
#include <cassert>
#include <iomanip>
#include <iostream>
-#include "mem/ruby/common/TypeDefines.hh"
-
class DataBlock
{
public:
DataBlock& operator=(const DataBlock& obj);
- void assign(uint8* data);
+ void assign(uint8_t *data);
void clear();
- uint8 getByte(int whichByte) const;
- const uint8* getData(int offset, int len) const;
- void setByte(int whichByte, uint8 data);
- void setData(uint8* data, int offset, int len);
+ uint8_t getByte(int whichByte) const;
+ const uint8_t *getData(int offset, int len) const;
+ void setByte(int whichByte, uint8_t data);
+ void setData(uint8_t *data, int offset, int len);
void copyPartial(const DataBlock & dblk, int offset, int len);
bool equal(const DataBlock& obj) const;
void print(std::ostream& out) const;
private:
void alloc();
- uint8* m_data;
+ uint8_t *m_data;
bool m_alloc;
};
inline void
-DataBlock::assign(uint8* data)
+DataBlock::assign(uint8_t *data)
{
assert(data != NULL);
if (m_alloc) {
m_alloc = false;
}
-inline uint8
+inline uint8_t
DataBlock::getByte(int whichByte) const
{
return m_data[whichByte];
}
inline void
-DataBlock::setByte(int whichByte, uint8 data)
+DataBlock::setByte(int whichByte, uint8_t data)
{
m_data[whichByte] = data;
}
int getSize() const { return m_data.size(); }
void resize(int size) { m_data.resize(size); }
- uint8 getByte(int offset) const { return m_data[offset]; }
- void setByte(int offset, uint8 data) { m_data[offset] = data; }
+ uint8_t getByte(int offset) const { return m_data[offset]; }
+ void setByte(int offset, uint8_t data) { m_data[offset] = data; }
// Shorthands
- uint8 readByte() const { return getByte(0); }
- void writeByte(uint8 data) { setByte(0, data); }
+ uint8_t readByte() const { return getByte(0); }
+ void writeByte(uint8_t data) { setByte(0, data); }
// Merging to and from DataBlocks - We only need to worry about
// updates when we are using DataBlocks
#ifndef TYPEDEFINES_H
#define TYPEDEFINES_H
-
-typedef unsigned char uint8;
typedef unsigned int uint32;
typedef unsigned long long uint64;
bool write;
int bytes_completed;
int bytes_issued;
- uint8* data;
+ uint8_t *data;
PacketPtr pkt;
};
void resize(uint64 size); // destructive
- void write(const Address & paddr, uint8* data, int len);
- uint8* read(const Address & paddr, uint8* data, int len);
- uint32 collatePages(uint8* &raw_data);
- void populatePages(uint8* raw_data);
+ void write(const Address & paddr, uint8_t *data, int len);
+ uint8_t *read(const Address & paddr, uint8_t *data, int len);
+ uint32 collatePages(uint8_t *&raw_data);
+ void populatePages(uint8_t *raw_data);
private:
- uint8* getBlockPtr(const PhysAddress & addr);
+ uint8_t *getBlockPtr(const PhysAddress & addr);
uint64 m_size;
- uint8** m_pages;
+ uint8_t **m_pages;
uint32 m_num_pages;
const uint32 m_page_offset_mask;
static const uint32 PAGE_SIZE = 4096;
m_size = size;
assert(size%PAGE_SIZE == 0);
m_num_pages = size >> 12;
- m_pages = new uint8*[m_num_pages];
- memset(m_pages, 0, m_num_pages * sizeof(uint8*));
+ m_pages = new uint8_t*[m_num_pages];
+ memset(m_pages, 0, m_num_pages * sizeof(uint8_t*));
}
inline void
-MemoryVector::write(const Address & paddr, uint8* data, int len)
+MemoryVector::write(const Address & paddr, uint8_t *data, int len)
{
assert(paddr.getAddress() + len <= m_size);
uint32 page_num = paddr.getAddress() >> 12;
}
if (all_zeros)
return;
- m_pages[page_num] = new uint8[PAGE_SIZE];
+ m_pages[page_num] = new uint8_t[PAGE_SIZE];
memset(m_pages[page_num], 0, PAGE_SIZE);
uint32 offset = paddr.getAddress() & m_page_offset_mask;
memcpy(&m_pages[page_num][offset], data, len);
}
}
-inline uint8*
-MemoryVector::read(const Address & paddr, uint8* data, int len)
+inline uint8_t*
+MemoryVector::read(const Address & paddr, uint8_t *data, int len)
{
assert(paddr.getAddress() + len <= m_size);
uint32 page_num = paddr.getAddress() >> 12;
return data;
}
-inline uint8*
+inline uint8_t*
MemoryVector::getBlockPtr(const PhysAddress & paddr)
{
uint32 page_num = paddr.getAddress() >> 12;
if (m_pages[page_num] == 0) {
- m_pages[page_num] = new uint8[PAGE_SIZE];
+ m_pages[page_num] = new uint8_t[PAGE_SIZE];
memset(m_pages[page_num], 0, PAGE_SIZE);
}
return &m_pages[page_num][paddr.getAddress()&m_page_offset_mask];
*/
inline uint32
-MemoryVector::collatePages(uint8* &raw_data)
+MemoryVector::collatePages(uint8_t *&raw_data)
{
uint32 num_zero_pages = 0;
uint32 data_size = 0;
if (m_pages[i] == 0) num_zero_pages++;
}
- raw_data = new uint8[ sizeof(uint32) /* number of pages*/
- + m_num_pages /* whether the page is all zeros */
- + PAGE_SIZE * (m_num_pages - num_zero_pages)];
+ raw_data = new uint8_t[sizeof(uint32) /* number of pages*/ +
+ m_num_pages /* whether the page is all zeros */ +
+ PAGE_SIZE * (m_num_pages - num_zero_pages)];
/* Write the number of pages to be stored. */
memcpy(raw_data, &m_num_pages, sizeof(uint32));
* in the checkpoint.
*/
inline void
-MemoryVector::populatePages(uint8* raw_data)
+MemoryVector::populatePages(uint8_t *raw_data)
{
uint32 data_size = 0;
uint32 num_pages = 0;
{
assert(m_pages[i] == 0);
if (raw_data[data_size] != 0) {
- m_pages[i] = new uint8[PAGE_SIZE];
+ m_pages[i] = new uint8_t[PAGE_SIZE];
memcpy(m_pages[i], raw_data + data_size + 1, PAGE_SIZE);
data_size += PAGE_SIZE;
}
}
assert(num_rw <= 1);
- uint8* data = pkt->getPtr<uint8_t>(true);
+ uint8_t *data = pkt->getPtr<uint8_t>(true);
unsigned int size_in_bytes = pkt->getSize();
unsigned startByte = address.getAddress() - line_address.getAddress();
num_busy, num_ro, num_rw);
assert(num_rw <= 1);
- uint8* data = pkt->getPtr<uint8_t>(true);
+ uint8_t *data = pkt->getPtr<uint8_t>(true);
unsigned int size_in_bytes = pkt->getSize();
unsigned startByte = addr.getAddress() - line_addr.getAddress();
}
void
-RubySystem::writeCompressedTrace(uint8* raw_data, string filename,
+RubySystem::writeCompressedTrace(uint8_t *raw_data, string filename,
uint64 uncompressed_trace_size)
{
// Create the checkpoint file for the memory
// Restore curTick
curTick(curtick_original);
- uint8* raw_data = NULL;
+ uint8_t *raw_data = NULL;
if (m_mem_vec_ptr != NULL) {
uint64 memory_trace_size = m_mem_vec_ptr->collatePages(raw_data);
}
void
-RubySystem::readCompressedTrace(string filename, uint8*& raw_data,
+RubySystem::readCompressedTrace(string filename, uint8_t *&raw_data,
uint64& uncompressed_trace_size)
{
// Read the trace file
// value of curTick()
//
clearStats();
- uint8* uncompressed_trace = NULL;
+ uint8_t *uncompressed_trace = NULL;
if (m_mem_vec_ptr != NULL) {
string memory_trace_file;
static void printSystemConfig(std::ostream& out);
void readCompressedTrace(std::string filename,
- uint8*& raw_data,
+ uint8_t *&raw_data,
uint64& uncompressed_trace_size);
- void writeCompressedTrace(uint8* raw_data, std::string file,
+ void writeCompressedTrace(uint8_t *raw_data, std::string file,
uint64 uncompressed_trace_size);
private: