MMU.c
int MMU_writeMemory() {

	if (registerMAR_MMU >= 0 && registerMAR_MMU<registerLimit_MMU) {
		// Physical address = logical address + base register
		registerMAR_MMU+=registerBase_MMU;
                // Send to the main memory HW the physical address to read from
		Buses_write_AddressBus_From_To(registerMAR_MMU, &registerMAR_MainMemory);
		// Tell the main memory HW to write
		MainMemory_writeMemory();
		return MMU_SUCCESS;
	}
	else{
		Processor_RaiseException(INVALIDADDRESS);
		return MMU_FAIL;
	}
}
// Logical address is in registerMAR_MMU. If correct, physical address is produced
// by adding logical address and base register
Logical address is in registerMAR_MMU. If correct, physical address is produced
by adding logical address and base register
Logical address is in registerMAR_MMU . If correct physical address is produced by adding logical address and base register
int MMU_writeMemory() {
	if (registerMAR_MMU >= 0 && registerMAR_MMU<registerLimit_MMU) {
		registerMAR_MMU+=registerBase_MMU;
		Buses_write_AddressBus_From_To(registerMAR_MMU, &registerMAR_MainMemory);
		MainMemory_writeMemory();
		return MMU_SUCCESS;
	}
	else{
		Processor_RaiseException(INVALIDADDRESS);
		return MMU_FAIL;
	}
}
int MMU_writeMemory ( ) { if ( registerMAR_MMU >= 0 && registerMAR_MMU < registerLimit_MMU ) { registerMAR_MMU += registerBase_MMU ; Buses_write_AddressBus_From_To ( registerMAR_MMU , & registerMAR_MainMemory ) ; MainMemory_writeMemory ( ) ; return MMU_SUCCESS ; } else { Processor_RaiseException ( INVALIDADDRESS ) ; return MMU_FAIL ; } }
Logical address is in registerMAR_MMU.
Logical address is in registerMAR_MMU .
// Physical address = logical address + base register // Send to the main memory HW the physical address to read from // Tell the main memory HW to write