ScEpTIC.emulator.energy.mcu package

Subpackages

Submodules

ScEpTIC.emulator.energy.mcu.msp430fr module

class ScEpTIC.emulator.energy.mcu.msp430fr.MSP430FREnergyModel(mcu_name, load_lookup_table=False, instruction_cache_hit_ratio=0.75)

Bases: MCUEnergyModel

MCU energy model for MSP430-FR series from Texas Instruments

ScEpTIC.emulator.energy.mcu.msp430g module

class ScEpTIC.emulator.energy.mcu.msp430g.MSP430GEnergyModel(mcu_name, load_lookup_table=False, instruction_cache_hit_ratio=0.75)

Bases: MCUEnergyModel

MCU energy model for MSP430-G series from Texas Instruments

ScEpTIC.emulator.energy.mcu.options module

class ScEpTIC.emulator.energy.mcu.options.ADCPowerState(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Enum indicating the ADC state

OFF = 'OFF'
ON = 'ON'
class ScEpTIC.emulator.energy.mcu.options.MCUClockCycleAction(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Enum for the operation type executed by the MCU in a specific clock cycle

I2C_ACCESS = 'I2C_ACCESS'
LPM_ENTER = 'LPM_ENTER'
LPM_EXIT = 'LPM_EXIT'
LPM_NOP = 'LPM_NOP'
NON_VOLATILE_MEMORY_ACCESS = 'NON_VOLATILE_MEMORY_ACCESS'
NOP_OFF_RECHARGE = 'NOP_OFF_RECHARGE'
NO_MEMORY_ACCESS = 'NO_MEMORY_ACCESS'
PHYSICAL_MEMORY_ACCESS = 'PHYSICAL_MEMORY_ACCESS'
SPI_ACCESS = 'SPI_ACCESS'
VOLATILE_MEMORY_ACCESS = 'VOLATILE_MEMORY_ACCESS'
class ScEpTIC.emulator.energy.mcu.options.MCUPowerState(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Enum indicating the MCU state

LPM = 'LPM'
LPM_WAKEUP = 'LPM_WAKEUP'
OFF = 'OFF'
ON = 'ON'

Module contents

class ScEpTIC.emulator.energy.mcu.MCUEnergyModel(mcu_name, load_lookup_table=False, instruction_cache_hit_ratio=0.75)

Bases: VoltageDrawner

MCU Energy Model

ADC_I_TO_CONSIDER = 'min'
ALFRED_n_min(n_writes)

Function to calculate the minimum number of read instructions required to create a volatile copy of a memory location. Necessary for virtual_memory transformation (ALFRED). :param n_writes: number of writes required for creating a volatile copy :return: number of minimum reads

attach_peripheral(peripheral)

Attaches a peripheral to the MCU :param peripheral: the peripheral

get_ADC_wait_cycles()
Returns:

ADC wait cycles (turn ADC on + wait for sample)

get_LPM_wait_cycles()
Returns:

LPM to ON wait cycles

get_NVM_wait_cycles()
Returns:

NVM wait cycles

get_action_wait_cycles(mcu_clock_action)
Parameters:

mcu_clock_action – Clock cycle action

Returns:

the number of wait cycles that the MCU executed due to the execution of mcu_clock_action

get_adc_state()
Returns:

The ADC state (instance of ADCPowerState)

get_clock_cycles()

Returns current active cycle clock cycles count

get_drained_energy(mcu_clock_action, elapsed_time=None)

Calculates the energy consumed by the MCU. :param mcu_clock_action: Clock cycle action :return: the consumed energy

get_external_nvm()
Returns:

an external NVM, if attached to the MCU; otherwise None

get_frequency()
Returns:

current MCU clock frequency

get_mcu_cycle_time()
Returns:

the time of a single clock cycle (seconds)

get_mcu_state()
Returns:

The mcu state (instance of MCUPowerState)

get_min_v(ignore_current_frequency=False)
Parameters:

ignore_current_frequency – returns the absolute minimum voltage, regardless of current frequency

Returns:

the minimum voltage required to compute with current frequency

get_nominal_frequency()
Returns:

a string representation of the MCU frequency

get_power_state_events()
Returns:

a list of PowerStateEvent events that are occurring

get_time()

Returns the mcu time

get_voltage()
Returns:

the voltage applied to the MCU

power_failure_callback()

Sets the last time and ticks when a power failure occurred

reset()

Resets the MCU state

set_adc_state(adc_state)

Sets the current ADC state to adc_state :param adc_state: ADCPowerState state

set_frequency(f)

Sets MCU frequency :param f: current frequency (string)

set_lookup_table(lookup_table)

Sets the lookup table for the MCU energy model. :param lookup_table: instance of LookupTable

set_mcu_state(mcu_state)

Sets the current MCU state to mcu_state :param mcu_state: MCUPowerState state

set_target_lpm(lpm_name)

Sets the parameters of the MCU LPM used during the simulation :param lpm_name: the name of the MCU LPM

set_time(t)

Sets the mcu time

set_v_on(v_on)

Sets the minimum voltage to turn the MCU on :param v_on: minimum voltage to turn the MCU on

update_stats(time, ticks)

Update stats