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

Safe Haskell | None

Language.Atom.Elaboration

Contents

- Atom monad and container.
- Type Aliases and Utilities

Synopsis

- data Atom a
- data AtomDB = AtomDB {
  - atomId :: Int
  - atomName :: Name
  - atomNames :: [Name]
  - atomEnable :: Hash
  - atomSubs :: [AtomDB]
  - atomPeriod :: Int
  - atomPhase :: Phase
  - atomAssigns :: [(MUV, Hash)]
  - atomActions :: [([String] -> String, [Hash])]
  - atomAsserts :: [(Name, Hash)]
  - atomCovers :: [(Name, Hash)]
  }
- data Global = Global {
  - gRuleId :: Int
  - gVarId :: Int
  - gArrayId :: Int
  - gState :: [StateHierarchy]
  - gProbes :: [(String, Hash)]
  - gPeriod :: Int
  - gPhase :: Phase
  }
- data Rule
  - = Rule {
    - ruleId :: Int
    - ruleName :: Name
    - ruleEnable :: Hash
    - ruleAssigns :: [(MUV, Hash)]
    - ruleActions :: [([String] -> String, [Hash])]
    - rulePeriod :: Int
    - rulePhase :: Phase
    }
  - | Assert {
    - ruleName :: Name
    - ruleEnable :: Hash
    - ruleAssert :: Hash
    }
  - | Cover {
    - ruleName :: Name
    - ruleEnable :: Hash
    - ruleCover :: Hash
    }
- data StateHierarchy
  - = StateHierarchy Name [StateHierarchy]
  - | StateVariable Name Const
  - | StateArray Name [Const]
- buildAtom :: UeMap -> Global -> Name -> Atom a -> IO (a, AtomSt)
- type UID = Int
- type Name = String
- data Phase
  - = MinPhase Int
  - | ExactPhase Int
- type Path = [Name]
- elaborate :: UeMap -> Name -> Atom () -> IO (Maybe (UeMap, (StateHierarchy, [Rule], [Name], [Name], [(Name, Type)])))
- var :: Expr a => Name -> a -> Atom (V a)
- var' :: Name -> Type -> V a
- array :: Expr a => Name -> [a] -> Atom (A a)
- array' :: Expr a => Name -> Type -> A a
- addName :: Name -> Atom Name
- get :: Atom AtomSt
- put :: AtomSt -> Atom ()
- allUVs :: UeMap -> [Rule] -> Hash -> [MUV]
- allUEs :: Rule -> [Hash]

# Atom monad and container.

data Atom a

The Atom monad holds variable and rule declarations.

Instances

Monad Atom |
MonadIO Atom |

data AtomDB

Constructors

AtomDB |
Fields atomId :: Int atomName :: Name atomNames :: [Name] atomEnable :: Hash atomSubs :: [AtomDB] atomPeriod :: Int atomPhase :: Phase atomAssigns :: [(MUV, Hash)] atomActions :: [([String] -> String, [Hash])] atomAsserts :: [(Name, Hash)] atomCovers :: [(Name, Hash)]

Instances

Eq AtomDB |
Ord AtomDB |
Show AtomDB |

data Global

Constructors

Global |
Fields gRuleId :: Int gVarId :: Int gArrayId :: Int gState :: [StateHierarchy] gProbes :: [(String, Hash)] gPeriod :: Int gPhase :: Phase

data Rule

Constructors

Rule |
Fields ruleId :: Int ruleName :: Name ruleEnable :: Hash ruleAssigns :: [(MUV, Hash)] ruleActions :: [([String] -> String, [Hash])] rulePeriod :: Int rulePhase :: Phase
Assert |
Fields ruleName :: Name ruleEnable :: Hash ruleAssert :: Hash
Cover |
Fields ruleName :: Name ruleEnable :: Hash ruleCover :: Hash

Instances

Show Rule |

data StateHierarchy

Constructors

StateHierarchy Name [StateHierarchy] |
StateVariable Name Const |
StateArray Name [Const] |

buildAtom :: UeMap -> Global -> Name -> Atom a -> IO (a, AtomSt)

# Type Aliases and Utilities

type UID = Int

type Name = String

A name.

data Phase

A phase is either the minimum phase or the exact phase.

Constructors

MinPhase Int |
ExactPhase Int |

type Path = [Name]

A hierarchical name.

elaborate :: UeMap -> Name -> Atom () -> IO (Maybe (UeMap, (StateHierarchy, [Rule], [Name], [Name], [(Name, Type)])))

A Relation is used for relative performance constraints between `Action`s. data Relation = Higher UID | Lower UID deriving (Show, Eq)

Given a top level name and design, elaborates design and returns a design database.

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.

addName :: Name -> Atom Name

get :: Atom AtomSt

put :: AtomSt -> Atom ()

allUVs :: UeMap -> [Rule] -> Hash -> [MUV]

All the variables that directly and indirectly control the value of an expression.

allUEs :: Rule -> [Hash]

All primary expressions used in a rule.