00001 #include <stdio.h>
00002 #include <stdlib.h>
00003 #include <systemc.h>
00004 #include <list>
00005 #include "archc.H"
00006 #include "ac_parms.H"
00007 #include "ac_storage.H"
00008 #include "ac_cache_if.H"
00009
00010 #include <string>
00011 #include "fstream"
00012
00013 #ifndef _AC_MEM_H
00014 #define _AC_MEM_H
00015
00016 #define W_WORD 4
00017 #define W_HALF 2
00018 #define W_BYTE 1
00019
00020
00021
00022 class ac_mem: public ac_storage , public ac_cache_if{
00023
00024 ac_cache_if* next_level;
00025 ac_cache_if* previous_level;
00026
00027
00028 private:
00029 char *request_buffer;
00030 int write_size;
00031 bool read_access_type;
00032 char* datum_ref;
00033 ac_cache_if* client_global;
00034 bool request_block_event;
00035 bool request_write_block_event;
00036 bool request_write_event;
00037
00038
00039 unsigned char replace_status;
00040 unsigned requested_address;
00041
00042
00043 public:
00044 #ifdef AC_TRACE
00045 ofstream trace;
00046 #endif
00047
00049 virtual ac_word ac_mem::read( unsigned address );
00050
00052 virtual unsigned char ac_mem::read_byte( unsigned address );
00053
00055 virtual ac_Hword ac_mem::read_half( unsigned address );
00056
00058 virtual void ac_mem::write( unsigned address, ac_word datum );
00059
00061 virtual void ac_mem::write_byte( unsigned address, unsigned char datum );
00062
00064 virtual void ac_mem::write_half( unsigned address, unsigned short datum );
00065
00067 ac_mem::ac_mem( char *n, unsigned s);
00068
00070 ac_mem::~ac_mem();
00071
00072
00073
00074
00075 void ac_mem::stall();
00076
00077 void ac_mem::ready();
00078
00079
00080 void request_block(ac_cache_if* client, unsigned address, unsigned size_bytes);
00081 void request_write_byte(ac_cache_if* client, unsigned address, unsigned char datum);
00082 void request_write_half(ac_cache_if* client, unsigned address, unsigned short datum);
00083 void request_write(ac_cache_if* client, unsigned address, ac_word datum);
00084 void request_write_block(ac_cache_if* client, unsigned address, char* datum, unsigned size_bytes);
00085
00086 void response_block(char* block);
00087 void response_write_byte();
00088 void response_write_half();
00089 void response_write();
00090 void response_write_block();
00091
00092 void bindToNext(ac_cache_if& next);
00093 void bindToPrevious(ac_cache_if& previous);
00094
00095 void process_request();
00096
00097 };
00098 #endif
00099