public abstract class ISimulator
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ISimulator.Extension
Describes how a
BitSit should be extended when being set on a larger input pin. |
Constructor and Description |
---|
ISimulator() |
Modifier and Type | Method and Description |
---|---|
abstract int |
getMemoryWidth(java.lang.String name)
return the width of the memory (i.e., the memory's word size)
|
abstract int |
getPinWidth(java.lang.String name)
return the width of the pin
|
abstract int |
getRegisterWidth(java.lang.String name)
return the width of the register
|
abstract void |
load(java.io.File file)
Load a circuit from a file
|
void |
load(java.lang.String filename)
Load a circuit from a file
|
abstract java.util.BitSet[] |
readMemoryBitSets(java.lang.String name,
long address,
int length)
Get the values in memory as
BitSet s. |
long[] |
readMemorySigned(java.lang.String name,
long address,
int length)
Get the values in the memory as signed long integers
|
long[] |
readMemoryUnsigned(java.lang.String name,
long address,
int length)
Get the values in memory as unsigned long integers
|
boolean |
readPin(java.lang.String name)
Get the value on a one-bit pin
|
abstract java.util.BitSet |
readPinAsBitSet(java.lang.String name)
Return the value on an output pin as a
BitSet |
long |
readPinSigned(java.lang.String name)
Get the value on the pin as a signed long integer
|
long |
readPinUnsigned(java.lang.String name)
Get the value on the pin as an unsigned long integer
|
boolean |
readRegister(java.lang.String name)
Get the value on a one-bit register
|
abstract java.util.BitSet |
readRegisterBitSet(java.lang.String name) |
long |
readRegisterSigned(java.lang.String name)
Get the value in the register as a signed long integer
|
long |
readRegisterUnsigned(java.lang.String name)
Get the value in the register as an unsigned long integer
|
abstract void |
reset()
Reset the simulator between tests
|
abstract void |
run()
Execute the simulator
|
abstract void |
setMemorySigned(java.lang.String name,
int beginningWordAddress,
int[] values)
Sets memory
|
abstract void |
setMemoryUnsigned(java.lang.String name,
int beginningWordAddress,
int[] values)
Sets memory using unsigned (positive) values only
|
abstract void |
setPin(java.lang.String name,
java.util.BitSet value,
int size,
ISimulator.Extension ext)
Set the input pin
name with a given set of bits. |
void |
setPin(java.lang.String name,
boolean value)
Set a single input pin
name with a given value . |
void |
setPinSigned(java.lang.String name,
long value)
Set the specified input pin to
value . |
void |
setPinUnsigned(java.lang.String name,
long value)
Set the specified input pin to
value . |
abstract void |
setRegister(java.lang.String name,
java.util.BitSet value,
int size,
ISimulator.Extension ext)
Set the input register
name with a given set of bits. |
void |
setRegister(java.lang.String name,
boolean value)
Set a one-bit register
name with a given value . |
void |
setRegisterSigned(java.lang.String name,
long value)
Set the specified input register to
value . |
void |
setRegisterUnsigned(java.lang.String name,
long value)
Set the specified register to
value . |
public abstract int getPinWidth(java.lang.String name) throws NoSuchElementException, InvalidElementException
name
- the name of the pinNoSuchElementException
- if a pin named name
can't be foundInvalidElementException
- if name
is not an input pinpublic abstract void setPin(java.lang.String name, java.util.BitSet value, int size, ISimulator.Extension ext) throws NoSuchElementException, InvalidElementException, InvalidWidthException
name
with a given set of bits.name
- the name of the pin to be setvalue
- the set of values to place on each individual pin in the setsize
- the number of bits to set.ext
- whether zero-extend or sign-extend the value if the pin is wider than size
.NoSuchElementException
- if an input pin named name
can't be foundInvalidElementException
- if name
is not an input pinInvalidWidthException
- if the pin does not have width 1public void setPin(java.lang.String name, boolean value) throws NoSuchElementException, InvalidElementException, InvalidWidthException
name
with a given value
.name
- the name of the pin to be setvalue
- the binary value to place on the pinNoSuchElementException
- if an input pin named name
can't be foundInvalidElementException
- if name
is not an input pinInvalidWidthException
- if the pin does not have width 1public void setPinSigned(java.lang.String name, long value) throws NoSuchElementException, InvalidElementException, InvalidWidthException
value
.name
- the name of the pin to setvalue
- the value to set the pin to.NoSuchElementException
- if an input pin named name
can't be foundInvalidElementException
- if name
is not an input pinInvalidWidthException
- if the given value
is too big for the width of the pinpublic void setPinUnsigned(java.lang.String name, long value) throws NoSuchElementException, InvalidElementException, InvalidWidthException, IllegalValueException
value
.name
- the name of the pin to setvalue
- the value to set the pin to.NoSuchElementException
- if an input pin named name
can't be foundInvalidElementException
- if name
is not an input pinInvalidWidthException
- if the given value
is too big for the width of the pinIllegalValueException
- if value
is negativepublic abstract java.util.BitSet readPinAsBitSet(java.lang.String name) throws NoSuchElementException, InvalidElementException
BitSet
name
- the pinBitSet
NoSuchElementException
- if a pin named name
can't be foundInvalidElementException
- if name
is not the correct type of elementpublic boolean readPin(java.lang.String name) throws NoSuchElementException, InvalidElementException, InvalidWidthException
name
- the pin nameNoSuchElementException
- an output pin named name
can't be foundInvalidElementException
- if name
is not the correct type of elementInvalidWidthException
public long readPinSigned(java.lang.String name) throws NoSuchElementException, InvalidElementException
name
- the pin nameNoSuchElementException
- if an output pin named name
can't be foundInvalidElementException
- if name
is not the correct type of elementpublic long readPinUnsigned(java.lang.String name) throws NoSuchElementException, InvalidElementException
name
- the pin nameNoSuchElementException
- if an output pin named name
can't be foundInvalidElementException
- if name
is not the correct type of elementpublic abstract int getRegisterWidth(java.lang.String name) throws NoSuchElementException, InvalidElementException
name
- the name of the registerNoSuchElementException
- if a register named name
can't be foundInvalidElementException
- if name
is not the correct type of elementpublic abstract void setRegister(java.lang.String name, java.util.BitSet value, int size, ISimulator.Extension ext) throws NoSuchElementException, InvalidElementException, InvalidWidthException
name
with a given set of bits.name
- the name of the register to be setvalue
- the set of values to place on each individual bit in the registersize
- the number of bits to set.ext
- whether zero-extend or sign-extend the value if the register is wider than size
.NoSuchElementException
- if an input register named name
can't be foundInvalidElementException
- if name
is not the correct type of elementInvalidWidthException
- if the register does not have width 1public void setRegister(java.lang.String name, boolean value) throws NoSuchElementException, InvalidElementException, InvalidWidthException
name
with a given value
.name
- the name of the register to be setvalue
- the binary value to place in the registerNoSuchElementException
- if a register named name
can't be foundInvalidElementException
- if name
is not the correct type of elementInvalidWidthException
- if the register does not have width 1public void setRegisterSigned(java.lang.String name, long value) throws NoSuchElementException, InvalidElementException, InvalidWidthException
value
.name
- the name of the register to setvalue
- the value to place in the registerNoSuchElementException
- if a register named name
can't be foundInvalidElementException
- if name
is not the correct type of elementInvalidWidthException
- if the given value
is too big for the width of the registerpublic void setRegisterUnsigned(java.lang.String name, long value) throws NoSuchElementException, InvalidElementException, InvalidWidthException, IllegalValueException
value
.name
- the name of the register to setvalue
- the value place in the registerNoSuchElementException
- if a register named name
can't be foundInvalidElementException
- if name
is not the correct type of elementInvalidWidthException
- if the given value
is too big for the width of the registerIllegalValueException
- if value
is negativepublic abstract java.util.BitSet readRegisterBitSet(java.lang.String name) throws NoSuchElementException, InvalidElementException
public boolean readRegister(java.lang.String name) throws NoSuchElementException, InvalidElementException, InvalidWidthException
name
- the register nameNoSuchElementException
- a register named name
can't be foundInvalidElementException
- if name
is not the correct type of elementInvalidWidthException
- if name
is not one bit widepublic long readRegisterSigned(java.lang.String name) throws NoSuchElementException, InvalidElementException
name
- the register nameNoSuchElementException
- if a register named name
can't be foundInvalidElementException
- if name
is not the correct type of elementpublic long readRegisterUnsigned(java.lang.String name) throws NoSuchElementException, InvalidElementException
name
- the register nameNoSuchElementException
- if a register named name
can't be foundInvalidElementException
- if name
is not the correct type of elementpublic abstract void setMemorySigned(java.lang.String name, int beginningWordAddress, int[] values) throws NoSuchElementException, InvalidElementException
name
- the name of the memory.beginningWordAddress
- word address of the first word to be setvalues
- an array of word values to be set. (The entire array will be set.)NoSuchElementException
- If there is no memory named name
InvalidElementException
- If name
is not a memorypublic abstract void setMemoryUnsigned(java.lang.String name, int beginningWordAddress, int[] values) throws NoSuchElementException, InvalidElementException
name
- the name of the memory.beginningWordAddress
- word address of the first word to be setvalues
- an array of word values to be set. (The entire array will be set.)NoSuchElementException
- If there is no memory named name
InvalidElementException
- If name
is not a memorypublic abstract int getMemoryWidth(java.lang.String name) throws NoSuchElementException, InvalidElementException
name
- the name of the memoryNoSuchElementException
- if a memory named name
can't be foundInvalidElementException
- if name
is not the correct type of elementpublic long[] readMemorySigned(java.lang.String name, long address, int length) throws NoSuchElementException, InvalidElementException
name
- the memory nameaddress
- the first word address to retreivelength
- the number of word addresses to retrieveNoSuchElementException
- if a memory named name
can't be foundInvalidElementException
- if name
is not the correct type of elementpublic long[] readMemoryUnsigned(java.lang.String name, long address, int length) throws NoSuchElementException, InvalidElementException
name
- the memory nameaddress
- the word addresslength
- the number of words to readNoSuchElementException
- if a register named name
can't be foundInvalidElementException
- if name
is not the correct type of elementpublic abstract java.util.BitSet[] readMemoryBitSets(java.lang.String name, long address, int length) throws NoSuchElementException, InvalidElementException
BitSet
s.name
- the memory nameaddress
- the word addresslength
- the number of words to readBitSet
sNoSuchElementException
- if no memory named name
is foundInvalidElementException
- if name
is not a memorypublic abstract void load(java.io.File file) throws Utilities.UnreadableFileException, Utilities.InvalidCircuitException
file
- the file containing the circuitUtilities.UnreadableFileException
- if the file cannot be read (e.g., as a result of the permissions)Utilities.InvalidCircuitException
- if the simulator cannot parse the file.public void load(java.lang.String filename) throws Utilities.UnreadableFileException, Utilities.InvalidCircuitException
filename
- the name of the file containing the circuitUtilities.UnreadableFileException
- if the file cannot be read (e.g., as a result of the permissions)Utilities.InvalidCircuitException
- if the simulator cannot parse the file.public abstract void run()
public abstract void reset()