Annotation Interface SubcircuitComponent
CircuitSimExtension
to find and inject a CircuitSim
component into the annotated field in a test class.
The annotated field can be a InputPin
, OutputPin
, Register
, MockRegister
, Ram
, Rom
, Clock
, or
Button
.
When you annotate such a field in a test class with this annotation, CircuitSimExtension
will search the subcircuit for a suitable component
matching the requirements specified by the parameters to this annotation.
If label()
is ""
(the default), it will search for a label
matching the name of the field instead. Also, note that bits()
is
required for some components.
- See Also:
-
Nested Class Summary
Nested Classes -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionint
The bit size of a matching Pin.The label of a matching Pin.boolean
Used to tell the tester library not to look up the component by label and instead to find this component by looking for the only instance of such component present in the circuit (optionally recursively viarecursiveSearch()
).boolean
Search for this component not only directly in the subcircuit identified withSubcircuitTest
but also in any subcircuits placed in it.ForOutputPin
s: The type of "pin".
-
Element Details
-
label
String labelThe label of a matching Pin. If empty (the default),CircuitSimExtension
will use the name of the field.- Returns:
- The label of a matching Pin.
- Default:
""
-
bits
-
onlyInstance
boolean onlyInstanceUsed to tell the tester library not to look up the component by label and instead to find this component by looking for the only instance of such component present in the circuit (optionally recursively viarecursiveSearch()
).- Returns:
- true if this should be the only component of its type present in the circuit (e.g., the only register), else false
- Default:
false
-
recursiveSearch
boolean recursiveSearchSearch for this component not only directly in the subcircuit identified withSubcircuitTest
but also in any subcircuits placed in it.For example, if you are autograding a simple finite state machine homework and a student is a subcircuit enthusiast and places their actual register deep in many levels of subcircuits, this parameter would tell the autograder to go subcircuit spelunking to find the register.
- Returns:
- true to look for the desired component in subcircuits placed in this subcircuit, else false
- Default:
false
-
type
ForOutputPin
s: The type of "pin". The default is a literal existing Pin component, but you can set this toTUNNEL
to spy on the value of a tunnel by attaching anOutputPin
to it. (The label is then the label of the tunnel you want to spy instead of the label of an existing pin.) This parameter is valid only forOutputPin
s.- Returns:
- An enum value determining if this should spy on a tunnel instead of controlling a Pin component
- Default:
INFER
-