text
stringlengths 0
252
|
---|
** HANDLE ACCELERATOR CALLS |
*/ |
if(exe_next_call.read()){ |
call.write(1); |
pc_prev_addr = (pc_prev_addr.read()); |
wait(micro_acc_ev); |
pc_prev_addr = (pc_prev_addr.read()) + 1; |
} |
} |
} |
void pcInc (){ |
// increment the pc |
tmp_pc_prev_addr = pc_prev_addr.read(); |
pc_prev_addr = ++tmp_pc_prev_addr; |
} |
void decode (){ |
/* |
** split next instruction to the corresponding signals (Instruction Decode) |
*/ |
tmp = ir_inst.read(); |
opcode = tmp.range(19, 16); |
opselect = tmp.range(3, 0); |
rd = tmp.range(15, 13); |
rs = tmp.range(12, 10); |
rt = tmp.range(9, 7); |
sa = tmp.range(6, 4); |
offset = (sc_int<13>) tmp.range(12, 0); |
} |
void ImmTo8bits (){ |
/* |
** Mux 8 for immediate or B |
*/ |
tmp_id_next_Imm = offset.read(); |
id_nex_imm_8bits = (tmp_id_next_Imm.range(7, 0)); |
} |
void busAccess (){ |
/* |
** ACCESS MEM. VIA BUS |
*/ |
wb_prev_mem_data = mem_data.read(); |
mem_addr = (sc_uint<13>) id_next_Imm.read(); |
read.write(exe_next_r.read()); |
write.write(exe_next_w.read()); |
addr.write(mem_addr.read()); |
data.write(exe_next_result.read()); |
call.write(0); // setting of the value is also performs in process function |
} |
void tester () { |
// testing wires |
for(int i=0; i<8; i++){ |
reg_dump[i].write(regs[i].read()); |
} |
test_aluOp.write(aluOp.read()); |
test_pc.write(pc_next_addr.read()); |
test_inst.write((sc_uint<20>)if_next_data.read()); |
print(); |
} |
void print(){ |
cout << "pc addr ((FETCH)) :\t" << pc_next_addr << endl << endl; |
cout << "IF inst ((DECODE)):\t" << std::hex << if_next_data << endl; |
cout << "controller| opcode:\t" << opcode << endl; |
cout << "regFile| regMux :\t" << regMux << endl; |
cout << "regFile| r1 :\t" << mux_reg_res << endl; |
cout << "regFile| r2 :\t" << rt << endl; |
cout << "regFile| r3 :\t" << wb_next_rd << endl; |
cout << "regFile| imm :\t" << offset << endl; |
cout << "regFile| data :\t" << wb_next_rd << endl; |
cout << "regFile| regWrite :\t" << wb_next_regWrite << endl << endl; |
cout << "A ((EXE)) :\t" << id_next_A << endl; |
cout << "B :\t" << alu_in_B << endl; |
cout << "aluOp :\t" << id_next_AluOp << endl; |
cout << "aluMux :\t" << id_next_AluMux << endl; |
cout << "imm :\t" << id_next_Imm << endl; |
cout << "aluOut :\t" << alu_out << endl << endl; |
cout << "imm :\t" << exe_next_Imm << endl; |
cout << "data_in ((MEM)) :\t" << exe_next_result << endl; |
cout << "addr :\t" << exe_next_Imm << endl; |
cout << "read :\t" << exe_next_r << endl; |
cout << "write :\t" << exe_next_w << endl; |
cout << "data_out :\t" << mem_data << endl << endl; |
cout << "data ((WB)) :\t" << regFileData << endl; |
cout << "rd :\t" << exe_next_rd << endl; |
cout << "wbMux :\t" << wb_next_WbMux << endl << endl; |
} |
}; |
/* |
Subsets and Splits