Beispiel #1
0
  @Override
  public Value visitGENERAL(Verilog2001Parser.GENERALContext ctx) {
    String ident = ctx.getText();
    ParsePort port = hash_ports.get(ident);
    ParseRegWire regWire = hash_vars.get(ident);

    if (regWire != null) {
      // System.out.println("General Ident:"+ident+" val:"+regWire.getValue(old_val_idx));
      return new Value(regWire.getValue(old_val_idx), 30);
    } else if (port != null) {
      return new Value(port.getValue(old_val_idx), 30);
    }

    System.out.println("Error: No item called: " + ident);

    return null;
  }
Beispiel #2
0
  @Override
  public Value visitBIT_ACCESS(Verilog2001Parser.BIT_ACCESSContext ctx) {
    String ident = ctx.identifier().getText();
    ParsePort port = hash_ports.get(ident);
    ParseRegWire regWire = hash_vars.get(ident);
    Value number = visit(ctx.constant_expression());

    if (regWire != null) {
      int value_of_bit = regWire.getIntegerBit(number.asInt(), old_val_idx);
      // System.out.println("RegWire bit:"+ident+" loc: "+number.asInt()+" val:"+value_of_bit);
      return new Value(value_of_bit, 1);
    } else if (port != null) {
      int value_of_bit = port.getIntegerBit(number.asInt(), old_val_idx);
      // System.out.println("Port bit:"+ident+" loc: "+number.asInt()+" val:"+value_of_bit);
      return new Value(value_of_bit, 1);
    }

    System.out.println("Error: No item called: " + ident);

    return visitChildren(ctx);
  }