Beispiel #1
0
  public void ID()
      throws RAWException, IrregularWriteOperationException, IrregularStringOfBitsException {
    // if source registers are valid passing their own values into temporary registers
    Register rs = cpu.getRegister(params.get(RS_FIELD));
    Register rt = cpu.getRegister(params.get(RT_FIELD));

    if (rs.getWriteSemaphore() > 0 || rt.getWriteSemaphore() > 0) {
      throw new RAWException();
    }

    TR[RS_FIELD] = rs;
    TR[RT_FIELD] = rt;
    // locking the destination registers (quotient and remainder)
    cpu.getLO().incrWriteSemaphore();
    cpu.getHI().incrWriteSemaphore();
  }
Beispiel #2
0
 public void doWB() throws IrregularStringOfBitsException {
   // passing results from temporary registers to destination registers and unlocking them
   Register lo = cpu.getLO();
   Register hi = cpu.getHI();
   lo.setBits(TR[LO_REG].getBinString(), 0);
   hi.setBits(TR[HI_REG].getBinString(), 0);
   lo.decrWriteSemaphore();
   hi.decrWriteSemaphore();
 }