Package avrora.sim

Examples of avrora.sim.BaseInterpreter$SREG_reg


                Program p = path.getProgram();
                SourceMapping smap = p.getSourceMapping();
                SourceMapping.Location location = smap.getLocation("TOS_LOCAL_ADDRESS");
                if ( location == null ) location = smap.getLocation("node_address");
                if ( location != null ) {
                    BaseInterpreter bi = simulator.getInterpreter();
                    bi.writeFlashByte(location.address, Arithmetic.low(id));
                    bi.writeFlashByte(location.address+1, Arithmetic.high(id));
                }
            }
        }
View Full Code Here


        Program p = path.getProgram();
        SourceMapping smap = p.getSourceMapping();
        SourceMapping.Location location = smap.getLocation("TOS_LOCAL_ADDRESS");
        if ( location == null ) location = smap.getLocation("node_address");
        if ( location != null ) {
          BaseInterpreter bi = simulator.getInterpreter();
          bi.writeFlashByte(location.address, Arithmetic.low(id));
          bi.writeFlashByte(location.address+1, Arithmetic.high(id));
        }
      }
    } // updateNodeID
View Full Code Here

    Utils.debugMsg("sendDataRequest()", this);

    long  timestamp;
    int    nodeId;
    byte[] data;
    BaseInterpreter interpreter;

    // Length will be stored in an integer, just in case the two-byte
    // length-field which is unsigned has a value that is too high and
    // would be interpreted as negative in Java.
    int length = 0;
    byte tmpLength;

    int startAddr = 1 + Const.SHARED_MEM_SEND_ADDRESS; // first byte is the signal, so +1

    byte temp;
    byte[] sendPkg;

    interpreter = sim.getInterpreter();

    nodeId = ((SimulatorThread) simMap.get(sim)).getNode().hashCode();
    timestamp = sim.getClock().getCount();

/*    if (Const.NODES_USE_BIG_ENDIAN) {
      tmpLength = interpreter.getDataByte(startAddr++); System.out.println("xx "+tmpLength);
      length |= (tmpLength << 24);
      tmpLength = interpreter.getDataByte(startAddr++); System.out.println("xx "+tmpLength);
      length |= (tmpLength << 16);
      tmpLength = interpreter.getDataByte(startAddr++); System.out.println("xx "+tmpLength);
      length |= (tmpLength << 8);
      tmpLength = interpreter.getDataByte(startAddr++); System.out.println("xx "+tmpLength);
      length |= tmpLength;
    } else {*/
      tmpLength = interpreter.getDataByte(startAddr++);
      length |= tmpLength;
      tmpLength = interpreter.getDataByte(startAddr++);
      length |= (tmpLength << 8);
      tmpLength = interpreter.getDataByte(startAddr++);
      length |= (tmpLength << 16);
      tmpLength = interpreter.getDataByte(startAddr++);
      length |= (tmpLength << 24);
//    }

    if (length == 0) return; // empty data, nothing to do

    if ((1+2+length) > Const.SHARED_MEM_SEND_SIZE) { // 1+2 => signal + length-field
      System.err.println("Node "+nodeId+" is trying to send to much data :" + (1+2+length));
      System.exit(-1);
    }

    startAddr = 1 + Const.SHARED_MEM_SEND_ADDRESS;

    // read the data from the node
    data = new byte[length];
    for (int i = 0; i < length; i++) {
      data[i] = interpreter.getDataByte(startAddr+i);
    }

    /* Convert the data into a message
     */
    PartsBuffer  messageBuffer;
View Full Code Here

    int startAddr = Const.SHARED_MEM_REC_ADDRESS;
    Simulation.Node node = (Simulation.Node) nodeMap.get(new Integer(nodeId));
    if (node == null) Avrora.userError("Not a valid NodeID: "+nodeId);
    Simulator sim = node.getSimulator();
    BaseInterpreter interpreter = sim.getInterpreter();

    interpreter.writeDataByte(startAddr++, Const.SIG_NODE_RECEIVE_DATA);
    interpreter.writeDataByte(startAddr++, (byte) data.length);
    for (int i = 0; i < data.length; i++){
      interpreter.writeDataByte(startAddr++, data[i]);
    }

    // Interrupt ausloesen
    if (Const.ACTIVATE_MESSAGE_INTERRUPT)
      interpreter.setEnabled(Const.MESSAGE_INTERRUPT, true);
    interpreter.setPosted(Const.MESSAGE_INTERRUPT, true);
  }
View Full Code Here

 
  public void enableInterrupt(int nodeId) {
    Simulation.Node node = (Simulation.Node) nodeMap.get(new Integer(nodeId));
    if (node == null) Avrora.userError("Not a valid NodeID: "+nodeId);
    Simulator sim = node.getSimulator();
    BaseInterpreter interpreter = sim.getInterpreter();
 
    // Interrupt ausloesen
    if (Const.ACTIVATE_MESSAGE_INTERRUPT)
      interpreter.setEnabled(Const.MESSAGE_INTERRUPT, true);
    interpreter.setPosted(Const.MESSAGE_INTERRUPT, true);
  }
View Full Code Here

          } else {
            Simulation.Node node = (Simulation.Node) extSync.getNodeMap().get(new Integer(nodeId));
            if (node == null) Avrora.userError("Not a valid NodeID: "+nodeId);
           
            Simulator       sim         = node.getSimulator();
            BaseInterpreter interpreter = sim.getInterpreter();
            InterruptTable  intTable    = interpreter.getInterruptTable();
           
            // Fire interrupt again
            extSync.enableInterrupt(nodeId);
           
          }
View Full Code Here

TOP

Related Classes of avrora.sim.BaseInterpreter$SREG_reg

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.