everything except end and crontrol flow

This commit is contained in:
karthikmurakonda 2022-10-07 11:38:33 +05:30
parent 783e72c4ed
commit e59b707dae
3 changed files with 6 additions and 4 deletions

View File

@ -124,6 +124,7 @@ public class Execute {
EX_IF_Latch.setIF_enable(true);
EX_IF_Latch.setPC(alu_result);
noma = true;
containingProcessor.getOFUnit().setProceed(false);
}
}
break;
@ -150,6 +151,7 @@ public class Execute {
EX_IF_Latch.setIF_enable(true);
EX_IF_Latch.setPC(alu_result);
noma = true;
containingProcessor.getOFUnit().setProceed(false);
}
}
break;

View File

@ -20,7 +20,7 @@ public class InstructionFetch {
public void performIF()
{ if(!IF_EnableLatch.isFreeze()){
if(EX_IF_Latch.isIF_enable()){
containingProcessor.getRegisterFile().setProgramCounter(EX_IF_Latch.getPC()-1);
containingProcessor.getRegisterFile().setProgramCounter(EX_IF_Latch.getPC());
EX_IF_Latch.setIF_enable(false);
System.out.println("IF: PC set to " + EX_IF_Latch.getPC());
} // if EX_IF_Latch is enabled, set PC to EX_IF_Latch's PC and wait for next cycle (1 nop)

View File

@ -139,7 +139,7 @@ public class OperandFetch {
int op2 = containingProcessor.getRegisterFile().getValue(rd.getValue());
// System.out.println("imm: " + imm);
if (checkdatahazard(new int[] { rs1.getValue() })) {
if (checkdatahazard(new int[] { rs1.getValue(), rd.getValue()})){
noDataHazard = false;
}else{
if(opcode <= 22) { // > 21 means it is a branch instruction so no need to update queue
@ -152,9 +152,9 @@ public class OperandFetch {
instr.setDestinationOperand(rd);
instr.setSourceOperand1(rs1);
}
// if(opcode == 22){
if(opcode == 22){
// }
}
}
else if (Arrays.stream(R1I_type_operators).anyMatch(x -> x == opcode)) {
if(opcode != 24){