21 #ifndef __simple_bus_fast_mem_h
22 #define __simple_bus_fast_mem_h
35 :
public scClusterBusSlave_if
41 ,
unsigned int start_address
42 ,
unsigned int end_address)
44 , m_start_address(start_address)
45 , m_end_address(end_address)
47 sc_assert(m_start_address <= m_end_address);
48 sc_assert((m_end_address-m_start_address+1)%4 == 0);
49 unsigned int size = (m_end_address-m_start_address+1)/4;
51 for (
unsigned int i = 0; i < size; ++i)
59 bool direct_read(
int *data,
unsigned int address);
60 bool direct_write(
int *data,
unsigned int address);
63 ClusterBusStatus read(
scIGPMessage*){
return CLUSTER_BUS_OK;};
64 ClusterBusStatus write(
scIGPMessage*){
return CLUSTER_BUS_OK;};
67 ClusterBusStatus read(
int *data,
unsigned int address);
68 ClusterBusStatus write(
int *data,
unsigned int address);
70 unsigned int start_address()
const;
71 unsigned int end_address()
const;
75 unsigned int m_start_address;
76 unsigned int m_end_address;
80 inline bool scClusterBusMemoryFast::direct_read(
int *data,
unsigned int address)
82 return (read(data, address) == CLUSTER_BUS_OK);
85 inline bool scClusterBusMemoryFast::direct_write(
int *data,
unsigned int address)
87 return (write(data, address) == CLUSTER_BUS_OK);
90 inline ClusterBusStatus scClusterBusMemoryFast::read(
int *data
91 ,
unsigned int address)
93 *data = MEM[(address - m_start_address)/4];
94 return CLUSTER_BUS_OK;
97 inline ClusterBusStatus scClusterBusMemoryFast::write(
int *data
98 ,
unsigned int address)
100 MEM[(address - m_start_address)/4] = *data;
101 return CLUSTER_BUS_OK;
104 inline scClusterBusMemoryFast::~scClusterBusMemoryFast()
106 if (MEM)
delete [] MEM;
110 inline unsigned int scClusterBusMemoryFast::start_address()
const
112 return m_start_address;
115 inline unsigned int scClusterBusMemoryFast::end_address()
const
117 return m_end_address;