예제 #1
0
//This function does a branch on equal
void ControlUnit::BEQ(int a, int b, int newPC, Register &r1, MainFrame* theFrame)
{
	if(r1.get(a)==r1.get(b))
	{
		cout<<"BEQ jumping."<<endl;
		setPC(newPC);
	}
	else
		pc++;
};
예제 #2
0
// This function saves from Register to DM
void ControlUnit::SW(int registerIndex, int dataIndex, DataMemory &da1, Register &r1, MainFrame* theFrame)
{
	theFrame->OnDelay(1);
	string regVal = r1.get(registerIndex); 
	da1.store(regVal, dataIndex, theFrame); // Store Register value into DM
	pc++;
};