atom-1.0.9: A DSL for embedded hard realtime applications.

Safe HaskellNone

Language.Atom.Language

Contents

Description

The Atom language.

Synopsis

Documentation

Primary Language Containers

type Atom = Atom

The Atom monad captures variable and transition rule declarations.

Hierarchical Rule Declarations

atom :: Name -> Atom a -> Atom a

Creates a hierarchical node, where each node could be a atomic rule.

period :: Int -> Atom a -> Atom a

Defines the period of execution of sub rules as a factor of the base rate of the system. Rule period is bound by the closest period assertion. For example:

 period 10 $ period 2 a   -- Rules in 'a' have a period of 2, not 10.

getPeriod :: Atom Int

Returns the execution period of the current scope.

phase :: Int -> Atom a -> Atom a

Defines the earliest phase within the period at which the rule should execute; the scheduler attempt to find an optimal phase from 0 <= n < period (thus, the phase must be at least zero and less than the current period.).

exactPhase :: Int -> Atom a -> Atom a

Ensures an atom is scheduled only at phase n.

getPhase :: Atom Int

Returns the phase of the current scope.

Action Directives

cond :: E Bool -> Atom ()

Adds an enabling condition to an atom subtree of rules. This condition must be true before any rules in hierarchy are allowed to execute.

class Expr a => Assign a where

Methods

(<==) :: V a -> E a -> Atom ()

Assign an E to a V.

incr :: (Assign a, NumE a) => V a -> Atom ()

Increments a NumE V.

decr :: (Assign a, NumE a) => V a -> Atom ()

Decrements a NumE V.

Variable Declarations

var :: Expr a => Name -> a -> Atom (V a)

Generic local variable declaration.

var' :: Name -> Type -> V a

Generic external variable declaration.

array :: Expr a => Name -> [a] -> Atom (A a)

Generic array declaration.

array' :: Expr a => Name -> Type -> A a

Generic external array declaration.

bool :: Name -> Bool -> Atom (V Bool)

Local boolean variable declaration.

bool' :: Name -> V Bool

External boolean variable declaration.

int8 :: Name -> Int8 -> Atom (V Int8)

Local int8 variable declaration.

int8' :: Name -> V Int8

External int8 variable declaration.

int16 :: Name -> Int16 -> Atom (V Int16)

Local int16 variable declaration.

int16' :: Name -> V Int16

External int16 variable declaration.

int32 :: Name -> Int32 -> Atom (V Int32)

Local int32 variable declaration.

int32' :: Name -> V Int32

External int32 variable declaration.

int64 :: Name -> Int64 -> Atom (V Int64)

Local int64 variable declaration.

int64' :: Name -> V Int64

External int64 variable declaration.

word8 :: Name -> Word8 -> Atom (V Word8)

Local word8 variable declaration.

word8' :: Name -> V Word8

External word8 variable declaration.

word16 :: Name -> Word16 -> Atom (V Word16)

Local word16 variable declaration.

word16' :: Name -> V Word16

External word16 variable declaration.

word32 :: Name -> Word32 -> Atom (V Word32)

Local word32 variable declaration.

word32' :: Name -> V Word32

External word32 variable declaration.

word64 :: Name -> Word64 -> Atom (V Word64)

Local word64 variable declaration.

word64' :: Name -> V Word64

External word64 variable declaration.

float :: Name -> Float -> Atom (V Float)

Local float variable declaration.

float' :: Name -> V Float

External float variable declaration.

double :: Name -> Double -> Atom (V Double)

Local double variable declaration.

double' :: Name -> V Double

External double variable declaration.

Custom Actions

action :: ([String] -> String) -> [UE] -> Atom ()

Declares an action.

call :: Name -> Atom ()

Calls an external C function of type 'void f(void)'.

Probing

probe :: Expr a => Name -> E a -> Atom ()

Declares a probe.

probes :: Atom [(String, UE)]

Fetches all declared probes to current design point.

Assertions and Functional Coverage

assert :: Name -> E Bool -> Atom ()

An assertions checks that an E Bool is true. Assertions are checked between the execution of every rule. Parent enabling conditions can disable assertions, but period and phase constraints do not. Assertion names should be globally unique.

cover :: Name -> E Bool -> Atom ()

A functional coverage point tracks if an event has occured (true). Coverage points are checked at the same time as assertions. Coverage names should be globally unique.

assertImply :: Name -> E Bool -> E Bool -> Atom ()

Implication assertions. Creates an implicit coverage point for the precondition.

Utilities

type Name = String

A name.

liftIO :: MonadIO m => forall a. IO a -> m a

Lift a computation from the IO monad.

path :: Atom String

Returns the current atom hierarchical path.

clock :: E Word64

Reference to the 64-bit free running clock.

Code Coverage

nextCoverage :: Atom (E Word32, E Word32)

Rule coverage information. (current coverage index, coverage data)