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 providedRegistercomponent and which lives in the providedSubcircuit. -
Method Summary
Modifier and TypeMethodDescriptionintgetQ()Returns the current value of the register.intgetQSext()Returns the current value of the register, sign-extended to 32 bits.com.ra4king.circuitsim.simulator.components.memory.RegisterReturns the internal CircuitSimRegistercomponent this object wraps.Returns theSubcircuit, a wrapper around a CircuitSimCircuitBoardwhere 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 providedRegistercomponent and which lives in the providedSubcircuit.- Parameters:
reg-Registercomponent 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 CircuitSimRegistercomponent this object wraps.This exposes an internal CircuitSim API. Do not use unless you know what you are doing.
- Returns:
- the CircuitSim
Registercomponent wrapped by this object.
-
mock
Mocks this register with aMockRegister. SeeMockRegisterandSubcircuit.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
CircuitSimExtensionhandle 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 CircuitSimCircuitBoardwhere this Register lives.- Returns:
- the
Subcircuitwhere this pin lives
-