text
stringlengths
0
252
read_in = acc_read.read();
write_in = acc_write.read();
if (acc_read.read()){
// increment accelerator notify_flag_read
notify_flag_read++;
addr_in = acc_addr_out.read();
}
else if (acc_write.read()){
// increment accelerator notify_flag_write
notify_flag_write++;
data_in = acc_data_out.read();
addr_in = acc_addr_out.read();
}
}
}
};
/*
* @ASCK
*/
#include <systemc.h>
SC_MODULE (WB) {
sc_in_clk clk;
sc_in <sc_int<8>> prev_alu_result;
sc_in <sc_int<8>> prev_mem_result;
sc_in <bool> prev_WbMux;
sc_in <bool> prev_regWrite;
sc_in <sc_uint<3>> prev_rd;
sc_out <sc_int<8>> next_alu_result;
sc_out <sc_int<8>> next_mem_result;
sc_out <bool> next_WbMux;
sc_out <bool> next_regWrite;
sc_out <sc_uint<3>> next_rd;
/*
** module global variables
*/
SC_CTOR (WB){
SC_THREAD (process);
sensitive << clk.pos();
}
void process () {
while(true){
wait();
if(now_is_call){
wait(micro_acc_ev);
}
next_alu_result.write(prev_alu_result.read());
next_mem_result.write(prev_mem_result.read());
next_WbMux.write(prev_WbMux.read());
next_regWrite.write(prev_regWrite);
next_rd.write(prev_rd.read());
}
}
};
/*
* @ASCK
*/
#include <systemc.h>
#include <System.cpp>
using namespace std;
int sc_main(int argc, char* argv[]){
cout << "starting the complete project" << endl;
sc_trace_file *wf = sc_create_vcd_trace_file("project");
sc_signal <bool> clk;
sc_signal <bool> clk_bus;
sc_signal <sc_int<8>> reg_dump[8];
sc_signal <sc_uint<5>> aluop;
sc_signal <sc_uint<14>> pc;
System sys ("System");
sys (clk, clk_bus, pc, aluop);
for (int i=0; i<8; i++){
sys.reg_dump[i](reg_dump[i]);
}
sc_trace (wf, clk, "clk");