Class VerilogLiteral
- java.lang.Object
-
- ru.ispras.verilog.parser.model.basis.VerilogLiteral
-
public final class VerilogLiteral extends java.lang.Object
VerilogLiteral
represents numeric and string literals.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
VerilogLiteral.Type
VerilogLiteral.Type
contains literal types.
-
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
, orSTRING
).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 isBIT_VECTOR
.boolean
isInteger()
Checks whether the literal isINTEGER
.boolean
isReal()
Checks whether the literal isREAL
.boolean
isString()
Checks whether the literal isSTRING
.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()
-
-
-
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
, orSTRING
).- Returns:
- the literal type.
-
isBitVector
public boolean isBitVector()
Checks whether the literal isBIT_VECTOR
.- Returns:
true
iff the literal isBIT_VECTOR
.
-
isInteger
public boolean isInteger()
Checks whether the literal isINTEGER
.- Returns:
true
iff the literal isINTEGER
.
-
isReal
public boolean isReal()
Checks whether the literal isREAL
.- Returns:
true
iff the literal isREAL
.
-
isString
public boolean isString()
Checks whether the literal isSTRING
.- Returns:
true
iff the literal isSTRING
.
-
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 classjava.lang.Object
-
clone
public VerilogLiteral clone()
- Overrides:
clone
in classjava.lang.Object
-
-