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 RegisterLayout

    java.lang.Object
      avrora.sim.mcu.RegisterLayout

public class RegisterLayout
extends java.lang.Object

The `RegisterLayout` class stores information about the IO register addresses for a particular microcontroller model. It maps the names of the IO registers to their addresses and also contains information about which fields are stored in which registers. When a microcontroller is instantiated, this class is used to create an instance of `RegisterSet` that corresponds to the layout of the registers on this device.

Nested Class Summary
`protected static class` | `RegisterLayout.Field`
`protected static class` | `RegisterLayout.RegisterInfo`
`protected static class` | `RegisterLayout.SubField`

Field Summary
`protected java.util.HashMap` | `fields` The `fields` field stores a reference to a hashmap that maps from a field name to a representation of the field.
`protected RegisterLayout.RegisterInfo[]` | `info`
`int` | `ioreg_length` The `ioreg_length` field stores the length of each register in bits.
`int` | `ioreg_size` The `ioreg_size` field stores the number of IO registers on this microcontroller.
`protected java.util.HashMap` | `ioregAssignments` The `ioregAssignments` field stores a reference to a hashmap from IO register names to their addresses.
`static RegisterLayout.Field` | `RESERVED`
`static RegisterLayout.Field` | `UNUSED`

Constructor Summary
`RegisterLayout(int is, int rlength)` The constructor for the `RegisterLayout` class creates a new register layout with the specified size.

Method Summary
`void` | `addIOReg(java.lang.String n, int ior_num)` The `addIOReg()` method adds a new IO register with the specified name and address to this register layout.
`void` | `addIOReg(java.lang.String n, int ior_num, java.lang.String format)` The `addIOReg()` method adds a new IO register with the specified name and address to this register layout.
`int` | `getIOReg(java.lang.String n)` The `getIOReg()` method retrieves the IO register number for the given IO Register name for this microcontroller.
`boolean` | `hasIOReg(java.lang.String n)` The `hasIOReg()` method simply checks whether this register layout has a register with the specified name.
`RegisterSet` | `instantiate()` The `instantiate()` method creates a new register set that contains the actual register implementations that can be used in simulation.

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

Field Detail

### UNUSED

    public static final RegisterLayout.Field UNUSED

### RESERVED

    public static final RegisterLayout.Field RESERVED

### ioreg_size

    public final int ioreg_size

  The `ioreg_size` field stores the number of IO registers on this microcontroller.

### ioreg_length

    public final int ioreg_length

  The `ioreg_length` field stores the length of each register in bits.

### ioregAssignments

    protected final java.util.HashMap ioregAssignments

  The `ioregAssignments` field stores a reference to a hashmap from IO register names to their addresses.

### info

    protected final RegisterLayout.RegisterInfo[] info

### fields

    protected final java.util.HashMap fields

  The `fields` field stores a reference to a hashmap that maps from a field name to a representation of the field.

Constructor Detail

### RegisterLayout

    public RegisterLayout(int is,
                          int rlength)

  The constructor for the `RegisterLayout` class creates a new register layout with the specified size.

Parameters:
  `is` - the number of registers in this register layout

Method Detail

### addIOReg

    public void addIOReg(java.lang.String n,
                         int ior_num)

  The `addIOReg()` method adds a new IO register with the specified name and address to this register layout.

  Parameters:
    `n` - the name of the IO register
    `ior_num` - the address of the IO register

### addIOReg

    public void addIOReg(java.lang.String n,
                         int ior_num,
                         java.lang.String format)

  The `addIOReg()` method adds a new IO register with the specified name and address to this register layout. This variant of the method also accepts a format string describing which fields are in this IO register. The format description is used to automatically generate an instance of the IO register that puts the right bits of the right fields in the right places when the register is written to.

  Parameters:
    `n` - the name of the IO register
    `ior_num` - the address of the IO register
    `format` - the format of the IO register as a string describing which fields and which bits of which fields are present in this IO register

### getIOReg

    public int getIOReg(java.lang.String n)

  The `getIOReg()` method retrieves the IO register number for the given IO Register name for this microcontroller.

  Parameters:
    `n` - the name of the IO register such as "TCNT0"
  Returns:
    an integer representing the IO register number if it exists
  Throws:
    `java.util.NoSuchElementException` - if the specified IO register name does not have an assignment

### hasIOReg

    public boolean hasIOReg(java.lang.String n)

  The `hasIOReg()` method simply checks whether this register layout has a register with the specified name.

  Parameters:
    `n` - the name of the IO register
  Returns:
    true if this layout has a register with the specified name; false otherwise

### instantiate

    public RegisterSet instantiate()

  The `instantiate()` method creates a new register set that contains the actual register implementations that can be used in simulation.

  Returns:
    a new register set to be used in simulation

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