text
stringlengths
0
252
acc->mem_data(acc_data_in);
acc->call(acc_call_in);
acc->read(acc_read);
acc->write(acc_write);
acc->addr(acc_addr_out);
acc->data(acc_data_out);
}
int c = 0; //clk counter for printing
/*
** FLAG: if the **acc_read** of accelerator is enabled then we know that after 2 clks
** we will have the memory data on the bus data_out!
**
** BRIEF: this flag acknowledge us whether we have to notify the acc_mem_read_ev or not!
*/
int notify_flag_read = 0;
int notify_flag_write = 0;
void process()
{
// testing wires
test_aluop.write(test_aluOp.read());
pc.write(test_pc.read());
cout << "-----------------------------------------------" << endl;
cout << "\t-___ " << "bus_clk: 0X" <<c++ << " ___-" << endl << endl;
/*
** Micro - MEMORY - ACC
*/
mem_addr = addr_out.read();
mem_data_in = data_out.read();
micro_data_in = data_out.read();
acc_data_in = data_out.read();
acc_call_in = call_out.read();
if (read_out.read() || write_out.read() || call_out.read()){
if (read_out.read()){
r_nw = read_out.read();
data_in = mem_data_out.read();
}
else if (write_out.read()){
r_nw = !(write_out.read());
}
}
////////////////////////HANDLE ACC READ/WRITE////////////////////////
if (notify_flag_write !=0 && notify_flag_write < 3){
// increment the flag to get to the intended clk count
notify_flag_write++;
return;
}
else if (notify_flag_write == 3){
// the write operation should have been done
notify_flag_write = 0;
acc_mem_write_ev.notify();
return;
}
if (notify_flag_read !=0 && notify_flag_read < 4){
// increment the flag to get to the intended clk count
notify_flag_read++;
return;
}
else if (notify_flag_read == 4){
// should we notify accelerator event? (two clocks have passed)
notify_flag_read = 0;
acc_mem_read_ev.notify();
return;
}
///////////////////////////////////////////////////////////////////MICRO
if (micro_read.read() || micro_write.read() || micro_call.read())
{
read_in = micro_read.read();
write_in = micro_write.read();
call_in = micro_call.read();
if (micro_read.read()){
addr_in = micro_addr.read();
}
else if (micro_write.read()){
data_in = micro_data_out.read();
addr_in = micro_addr.read();
}
}
///////////////////////////////////////////////////////////////////ACC
if (acc_read.read() || acc_write.read())
{