avrora.sim.mcu
Class MicrocontrollerProperties

java.lang.Object
  extended byavrora.sim.mcu.MicrocontrollerProperties

public class MicrocontrollerProperties
extends java.lang.Object

The MicrocontrollerProperties class is simply a wrapper class around several properties of a microcontroller including the size of the IO registers, the size of SRAM, flash, and EEPROM, as well as the mapping between names of pins and their physical pin number.


Field Summary
 CodeSegment.Factory codeSegmentFactory
           
 int eeprom_size
          The eeprom_size field stores the size of the EEPROM on this microcontroller.
 int flash_size
          The flash_size field stores the size of the code segment (flash) on this microcontroller.
protected  java.lang.String[] interrupt_name
           
protected  java.util.HashMap interruptAssignments
           
protected  java.lang.String[] ioreg_name
           
 int ioreg_size
          The ioreg_size field stores the number of IO registers on this microcontroller.
protected  RegisterLayout layout
           
 int num_interrupts
          The num_interrupts field stores the number of interrupts supported on this microcontroller.
 int num_pins
          The num_pins field stores the number of physical pins on this microcontroller.
protected  java.util.HashMap pinAssignments
           
 int sram_size
          The sram_size field stores the size of the SRAM (excluding the general purpose registers and IO registers) on this microcontroller.
 
Constructor Summary
MicrocontrollerProperties(int is, int ss, int fs, int es, int np, int ni, CodeSegment.Factory csf, java.util.HashMap pa, RegisterLayout rl, java.util.HashMap inta)
          The constructor for the MicrocontrollerProperties class creates a new instance with the specified register size, flash size, etc.
 
Method Summary
 int getInterrupt(java.lang.String n)
          The getInterrupt() method retrieves the interrupt number for the given interrupt name for this microcontroller
 java.lang.String getInterruptName(int inum)
          The getInterruptName() method returns the name of an interrupt specified by the given number.
 int getIOReg(java.lang.String n)
          The getIOReg() method retrieves the IO register number for the given IO Register name for this microcontroller.
 java.lang.String getIORegName(int ioreg)
          The getIORegName() method returns the name of the IO register specified by the given number.
 int getPin(java.lang.String n)
          The getPin() method retrieves the pin number for the given pin name for this microcontroller.
 RegisterLayout getRegisterLayout()
           
 boolean hasIOReg(java.lang.String n)
          The hasIOReg() method queries whether the IO register exists on this device.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ioreg_size

public final int ioreg_size
The ioreg_size field stores the number of IO registers on this microcontroller.


sram_size

public final int sram_size
The sram_size field stores the size of the SRAM (excluding the general purpose registers and IO registers) on this microcontroller.


flash_size

public final int flash_size
The flash_size field stores the size of the code segment (flash) on this microcontroller.


eeprom_size

public final int eeprom_size
The eeprom_size field stores the size of the EEPROM on this microcontroller.


num_pins

public final int num_pins
The num_pins field stores the number of physical pins on this microcontroller.


num_interrupts

public final int num_interrupts
The num_interrupts field stores the number of interrupts supported on this microcontroller.


codeSegmentFactory

public final CodeSegment.Factory codeSegmentFactory

pinAssignments

protected final java.util.HashMap pinAssignments

layout

protected final RegisterLayout layout

interruptAssignments

protected final java.util.HashMap interruptAssignments

ioreg_name

protected final java.lang.String[] ioreg_name

interrupt_name

protected final java.lang.String[] interrupt_name
Constructor Detail

MicrocontrollerProperties

public MicrocontrollerProperties(int is,
                                 int ss,
                                 int fs,
                                 int es,
                                 int np,
                                 int ni,
                                 CodeSegment.Factory csf,
                                 java.util.HashMap pa,
                                 RegisterLayout rl,
                                 java.util.HashMap inta)
The constructor for the MicrocontrollerProperties class creates a new instance with the specified register size, flash size, etc. All such fields are immutable, and the pin assignments and IO register assignments cannot be changed.

Parameters:
is - the number of IO registers on this microcontroller
ss - the size of the SRAM in bytes
fs - the size of the flash in bytes
es - the size of the EEPROM in bytes
np - the number of physical pins on the microcontroller
ni - the number of interrupts on the microcontroller
pa - a HashMap instance mapping string names to Integer indexes for the pins
rl - a RegisterLayout instance mapping string names to IO register addresses
inta - a HashMap instance mapping string names to Integer indexes for each type of interrupt
Method Detail

getRegisterLayout

public RegisterLayout getRegisterLayout()

getPin

public int getPin(java.lang.String n)
The getPin() method retrieves the pin number for the given pin name for this microcontroller.

Parameters:
n - the name of the pin such as "OC0"
Returns:
an integer representing the physical pin number if it exists;
Throws:
java.util.NoSuchElementException - if the specified pin name does not have an assignment

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 queries whether the IO register exists on this device.

Parameters:
n - the name of the IO register
Returns:
true if the IO register exists on this device; false otherwise

getInterrupt

public int getInterrupt(java.lang.String n)
The getInterrupt() method retrieves the interrupt number for the given interrupt name for this microcontroller

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

getIORegName

public java.lang.String getIORegName(int ioreg)
The getIORegName() method returns the name of the IO register specified by the given number.

Parameters:
ioreg - the io register number for which to get a string name
Returns:
the string name of the IO register if there is such a name

getInterruptName

public java.lang.String getInterruptName(int inum)
The getInterruptName() method returns the name of an interrupt specified by the given number.

Parameters:
inum - the interrupt number for which to get a string name
Returns:
the string name of the interrupt if there is such a name