public class Utilities
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Utilities.InvalidCircuitException
Exception thrown if a circuit file cannot be parsed as a circuit.
|
static class |
Utilities.UnreadableFileException
Exception thrown if a file is not accessible or readable.
|
Constructor and Description |
---|
Utilities() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
intToHex(int theInt,
int bitLength) |
static int |
unsignedToSigned(int value,
int width) |
static long |
unsignedToSigned(long value,
int width) |
static void |
validateMemoryAddress(long address,
int capacity,
int num_words) |
static void |
validateValueWidth(long value,
int width,
boolean signed) |
static void |
verifyFileIsReadable(java.io.File file)
Create
File object and throw an exception if the file (1) does not exist, (2) is not readable, or (3) is
a directory. |
public static void verifyFileIsReadable(java.io.File file) throws Utilities.UnreadableFileException
File
object and throw an exception if the file (1) does not exist, (2) is not readable, or (3) is
a directory.file
- the fileUtilities.UnreadableFileException
- if the file either does not exist, or is otherwise not readablepublic static java.lang.String intToHex(int theInt, int bitLength) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public static void validateValueWidth(long value, int width, boolean signed) throws InvalidWidthException
InvalidWidthException
public static void validateMemoryAddress(long address, int capacity, int num_words) throws IllegalValueException, InvalidWidthException
public static int unsignedToSigned(int value, int width)
public static long unsignedToSigned(long value, int width)