X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ships%2FMemory.ship;h=e103fbd79f92971fe11199dcf401184fe5c1f090;hb=b9dbc8cf26a34328893e2e462456f15e1baf1a07;hp=6600dd56fae58cc64cd287626f0ce40304503b7a;hpb=cedfa0d79cc8f11ca66d735ac58b793aa0aa72ac;p=fleet.git diff --git a/ships/Memory.ship b/ships/Memory.ship index 6600dd5..e103fbd 100644 --- a/ships/Memory.ship +++ b/ships/Memory.ship @@ -127,44 +127,34 @@ sequence guarantee problem mentioned in the previous paragraph. long size = val & 0x3f; dispatch((int)addr, (int)size); } - if (count > 0 && writing) { - if (box_inDataWrite.dataReadyForShip() && box_out.readyForDataFromShip()) { - writeMem((int)addr, box_inDataWrite.removeDataForShip()); - box_out.addDataFromShip(0); - count--; - addr += stride; + if (count > 0) { + if (writing) { + if (box_inDataWrite.dataReadyForShip() && box_out.readyForDataFromShip()) { + writeMem((int)addr, box_inDataWrite.removeDataForShip()); + box_out.addDataFromShip(0); + count--; + addr += stride; + } + } else { + if (box_out.readyForDataFromShip()) { + box_out.addDataFromShip(readMem((int)addr)); + count--; + addr += stride; + } } - } else if (count > 0 && !writing) { - if (box_out.readyForDataFromShip()) { - box_out.addDataFromShip(readMem((int)addr)); - count--; - addr += stride; - } - - } else if (box_inAddrRead.dataReadyForShip() && box_out.readyForDataFromShip()) { - Packet packet = box_inAddrRead.peekPacketForShip(); - if (packet.destination.getDestinationName().equals("read")) { - box_out.addDataFromShip(readMem((int)box_inAddrRead.removeDataForShip())); - } else if (packet.destination.getDestinationName().equals("write") && box_inDataWrite.dataReadyForShip()) { - writeMem((int)box_inAddrRead.removeDataForShip(), - box_inDataWrite.removeDataForShip()); - box_out.addDataFromShip(0); - } else if (packet.destination.getDestinationName().equals("writeMany") - && box_inStride.dataReadyForShip() - && box_inCount.dataReadyForShip()) { - addr = box_inAddrRead.removeDataForShip(); - stride = box_inStride.removeDataForShip(); - count = box_inCount.removeDataForShip(); - writing = true; - } else if (packet.destination.getDestinationName().equals("readMany") - && box_inStride.dataReadyForShip() - && box_inCount.dataReadyForShip()) { - addr = box_inAddrRead.removeDataForShip(); - stride = box_inStride.removeDataForShip(); - count = box_inCount.removeDataForShip(); - writing = false; - } + } else if (box_inAddrRead.dataReadyForShip()) { + addr = box_inAddrRead.removeDataForShip(); + stride = 0; + count = 1; + writing = false; + + } else if (box_inAddrWrite.dataReadyForShip()) { + addr = box_inAddrWrite.peekPacketForShip().value; + box_inAddrWrite.removeDataForShip(); + stride = 0; + count = 1; + writing = true; } }