forsyde-deep-0.2.0: ForSyDe's Haskell-embedded Domain Specific Language.

Copyright(c) ES Group, KTH/ICT/ES 2007-2013
LicenseBSD-style (see the file LICENSE)
Maintainerforsyde-dev@ict.kth.se
Stabilityexperimental
Portabilitynon-portable (Template Haskell)
Safe HaskellNone
LanguageHaskell98

ForSyDe.Deep.System

Description

This module provides publicly usable functions to build a system definition and instantiate it.

Synopsis

Documentation

data SysDef a Source #

We add a phantom parameter to indicate the type of the system

newSysDef Source #

Arguments

:: 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.

newSysDefTH Source #

Arguments

:: 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.

newSysDefTHName Source #

Arguments

:: 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 SysFun f Source #

Class used to describe a System function. It uses the same trick as Printf to implement the variable number of arguments.

Minimal complete definition

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.

Minimal complete definition

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.

Minimal complete definition

fromTHStrSimFun

instantiate :: SysFun f => ProcId -> SysDef f -> f Source #

Generates an instance of a SysDef in the form of function out of the name of a SysDef with the same type as its system function. The resulting function can then be used to plug the instance to the rest of the system.