All Packages Class Hierarchy This Package Previous Next Index
Class byucc.jhdl.base.BV
java.lang.Object
|
+----java.lang.Number
|
+----byucc.jhdl.base.BV
- public class BV
- extends Number
- implements Cloneable, Serializable
Copyright (c) 1999-2000 Brigham Young University. All rights reserved.
Reproduction in whole or in part in any form or medium without express
permission of Brigham Young University is prohibited.
General Description
This class defines a structure that represents legal values for wires.
Each BitVector (BV) has both a width and a value. In addition, a variety
of methods are provided for manipulation of BVs.
Constructors
In general, the constructors are of the form:
BV(width, value [, sign_ext]).
width must be a positive integer, or a
BVException is thrown.
value can be a boolean, byte, char, short, int, long, low-endian int[]
(that is, the least significant bits are in slot [0]), String, BigInteger, or BV.
If value is wider than width, only the least significant bits will
be used; if width is wider, the most significant bits will be set according
to sign_ext.
sign_ext can be ZERO_PAD or SIGN_EXT, constants
inherited by extending Cell. ZERO_PAD will set all bits beyond those
provided to 0, SIGN_EXT will set all extra bits to the value of the
most significant bit provided. When not provided, default behavior of the
constructors is to ZERO_PAD.
String constructors have some minor differences. width may be
the constant DETERMINE_FROM_STRING, or it may be omitted in which
case it defaults to DETERMINE_FROM_STRING. This constant will set
the width according to the number of bits per character of binary, octal, or
hexadecimal strings, or to the minimum number of bits needed for a decimal
string to be represented in 2's-complement. The String will be parsed as a
decimal string unless prefixed with "0b" for binary, "0o" for octal, or "0x" for
hexadecimal, but is not case sensitive. If a String is decimal, it is explicitly
signed by the presence or absence of '-' at the beginning of the string, and
in that case the flag sign_ext has no meaning. Whitespace in the string
is ignored. If a String cannot be parsed, a NumberFormatException is thrown.
Additionally, the constructor BV(BV vector) is valid, simply cloning
the vector. The constructors BV(BV bv1, BV bv2 [, BV bv3 [, BV bv4]])
and BV(BV[] array) concatenate the given BVs, with the first one listed
providing the least significant bits. The constructor BV(int width)
creates a BV with value 0. The constructor BV() creates a BV with width
1 and value 0. The constructor BV(Wire w) creates a BV with the width
of the wire and value 0.
Instance modification:
Once a BV has been constructed, it can be modified directly with the method
setValue([width,] value [, sign_ext]).
Here, the parameters behave the same as in the constructors, except that
width is optional and value required. If width is not
specified, the BV does not change in width from its previous value, even when
value is a String. In order to have different type signatures,
setValue(int, boolean) treats the int as the value and the boolean
as the sign_ext parameter - in order to interpret the int as the width and set
a boolean value, a second boolean for sign_ext must be included.
The width of a BV can be modified by
setWidth(width [, sign_ext]).
If width is greater than the prior width, the new bits are set according
to sign_ext, defaulting to ZERO_PAD if not specified.
Also, setWidth(Wire w [, sign_ext]) sets the width to that
of the wire argument.
Additionally, the methods
setValue(BV bv1, BV bv2 [, BV bv3 [, BV bv4]]) and
setValue(BV[] array) concatenate the given BVs, with the first one
providing the least significant bits of the new BV.
Operations:
All operator methods are static, and return a BV. Each operator is of the form:
operator([width, ] arglist [, output]).
When width is specified, the output will be that width, otherwise, it
will be the width of output or the default as determined by the operation.
When output is specified, it is modified to get the result of the
operation, and is returned for chaining or nesting operations. When output
is not specified, a new BV is created with the result and returned, available for
assignment.
Caution should be excercised in assigning output to a variable when output
is specified, because multiple references to the same BV could lead to data corruption.
See the individual operations for information on default width, and for the
syntax of arglist. In general, arglist is a single BV for unary
operators, and two BVs for binary.
Most operations also have an optional sign_ext flag as the last argument.
In general, this flag determines whether an operation will be signed or unsigned,
and whether the arguments and result will be sign-extended or zero-padded. See the
operation in question to determine the behavior of the method with or without the
use of this flag, when it is supported.
Arithmetic operators include add, incr (increment),
sub, decr (decrement), abs (absolute value),
negate, mult (multiply), div (divide),
mod (modulus), pow (exponentiation), max,
and min. Note that pow takes an int, not a BV, as the
argument for the exponent, and that illegal math operations, like division by
0, throw a BVException.
Boolean operators include and, or, not,
xor, nand, nor, xnor. Shift
operators include shiftRight, shiftLeft,
barrelShiftRight, and barrelShiftLeft. Note that the
shift operations take an int, not a BV, as the argument for shift amount, and that
a negative shift amount simply shifts in the opposite direction. The operator
reverse simply reverses the bit order from most to least significant.
Comparison methods:
These instance methods return a boolean for comparison to 0:
negative, positive, zero.
equals(Object obj) overrides Object.equals for strict equality (both
width and value are identical), and is accompanied by hashCode()
to allow HashTables of BVs. signum returns -1 if the value is
negative, 0 if it is zero, or 1 if it is positive, as a 2's-complement number.
compare(BV bv2 [, sign_ext]) returns -1 if the bound
instance is less than the argument, 0 if equal, and 1 if greater, with
sign_ext determining whether the comparisons are signed or unsigned.
In addition, the following comparison methods exist in both an instance
(where the bound reference is compared to the first argument) and a static
(where the first argument is compared to the second) version, returning
true if and only if the relation is satisfied: lt
(less than), gt (greater than), lteq (less than or
equal), gteq (greater than or equal), eq (equal in
value, not necessarily width), and neq (not equal). Again, the
presence of the optional flag sign_ext determines whether to perform
signed or unsigned comparison.
Accessor methods:
The method stringBitWidth(String, [boolean]) returns the minimum
number of bits needed to represent the string as a BV, either including or
ignoring leading 0 bits in the string.
The following instance methods allow read access to the width and arbitrary
portions of the value: getWidth, getBit,
upperBits, lowerBits, and range.
In addition, these instance methods allow write access to an arbitrary subset
of an existing BV: setBit, setBits, clearBit,
clearBits, toggleBit, toggleBits, and
setRange. See the individual methods for more information on the
argument types, but the return value is the updated BV except for getBit.
In general, attempts to access bits out of the boundaries of the width will
throw a BVException.
Further methods for obtaining information about a BV are getLSBOn,
getMSBOff, getLSBOn, getLSBOff,
getOnCount, and getOffCount. Also, the method
clone() overrides that of Object, and returns a clone as type Object.
Conversion methods:
The following methods override Number, and provide a way to convert a BV
to native types (although the conversion may lose precision): byteValue,
shortValue, intValue, longValue,
floatValue, and doubleValue.
These methods also convert a BV to various types, and accept the optional
argument sign_ext of whether or not to sign-extend smaller BVs into
the return type: toBoolean, toByte, toShort,
toChar, toInt, toLong, toArray
(a low-endian int[], where the lsb is in slot [0]). Formatted String conversion is
provided with toBinaryString, toDecimalString, and
toHexString.
The method toString overrides Object, and displays the width
of the BV inside parentheses, before the value in hexadecimal, spaced every
8 characters for legibility.
- Author:
- Eric Blake
-
DETERMINE_FROM_STRING
- Set the width according to the number of bits required to represent the String.
-
SIGN_EXT
- Set any bits beyond those provided to the value of the most significant bit provided.
-
ZERO_PAD
- Set any bits beyond those provided to 0.
-
BV()
- Creates a BV of width 1 and value 0.
-
BV(BigInteger)
- Creates a BV of width value.bitLength() from the BigInteger.
-
BV(BV)
- Creates a BV of identical width (short for (BV)clone()).
-
BV(BV, BV)
- Creates a BV by concatenating the given BVs, with the first argument providing the
least significant bits.
-
BV(BV, BV, BV)
- Creates a BV by concatenating the given BVs, with the first argument providing the
least significant bits.
-
BV(BV, BV, BV, BV)
- Creates a BV by concatenating the given BVs, with the first argument providing the
least significant bits.
-
BV(BV[])
- Creates a BV by concatenating the given BVs, with the BV in slot 0 providing the
least significant bits.
-
BV(int)
- Creates a BV of specified width and value 0.
-
BV(int, BigInteger)
- Creates a BV of arbitrary width, with zero-padding as necessary.
-
BV(int, BigInteger, boolean)
- Creates a BV of arbitrary width, with appropriate sign extension as necessary.
-
BV(int, boolean)
- Creates a BV of arbitrary width, set to true (1) or false (0).
-
BV(int, boolean, boolean)
- Creates a BV of arbitrary width, set to true or false.
-
BV(int, BV)
- Creates a BV of arbitrary width, with zero-padding as necessary.
-
BV(int, BV, boolean)
- Creates a BV of arbitrary width, with appropriate sign extension as necessary.
-
BV(int, byte)
- Creates a BV of arbitrary width, with zero-padding as necessary.
-
BV(int, byte, boolean)
- Creates a BV of arbitrary width, with appropriate sign extension as necessary.
-
BV(int, char)
- Creates a BV of arbitrary width, with zero-padding as necessary.
-
BV(int, char, boolean)
- Creates a BV of arbitrary width, with appropriate sign extension as necessary.
-
BV(int, int)
- Creates a BV of arbitrary width, with zero-padding as necessary.
-
BV(int, int, boolean)
- Creates a BV of arbitrary width, with appropriate sign extension as necessary.
-
BV(int, int[])
- Creates a BV of arbitrary width, with zero-padding as necessary.
-
BV(int, int[], boolean)
- Creates a BV of arbitrary width, with appropriate sign extension as necessary.
-
BV(int, long)
- Creates a BV of arbitrary width, with zero-padding as necessary.
-
BV(int, long, boolean)
- Creates a BV of arbitrary width, with appropriate sign extension as necessary.
-
BV(int, short)
- Creates a BV of arbitrary width, with zero-padding as necessary.
-
BV(int, short, boolean)
- Creates a BV of arbitrary width, with appropriate sign extension as necessary.
-
BV(int, String)
- Creates a BV of arbitrary width, with zero-padding as necessary.
-
BV(int, String, boolean)
- Creates a BV of arbitrary width, with appropriate sign extension as necessary.
-
BV(String)
- Creates a BV of width DETERMINE_FROM_STRING.
-
BV(Wire)
- Creates a BV with value 0 and width of the wire argument.
-
abs(BV)
- Returns a new BV with the absolute value of the argument, with default width.
-
abs(BV, BV)
- Changes the value of out to the absolute value of the argument, with default width.
-
abs(int, BV)
- Returns a new BV with the absolute value of the argument, with specified width.
-
abs(int, BV, BV)
- Changes the value of out to the absolute value of the argument, with specified width.
-
add(BV, BV)
- Returns a new BV containing the sum of in1 and in2 with default width.
-
add(BV, BV, boolean)
- Returns a new BV containing the sum of in1 and in2 with default width.
-
add(BV, BV, BV)
- Changes value of out to the sum of in1 and in2, keeping existing width.
-
add(BV, BV, BV, boolean)
- Changes value of out to the sum of in1 and in2, keeping existing width.
-
add(int, BV, BV)
- Returns a new BV containing the sum of in1 and in2 with specified width.
-
add(int, BV, BV, boolean)
- Returns a new BV containing the sum of in1 and in2 with specified width.
-
add(int, BV, BV, BV)
- Changes value of out to the sum of in1 and in2, resizing out to specified width.
-
add(int, BV, BV, BV, boolean)
- Changes value of out to the sum of in1 and in2, resizing out to specified width.
-
and(BV, BV)
- Returns boolean and of the two arguments, with default width.
-
and(BV, BV, boolean)
- Returns boolean and of the two arguments, with default width.
-
and(BV, BV, BV)
- Changes value of out to the boolean and of the two arguments, with original width.
-
and(BV, BV, BV, boolean)
- Changes value of out to the boolean and of the two arguments, with original width.
-
and(int, BV, BV)
- Returns boolean and of the two arguments, with specified width.
-
and(int, BV, BV, boolean)
- Returns boolean and of the two arguments, with specified width.
-
and(int, BV, BV, BV)
- Changes value of out to the boolean and of the two arguments, with specified width.
-
and(int, BV, BV, BV, boolean)
- Changes value of out to the boolean and of the two arguments, with specified width.
-
barrelShiftLeft(BV, int)
- Barrel shifts the BV left (moves bits from left end to the right) by amt places.
-
barrelShiftLeft(BV, int, BV)
- Barrel shifts the BV left (moves bits from left end to the right) by amt places.
-
barrelShiftRight(BV, int)
- Barrel shifts the BV right (moves bits from right end to the left) by amt places.
-
barrelShiftRight(BV, int, BV)
- Barrel shifts the BV right (moves bits from right end to the left) by amt places.
-
byteValue()
- Returns the least significant 8 bits of the BV, zero-padded if needed.
-
clearBit(int)
- Clears value of bit in given position to 0.
-
clearBits(int, int)
- Clears value of a range of bits to 0.
-
clone()
- Returns a clone of this.
-
compare(BV)
- Returns integer representing relation between two bit vectors, default of sign extension.
-
compare(BV, boolean)
- Returns integer representing relation between two bit vectors, according to sign_ext.
-
compare(BV, BV)
- Returns integer representing relation between two bit vectors, default of sign extension.
-
compare(BV, BV, boolean)
- Returns integer representing relation between two bit vectors, according to sign_ext.
-
decr(BV)
- Returns a new BV with value 1 less than in and default width.
-
decr(BV, boolean)
- Returns a new BV with value 1 less than in and default width.
-
decr(BV, BV)
- Changes the value of out to be one more than the value of in.
-
decr(BV, BV, boolean)
- Changes the value of out to be one more than the value of in.
-
decr(int, BV)
- Returns a new BV with value 1 less than in and default width.
-
decr(int, BV, boolean)
- Returns a new BV with value 1 less than in and default width.
-
decr(int, BV, BV)
- Changes the value of out to be one more than the value of in.
-
decr(int, BV, BV, boolean)
- Changes the value of out to be one more than the value of in.
-
div(BV, BV)
- Returns a new BV containing the quotient of in1 and in2 with default width.
-
div(BV, BV, boolean)
- Returns a new BV containing the quotient of in1 and in2 with default width.
-
div(BV, BV, BV)
- Changes value of out to the quotient of in1 and in2, keeping existing width.
-
div(BV, BV, BV, boolean)
- Changes value of out to the quotient of in1 and in2, keeping existing width.
-
div(int, BV, BV)
- Returns a new BV containing the quotient of in1 and in2 with specified width.
-
div(int, BV, BV, boolean)
- Returns a new BV containing the quotient of in1 and in2 with specified width.
-
div(int, BV, BV, BV)
- Changes value of out to the quotient of in1 and in2, resizing out to specified width.
-
div(int, BV, BV, BV, boolean)
- Changes value of out to the quotient of in1 and in2, resizing out to specified width.
-
doubleValue()
- Returns the closest double to the integral value of the BV.
-
eq(BV)
- Returns true iff this == bv2.
-
eq(BV, boolean)
- Returns true iff this == bv2.
-
eq(BV, BV)
- Returns true iff bv1 == bv2.
-
eq(BV, BV, boolean)
- Returns true iff bv1 == bv2.
-
equals(Object)
- Returns true iff obj is equivalent to this.
-
floatValue()
- Returns the closest float to the integral value of the BV.
-
getBit(int)
- Returns value of bit in given position.
-
getLSBOff()
- Returns the position of the first zero bit, starting from the least significant
position.
-
getLSBOff(BV)
- Returns the position of the first zero bit, starting from the least significant
position.
-
getLSBOn()
- Returns the position of the first non-zero bit, starting from the least significant
position.
-
getLSBOn(BV)
- Returns the position of the first non-zero bit, starting from the least significant
position.
-
getMSBOff()
- Returns the position of the first zero bit, starting from the most significant
position.
-
getMSBOff(BV)
- Returns the position of the first zero bit, starting from the most significant
position.
-
getMSBOn()
- Returns the position of the first non-zero bit, starting from the most significant
position.
-
getMSBOn(BV)
- Returns the position of the first non-zero bit, starting from the most significant
position.
-
getOffCount()
- Returns a count of the number of bits that are currently 0.
-
getOffCount(BV)
- Returns a count of the number of bits that are currently 0.
-
getOnCount()
- Returns a count of the number of bits that are currently 1.
-
getOnCount(BV)
- Returns a count of the number of bits that are currently 1.
-
getWidth()
- Retrieves the width of the BV.
-
gt(BV)
- Returns true iff this > bv2.
-
gt(BV, boolean)
- Returns true iff this > bv2.
-
gt(BV, BV)
- Returns true iff bv1 > bv2.
-
gt(BV, BV, boolean)
- Returns true iff bv1 > bv2.
-
gteq(BV)
- Returns true iff this >= bv2.
-
gteq(BV, boolean)
- Returns true iff this >= bv2.
-
gteq(BV, BV)
- Returns true iff bv1 >= bv2.
-
gteq(BV, BV, boolean)
- Returns true iff bv1 >= bv2.
-
hashCode()
- Returns a hash of this.
-
incr(BV)
- Returns a new BV with value 1 greater than in and default width.
-
incr(BV, boolean)
- Returns a new BV with value 1 greater than in and default width.
-
incr(BV, BV)
- Changes the value of out to be one more than the value of in.
-
incr(BV, BV, boolean)
- Changes the value of out to be one more than the value of in.
-
incr(int, BV)
- Returns a new BV with value 1 greater than in and default width.
-
incr(int, BV, boolean)
- Returns a new BV with value 1 greater than in and default width.
-
incr(int, BV, BV)
- Changes the value of out to be one more than the value of in.
-
incr(int, BV, BV, boolean)
- Changes the value of out to be one more than the value of in.
-
intValue()
- Returns the least significant 32 bits of the BV, zero-padded if needed.
-
longValue()
- Returns the least significant 64 bits of the BV, zero-padded if needed.
-
lowerBits(int)
- Returns a BV that has the present value and width of the specified amount of the least
significant bits of this.
-
lowerBits(int, BV)
- Changes given BV to have the present value and width of the specified amount of the least
significant bits of this.
-
lt(BV)
- Returns true iff this < bv2.
-
lt(BV, boolean)
- Returns true iff this < bv2.
-
lt(BV, BV)
- Returns true iff bv1 < bv2.
-
lt(BV, BV, boolean)
- Returns true iff bv1 < bv2.
-
lteq(BV)
- Returns true iff this <= bv2.
-
lteq(BV, boolean)
- Returns true iff this <= bv2.
-
lteq(BV, BV)
- Returns true iff bv1 <= bv2.
-
lteq(BV, BV, boolean)
- Returns true iff bv1 <= bv2.
-
max(BV, BV)
- Returns a new BV with the maximum value of the two arguments, with default width.
-
max(BV, BV, boolean)
- Returns a new BV with the maximum value of the two arguments, with default width.
-
max(BV, BV, BV)
- Changes the value of out to the maximum value of the two arguments, with default width.
-
max(BV, BV, BV, boolean)
- Changes the value of out to the maximum value of the two arguments, with default width.
-
max(int, BV, BV)
- Returns a new BV with the maximum value of the two arguments, with specified width.
-
max(int, BV, BV, boolean)
- Returns a new BV with the maximum value of the two arguments, with specified width.
-
max(int, BV, BV, BV)
- Changes the value of out to the maximum value of the two arguments, with specified width.
-
max(int, BV, BV, BV, boolean)
- Changes the value of out to the maximum value of the two arguments, with specified width.
-
min(BV, BV)
- Returns a new BV with the minimum value of the two arguments, with default width.
-
min(BV, BV, boolean)
- Returns a new BV with the minimum value of the two arguments, with default width.
-
min(BV, BV, BV)
- Changes the value of out to the minimum value of the two arguments, with default width.
-
min(BV, BV, BV, boolean)
- Changes the value of out to the minimum value of the two arguments, with default width.
-
min(int, BV, BV)
- Returns a new BV with the minimum value of the two arguments, with specified width.
-
min(int, BV, BV, boolean)
- Returns a new BV with the minimum value of the two arguments, with specified width.
-
min(int, BV, BV, BV)
- Changes the value of out to the minimum value of the two arguments, with specified width.
-
min(int, BV, BV, BV, boolean)
- Changes the value of out to the minimum value of the two arguments, with specified width.
-
mod(BV, BV)
- Returns a new BV containing the modulus of in1 and in2 with default width.
-
mod(BV, BV, boolean)
- Returns a new BV containing the modulus of in1 and in2 with default width.
-
mod(BV, BV, BV)
- Changes value of out to the modulus of in1 and in2, keeping existing width.
-
mod(BV, BV, BV, boolean)
- Changes value of out to the modulus of in1 and in2, keeping existing width.
-
mod(int, BV, BV)
- Returns a new BV containing the modulus of in1 and in2 with specified width.
-
mod(int, BV, BV, boolean)
- Returns a new BV containing the modulus of in1 and in2 with specified width.
-
mod(int, BV, BV, BV)
- Changes value of out to the modulus of in1 and in2, resizing out to specified width.
-
mod(int, BV, BV, BV, boolean)
- Changes value of out to the modulus of in1 and in2, resizing out to specified width.
-
mult(BV, BV)
- Returns a new BV containing the product of in1 and in2 with default width.
-
mult(BV, BV, boolean)
- Returns a new BV containing the product of in1 and in2 with default width.
-
mult(BV, BV, BV)
- Changes value of out to the product of in1 and in2, keeping existing width.
-
mult(BV, BV, BV, boolean)
- Changes value of out to the product of in1 and in2, keeping existing width.
-
mult(int, BV, BV)
- Returns a new BV containing the product of in1 and in2 with specified width.
-
mult(int, BV, BV, boolean)
- Returns a new BV containing the product of in1 and in2 with specified width.
-
mult(int, BV, BV, BV)
- Changes value of out to the product of in1 and in2, resizing out to specified width.
-
mult(int, BV, BV, BV, boolean)
- Changes value of out to the product of in1 and in2, resizing out to specified width.
-
nand(BV, BV)
- Returns boolean nand of the two arguments, with default width.
-
nand(BV, BV, boolean)
- Returns boolean nand of the two arguments, with default width.
-
nand(BV, BV, BV)
- Changes value of out to the boolean nand of the two arguments, with original width.
-
nand(BV, BV, BV, boolean)
- Changes value of out to the boolean nand of the two arguments, with original width.
-
nand(int, BV, BV)
- Returns boolean nand of the two arguments, with specified width.
-
nand(int, BV, BV, boolean)
- Returns boolean nand of the two arguments, with specified width.
-
nand(int, BV, BV, BV)
- Changes value of out to the boolean nand of the two arguments, with specified width.
-
nand(int, BV, BV, BV, boolean)
- Changes value of out to the boolean nand of the two arguments, with specified width.
-
negate(BV)
- Returns a new BV containing the negation of in (in 2's complement) with default width.
-
negate(BV, boolean)
- Returns a new BV containing the negation of in (in 2's complement) with default width.
-
negate(BV, BV)
- Returns the BV out, with value modified to be the negation of in.
-
negate(BV, BV, boolean)
- Returns the BV out, with value modified to be the negation of in.
-
negate(int, BV)
- Returns a new BV containing the negation of in with specified width.
-
negate(int, BV, boolean)
- Returns a new BV containing the negation of in with specified width.
-
negate(int, BV, BV)
- Returns the BV out, with value the negation of in and specified width.
-
negate(int, BV, BV, boolean)
- Returns the BV out, with value the negation of in and specified width.
-
negative()
- Returns true if negative when interpreted as a 2's-complement number.
-
negative(BV)
- Returns true if negative when interpreted as a 2's-complement number.
-
neq(BV)
- Returns true iff this != bv2.
-
neq(BV, boolean)
- Returns true iff this != bv2.
-
neq(BV, BV)
- Returns true iff bv1 != bv2.
-
neq(BV, BV, boolean)
- Returns true iff bv1 != bv2.
-
nor(BV, BV)
- Returns boolean nor of the two arguments, with default width.
-
nor(BV, BV, boolean)
- Returns boolean nor of the two arguments, with default width.
-
nor(BV, BV, BV)
- Changes value of out to the boolean nor of the two arguments, with original width.
-
nor(BV, BV, BV, boolean)
- Changes value of out to the boolean nor of the two arguments, with original width.
-
nor(int, BV, BV)
- Returns boolean nor of the two arguments, with specified width.
-
nor(int, BV, BV, boolean)
- Returns boolean nor of the two arguments, with specified width.
-
nor(int, BV, BV, BV)
- Changes value of out to the boolean nor of the two arguments, with specified width.
-
nor(int, BV, BV, BV, boolean)
- Changes value of out to the boolean nor of the two arguments, with specified width.
-
not(BV)
- Returns boolean not (the inverse) of the argument, with default width.
-
not(BV, boolean)
- Returns boolean not of the argument, with default width.
-
not(BV, BV)
- Changes value of out to the boolean not of the argument, with original width.
-
not(BV, BV, boolean)
- Changes value of out to the boolean not of the argument, with original width.
-
not(int, BV)
- Returns boolean not of the argument, with specified width.
-
not(int, BV, boolean)
- Returns boolean not of the argument, with specified width.
-
not(int, BV, BV)
- Changes value of out to the boolean not of the argument, with specified width.
-
not(int, BV, BV, boolean)
- Changes value of out to the boolean not of the argument, with specified width.
-
or(BV, BV)
- Returns boolean or of the two arguments, with default width.
-
or(BV, BV, boolean)
- Returns boolean or of the two arguments, with default width.
-
or(BV, BV, BV)
- Changes value of out to the boolean or of the two arguments, with original width.
-
or(BV, BV, BV, boolean)
- Changes value of out to the boolean or of the two arguments, with original width.
-
or(int, BV, BV)
- Returns boolean or of the two arguments, with specified width.
-
or(int, BV, BV, boolean)
- Returns boolean or of the two arguments, with specified width.
-
or(int, BV, BV, BV)
- Changes value of out to the boolean or of the two arguments, with specified width.
-
or(int, BV, BV, BV, boolean)
- Changes value of out to the boolean or of the two arguments, with specified width.
-
positive()
- Returns true if positive when interpreted as a 2's-complement number.
-
positive(BV)
- Returns true if positive when interpreted as a 2's-complement number.
-
pow(BV, int)
- Returns the value of the BV raised to the amt power, with default width.
-
pow(BV, int, boolean)
- Returns the value of the BV raised to the amt power, with default width.
-
pow(BV, int, BV)
- Changes out to the value of in raised to the amt power, keeping width of out.
-
pow(BV, int, BV, boolean)
- Changes out to the value of in raised to the amt power, keeping width of out.
-
pow(int, BV, int)
- Returns the value of the BV raised to the amt power, with specified width.
-
pow(int, BV, int, boolean)
- Returns the value of the BV raised to the amt power, with specified width.
-
pow(int, BV, int, BV)
- Changes out to the value of in raised to the amt power, with specified width.
-
pow(int, BV, int, BV, boolean)
- Changes out to the value of in raised to the amt power, with specified width.
-
range(int, int)
- Returns a BV that has the present value of the specified range of this.
-
range(int, int, BV)
- Returns a BV that has the present value of the specified range of this.
-
reverse(BV)
- Reverses the order of the bits from most to least significant.
-
reverse(BV, BV)
- Reverses the order of the bits from most to least significant.
-
setBit(int)
- Sets value of bit in given position to 1.
-
setBit(int, boolean)
- Sets value of bit in given position to 1 if value is true, to 0 if value is false.
-
setBits(int, int)
- Sets value of a range of bits to 1.
-
setBits(int, int, boolean)
- Sets value of a range of bits to 1 if value is true, to 0 if value is false.
-
setRange(int, BV)
- Sets the range of the BV starting at lower to the value of the argument, stopping at
either the most significant bit of the argument or the instance.
-
setRange(int, int, BV)
- Sets the given range of the BV to the value of the argument, zero-padding or taking
the least significant portion of the argument as needed.
-
setRange(int, int, BV, boolean)
- Sets the given range of the BV to the value of the argument, taking the least significant
portion of the argument or extending it according to sign_ext as needed.
-
setValue(BigInteger)
- Sets value of BV, with zero-padding as necessary.
-
setValue(BigInteger, boolean)
- Sets value of BV, with appropriate sign extension as necessary.
-
setValue(boolean)
- Sets value of BV to true (1) or false (0).
-
setValue(boolean, boolean)
- Sets value of BV to true or false.
-
setValue(BV)
- Sets value of BV, with zero-padding as necessary.
-
setValue(BV, boolean)
- Sets value of BV, with appropriate sign extension as necessary.
-
setValue(BV, BV)
- Sets value and width of BV to the concatenation of the arguments, with the first
argument providing the least significant bits.
-
setValue(BV, BV, BV)
- Sets value and width of BV to the concatenation of the arguments, with the first
argument providing the least significant bits.
-
setValue(BV, BV, BV, BV)
- Sets value and width of BV to the concatenation of the arguments, with the first
argument providing the least significant bits.
-
setValue(BV[])
- Sets value and width of BV to the concatenation of the arguments, with the BV in array
slot 0 providing the least significant bits.
-
setValue(byte)
- Sets value of BV, with zero-padding as necessary.
-
setValue(byte, boolean)
- Sets value of BV, with appropriate sign extension as necessary.
-
setValue(char)
- Sets value of BV, with zero-padding as necessary.
-
setValue(char, boolean)
- Sets value of BV, with appropriate sign extension as necessary.
-
setValue(int)
- Sets value of BV, with zero-padding as necessary.
-
setValue(int, BigInteger)
- Sets value and width of BV, with zero-padding as necessary.
-
setValue(int, BigInteger, boolean)
- Sets value and width of BV, with appropriate sign exension as necessary.
-
setValue(int, boolean)
- Sets value of BV, with appropriate sign extension as necessary.
-
setValue(int, boolean, boolean)
- Sets width and value of BV to true or false.
-
setValue(int, BV)
- Sets value and width of BV, with zero-padding as necessary.
-
setValue(int, BV, boolean)
- Sets value and width of BV, with appropriate sign exension as necessary.
-
setValue(int, byte)
- Sets value and width of BV, with zero-padding as necessary.
-
setValue(int, byte, boolean)
- Sets value and width of BV, with appropriate sign exension as necessary.
-
setValue(int, char)
- Sets value and width of BV, with zero-padding as necessary.
-
setValue(int, char, boolean)
- Sets value and width of BV, with appropriate sign exension as necessary.
-
setValue(int, int)
- Sets value and width of BV, with zero-padding as necessary.
-
setValue(int, int, boolean)
- Sets value and width of BV, with appropriate sign exension as necessary.
-
setValue(int, int[])
- Sets value and width of BV, with zero-padding as necessary.
-
setValue(int, int[], boolean)
- Sets value and width of BV, with appropriate sign exension as necessary.
-
setValue(int, long)
- Sets value and width of BV, with zero-padding as necessary.
-
setValue(int, long, boolean)
- Sets value and width of BV, with appropriate sign exension as necessary.
-
setValue(int, short)
- Sets value and width of BV, with zero-padding as necessary.
-
setValue(int, short, boolean)
- Sets value and width of BV, with appropriate sign exension as necessary.
-
setValue(int, String)
- Sets value and width of BV, with zero-padding as necessary.
-
setValue(int, String, boolean)
- Sets value and width of BV, with appropriate sign exension as necessary.
-
setValue(int[])
- Sets value of BV, with zero-padding as necessary.
-
setValue(int[], boolean)
- Sets value of BV, with appropriate sign extension as necessary.
-
setValue(long)
- Sets value of BV, with zero-padding as necessary.
-
setValue(long, boolean)
- Sets value of BV, with appropriate sign extension as necessary.
-
setValue(short)
- Sets value of BV, with zero-padding as necessary.
-
setValue(short, boolean)
- Sets value of BV, with appropriate sign extension as necessary.
-
setValue(String)
- Sets value of BV, with zero-padding as necessary.
-
setValue(String, boolean)
- Sets value of BV, with appropriate sign extension as necessary.
-
setWidth(int)
- Sets width of BV, with appropriate sign extension as necessary.
-
setWidth(int, boolean)
- Sets width of BV, with appropriate sign extension as necessary.
-
setWidth(Wire)
- Sets width of BV to match width of wire argument.
-
setWidth(Wire, boolean)
- Sets width of BV to match width of wire argument, sign extension as specified.
-
shiftLeft(BV, int)
- Returns the value of the BV shifted right by amt places, with default width.
-
shiftLeft(BV, int, boolean)
- Returns the value of the BV shifted left by amt places, with default width.
-
shiftLeft(BV, int, BV)
- Changes out to the value of in shifted left by amt places, keeping width of out.
-
shiftLeft(BV, int, BV, boolean)
- Changes out to the value of in shifted left by amt places, keeping width of out.
-
shiftLeft(int, BV, int)
- Returns the value of the BV shifted left by amt places, with specified width.
-
shiftLeft(int, BV, int, boolean)
- Returns the value of the BV shifted left by amt places, with specified width.
-
shiftLeft(int, BV, int, BV)
- Changes out to the value of in shifted left by amt places, with specified width.
-
shiftLeft(int, BV, int, BV, boolean)
- Changes out to the value of in shifted left by amt places, with specified width.
-
shiftRight(BV, int)
- Returns the value of the BV shifted right by amt places, with default width.
-
shiftRight(BV, int, boolean)
- Returns the value of the BV shifted right by amt places, with default width.
-
shiftRight(BV, int, BV)
- Changes out to the value of in shifted right by amt places, keeping width of out.
-
shiftRight(BV, int, BV, boolean)
- Changes out to the value of in shifted right by amt places, keeping width of out.
-
shiftRight(int, BV, int)
- Returns the value of the BV shifted right by amt places, with specified width.
-
shiftRight(int, BV, int, boolean)
- Returns the value of the BV shifted right by amt places, with specified width.
-
shiftRight(int, BV, int, BV)
- Changes out to the value of in shifted right by amt places, with specified width.
-
shiftRight(int, BV, int, BV, boolean)
- Changes out to the value of in shifted right by amt places, with specified width.
-
shortValue()
- Returns the least significant 16 bits of the BV, zero-padded if needed.
-
signum()
- Returns the signum of the value.
-
signum(BV)
- Returns the signum of the value.
-
stringBitWidth(String)
- Returns the width that DETERMINE_FROM_STRING will use for the given string
-
stringBitWidth(String, boolean)
- Returns the number of bits needed to represent the given string
If ignore_zeroes is false, this is equivalent to the width using DETERMINE_FROM_STRING
in the constructor; if true, it is the position of the first non-zero bit
-
sub(BV, BV)
- Returns a new BV containing the difference of in1 and in2 with default width.
-
sub(BV, BV, boolean)
- Returns a new BV containing the difference of in1 and in2 with default width.
-
sub(BV, BV, BV)
- Changes value of out to the difference of in1 and in2, keeping existing width.
-
sub(BV, BV, BV, boolean)
- Changes value of out to the difference of in1 and in2, keeping existing width.
-
sub(int, BV, BV)
- Returns a new BV containing the difference of in1 and in2 with specified width.
-
sub(int, BV, BV, boolean)
- Returns a new BV containing the difference of in1 and in2 with specified width.
-
sub(int, BV, BV, BV)
- Changes value of out to the difference of in1 and in2, resizing out to specified width.
-
sub(int, BV, BV, BV, boolean)
- Changes value of out to the difference of in1 and in2, resizing out to specified width.
-
toArray()
- Returns the value as a low-endian int[] (ie.
-
toArray(boolean)
- Returns the value as an int[] (ie.
-
toBigInteger()
- Returns the value as a BigInteger, with zero padding.
-
toBigInteger(boolean)
- Returns the value as a BigInteger, with appropriate sign extension.
-
toBinaryString()
- Returns value of BV as a straight binary string, no leading 0's.
-
toBinaryString(boolean)
- Returns value of BV as a straight binary string, with leading 0's iff flag is true.
-
toBoolean()
- Returns true if the BV is non-zero.
-
toByte()
- Returns the least significant 8 bits of the BV, zero-padded if needed.
-
toByte(boolean)
- Returns the least significant 8 bits of the BV, with appropriate sign extension.
-
toChar()
- Returns the least significant 16 bits of the BV, zero-padded if needed.
-
toChar(boolean)
- Returns the least significant 16 bits of the BV, with appropriate sign extension.
-
toDecimalString()
- Returns value of BV as an unsigned decimal string, no leading 0's.
-
toDecimalString(boolean)
- Returns value of BV as a decimal string, no leading 0's, interpreted as a
2's-complement number iff flag is true.
-
toggleBit(int)
- Toggles value of bit in given position between 1 and 0, and returns its new value.
-
toggleBits(int, int)
- Toggles value of each bit in a range between 1 and 0.
-
toHexString()
- Returns value of BV as a straight hexadecimal string, no leading 0's.
-
toHexString(boolean)
- Returns value of BV as a straight hexadecimal string, with leading 0's iff flag is true.
-
toInt()
- Returns the least significant 32 bits of the BV, zero-padded if needed.
-
toInt(boolean)
- Returns the least significant 32 bits of the BV, with appropriate sign extension.
-
toLong()
- Returns the least significant 64 bits of the BV, zero-padded if needed.
-
toLong(boolean)
- Returns the least significant 64 bits of the BV, with appropriate sign extension.
-
toShort()
- Returns the least significant 16 bits of the BV, zero-padded if needed.
-
toShort(boolean)
- Returns the least significant 16 bits of the BV, with appropriate sign extension.
-
toString()
- Displays a BV as "(width bits)0xvalue", where value is in
hexadecimal, and separated by spaces every 8 characters for legibility.
-
toString(int)
- Returns value of BV as a string of specified radix.
-
upperBits(int)
- Returns a BV that has the present value and width of the specified amount of the most
significant bits of this.
-
upperBits(int, BV)
- Changes given BV to have the present value and width of the specified amount of the most
significant bits of this.
-
xnor(BV, BV)
- Returns boolean xnor of the two arguments, with default width.
-
xnor(BV, BV, boolean)
- Returns boolean xnor of the two arguments, with default width.
-
xnor(BV, BV, BV)
- Changes value of out to the boolean xnor of the two arguments, with original width.
-
xnor(BV, BV, BV, boolean)
- Changes value of out to the boolean xnor of the two arguments, with original width.
-
xnor(int, BV, BV)
- Returns boolean xnor of the two arguments, with specified width.
-
xnor(int, BV, BV, boolean)
- Returns boolean xnor of the two arguments, with specified width.
-
xnor(int, BV, BV, BV)
- Changes value of out to the boolean xnor of the two arguments, with specified width.
-
xnor(int, BV, BV, BV, boolean)
- Changes value of out to the boolean xnor of the two arguments, with specified width.
-
xor(BV, BV)
- Returns boolean xor of the two arguments, with default width.
-
xor(BV, BV, boolean)
- Returns boolean xor of the two arguments, with default width.
-
xor(BV, BV, BV)
- Changes value of out to the boolean xor of the two arguments, with original width.
-
xor(BV, BV, BV, boolean)
- Changes value of out to the boolean xor of the two arguments, with original width.
-
xor(int, BV, BV)
- Returns boolean xor of the two arguments, with specified width.
-
xor(int, BV, BV, boolean)
- Returns boolean xor of the two arguments, with specified width.
-
xor(int, BV, BV, BV)
- Changes value of out to the boolean xor of the two arguments, with specified width.
-
xor(int, BV, BV, BV, boolean)
- Changes value of out to the boolean xor of the two arguments, with specified width.
-
zero()
- Returns true if the value is 0.
-
zero(BV)
- Returns true if the value is 0.
ZERO_PAD
public static final boolean ZERO_PAD
- Set any bits beyond those provided to 0.
SIGN_EXT
public static final boolean SIGN_EXT
- Set any bits beyond those provided to the value of the most significant bit provided.
DETERMINE_FROM_STRING
public static final int DETERMINE_FROM_STRING
- Set the width according to the number of bits required to represent the String.
BV
public BV()
- Creates a BV of width 1 and value 0.
BV
public BV(int width)
- Creates a BV of specified width and value 0.
- Parameters:
- width - The width of the vector.
BV
public BV(Wire w)
- Creates a BV with value 0 and width of the wire argument.
- Parameters:
- w - The wire to determine width from.
BV
public BV(int width,
boolean value)
- Creates a BV of arbitrary width, set to true (1) or false (0).
- Parameters:
- width - The width of the vector.
- value - The value of the vector.
BV
public BV(int width,
boolean value,
boolean sign_ext)
- Creates a BV of arbitrary width, set to true or false. When value is true, ZERO_PAD
sets only the least significant bit, SIGN_EXT sets all bits.
- Parameters:
- width - The width of the vector.
- value - The value of the vector.
- sign_ext - Either ZERO_PAD or SIGN_EXT.
BV
public BV(int width,
byte value)
- Creates a BV of arbitrary width, with zero-padding as necessary.
- Parameters:
- width - The width of the vector.
- value - Up to 8 bits of the vector.
BV
public BV(int width,
byte value,
boolean sign_ext)
- Creates a BV of arbitrary width, with appropriate sign extension as necessary.
- Parameters:
- width - The width of the vector.
- value - Up to 8 bits of the value.
- sign_ext - Either ZERO_PAD or SIGN_EXT.
BV
public BV(int width,
char value)
- Creates a BV of arbitrary width, with zero-padding as necessary.
- Parameters:
- width - The width of the vector.
- value - Up to 16 bits of the value.
BV
public BV(int width,
char value,
boolean sign_ext)
- Creates a BV of arbitrary width, with appropriate sign extension as necessary.
- Parameters:
- width - The width of the vector.
- value - Up to 16 bits of the value.
- sign_ext - Either ZERO_PAD or SIGN_EXT.
BV
public BV(int width,
short value)
- Creates a BV of arbitrary width, with zero-padding as necessary.
- Parameters:
- width - The width of the vector.
- value - Up to 16 bits of the value.
BV
public BV(int width,
short value,
boolean sign_ext)
- Creates a BV of arbitrary width, with appropriate sign extension as necessary.
- Parameters:
- width - The width of the vector.
- value - Up to 16 bits of the value.
- sign_ext - Either ZERO_PAD or SIGN_EXT.
BV
public BV(int width,
int value)
- Creates a BV of arbitrary width, with zero-padding as necessary.
- Parameters:
- width - The width of the vector.
- value - Up to 32 bits of the value.
BV
public BV(int width,
int value,
boolean sign_ext)
- Creates a BV of arbitrary width, with appropriate sign extension as necessary.
- Parameters:
- width - The width of the vector.
- value - Up to 32 bits of the value.
- sign_ext - Either ZERO_PAD or SIGN_EXT.
BV
public BV(int width,
long value)
- Creates a BV of arbitrary width, with zero-padding as necessary.
- Parameters:
- width - The width of the vector.
- value - Up to 64 bits of the value.
BV
public BV(int width,
long value,
boolean sign_ext)
- Creates a BV of arbitrary width, with appropriate sign extension as necessary.
- Parameters:
- width - The width of the vector.
- value - Up to 64 bits of the value.
- sign_ext - Either ZERO_PAD or SIGN_EXT.
BV
public BV(int width,
int value[])
- Creates a BV of arbitrary width, with zero-padding as necessary.
- Parameters:
- width - The width of the vector.
- value - An arbitrary amount of bits, in low-endian order (ie. bits 0-31 are in value[0]).
BV
public BV(int width,
int value[],
boolean sign_ext)
- Creates a BV of arbitrary width, with appropriate sign extension as necessary.
- Parameters:
- width - The width of the vector.
- value - An arbitrary amount of bits, in low-endian order (ie. bits 0-31 are in value[0]).
- sign_ext - Either ZERO_PAD or SIGN_EXT.
BV
public BV(BV vector)
- Creates a BV of identical width (short for (BV)clone()).
- Parameters:
- vector - The original BV.
BV
public BV(BV bv1,
BV bv2)
- Creates a BV by concatenating the given BVs, with the first argument providing the
least significant bits.
- Parameters:
- bv1 - The least significant bits.
- bv2 - The next bits.
BV
public BV(BV bv1,
BV bv2,
BV bv3)
- Creates a BV by concatenating the given BVs, with the first argument providing the
least significant bits.
- Parameters:
- bv1 - The least significant bits.
- bv2 - The next bits.
- bv3 - The next bits.
BV
public BV(BV bv1,
BV bv2,
BV bv3,
BV bv4)
- Creates a BV by concatenating the given BVs, with the first argument providing the
least significant bits.
- Parameters:
- bv1 - The least significant bits.
- bv2 - The next bits.
- bv3 - The next bits.
- bv4 - The next bits.
BV
public BV(BV bv_array[])
- Creates a BV by concatenating the given BVs, with the BV in slot 0 providing the
least significant bits.
- Parameters:
- bv_array - The array of BVs, least significant bits in slot 0.
- Throws: BVException
- if the array contains only null pointers.
BV
public BV(int width,
BV vector)
- Creates a BV of arbitrary width, with zero-padding as necessary.
- Parameters:
- width - The width of the new vector.
- vector - Original BV.
BV
public BV(int width,
BV vector,
boolean sign_ext)
- Creates a BV of arbitrary width, with appropriate sign extension as necessary.
- Parameters:
- width - The width of the new vector.
- vector - Original BV.
- sign_ext - Either ZERO_PAD or SIGN_EXT.
BV
public BV(String value)
- Creates a BV of width DETERMINE_FROM_STRING.
- Parameters:
- value - The String to parse. In decimal, unless prefixed with 0b, 0o, or 0x.
- Throws: NumberFormatException
- if the string cannot be parsed as a valid number
BV
public BV(int width,
String value)
- Creates a BV of arbitrary width, with zero-padding as necessary.
For width of DETERMINE_FROM_STRING, if the string is binary, octal, or hexadecimal,
the vector is (bits per digit)*(digits) wide, and if the string is decimal, the
vector is the minimum number of bits for a 2's-complement representation, given by
ceil(log2(this < 0 ? -this : this + 1)) + 1.
- Parameters:
- width - The width of the new vector.
- value - The String to parse. In decimal, unless prefixed with 0b, 0o, or 0x.
- Throws: NumberFormatException
- if the string cannot be parsed as a valid number
BV
public BV(int width,
String value,
boolean sign_ext)
- Creates a BV of arbitrary width, with appropriate sign extension as necessary.
For width of DETERMINE_FROM_STRING, if the string is binary, octal, or hexadecimal,
the vector is (bits per digit)*(digits) wide, and if the string is decimal, the
vector is the minimum number of bits for a 2's-complement representation, given by
ceil(log2(this < 0 ? -this : this + 1)) + 1.
- Parameters:
- width - The width of the new vector.
- value - The String to parse. In decimal, unless prefixed with 0b, 0o, or 0x.
- sign_ext - Either ZERO_PAD or SIGN_EXT.
- Throws: NumberFormatException
- if the string cannot be parsed as a valid number
BV
public BV(BigInteger value)
- Creates a BV of width value.bitLength() from the BigInteger.
- Parameters:
- value - The BigInteger to parse.
BV
public BV(int width,
BigInteger value)
- Creates a BV of arbitrary width, with zero-padding as necessary.
- Parameters:
- width - The width of the new vector.
- value - The BigInteger to parse.
BV
public BV(int width,
BigInteger value,
boolean sign_ext)
- Creates a BV of arbitrary width, with appropriate sign extension as necessary.
- Parameters:
- width - The width of the new vector.
- value - The String to parse.
- sign_ext - Either ZERO_PAD or SIGN_EXT.
setValue
public BV setValue(boolean value)
- Sets value of BV to true (1) or false (0).
- Parameters:
- value - The value of the vector.
- Returns:
- this, to allow chaining or nesting of operations.
setValue
public BV setValue(boolean value,
boolean sign_ext)
- Sets value of BV to true or false. When value is true, ZERO_PAD sets only the least
significant bit, SIGN_EXT sets all bits.
- Parameters:
- value - The value of the vector.
- sign_ext - Either ZERO_PAD or SIGN_EXT.
- Returns:
- this, to allow chaining or nesting of operations.
setValue
public BV setValue(int width,
boolean value,
boolean sign_ext)
- Sets width and value of BV to true or false. When value is true, ZERO_PAD sets only
the least significant bit, SIGN_EXT sets all bits.
- Parameters:
- width - New width of BV.
- value - The value of the vector.
- sign_ext - Either ZERO_PAD or SIGN_EXT.
- Returns:
- this, to allow chaining or nesting of operations.
setValue
public BV setValue(byte value)
- Sets value of BV, with zero-padding as necessary.
- Parameters:
- value - Up to 8 bits of the vector.
- Returns:
- this, to allow chaining or nesting of operations.
setValue
public BV setValue(byte value,
boolean sign_ext)
- Sets value of BV, with appropriate sign extension as necessary.
- Parameters:
- value - Up to 8 bits of the value.
- sign_ext - Either ZERO_PAD or SIGN_EXT.
- Returns:
- this, to allow chaining or nesting of operations.
setValue
public BV setValue(int width,
byte value)
- Sets value and width of BV, with zero-padding as necessary.
- Parameters:
- width - New width of BV.
- value - Up to 8 bits of the value.
- Returns:
- this, to allow chaining or nesting of operations.
setValue
public BV setValue(int width,
byte value,
boolean sign_ext)
- Sets value and width of BV, with appropriate sign exension as necessary.
- Parameters:
- width - New width of BV.
- value - Up to 8 bits of the value.
- sign_ext - Either ZERO_PAD or SIGN_EXT.
- Returns:
- this, to allow chaining or nesting of operations.
setValue
public BV setValue(char value)
- Sets value of BV, with zero-padding as necessary.
- Parameters:
- value - Up to 16 bits of the value.
- Returns:
- this, to allow chaining or nesting of operations.
setValue
public BV setValue(char value,
boolean sign_ext)
- Sets value of BV, with appropriate sign extension as necessary.
- Parameters:
- value - Up to 16 bits of the value.
- sign_ext - Either ZERO_PAD or SIGN_EXT.
- Returns:
- this, to allow chaining or nesting of operations.
setValue
public BV setValue(int width,
char value)
- Sets value and width of BV, with zero-padding as necessary.
- Parameters:
- width - New width of BV.
- value - Up to 16 bits of the value.
- Returns:
- this, to allow chaining or nesting of operations.
setValue
public BV setValue(int width,
char value,
boolean sign_ext)
- Sets value and width of BV, with appropriate sign exension as necessary.
- Parameters:
- width - New width of BV.
- value - Up to 16 bits of the value.
- sign_ext - Either ZERO_PAD or SIGN_EXT.
- Returns:
- this, to allow chaining or nesting of operations.
setValue
public BV setValue(short value)
- Sets value of BV, with zero-padding as necessary.
- Parameters:
- value - Up to 16 bits of the value.
- Returns:
- this, to allow chaining or nesting of operations.
setValue
public BV setValue(short value,
boolean sign_ext)
- Sets value of BV, with appropriate sign extension as necessary.
- Parameters:
- value - Up to 16 bits of the value.
- sign_ext - Either ZERO_PAD or SIGN_EXT.
- Returns:
- this, to allow chaining or nesting of operations.
setValue
public BV setValue(int width,
short value)
- Sets value and width of BV, with zero-padding as necessary.
- Parameters:
- width - New width of BV.
- value - Up to 16 bits of the value.
- Returns:
- this, to allow chaining or nesting of operations.
setValue
public BV setValue(int width,
short value,
boolean sign_ext)
- Sets value and width of BV, with appropriate sign exension as necessary.
- Parameters:
- width - New width of BV.
- value - Up to 16 bits of the value.
- sign_ext - Either ZERO_PAD or SIGN_EXT.
- Returns:
- this, to allow chaining or nesting of operations.
setValue
public BV setValue(int value)
- Sets value of BV, with zero-padding as necessary.
- Parameters:
- value - Up to 32 bits of the value.
- Returns:
- this, to allow chaining or nesting of operations.
setValue
public BV setValue(int value,
boolean sign_ext)
- Sets value of BV, with appropriate sign extension as necessary.
NOTE: This does not set the width according to the int and the value according to the boolean.
For that functionality, @see setValue(int, boolean, boolean).
- Parameters:
- value - Up to 32 bits of the value.
- sign_ext - Either ZERO_PAD or SIGN_EXT.
- Returns:
- this, to allow chaining or nesting of operations.
setValue
public BV setValue(int width,
int value)
- Sets value and width of BV, with zero-padding as necessary.
- Parameters:
- width - New width of BV.
- value - Up to 32 bits of the value.
- Returns:
- this, to allow chaining or nesting of operations.
setValue
public BV setValue(int width,
int value,
boolean sign_ext)
- Sets value and width of BV, with appropriate sign exension as necessary.
- Parameters:
- width - New width of BV.
- value - Up to 32 bits of the value.
- sign_ext - Either ZERO_PAD or SIGN_EXT.
- Returns:
- this, to allow chaining or nesting of operations.
setValue
public BV setValue(long value)
- Sets value of BV, with zero-padding as necessary.
- Parameters:
- value - Up to 64 bits of the value.
- Returns:
- this, to allow chaining or nesting of operations.
setValue
public BV setValue(long value,
boolean sign_ext)
- Sets value of BV, with appropriate sign extension as necessary.
- Parameters:
- value - Up to 64 bits of the value.
- sign_ext - Either ZERO_PAD or SIGN_EXT.
- Returns:
- this, to allow chaining or nesting of operations.
setValue
public BV setValue(int width,
long value)
- Sets value and width of BV, with zero-padding as necessary.
- Parameters:
- width - New width of BV.
- value - Up to 64 bits of the value.
- Returns:
- this, to allow chaining or nesting of operations.
setValue
public BV setValue(int width,
long value,
boolean sign_ext)
- Sets value and width of BV, with appropriate sign exension as necessary.
- Parameters:
- width - New width of BV.
- value - Up to 64 bits of the value.
- sign_ext - Either ZERO_PAD or SIGN_EXT.
- Returns:
- this, to allow chaining or nesting of operations.
setValue
public BV setValue(int value[])
- Sets value of BV, with zero-padding as necessary.
- Parameters:
- value - An arbitrary amount of bits, in low-endian order (ie. bits 0-31 are in value[0]).
- Returns:
- this, to allow chaining or nesting of operations.
setValue
public BV setValue(int value[],
boolean sign_ext)
- Sets value of BV, with appropriate sign extension as necessary.
- Parameters:
- value - An arbitrary amount of bits, in low-endian order (ie. bits 0-31 are in value[0]).
- sign_ext - Either ZERO_PAD or SIGN_EXT.
- Returns:
- this, to allow chaining or nesting of operations.
setValue
public BV setValue(int width,
int value[])
- Sets value and width of BV, with zero-padding as necessary.
- Parameters:
- width - New width of BV.
- value - An arbitrary amount of bits, in low-endian order (ie. bits 0-31 are in value[0]).
- Returns:
- this, to allow chaining or nesting of operations.
setValue
public BV setValue(int width,
int value[],
boolean sign_ext)
- Sets value and width of BV, with appropriate sign exension as necessary.
- Parameters:
- width - New width of BV.
- value - An arbitrary amount of bits, in low-endian order (ie. bits 0-31 are in value[0]).
- sign_ext - Either ZERO_PAD or SIGN_EXT.
- Returns:
- this, to allow chaining or nesting of operations.
setValue
public BV setValue(BV vector)
- Sets value of BV, with zero-padding as necessary.
- Parameters:
- vector - Original BV.
- Returns:
- this, to allow chaining or nesting of operations.
setValue
public BV setValue(BV bv1,
BV bv2)
- Sets value and width of BV to the concatenation of the arguments, with the first
argument providing the least significant bits.
- Parameters:
- bv1 - The least significant bits.
- bv2 - The next bits.
- Returns:
- this, to allow chaining or nesting of operations.
setValue
public BV setValue(BV bv1,
BV bv2,
BV bv3)
- Sets value and width of BV to the concatenation of the arguments, with the first
argument providing the least significant bits.
- Parameters:
- bv1 - The least significant bits.
- bv2 - The next bits.
- bv3 - The next bits.
- Returns:
- this, to allow chaining or nesting of operations.
setValue
public BV setValue(BV bv1,
BV bv2,
BV bv3,
BV bv4)
- Sets value and width of BV to the concatenation of the arguments, with the first
argument providing the least significant bits.
- Parameters:
- bv1 - The least significant bits.
- bv2 - The next bits.
- bv3 - The next bits.
- bv4 - The next bits.
- Returns:
- this, to allow chaining or nesting of operations.
setValue
public BV setValue(BV bv_array[])
- Sets value and width of BV to the concatenation of the arguments, with the BV in array
slot 0 providing the least significant bits.
- Returns:
- this, to allow chaining or nesting of operations.
- Throws: BVException
- if the array contains only null pointers.
setValue
public BV setValue(BV vector,
boolean sign_ext)
- Sets value of BV, with appropriate sign extension as necessary.
- Parameters:
- vector - Original BV.
- sign_ext - Either ZERO_PAD or SIGN_EXT.
- Returns:
- this, to allow chaining or nesting of operations.
setValue
public BV setValue(int width,
BV vector)
- Sets value and width of BV, with zero-padding as necessary.
- Parameters:
- width - New width of BV.
- vector - Original BV.
- Returns:
- this, to allow chaining or nesting of operations.
setValue
public BV setValue(int width,
BV vector,
boolean sign_ext)
- Sets value and width of BV, with appropriate sign exension as necessary.
- Parameters:
- width - New width of BV.
- vector - Original BV.
- sign_ext - Either ZERO_PAD or SIGN_EXT.
- Returns:
- this, to allow chaining or nesting of operations.
setValue
public BV setValue(String value)
- Sets value of BV, with zero-padding as necessary.
- Parameters:
- value - The String to parse. In decimal, unless prefixed with 0b, 0o, or 0x.
- Returns:
- this, to allow chaining or nesting of operations.
- Throws: NumberFormatException
- if the string cannot be parsed as a valid number
setValue
public BV setValue(String value,
boolean sign_ext)
- Sets value of BV, with appropriate sign extension as necessary.
- Parameters:
- value - The String to parse. In decimal, unless prefixed with 0b, 0o, or 0x.
- sign_ext - Either ZERO_PAD or SIGN_EXT.
- Throws: NumberFormatException
- if the string cannot be parsed as a valid number
setValue
public BV setValue(int width,
String value)
- Sets value and width of BV, with zero-padding as necessary.
- Parameters:
- width - New width of BV.
- value - The String to parse. In decimal, unless prefixed with 0b, 0o, or 0x.
- Returns:
- this, to allow chaining or nesting of operations.
- Throws: NumberFormatException
- if the string cannot b