annotate modules/bluespec/Pygar/lab4/ProcessorSystemRRR.cpp @ 36:99519a031813 pygar svn.37

[svn r37] moved the server into audioCorePipeline
author punk
date Tue, 04 May 2010 18:54:54 -0400
parents 74716e9a81cc
children
rev   line source
rlm@8 1 #include <cstdio>
rlm@8 2 #include <cstdlib>
rlm@8 3 #include <iostream>
rlm@8 4 #include <iomanip>
rlm@8 5 #include <stdio.h>
rlm@8 6 #include <sys/stat.h>
rlm@8 7
rlm@8 8 #include "asim/rrr/service_ids.h"
rlm@8 9
rlm@8 10 #include "asim/provides/connected_application.h"
rlm@8 11
rlm@8 12
rlm@8 13
rlm@8 14 using namespace std;
rlm@8 15
rlm@8 16 // ===== service instantiation =====
rlm@8 17 PROCESSORSYSTEMRRR_SERVER_CLASS PROCESSORSYSTEMRRR_SERVER_CLASS::instance;
rlm@8 18
rlm@8 19 // constructor
rlm@8 20 PROCESSORSYSTEMRRR_SERVER_CLASS::PROCESSORSYSTEMRRR_SERVER_CLASS() :
rlm@8 21 serverStub(new PROCESSORSYSTEMRRR_SERVER_STUB_CLASS(this))
rlm@8 22 {
rlm@8 23 // instantiate stub
rlm@8 24 memory = NULL;
rlm@8 25 fflush(stdout);
rlm@8 26 }
rlm@8 27
rlm@8 28 // destructor
rlm@8 29 PROCESSORSYSTEMRRR_SERVER_CLASS::~PROCESSORSYSTEMRRR_SERVER_CLASS()
rlm@8 30 {
rlm@8 31 Cleanup();
rlm@8 32 }
rlm@8 33
rlm@8 34 // init
rlm@8 35 void
rlm@8 36 PROCESSORSYSTEMRRR_SERVER_CLASS::Init(PLATFORMS_MODULE p)
rlm@8 37 {
rlm@8 38 parent = p;
rlm@8 39 }
rlm@8 40
rlm@8 41 // uninit
rlm@8 42 void
rlm@8 43 PROCESSORSYSTEMRRR_SERVER_CLASS::Uninit()
rlm@8 44 {
rlm@8 45 Cleanup();
rlm@8 46 }
rlm@8 47
rlm@8 48 // cleanup
rlm@8 49 void
rlm@8 50 PROCESSORSYSTEMRRR_SERVER_CLASS::Cleanup()
rlm@8 51 {
rlm@8 52 delete serverStub;
rlm@8 53 }
rlm@8 54
rlm@8 55
rlm@8 56 //
rlm@8 57 // RRR service methods
rlm@8 58 //
rlm@8 59
rlm@8 60 UINT32
rlm@8 61 PROCESSORSYSTEMRRR_SERVER_CLASS::MemoryRequestLoad (UINT32 address)
rlm@8 62 {
rlm@8 63 UINT32 returnVal;
rlm@8 64
rlm@8 65 if(memory == NULL) {
rlm@8 66 memory = new FUNCP_SIMULATED_MEMORY_CLASS();
rlm@8 67 }
rlm@8 68
rlm@8 69
rlm@8 70
rlm@8 71 memory->Read(0,(UINT64) address, sizeof(UINT32), &returnVal);
rlm@8 72 return returnVal;
rlm@8 73 }
rlm@8 74
rlm@8 75 void
rlm@8 76 PROCESSORSYSTEMRRR_SERVER_CLASS::MemoryRequestStore (UINT32 address, UINT32 data)
rlm@8 77 {
rlm@8 78 if(memory == NULL) {
rlm@8 79 memory = new FUNCP_SIMULATED_MEMORY_CLASS();
rlm@8 80 }
rlm@8 81
rlm@8 82 memory->Write(0,(UINT64) address, sizeof(UINT32), &data);
rlm@8 83 }