Class Register
java.lang.Object
io.zucchini.circuitsimtester.api.Register
Wraps a CircuitSim Register component. Currently changing the value
of the register is not supported, but you can observe its value.
-
Constructor Summary
ConstructorsConstructorDescriptionRegister
(com.ra4king.circuitsim.simulator.components.memory.Register reg, Subcircuit subcircuit) Creates a new Register which wraps the providedRegister
component and which lives in the providedSubcircuit
. -
Method Summary
Modifier and TypeMethodDescriptionint
getQ()
Returns the current value of the register.int
getQSext()
Returns the current value of the register, sign-extended to 32 bits.com.ra4king.circuitsim.simulator.components.memory.Register
Returns the internal CircuitSimRegister
component this object wraps.Returns theSubcircuit
, a wrapper around a CircuitSimCircuitBoard
where this Register lives.mock()
Mocks this register with aMockRegister
.
-
Constructor Details
-
Register
public Register(com.ra4king.circuitsim.simulator.components.memory.Register reg, Subcircuit subcircuit) Creates a new Register which wraps the providedRegister
component and which lives in the providedSubcircuit
.- Parameters:
reg
-Register
component to wrapsubcircuit
- where this pin lives
-
-
Method Details
-
getQ
public int getQ()Returns the current value of the register. This value is not sign-extended; to sign-extend the value, seegetQSext()
.- Returns:
- the current value of the register, not sign extended
-
getQSext
public int getQSext()Returns the current value of the register, sign-extended to 32 bits. LikegetQ()
except sign-extended.- Returns:
- the current value of the register, sign extended to 32 bits
-
getRegister
public com.ra4king.circuitsim.simulator.components.memory.Register getRegister()Returns the internal CircuitSimRegister
component this object wraps.This exposes an internal CircuitSim API. Do not use unless you know what you are doing.
- Returns:
- the CircuitSim
Register
component wrapped by this object.
-
mock
Mocks this register with aMockRegister
. SeeMockRegister
andSubcircuit.mockRegister(com.ra4king.circuitsim.simulator.components.memory.Register)
for details.You probably should not be calling this directly — use the following code instead and let
CircuitSimExtension
handle this for you:@SubcircuitComponent(bits=16) private MockRegister myFunRegister;
- Returns:
- a mocked version of this register
- See Also:
-
getSubcircuit
Returns theSubcircuit
, a wrapper around a CircuitSimCircuitBoard
where this Register lives.- Returns:
- the
Subcircuit
where this pin lives
-