public abstract class CfgDeclarationStatement extends CfgStatement
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NEW_VAR_PREFIX
Prefix for new variables that are created by the tool.
|
Modifier | Constructor and Description |
---|---|
protected |
CfgDeclarationStatement() |
protected |
CfgDeclarationStatement(CfgDeclarationStatement statement) |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(ru.ispras.fortress.expression.NodeVariable variable)
Checks does this object contain the specified variable.
|
boolean |
containsInput(java.lang.String name)
Checks whether this object contain input signal variable with the specified name.
|
boolean |
containsOutput(java.lang.String name)
Checks whether this object contain output signal variable with the specified name.
|
boolean |
containsRegister(java.lang.String name)
Checks whether this object contain register variable with the specified name.
|
boolean |
containsVariable(java.lang.String name)
Checks whether object contains a variable with the specified name.
|
ru.ispras.fortress.expression.NodeVariable |
declareNewVariable(ru.ispras.fortress.data.DataType dataType)
Declares new variable of the specified data type.
|
void |
declareVariable(ru.ispras.fortress.expression.NodeVariable variable)
Declares non-existing variable.
|
void |
declareVariable(ru.ispras.fortress.expression.NodeVariable variable,
ru.ispras.fortress.expression.Node invariant)
Declares the specified variable with the specified invariant.
|
void |
declareVariable(ru.ispras.fortress.expression.NodeVariable variable,
ru.ispras.fortress.expression.Node initialValue,
ru.ispras.fortress.expression.Node invariant)
Declares the specified variable with the specified initial value and the specified invariant.
|
void |
declareVariables(java.util.Map<ru.ispras.fortress.expression.NodeVariable,VariableDeclaration> declarations)
Declares the specified collection of variables.
|
ru.ispras.fortress.data.DataType |
getDataType(java.lang.String name)
Returns data type of the declared variable with the specified name.
|
VariableDeclaration |
getDeclaration(ru.ispras.fortress.expression.NodeVariable variable)
Returns the declaration of the specified variable.
|
java.util.Map<ru.ispras.fortress.expression.NodeVariable,VariableDeclaration> |
getDeclarationMap()
Mapping of internal variables names to variable declarations.
|
java.util.Collection<VariableDeclaration> |
getDeclarations()
Returns variables declarations.
|
java.util.Set<ru.ispras.fortress.expression.NodeVariable> |
getDefines()
Returns a set of defined variables.
|
ru.ispras.fortress.expression.Node |
getInitialValue(java.lang.String name)
Returns initial value of the declared variable with the specified name.
|
java.util.Set<java.lang.String> |
getInputNames()
Returns a collection of names of the declared input signal variables.
|
ru.ispras.fortress.expression.Node |
getInvariant(java.lang.String name)
Returns invariant of the declared variable with the specified name.
|
java.util.Set<java.lang.String> |
getOutputNames()
Returns a collection of names of the declared output signal variables.
|
java.util.Set<java.lang.String> |
getRegisterNames()
Returns a collection of names of the declared register variables.
|
java.util.Set<ru.ispras.fortress.expression.NodeVariable> |
getUses()
Returns a set of used variables.
|
ru.ispras.fortress.expression.NodeVariable |
getVariable(java.lang.String name)
Returns declared variable with specified name.
|
java.util.Set<java.lang.String> |
getVariableNames()
Returns a collection of this object variables names.
|
java.util.List<ru.ispras.fortress.expression.NodeVariable> |
getVariables()
Returns declared variables.
|
void |
removeDeclaration(java.lang.String name)
Removes declaration of variable with the specified name.
|
void |
setVariablesMapping(java.util.Map<ru.ispras.fortress.expression.NodeVariable,VariableDeclaration> map)
Adds declared variables to the existing declarations.
|
add, add, addAll, apply, contains, containStatements, deepCopy, equals, getDescription, getId, getParent, getStatement, getStatement, getStatementNum, getType, hashCode, hasParent, indexOf, isType, remove, removeAll, removeParent, removeStatement, setParent
addMetaInfo, addMetaInfo, addMetaInfo, addMetaInfo, getMetaInfo, getMetaInfo, getMetaInfo, hasMetaInfo, hasMetaInfo, removeMetaInfo
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
getDescription
public static final java.lang.String NEW_VAR_PREFIX
protected CfgDeclarationStatement()
protected CfgDeclarationStatement(CfgDeclarationStatement statement)
public java.util.Collection<VariableDeclaration> getDeclarations()
public VariableDeclaration getDeclaration(ru.ispras.fortress.expression.NodeVariable variable)
variable
- variablejava.lang.IllegalArgumentException
- when argument is null
.public java.util.Map<ru.ispras.fortress.expression.NodeVariable,VariableDeclaration> getDeclarationMap()
public ru.ispras.fortress.expression.NodeVariable getVariable(java.lang.String name)
name
- name of variable to be returnednull
if there is no such variable.java.lang.IllegalArgumentException
- when argument is null
.public java.util.List<ru.ispras.fortress.expression.NodeVariable> getVariables()
public java.util.Set<java.lang.String> getVariableNames()
public java.util.Set<java.lang.String> getInputNames()
public java.util.Set<java.lang.String> getOutputNames()
public java.util.Set<java.lang.String> getRegisterNames()
public ru.ispras.fortress.data.DataType getDataType(java.lang.String name)
name
- variable namenull
otherwise.public ru.ispras.fortress.expression.Node getInitialValue(java.lang.String name)
name
- variable namenull
otherwise.public ru.ispras.fortress.expression.Node getInvariant(java.lang.String name)
name
- variable namenull
otherwise.public boolean contains(ru.ispras.fortress.expression.NodeVariable variable)
variable
- variable to be checkedtrue
if module already has such variable declared, false
otherwise.java.lang.IllegalArgumentException
- when argument is null
.public boolean containsVariable(java.lang.String name)
name
- variable nametrue
if object contains a variable with the specified name,
false
otherwise.public boolean containsInput(java.lang.String name)
name
- variable nametrue
if this object contains an input signal variable with the specified name,
false
otherwise.public boolean containsOutput(java.lang.String name)
name
- variable nametrue
if this object contains an output signal variable with the specified name,
false
otherwise.public boolean containsRegister(java.lang.String name)
name
- variable nametrue
if this object contains a register variable with the specified name,
false
otherwise.public void declareVariables(java.util.Map<ru.ispras.fortress.expression.NodeVariable,VariableDeclaration> declarations)
declarations
- variables declarationsjava.lang.IllegalArgumentException
- when argument is null
.public void declareVariable(ru.ispras.fortress.expression.NodeVariable variable)
Object MUST NOT contain the specified variable. Check this fact by corresponding check-method first.
variable
- variable to be addedjava.lang.IllegalArgumentException
- when argument is null
.java.lang.IllegalStateException
- when this object
already contains such variable.public void declareVariable(ru.ispras.fortress.expression.NodeVariable variable, ru.ispras.fortress.expression.Node invariant)
mObject MUST NOT contain the specified variable. Check this fact by corresponding method first.
variable
- variable to be addedinvariant
- variable invariant (can be null
)java.lang.IllegalArgumentException
- when variable argument is null
.java.lang.IllegalStateException
- when this module object
already contains such variable.public void declareVariable(ru.ispras.fortress.expression.NodeVariable variable, ru.ispras.fortress.expression.Node initialValue, ru.ispras.fortress.expression.Node invariant)
Invariant keeps a constraint on variable value.
variable
- variableinitialValue
- initial value of variableinvariant
- variable invariantpublic ru.ispras.fortress.expression.NodeVariable declareNewVariable(ru.ispras.fortress.data.DataType dataType)
NOTE: the VariableDescriptor
variable data is not set here
because of Verilog parser features.
dataType
- new variable data typejava.lang.IllegalArgumentException
- when argument is null
.public void setVariablesMapping(java.util.Map<ru.ispras.fortress.expression.NodeVariable,VariableDeclaration> map)
map
- mapping of variable name to variable declarationjava.lang.IllegalArgumentException
- when argument is null
.public void removeDeclaration(java.lang.String name)
name
- variable namejava.lang.IllegalArgumentException
- when argument is null
.public java.util.Set<ru.ispras.fortress.expression.NodeVariable> getUses()
UseDef
getUses
in interface UseDef
getUses
in class CfgStatement
public java.util.Set<ru.ispras.fortress.expression.NodeVariable> getDefines()
UseDef
getDefines
in interface UseDef
getDefines
in class CfgStatement