- }
- 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 (box_inAddrRead.dataReadyForShip()) {
- addr = box_inAddrRead.removeDataForShip();
- stride = 0;
- count = 1;
- writing = false;
-
- } else if (box_inAddrWrite.dataReadyForShip()) {
- addr = box_inAddrWrite.removeDataForShip();
- stride = 0;
- count = 1;
- writing = true;
+ } else if (box_inAddrWrite.dataReadyForShip() && box_inDataWrite.dataReadyForShip() && box_out.readyForDataFromShip()) {
+ writeMem((int)box_inAddrWrite.removeDataForShip(), box_inDataWrite.removeDataForShip());
+ box_out.addDataFromShip(0,true);
+ } else if (box_inAddrRead.dataReadyForShip() && box_out.readyForDataFromShip()) {
+ box_out.addDataFromShip(readMem((int)box_inAddrRead.removeDataForShip()),false);