comparison modules/bluespec/Pygar/lab4/ProcessorSystemRRR.cpp @ 8:74716e9a81cc pygar svn.9

[svn r9] Pygar now has the proper directory structure to play nicely with awb. Also, the apm file for audio-core willcompile successfully.
author rlm
date Fri, 23 Apr 2010 02:32:05 -0400
parents
children
comparison
equal deleted inserted replaced
7:7393cd19371e 8:74716e9a81cc
1 #include <cstdio>
2 #include <cstdlib>
3 #include <iostream>
4 #include <iomanip>
5 #include <stdio.h>
6 #include <sys/stat.h>
7
8 #include "asim/rrr/service_ids.h"
9
10 #include "asim/provides/connected_application.h"
11
12
13
14 using namespace std;
15
16 // ===== service instantiation =====
17 PROCESSORSYSTEMRRR_SERVER_CLASS PROCESSORSYSTEMRRR_SERVER_CLASS::instance;
18
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 }
27
28 // destructor
29 PROCESSORSYSTEMRRR_SERVER_CLASS::~PROCESSORSYSTEMRRR_SERVER_CLASS()
30 {
31 Cleanup();
32 }
33
34 // init
35 void
36 PROCESSORSYSTEMRRR_SERVER_CLASS::Init(PLATFORMS_MODULE p)
37 {
38 parent = p;
39 }
40
41 // uninit
42 void
43 PROCESSORSYSTEMRRR_SERVER_CLASS::Uninit()
44 {
45 Cleanup();
46 }
47
48 // cleanup
49 void
50 PROCESSORSYSTEMRRR_SERVER_CLASS::Cleanup()
51 {
52 delete serverStub;
53 }
54
55
56 //
57 // RRR service methods
58 //
59
60 UINT32
61 PROCESSORSYSTEMRRR_SERVER_CLASS::MemoryRequestLoad (UINT32 address)
62 {
63 UINT32 returnVal;
64
65 if(memory == NULL) {
66 memory = new FUNCP_SIMULATED_MEMORY_CLASS();
67 }
68
69
70
71 memory->Read(0,(UINT64) address, sizeof(UINT32), &returnVal);
72 return returnVal;
73 }
74
75 void
76 PROCESSORSYSTEMRRR_SERVER_CLASS::MemoryRequestStore (UINT32 address, UINT32 data)
77 {
78 if(memory == NULL) {
79 memory = new FUNCP_SIMULATED_MEMORY_CLASS();
80 }
81
82 memory->Write(0,(UINT64) address, sizeof(UINT32), &data);
83 }