Class Register

java.lang.Object
io.zucchini.circuitsimtester.api.Register

public class Register extends Object
Wraps a CircuitSim Register component. Currently changing the value of the register is not supported, but you can observe its value.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Register(com.ra4king.circuitsim.simulator.components.memory.Register reg, Subcircuit subcircuit)
    Creates a new Register which wraps the provided Register component and which lives in the provided Subcircuit.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the current value of the register.
    int
    Returns the current value of the register, sign-extended to 32 bits.
    com.ra4king.circuitsim.simulator.components.memory.Register
    Returns the internal CircuitSim Register component this object wraps.
    Returns the Subcircuit, a wrapper around a CircuitSim CircuitBoard where this Register lives.
    Mocks this register with a MockRegister.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Register

      public Register(com.ra4king.circuitsim.simulator.components.memory.Register reg, Subcircuit subcircuit)
      Creates a new Register which wraps the provided Register component and which lives in the provided Subcircuit.
      Parameters:
      reg - Register component to wrap
      subcircuit - 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, see getQSext().
      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. Like getQ() 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 CircuitSim Register 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

      public MockRegister mock()
      Mocks this register with a MockRegister. See MockRegister and Subcircuit.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

      public Subcircuit getSubcircuit()
      Returns the Subcircuit, a wrapper around a CircuitSim CircuitBoard where this Register lives.
      Returns:
      the Subcircuit where this pin lives