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 ATMega128L

    java.lang.Object
      avrora.sim.mcu.ATMega128L

All Implemented Interfaces:
  Microcontroller, MicrocontrollerFactory, MicrocontrollerProperties

public class ATMega128L
extends java.lang.Object
implements Microcontroller, MicrocontrollerFactory

The `ATMega128L` class represents the `Microcontroller` instance that has all the hardware parameters of the ATMega128L microcontroller as produced by Atmel Corporatation.

Nested Class Summary
`protected class` | `ATMega128L.Pin` The `Pin` class implements a model of a pin on the ATmega128L for the general purpose IO ports.
`class` | `ATMega128L.SimImpl`

Field Summary
`static int` | `EEPROM_SIZE`
`static int` | `FLASH_SIZE`
`static int` | `HZ`
`static int` | `IOREG_SIZE`
`static int` | `IOREG_SIZE_103`
`static int` | `NUM_PINS`
`protected static java.util.HashMap` | `pinNumbers`
`protected ATMega128L.Pin[]` | `pins`
`protected Simulator` | `simulator`
`static int` | `SRAM_SIZE`

Constructor Summary
`` | `ATMega128L(boolean compatibility)` The constructor for the default instance.
`protected` | `ATMega128L(Program p, boolean compatibility)`

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 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.
`Microcontroller.Pin` | `getPin(java.lang.String name)` The `getPin()` method looks up the named pin and returns a reference to that pin.
`int` | `getPinNumber(java.lang.String name)` The `getPinNumber()` method looks up the named pin and returns its number.
`int` | `getRamSize()` The `getRamSize()` method returns the number of bytes of SRAM present on this hardware device.
`Simulator` | `getSimulator()` The `getSimulator()` method gets a simulator instance that is capable of emulating this hardware device.
`protected void` | `installPins()`
`boolean` | `isSupported(InstrPrototype i)` The `isSupported()` method allows a client to query whether a particular instruction is implemented on this hardware device.
`long` | `millisToCycles(double ms)` The `millisToCycles()` method converts the specified number of milliseconds to a cycle count.
`Microcontroller` | `newMicrocontroller(Program p)` The `newMicrocontroller()` method is used to instantiate a microcontroller instance for the particular program.

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

Field Detail

### HZ

    public static final int HZ

See Also:
  Constant Field Values

### SRAM_SIZE

    public static final int SRAM_SIZE

See Also:
  Constant Field Values

### IOREG_SIZE

    public static final int IOREG_SIZE

See Also:
  Constant Field Values

### IOREG_SIZE_103

    public static final int IOREG_SIZE_103

See Also:
  Constant Field Values

### FLASH_SIZE

    public static final int FLASH_SIZE

See Also:
  Constant Field Values

### EEPROM_SIZE

    public static final int EEPROM_SIZE

See Also:
  Constant Field Values

### NUM_PINS

    public static final int NUM_PINS

See Also:
  Constant Field Values

### pinNumbers

    protected static final java.util.HashMap pinNumbers

### simulator

    protected final Simulator simulator

### pins

    protected final ATMega128L.Pin[] pins

Constructor Detail

### ATMega128L

    public ATMega128L(boolean compatibility)

  The constructor for the default instance.

### ATMega128L

    protected ATMega128L(Program p,
                         boolean compatibility)

Method Detail

### installPins

    protected void installPins()

### getRamSize

    public int getRamSize()

  The `getRamSize()` method returns the number of bytes of SRAM present on this hardware device. On the Atmega128L this number is 4096 (4KB).

  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. On the Atmega128L this number is 224 (256 - 32).

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

### getFlashSize

    public int getFlashSize()

  The 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. On the Atmega128L, this number is 131,072 (128K).

  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. On the ATmega128L, this number is 4096.

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

### isSupported

    public boolean isSupported(InstrPrototype i)

  The `isSupported()` method allows a client to query whether a particular instruction is implemented on this hardware device. Older implementations of the AVR instruction set preceded the introduction of certain instructions, and therefore did not support the new instructions.

  Specified by:
    `isSupported` in interface `MicrocontrollerProperties`
  Parameters:
    `i` - the instruction prototype of the instruction
  Returns:
    true if the specified instruction is supported on this device; false otherwise

### getSimulator

    public Simulator getSimulator()

  The `getSimulator()` method gets a simulator instance that is capable of emulating this hardware device.

  Specified by:
    `getSimulator` in interface `Microcontroller`
  Returns:
    a `Simulator` instance corresponding to this device

### getHz

    public int getHz()

  The `getHZ()` method returns the number of cycles per second at which this hardware device is designed to run. The Atmega128L runs at 7.3278MHz, so this method will return 7,327,800.

  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

### getPinNumber

    public int getPinNumber(java.lang.String name)

  The `getPinNumber()` method looks up the named pin and returns its number. Names of pins should be UPPERCASE. The intended users of this method are external device implementors which connect their devices to the microcontroller through the pins.

  Specified by:
    `getPinNumber` in interface `MicrocontrollerProperties`
  Parameters:
    `name` - the name of the pin; for example "PA0" or "OC1A"
  Returns:
    the number of the pin if it exists; -1 otherwise

### newMicrocontroller

    public Microcontroller newMicrocontroller(Program p)

  The `newMicrocontroller()` method is used to instantiate a microcontroller instance for the particular program. It will construct an instance of the `Simulator` class that has all the properties of this hardware device and has been initialized with the specified program.

  Specified by:
    `newMicrocontroller` in interface `MicrocontrollerFactory`
  Parameters:
    `p` - the program to load onto the microcontroller
  Returns:
    a `Microcontroller` instance that represents the specific hardware device with the program loaded onto it

### 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

### getPin

    public Microcontroller.Pin getPin(java.lang.String name)

  The `getPin()` method looks up the named pin and returns a reference to that pin. Names of pins should be UPPERCASE. 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:
    `name` - the name of the pin; for example "PA0" or "OC1A"
  Returns:
    a reference to the `Pin` object corresponding to the named pin if it exists; null otherwise

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