avrora.sim.mcu
Class ATMegaFamily

java.lang.Object
  extended byavrora.sim.mcu.ATMegaFamily
All Implemented Interfaces:
Microcontroller, MicrocontrollerProperties
Direct Known Subclasses:
ATMega128L

public abstract class ATMegaFamily
extends java.lang.Object
implements Microcontroller


Nested Class Summary
 class ATMegaFamily.FlagRegister
           
 class ATMegaFamily.MaskableInterrupt
          The MaskableInterrupt class represents an interrupt that is controlled by two bits in two registers: a mask bit in a mask register and a flag bit in a flag register, at the same offset.
 class ATMegaFamily.MaskRegister
           
protected  class ATMegaFamily.Pin
          The Pin class implements a model of a pin on the ATMegaFamily for the general purpose IO ports.
 
Field Summary
protected  Clock clock
           
 int EEPROM_SIZE
           
 int FLASH_SIZE
           
 int HZ
          The HZ field stores a public static final integer that represents the clockspeed of the AtMega128L microcontroller (7.327mhz).
protected  BaseInterpreter interpreter
           
 int IOREG_SIZE
           
 int NUM_PINS
           
protected  Simulator.Printer pinPrinter
           
protected  ATMegaFamily.Pin[] pins
           
protected  Simulator simulator
           
 int SRAM_SIZE
           
 
Constructor Summary
protected ATMegaFamily(int hz, int sram_size, int ioreg_size, int flash_size, int eeprom_size, int num_pins)
           
 
Method Summary
 double cyclesToMillis(long cycles)
          The cyclesToMillis() method converts the specified number of cycles to a time quantity in milliseconds.
 int getEEPromSize()
          The getEEPromSize() method returns the size in bytes of the EEPROM on this hardware device.
 int getFlashSize()
          The getFlashSize() method returns the size in bytes of the flash memory on this hardware device.
 int getHz()
          The getHZ() method returns the number of cycles per second at which this hardware device is designed to run.
 int getIORegSize()
          The getIORegSize() method returns the number of IO registers that are present on this hardware device.
 Microcontroller.Pin getPin(int num)
          The getPin() method looks up the specified pin by its number and returns a reference to that pin.
 int getRamSize()
          The getRamSize() method returns the number of bytes of SRAM present on this hardware device.
 long millisToCycles(double ms)
          The millisToCycles() method converts the specified number of milliseconds to a cycle count.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface avrora.sim.mcu.Microcontroller
getMode, getModeName, getPin, getRadio, getSimulator, setRadio, sleep, wakeup
 
Methods inherited from interface avrora.sim.mcu.MicrocontrollerProperties
getPinNumber, isSupported
 

Field Detail

HZ

public final int HZ
The HZ field stores a public static final integer that represents the clockspeed of the AtMega128L microcontroller (7.327mhz).


SRAM_SIZE

public final int SRAM_SIZE

IOREG_SIZE

public final int IOREG_SIZE

FLASH_SIZE

public final int FLASH_SIZE

EEPROM_SIZE

public final int EEPROM_SIZE

NUM_PINS

public final int NUM_PINS

pinPrinter

protected Simulator.Printer pinPrinter

pins

protected final ATMegaFamily.Pin[] pins

clock

protected Clock clock

simulator

protected Simulator simulator

interpreter

protected BaseInterpreter interpreter
Constructor Detail

ATMegaFamily

protected ATMegaFamily(int hz,
                       int sram_size,
                       int ioreg_size,
                       int flash_size,
                       int eeprom_size,
                       int num_pins)
Method Detail

getRamSize

public int getRamSize()
The getRamSize() method returns the number of bytes of SRAM present on this hardware device.

Specified by:
getRamSize in interface MicrocontrollerProperties
Returns:
the number of bytes of SRAM on this hardware device

getIORegSize

public int getIORegSize()
The getIORegSize() method returns the number of IO registers that are present on this hardware device.

Specified by:
getIORegSize in interface MicrocontrollerProperties
Returns:
the number of IO registers supported on this hardware device

getFlashSize

public int getFlashSize()
The getFlashSize() method returns the size in bytes of the flash memory on this hardware device. The flash memory stores the initialized data and the machine code instructions of the program.

Specified by:
getFlashSize in interface MicrocontrollerProperties
Returns:
the size of the flash memory in bytes

getEEPromSize

public int getEEPromSize()
The getEEPromSize() method returns the size in bytes of the EEPROM on this hardware device.

Specified by:
getEEPromSize in interface MicrocontrollerProperties
Returns:
the size of the EEPROM in bytes

getHz

public int getHz()
The getHZ() method returns the number of cycles per second at which this hardware device is designed to run.

Specified by:
getHz in interface MicrocontrollerProperties
Returns:
the number of cycles per second on this device

millisToCycles

public long millisToCycles(double ms)
The millisToCycles() method converts the specified number of milliseconds to a cycle count. The conversion factor used is the number of cycles per second of this device. This method serves as a utility so that clients need not do repeated work in converting milliseconds to cycles and back.

Specified by:
millisToCycles in interface MicrocontrollerProperties
Parameters:
ms - a time quantity in milliseconds as a double
Returns:
the same time quantity in clock cycles, rounded up to the nearest integer

cyclesToMillis

public double cyclesToMillis(long cycles)
The cyclesToMillis() method converts the specified number of cycles to a time quantity in milliseconds. The conversion factor used is the number of cycles per second of this device. This method serves as a utility so that clients need not do repeated work in converting milliseconds to cycles and back.

Specified by:
cyclesToMillis in interface MicrocontrollerProperties
Parameters:
cycles - the number of cycles
Returns:
the same time quantity in milliseconds

getPin

public Microcontroller.Pin getPin(int num)
The getPin() method looks up the specified pin by its number and returns a reference to that pin. The intended users of this method are external device implementors which connect their devices to the microcontroller through the pins.

Specified by:
getPin in interface Microcontroller
Parameters:
num - the pin number to look up
Returns:
a reference to the Pin object corresponding to the named pin if it exists; null otherwise