T32: Memory access.

Still not tested on real T32.

git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@2105 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
hoffmann
2013-02-16 22:05:02 +00:00
parent d86d18bced
commit 2e16b8873b
6 changed files with 23 additions and 10 deletions

View File

@ -4,6 +4,8 @@
namespace fail {
static const uint64_t lower = 0x00000000ffffffff;
regdata_t T32ArmCPU::getRegisterContent(Register* reg) const
{
// T32_ReadRegister wants a mask of bits representig the registers to read:
@ -11,11 +13,11 @@ regdata_t T32ArmCPU::getRegisterContent(Register* reg) const
// mask1
// 0000 0000 0000 0000 0001 0010 -> R1/R4
// mask2
// 1000 0000 0000 0000 0001 0010 -> R63
// 1000 0000 0000 0000 0000 0000 -> R63
uint64_t mask = (1 << reg->getIndex());
if(mask){
if( T32_ReadRegister(static_cast<dword>(mask & 0xffffffff), static_cast<dword>(mask >> 32), m_regbuffer) == 0 ){
if( T32_ReadRegister(static_cast<dword>(mask & lower ), static_cast<dword>(mask >> 32), m_regbuffer) == 0 ){
// No error, return value.
return m_regbuffer[reg->getIndex()];
} else {
@ -30,7 +32,7 @@ void T32ArmCPU::setRegisterContent(Register* reg, regdata_t value)
uint64_t mask = (1 << reg->getIndex());
if(mask){
if( T32_WriteRegister(static_cast<dword>(mask & 0xffffffff), static_cast<dword>(mask >> 32), m_regbuffer) == 0 ){
if( T32_WriteRegister(static_cast<dword>(mask & lower), static_cast<dword>(mask >> 32), m_regbuffer) == 0 ){
// No error, return value.
return;
} else {

View File

@ -18,9 +18,9 @@ namespace fail {
class T32ArmCPU : public ArmArchitecture, public ArmCPUState {
public:
/**
* Creates a new gem5 CPU for ARM based targets.
* Creates a new T32 CPU for ARM based targets.
* @param id the unique ID of the CPU to be created (the first CPU0 has ID 0)
* @param system the gem5 system object
* @param system the T32 system object
*/
T32ArmCPU(unsigned int id = 0) : m_Id(id) { }
virtual ~T32ArmCPU() { }

View File

@ -13,9 +13,9 @@ namespace fail {
class T32Controller : public SimulatorController {
public:
void startup();
T32Controller() : SimulatorController(new T32MemoryManager()) { };
~T32Controller();
/* ********************************************************************
* Simulator Controller & Access API:
* ********************************************************************/

View File

@ -9,16 +9,15 @@
#include "../SALInst.hpp"
aspect T32Listener
{
advice "fail::BPSingleListener" : slice class
{
public:
bool onAddition()
{
// Setup Breakpoint in T32
std::cout << "T32Listener::onAddition" << std::endl;
// Enable Breakpoint
return true;
}

View File

@ -2,7 +2,7 @@
#define __T32_MEMORY_HPP__
#include "../Memory.hpp"
#include <iostream>
#include <t32.h>
namespace fail {

View File

@ -32,6 +32,18 @@ bool VEZSExperiment::run()
m_log << "Register R1: 0x" << hex << simulator.getCPU(0).getRegisterContent(reg) << endl;
simulator.getCPU(0).setRegisterContent(reg, 0x23);
address_t targetaddress = 0x12345678;
MemoryManager& mm = simulator.getMemoryManager();
mm.setByte(targetaddress, 0x42);
mm.getByte(targetaddress);
uint8_t tb[] = {0xaa, 0xbb, 0xcc, 0xdd};
mm.setBytes(targetaddress, 4, tb);
*((uint32_t*)(tb)) = 0; // clear array.
// read back bytes
mm.getBytes(targetaddress, 4, tb);
// Explicitly terminate, or the simulator will continue to run.
simulator.terminate();
}