Copyright | (c) ES Group, KTH/ICT/ES 2007-2013 |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | forsyde-dev@ict.kth.se |
Stability | experimental |
Portability | non-portable (Template Haskell) |
Safe Haskell | None |
Language | Haskell98 |
This module provides publicly usable functions to build a system definition and instantiate it.
- data SysDef a
- newSysDef :: SysFun f => f -> SysId -> [PortId] -> [PortId] -> SysDef f
- newSysDefTH :: SysFun f => f -> SysId -> [PortId] -> [PortId] -> ExpQ
- newSysDefTHName :: Name -> [PortId] -> [PortId] -> ExpQ
- class SysFun f
- class SysFun sysFun => SysFunToSimFun sysFun simFun | sysFun -> simFun, simFun -> sysFun
- class SysFun sysFun => SysFunToIOSimFun sysFun simFun | sysFun -> simFun, simFun -> sysFun
- instantiate :: SysFun f => ProcId -> SysDef f -> f
Documentation
:: SysFun f | |
=> f | system function |
-> SysId | System identifier |
-> [PortId] | Input interface port identifiers |
-> [PortId] | Output interface port identifiers |
-> SysDef f |
SysDef
constructor
Builds a system definition out of a system function describing the system and its port identifers.
:: SysFun f | |
=> f | system function |
-> SysId | System identifier |
-> [PortId] | Input interface port identifiers |
-> [PortId] | Output interface port identifiers |
-> ExpQ |
CURRENTLY BROKEN, do not use!
SysDef
constructor, Template Haskell version
Builds a system definition out of a system function, a system identifiers and its port identifers.
For example $(newSysDefTH mySysFun "mysys" ["in1"] ["out1"])
creates a
system definition from system funcion mySysFun
which should have
one input and output signals.
The advantage of newSysDefTH
over newSysDef
is that it
reports errors (e.g duplicated port and process identifiers) earlier,
at host-language (Haskell) compile-time.
In addition, due to the use of Template Haskell, newSysDefTH
is
aware of the source location at which it was called, making
further error reports friendlier to the user.
:: Name | Name of the system function |
-> [PortId] | Input interface port identifiers |
-> [PortId] | Output interface port identifiers |
-> ExpQ |
SysDef
constructor, Template Haskell Name
version
Builds a SysDef
out of the name of a system function
and its port identifers.
The system will later be identified by the basename (i.e. unqualified name) of the function.
For example $(newSysDefTHName 'mySysFun ["in1"] ["out1"])
creates a
system definition from system funcion mySysFun
which has one input and
output signals.
The advantage of newSysDefTHName
over newSysDefTH
is that it
doesn't suffer from the Template Haskell bug http://hackage.haskell.org/trac/ghc/ticket/1800, or in other words, it allows to declare the system
defintion and system function in the same module.
However, since it doesn't have acces to the system function itself, it can only give early error reports related to incorrect port identifiers (process identifier duplicate errors will be reported at runtime).
Class used to describe a System function. It uses the same trick
as Printf
to implement the variable number of arguments.
applySysFun, fromListSysFun
class SysFun sysFun => SysFunToSimFun sysFun simFun | sysFun -> simFun, simFun -> sysFun Source #
Multiparameter class to transform a System Function into a Simulation Function, able to simulate a System using a list-based representation of its signals.
fromDynSimFun
class SysFun sysFun => SysFunToIOSimFun sysFun simFun | sysFun -> simFun, simFun -> sysFun Source #
Multiparameter class to transform a System Function into an IO Simulation Function, able to externally simulate a System using a list-based representation of its signals.
fromTHStrSimFun