Ejemplo n.º 1
0
  public ScramblerRx(TypedCompositeActor container, String name)
      throws NameDuplicationException, IllegalActionException {
    super(container, name);

    input = new TypedIOPort(this, "input", true, false);
    input.setTypeEquals(ObjectToken.class);

    output = new TypedIOPort(this, "output", false, true);
    output.setTypeEquals(ObjectToken.class);

    LS0Bytes = new Parameter(this, "LS0Bytes", new IntToken(8));
    LS0Map = new Parameter(this, "LS0Map", new BooleanToken(false));

    S = new Parameter(this, "S", new IntToken(1));
  }
Ejemplo n.º 2
0
  public void fire() throws IllegalActionException {

    ObjectToken ot = (ObjectToken) input.get(0);
    MuxDataFrame mf = (MuxDataFrame) ot.getValue();
    int b;

    if (_frameCounter == 0) {
      b = _processFast(mf.getFastByte());
      mf.setFastByte(b);

      if (!_LS0Map) {
        for (int i = 0; i < _LS0Bytes; i++) {
          b = _processFast(mf.getLS0Byte(i));
          mf.setLS0Byte(b, i);
        }
      }

      if (mf.hasLEX()) {
        b = _processFast(mf.getLEXByte());
        mf.setLEXByte(b);
      }
    } else {
      b = _processInter(mf.getFastByte());
      mf.setFastByte(b);

      if (_LS0Map) {
        for (int i = 0; i < _LS0Bytes; i++) {
          b = _processInter(mf.getLS0Byte(i));
          mf.setLS0Byte(b, i);
        }
      }

      if (mf.hasLEX()) {
        b = _processInter(mf.getLEXByte());
        mf.setLEXByte(b);
      }
    }
    _frameCounter++;
    if (_frameCounter == 1 + _S) _frameCounter = 0;

    ot = new ObjectToken(mf);
    output.broadcast(ot);
  }