Class VerilogLiteral


  • public final class VerilogLiteral
    extends java.lang.Object
    VerilogLiteral represents numeric and string literals.
    • Constructor Summary

      Constructors 
      Constructor Description
      VerilogLiteral​(boolean value)
      Creates an integer literal.
      VerilogLiteral​(double value)
      Creates a real literal.
      VerilogLiteral​(int value)
      Creates an integer literal.
      VerilogLiteral​(int value, int width)
      Creates a bit vector literal.
      VerilogLiteral​(java.lang.String value)
      Creates a string literal.
      VerilogLiteral​(java.math.BigInteger value)
      Creates an integer literal.
      VerilogLiteral​(ru.ispras.fortress.data.Data value)
      Creates a literal.
      VerilogLiteral​(ru.ispras.fortress.data.types.bitvector.BitVector value)
      Creates a bit vector literal with no X and Z digits.
      VerilogLiteral​(ru.ispras.fortress.data.types.bitvector.BitVector value, ru.ispras.fortress.data.types.bitvector.BitVector xmask, ru.ispras.fortress.data.types.bitvector.BitVector zmask)
      Creates a bit vector literal.
      VerilogLiteral​(VerilogLiteral other)
      Creates a copy of the literal.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      VerilogLiteral clone()  
      java.math.BigInteger getBigInteger()
      Returns the big integer value of the literal.
      int getBitSize()
      Returns the bit width of the literal.
      ru.ispras.fortress.data.types.bitvector.BitVector getBitVector()
      Returns the bit vector value of the literal.
      boolean getBoolean()
      Returns the boolean value of the literal.
      byte[] getByteArray()
      Returns the byte array representation of the literal.
      int getInteger()
      Returns the integer value of the literal.
      double getReal()
      Returns the real value of the literal.
      java.lang.String getString()
      Returns the string value of the literal.
      VerilogLiteral.Type getType()
      Returns the literal type (INTEGER, REAL, or STRING).
      ru.ispras.fortress.data.types.bitvector.BitVector getXMask()
      Returns the X mask of the literal.
      ru.ispras.fortress.data.types.bitvector.BitVector getZMask()
      Returns the Z mask of the literal.
      boolean hasX()
      Checks whether the literal contains X digits.
      boolean hasXorZ()
      Checks whether the literal contains X or Z digits.
      boolean hasZ()
      Checks whether the literal contains Z digits.
      boolean isBitVector()
      Checks whether the literal is BIT_VECTOR.
      boolean isInteger()
      Checks whether the literal is INTEGER.
      boolean isReal()
      Checks whether the literal is REAL.
      boolean isString()
      Checks whether the literal is STRING.
      static VerilogLiteral parseNumber​(java.lang.String text)
      Parses the string representing a numeric literal.
      static VerilogLiteral parseString​(java.lang.String text, boolean withQuotes)
      Parses the string representing a string literal.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • VerilogLiteral

        public VerilogLiteral​(ru.ispras.fortress.data.types.bitvector.BitVector value,
                              ru.ispras.fortress.data.types.bitvector.BitVector xmask,
                              ru.ispras.fortress.data.types.bitvector.BitVector zmask)
        Creates a bit vector literal.
        Parameters:
        value - the value.
        xmask - the X mask.
        zmask - the Z mask.
      • VerilogLiteral

        public VerilogLiteral​(ru.ispras.fortress.data.types.bitvector.BitVector value)
        Creates a bit vector literal with no X and Z digits.
        Parameters:
        value - the value.
      • VerilogLiteral

        public VerilogLiteral​(int value,
                              int width)
        Creates a bit vector literal.
        Parameters:
        value - the value.
        width - the width.
      • VerilogLiteral

        public VerilogLiteral​(int value)
        Creates an integer literal.
        Parameters:
        value - the value.
      • VerilogLiteral

        public VerilogLiteral​(boolean value)
        Creates an integer literal.
        Parameters:
        value - the value.
      • VerilogLiteral

        public VerilogLiteral​(java.math.BigInteger value)
        Creates an integer literal.
        Parameters:
        value - the value.
      • VerilogLiteral

        public VerilogLiteral​(double value)
        Creates a real literal.
        Parameters:
        value - the value.
      • VerilogLiteral

        public VerilogLiteral​(java.lang.String value)
        Creates a string literal.
        Parameters:
        value - the value.
      • VerilogLiteral

        public VerilogLiteral​(ru.ispras.fortress.data.Data value)
        Creates a literal.
        Parameters:
        value - the value.
      • VerilogLiteral

        public VerilogLiteral​(VerilogLiteral other)
        Creates a copy of the literal.
        Parameters:
        other - the literal to be copied.
    • Method Detail

      • parseNumber

        public static VerilogLiteral parseNumber​(java.lang.String text)
        Parses the string representing a numeric literal.
        Parameters:
        text - the string to be parsed.
        Returns:
        the constructed literal.
      • parseString

        public static VerilogLiteral parseString​(java.lang.String text,
                                                 boolean withQuotes)
        Parses the string representing a string literal.
        Parameters:
        text - the string to be parsed.
        withQuotes - the flag indicating whether the string contains quotes to be removed.
        Returns:
        the constructed literal.
      • getType

        public VerilogLiteral.Type getType()
        Returns the literal type (INTEGER, REAL, or STRING).
        Returns:
        the literal type.
      • isBitVector

        public boolean isBitVector()
        Checks whether the literal is BIT_VECTOR.
        Returns:
        true iff the literal is BIT_VECTOR.
      • isInteger

        public boolean isInteger()
        Checks whether the literal is INTEGER.
        Returns:
        true iff the literal is INTEGER.
      • isReal

        public boolean isReal()
        Checks whether the literal is REAL.
        Returns:
        true iff the literal is REAL.
      • isString

        public boolean isString()
        Checks whether the literal is STRING.
        Returns:
        true iff the literal is STRING.
      • getBitVector

        public ru.ispras.fortress.data.types.bitvector.BitVector getBitVector()
        Returns the bit vector value of the literal.
        Returns:
        the bit vector value.
      • getInteger

        public int getInteger()
        Returns the integer value of the literal.
        Returns:
        the integer value.
      • getBoolean

        public boolean getBoolean()
        Returns the boolean value of the literal.
        Returns:
        the boolean value.
      • getBigInteger

        public java.math.BigInteger getBigInteger()
        Returns the big integer value of the literal.
        Returns:
        the big integer value.
      • getReal

        public double getReal()
        Returns the real value of the literal.
        Returns:
        the real value.
      • getString

        public java.lang.String getString()
        Returns the string value of the literal.
        Returns:
        the string value.
      • getByteArray

        public byte[] getByteArray()
        Returns the byte array representation of the literal.
        Returns:
        the byte array representation.
      • hasX

        public boolean hasX()
        Checks whether the literal contains X digits.
        Returns:
        true iff the literal contains X digits.
      • hasZ

        public boolean hasZ()
        Checks whether the literal contains Z digits.
        Returns:
        true iff the literal contains Z digits.
      • hasXorZ

        public boolean hasXorZ()
        Checks whether the literal contains X or Z digits.
        Returns:
        true iff the literal contains X or Z digits.
      • getXMask

        public ru.ispras.fortress.data.types.bitvector.BitVector getXMask()
        Returns the X mask of the literal.
        Returns:
        the X mask.
      • getZMask

        public ru.ispras.fortress.data.types.bitvector.BitVector getZMask()
        Returns the Z mask of the literal.
        Returns:
        the Z mask.
      • getBitSize

        public int getBitSize()
        Returns the bit width of the literal.
        Returns:
        the bit width.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • clone

        public VerilogLiteral clone()
        Overrides:
        clone in class java.lang.Object