Mercurial > pygar
view modules/bluespec/Pygar/lab4/ProcessorSystemRRR.cpp @ 25:220c14f5963c pygar svn.26
[svn r26] Not fully connected but passes audio successfully
author | punk |
---|---|
date | Wed, 28 Apr 2010 12:01:37 -0400 |
parents | 74716e9a81cc |
children |
line wrap: on
line source
1 #include <cstdio>2 #include <cstdlib>3 #include <iostream>4 #include <iomanip>5 #include <stdio.h>6 #include <sys/stat.h>8 #include "asim/rrr/service_ids.h"10 #include "asim/provides/connected_application.h"14 using namespace std;16 // ===== service instantiation =====17 PROCESSORSYSTEMRRR_SERVER_CLASS PROCESSORSYSTEMRRR_SERVER_CLASS::instance;19 // constructor20 PROCESSORSYSTEMRRR_SERVER_CLASS::PROCESSORSYSTEMRRR_SERVER_CLASS() :21 serverStub(new PROCESSORSYSTEMRRR_SERVER_STUB_CLASS(this))22 {23 // instantiate stub24 memory = NULL;25 fflush(stdout);26 }28 // destructor29 PROCESSORSYSTEMRRR_SERVER_CLASS::~PROCESSORSYSTEMRRR_SERVER_CLASS()30 {31 Cleanup();32 }34 // init35 void36 PROCESSORSYSTEMRRR_SERVER_CLASS::Init(PLATFORMS_MODULE p)37 {38 parent = p;39 }41 // uninit42 void43 PROCESSORSYSTEMRRR_SERVER_CLASS::Uninit()44 {45 Cleanup();46 }48 // cleanup49 void50 PROCESSORSYSTEMRRR_SERVER_CLASS::Cleanup()51 {52 delete serverStub;53 }56 //57 // RRR service methods58 //60 UINT3261 PROCESSORSYSTEMRRR_SERVER_CLASS::MemoryRequestLoad (UINT32 address)62 {63 UINT32 returnVal;65 if(memory == NULL) {66 memory = new FUNCP_SIMULATED_MEMORY_CLASS();67 }71 memory->Read(0,(UINT64) address, sizeof(UINT32), &returnVal);72 return returnVal;73 }75 void76 PROCESSORSYSTEMRRR_SERVER_CLASS::MemoryRequestStore (UINT32 address, UINT32 data)77 {78 if(memory == NULL) {79 memory = new FUNCP_SIMULATED_MEMORY_CLASS();80 }82 memory->Write(0,(UINT64) address, sizeof(UINT32), &data);83 }