diff 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
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/modules/bluespec/Pygar/lab4/ProcessorSystemRRR.cpp	Fri Apr 23 02:32:05 2010 -0400
     1.3 @@ -0,0 +1,83 @@
     1.4 +#include <cstdio>
     1.5 +#include <cstdlib>
     1.6 +#include <iostream>
     1.7 +#include <iomanip>
     1.8 +#include <stdio.h>
     1.9 +#include <sys/stat.h>
    1.10 +
    1.11 +#include "asim/rrr/service_ids.h"
    1.12 +
    1.13 +#include "asim/provides/connected_application.h"
    1.14 +
    1.15 +
    1.16 +
    1.17 +using namespace std;
    1.18 +
    1.19 +// ===== service instantiation =====
    1.20 +PROCESSORSYSTEMRRR_SERVER_CLASS PROCESSORSYSTEMRRR_SERVER_CLASS::instance;
    1.21 +
    1.22 +// constructor
    1.23 +PROCESSORSYSTEMRRR_SERVER_CLASS::PROCESSORSYSTEMRRR_SERVER_CLASS() :
    1.24 +  serverStub(new PROCESSORSYSTEMRRR_SERVER_STUB_CLASS(this))
    1.25 +{
    1.26 +    // instantiate stub
    1.27 +    memory = NULL;
    1.28 +    fflush(stdout);
    1.29 +}
    1.30 +
    1.31 +// destructor
    1.32 +PROCESSORSYSTEMRRR_SERVER_CLASS::~PROCESSORSYSTEMRRR_SERVER_CLASS()
    1.33 +{
    1.34 +    Cleanup();
    1.35 +}
    1.36 +
    1.37 +// init
    1.38 +void
    1.39 +PROCESSORSYSTEMRRR_SERVER_CLASS::Init(PLATFORMS_MODULE p)
    1.40 +{
    1.41 +    parent = p;
    1.42 +}
    1.43 +
    1.44 +// uninit
    1.45 +void
    1.46 +PROCESSORSYSTEMRRR_SERVER_CLASS::Uninit()
    1.47 +{
    1.48 +    Cleanup();
    1.49 +}
    1.50 +
    1.51 +// cleanup
    1.52 +void
    1.53 +PROCESSORSYSTEMRRR_SERVER_CLASS::Cleanup()
    1.54 +{
    1.55 +    delete serverStub;
    1.56 +}
    1.57 +
    1.58 +
    1.59 +//
    1.60 +// RRR service methods
    1.61 +//
    1.62 +
    1.63 +UINT32
    1.64 +PROCESSORSYSTEMRRR_SERVER_CLASS::MemoryRequestLoad (UINT32 address)
    1.65 +{
    1.66 +  UINT32 returnVal;
    1.67 +  
    1.68 +  if(memory == NULL) {
    1.69 +    memory = new FUNCP_SIMULATED_MEMORY_CLASS();
    1.70 +  }
    1.71 +
    1.72 +
    1.73 + 
    1.74 +  memory->Read(0,(UINT64) address, sizeof(UINT32), &returnVal); 
    1.75 +  return returnVal;
    1.76 +}
    1.77 +
    1.78 +void
    1.79 +PROCESSORSYSTEMRRR_SERVER_CLASS::MemoryRequestStore (UINT32 address, UINT32 data)
    1.80 +{
    1.81 +  if(memory == NULL) {
    1.82 +    memory = new FUNCP_SIMULATED_MEMORY_CLASS();
    1.83 +  }
    1.84 +
    1.85 +  memory->Write(0,(UINT64) address, sizeof(UINT32), &data); 
    1.86 +}