view modules/bluespec/Pygar/lab4/ProcessorSystemRRR.cpp @ 19:9910c032f38d pygar svn.20

[svn r20] fixed some random reference errot
author rlm
date Tue, 27 Apr 2010 23:31:38 -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 // constructor
20 PROCESSORSYSTEMRRR_SERVER_CLASS::PROCESSORSYSTEMRRR_SERVER_CLASS() :
21 serverStub(new PROCESSORSYSTEMRRR_SERVER_STUB_CLASS(this))
22 {
23 // instantiate stub
24 memory = NULL;
25 fflush(stdout);
26 }
28 // destructor
29 PROCESSORSYSTEMRRR_SERVER_CLASS::~PROCESSORSYSTEMRRR_SERVER_CLASS()
30 {
31 Cleanup();
32 }
34 // init
35 void
36 PROCESSORSYSTEMRRR_SERVER_CLASS::Init(PLATFORMS_MODULE p)
37 {
38 parent = p;
39 }
41 // uninit
42 void
43 PROCESSORSYSTEMRRR_SERVER_CLASS::Uninit()
44 {
45 Cleanup();
46 }
48 // cleanup
49 void
50 PROCESSORSYSTEMRRR_SERVER_CLASS::Cleanup()
51 {
52 delete serverStub;
53 }
56 //
57 // RRR service methods
58 //
60 UINT32
61 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 void
76 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 }