2#include "SpartaMemory.hpp"
6 void SpartaMemory::receiveMemoryRequest_(
const MemoryRequest & request)
8 uint8_t *data = request.data;
10 uint32_t length = request.size;
11 sparta::Clock::Cycle delay = 0;
14 case MemoryRequest::Command::READ:
15 for (
unsigned int i = 0; i < length; i++)
17 data[i] = m_memory[address++];
19 delay = read_response_delay_;
21 case MemoryRequest::Command::WRITE:
22 for (
unsigned int i = 0; i < length; i++)
24 m_memory[address++] = data[i];
26 delay = write_response_delay_;
28 case MemoryRequest::Command::UNKNOWN:
35 ev_drive_response_.preparePayload(request)->schedule(delay);
38 void SpartaMemory::driveMemoryResponse_(
const MemoryRequest & req)
43 out_memory_response_.send(req);
#define sparta_assert(...)
Simple variadic assertion that will throw a sparta_exception if the condition fails.
#define SPARTA_EXPECT_FALSE(x)
A macro for hinting to the compiler a particular condition should be considered most likely false.
log::MessageSource info_logger_
Default info logger.
uint64_t addr_t
Type for generic address representation in generic interfaces, errors and printouts within SPARTA.