everything except end and crontrol flow
This commit is contained in:
		
							parent
							
								
									783e72c4ed
								
							
						
					
					
						commit
						e59b707dae
					
				| 
						 | 
					@ -124,6 +124,7 @@ public class Execute {
 | 
				
			||||||
						EX_IF_Latch.setIF_enable(true);
 | 
											EX_IF_Latch.setIF_enable(true);
 | 
				
			||||||
						EX_IF_Latch.setPC(alu_result);
 | 
											EX_IF_Latch.setPC(alu_result);
 | 
				
			||||||
						noma = true;
 | 
											noma = true;
 | 
				
			||||||
 | 
											containingProcessor.getOFUnit().setProceed(false);
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
| 
						 | 
					@ -150,6 +151,7 @@ public class Execute {
 | 
				
			||||||
						EX_IF_Latch.setIF_enable(true);
 | 
											EX_IF_Latch.setIF_enable(true);
 | 
				
			||||||
						EX_IF_Latch.setPC(alu_result);
 | 
											EX_IF_Latch.setPC(alu_result);
 | 
				
			||||||
						noma = true;
 | 
											noma = true;
 | 
				
			||||||
 | 
											containingProcessor.getOFUnit().setProceed(false);
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,7 +20,7 @@ public class InstructionFetch {
 | 
				
			||||||
	public void performIF()
 | 
						public void performIF()
 | 
				
			||||||
	{	if(!IF_EnableLatch.isFreeze()){
 | 
						{	if(!IF_EnableLatch.isFreeze()){
 | 
				
			||||||
			if(EX_IF_Latch.isIF_enable()){
 | 
								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);
 | 
									EX_IF_Latch.setIF_enable(false);
 | 
				
			||||||
				System.out.println("IF: PC set to " + EX_IF_Latch.getPC());
 | 
									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)
 | 
								} // if EX_IF_Latch is enabled, set PC to EX_IF_Latch's PC and wait for next cycle (1 nop)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -139,7 +139,7 @@ public class OperandFetch {
 | 
				
			||||||
				int op2 = containingProcessor.getRegisterFile().getValue(rd.getValue());
 | 
									int op2 = containingProcessor.getRegisterFile().getValue(rd.getValue());
 | 
				
			||||||
				// System.out.println("imm: " + imm);
 | 
									// System.out.println("imm: " + imm);
 | 
				
			||||||
				
 | 
									
 | 
				
			||||||
				if (checkdatahazard(new int[] { rs1.getValue() })) {
 | 
									if (checkdatahazard(new int[] { rs1.getValue(), rd.getValue()})){
 | 
				
			||||||
					noDataHazard = false;
 | 
										noDataHazard = false;
 | 
				
			||||||
				}else{
 | 
									}else{
 | 
				
			||||||
					if(opcode <= 22) { // > 21 means it is a branch instruction so no need to update queue
 | 
										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.setDestinationOperand(rd);
 | 
				
			||||||
					instr.setSourceOperand1(rs1);
 | 
										instr.setSourceOperand1(rs1);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				// if(opcode == 22){
 | 
									if(opcode == 22){
 | 
				
			||||||
					
 | 
										
 | 
				
			||||||
				// }
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			else if (Arrays.stream(R1I_type_operators).anyMatch(x -> x == opcode)) {
 | 
								else if (Arrays.stream(R1I_type_operators).anyMatch(x -> x == opcode)) {
 | 
				
			||||||
				if(opcode != 24){
 | 
									if(opcode != 24){
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue