#include "AXI_master_if.h"
SC_MODULE(simple_master) {
AXI_master_if* m_if; // instance master channel
sc_uint<2> Master_ID; // Master id
void simple_master_execute() {
wait();
cout << sc_time_stamp() << " Simple master execute start!!" << endl;
for (int i = 0; i < 16; i++) {
// Write one 32-bit data and read one 32-bit data
cout << sc_time_stamp() << " master write: " << i << " address: " << i << endl;
m_if->master_write(Master_ID, i, i, 2, 1, 0); // write
sc_uint <32>* buff; // Read buffer
buff = m_if->master_read(Master_ID, i, 2, 1, 0); // read
cout << sc_time_stamp() << " data : " << buff[0] << " address: " << i << endl;
}
cout << sc_time_stamp() << " Simple master execute end!!" << endl;
sc_stop(); // Stop simulation
}
SC_CTOR(simple_master) {
Master_ID = 1; // Initialize master id
m_if = new AXI_master_if("process_interface");
SC_THREAD(simple_master_execute);
sensitive << m_if->clk.pos();
}
};