Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## avrora.sim.mcu
Class RegisterSet

    java.lang.Object
      avrora.sim.mcu.RegisterSet

public class RegisterSet
extends java.lang.Object

The `RegisterSet` class is a utility that simplifies the implementation of certain IO registers that contain many types of fields whose bits may be spread out and mixed up over multiple IO registers. For example, a 5 bit field used to configure a device might be spread among multiple 1, 2, 3, or 4 bit fields across multiple registers. This class allows a set of those registers to be created, and collects together writes and reads easily.

Nested Class Summary
`static class` | `RegisterSet.Field` The `Field` class represents a collection of bits that represent a quantity used by a device.
`class` | `RegisterSet.MultiFieldRegister` The `Register` class implements an IO register that is directly read and written by the program.

Field Summary
`protected java.util.HashMap` | `fields`
`protected RegisterLayout` | `layout`
`protected ActiveRegister[]` | `registers`

Constructor Summary
`RegisterSet(RegisterLayout rl)` The constructor for the `RegisterSet` class creates a new register set with the specified register layout and size.

Method Summary
`RegisterSet.Field` | `getField(java.lang.String fname)` The `getField()` gets an object that represents an entire field which may be stored across multiple registers in multiple bit fields.
`RegisterLayout` | `getRegisterLayout()` The `getRegisterLayout()` method gets a reference to the register layout object for this register set.
`int` | `getSize()` The `getSize()` method returns the total number of registers in this register set.
`RegisterSet.Field` | `installField(java.lang.String fname, RegisterSet.Field fo)` The `installField()` method allows device implementations to substitute a new field implementation for the named field.
`void` | `installIOReg(ActiveRegister ar, int ior)` The `installIOReg()` method installs a new register at the specified address.
`ActiveRegister[]` | `share()` The `share()` method is NOT meant for general use.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### fields

    protected final java.util.HashMap fields

### registers

    protected final ActiveRegister[] registers

### layout

    protected final RegisterLayout layout

Constructor Detail

### RegisterSet

    public RegisterSet(RegisterLayout rl)

  The constructor for the `RegisterSet` class creates a new register set with the specified register layout and size.

Parameters:
  `rl` - the layout of all the registers in the set

Method Detail

### getSize

    public int getSize()

  The `getSize()` method returns the total number of registers in this register set.

  Returns:
    the number of IO registers in this set

### installIOReg

    public void installIOReg(ActiveRegister ar,
                             int ior)

  The `installIOReg()` method installs a new register at the specified address. This is intented to be used only in the device implementations.

  Parameters:
    `ar` - the active register to install
    `ior` - the address to install the active register to

### getRegisterLayout

    public RegisterLayout getRegisterLayout()

  The `getRegisterLayout()` method gets a reference to the register layout object for this register set. The register layout describes where each IO register is and what fields it contains.

  Returns:
    a reference to the register layout for this register set

### share

    public ActiveRegister[] share()

  The `share()` method is NOT meant for general use. It is used ONLY by the interpreter to share the underlying array representation that maps from register address to an actual register object.

  Returns:
    a reference to the array containing references to the actual register objects

### getField

    public RegisterSet.Field getField(java.lang.String fname)

  The `getField()` gets an object that represents an entire field which may be stored across multiple registers in multiple bit fields. This object allows access to the field's value without consideration for its underlying representation in the IO register(s).

  Parameters:
    `fname` - the name of the fieldWriter to get the fieldWriter representation for
  Returns:
    a reference to the `FieldWriter` object that represents the field

### installField

    public RegisterSet.Field installField(java.lang.String fname,
                                          RegisterSet.Field fo)

  The `installField()` method allows device implementations to substitute a new field implementation for the named field. The field implementation can then override the appropriate methods of the `RegisterSet.Field` class to be notified upon writes.

  Parameters:
    `fname` - the name of the field
    `fo` - the field object to install for this field
  Returns:
    the new field installed

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD