forsyde-shallow-3.4.0.0: ForSyDe's Haskell-embedded Domain Specific Language.

Copyright(c) SAM/KTH 2007
LicenseBSD-style (see the file LICENSE)
Maintainerforsyde-dev@ict.kth.se
Stabilityexperimental
Portabilityportable
Safe HaskellSafe
LanguageHaskell98

ForSyDe.Shallow.MoC

Description

The corrent module is a container including all MoC libraries and their domain interfaces.

Synopsis

Documentation

The library for the synchronous MoC

The library for the most general form of the untimed MoC

The library for a specialized untimed MoC

The library for the Synchronous Dataflow MoC

The library for the continuous time MoC

data DACMode Source #

For the digital-analog conversion we have two different possibilities which is determined by this data type DACMode.

Constructors

DAlinear

linear interpolation

DAhold

the last digital value is frozen

Instances
Eq DACMode Source # 
Instance details

Defined in ForSyDe.Shallow.MoC.CT

Methods

(==) :: DACMode -> DACMode -> Bool #

(/=) :: DACMode -> DACMode -> Bool #

Show DACMode Source # 
Instance details

Defined in ForSyDe.Shallow.MoC.CT

data SubsigCT a Source #

The type of a sub-signal of a continuous signal. It consisits of the function and the interval on which the function is defined. The continuous time signal is then defined as a sequence of SubsigCT elements: Signal SubsigCT

Constructors

SubsigCT (Rational -> a, (Rational, Rational)) 
Instances
(Num a, Show a) => Show (SubsigCT a) Source # 
Instance details

Defined in ForSyDe.Shallow.MoC.CT

Methods

showsPrec :: Int -> SubsigCT a -> ShowS #

show :: SubsigCT a -> String #

showList :: [SubsigCT a] -> ShowS #

liftCT :: Fractional a => (a -> b) -> Rational -> b Source #

The function liftCT creates a CT-compliant function (using the Rationals as domain) from a normal mathematical function that uses a fractional (Double) as domain

ctSignal :: [(Rational -> a, (Rational, Rational))] -> Signal (SubsigCT a) Source #

The function ctSignal creates a CT signal from a list of subsignals that are given by a function, an a time range.

*ForSyDe.Shallow.MoC.CT> ctsig1 = ctSignal [(liftCT sin, (0, 3.14)), (\t -> 1, (3.14, 6.28))]
*ForSyDe.Shallow.MoC.CT> :t ctsig1
ctsig1 :: Floating a => Signal (SubsigCT a)-- ctsig1 = ctSignal [(liftCT sin, (0, 3.14)), (\t -> 1, (3.14, 6.28))]

timeStep :: Rational Source #

This constant gives the default time step for sampling and plotting. Its value is 10ns.

mapCT :: (a -> b) -> Signal (SubsigCT a) -> Signal (SubsigCT b) Source #

zipWithCT :: (a -> b -> c) -> Signal (SubsigCT a) -> Signal (SubsigCT b) -> Signal (SubsigCT c) Source #

combCT :: (a -> b) -> Signal (SubsigCT a) -> Signal (SubsigCT b) Source #

comb2CT :: (a -> b -> c) -> Signal (SubsigCT a) -> Signal (SubsigCT b) -> Signal (SubsigCT c) Source #

scaleCT Source #

Arguments

:: (Num a, Show a) 
=> a

The scaling factor

-> Signal (SubsigCT a)

The input signal

-> Signal (SubsigCT a)

The output signal of the process

scaleCT amplifies an input by a constant factor:

addCT Source #

Arguments

:: (Num a, Show a) 
=> Signal (SubsigCT a)

The first input signal

-> Signal (SubsigCT a)

The second input signal

-> Signal (SubsigCT a)

The output signal

addCT adds two input signals together.

multCT Source #

Arguments

:: (Num a, Show a) 
=> Signal (SubsigCT a)

The first input signal

-> Signal (SubsigCT a)

The second input signal

-> Signal (SubsigCT a)

The output signal

multCT multiplies two input signals together.

absCT Source #

Arguments

:: (Num a, Ord a, Show a) 
=> Signal (SubsigCT a)

The input signal

-> Signal (SubsigCT a)

The output signal

absCT takes the absolute value of a signal.

sineWave Source #

Arguments

:: (Floating a, Show a) 
=> Rational

The frequency

-> (Rational, Rational)

The interval of the signal

-> Signal (SubsigCT a)

The generated signal

sineWave generates a sinus signal with the given frequency defined over a given period. The function is defined as f(x)=sin(2*pi*freq*x).

d2aConverter Source #

Arguments

:: (Fractional a, Show a) 
=> DACMode

Mode of conversion

-> Rational

Duration of input signal

-> Signal a

Input signal (untimed MoC)

-> Signal (SubsigCT a)

Output signal (continuous time MoC)

d2aConverter converts an untimes or synchronous signal into a continuous time signal. The process d2aConverter converts a signal of the digital domain into a continuous time signal. There are two modes, DAlinear, which makes a smooth transition between adjacent digital values and DAhold, where the analog value directly follows the digital value. This means that in DAhold-mode a staircase function remains a staircase function, while in DAlinear the staircase function would resemble at least partially a saw tooth-curve.

The resolution of the converter is given by the parameter timeStep.

Note, that the process d2aConverter is an ideal component, i.e. there are no losses due to a limited resolution due to a fixed number of bits.

a2dConverter Source #

Arguments

:: (Num a, Show a) 
=> Rational

Sampling Period

-> Signal (SubsigCT a)

Input signal (continuous time)

-> Signal a

Output signal (untimed)

The process a2dConverter converts a continuous time signal to an untimed or synchronous signal. The first parameter gives the sampling period of the converter.

Note, that the process a2dConverter is an ideal component, i.e. there are no losses due to a limited resolution due to a fixed number of bits.

applyF1 :: (Num a, Num b, Show a, Show b) => ((Rational -> a) -> Rational -> b) -> Signal (SubsigCT a) -> Signal (SubsigCT b) Source #

applyF1 applies a function on a sub-signal, which means the function of the subsignal is transformed to another function:

applyF2 :: (Num a, Num b, Num c, Show a, Show b, Show c) => ((Rational -> a) -> (Rational -> b) -> Rational -> c) -> Signal (SubsigCT a) -> Signal (SubsigCT b) -> Signal (SubsigCT c) Source #

applyF2 works just like applyF1 but operates on two incoming signals.

applyG1 :: (Num b, Show b) => (a -> (Rational -> b) -> a) -> a -> Signal (SubsigCT b) -> a Source #

applyG1 is used to apply a next-state function. A very interesting question is, what should be an argument to the next-state function: the incoming function, defining the value of the input signal? or the incoming function and the incoming interval? or the value of the incoming signal at a particular point, e.g. at the left most point of the interval? To give the next-state function the interval itself as argument, would mean that the process becomes time variant process, i.e. its behaviour is dependent on the absolute time values. This is not a good thing to have! Another possibility may be to give a sub-signal that is relative to the current evaluation, i.e. the left most point is always 0. Would that make sense?

cutEq :: (Num a, Num b, Show a, Show b) => Signal (SubsigCT a) -> Signal (SubsigCT b) -> (Signal (SubsigCT a), Signal (SubsigCT b)) Source #

cutEq partitions the two signals such that the partitioning are identical in both result signals, but only up to the duration of the shorter of the two signals:

showParts Source #

Arguments

:: (Num a, Show a) 
=> Signal (SubsigCT a)

The partitioned signal

-> [(Double, Double)]

The sequence of intervals

showParts allows to see how a signal is partitioned into sub-signals. It returns the sequence of intervals.

plot Source #

Arguments

:: (Num a, Show a) 
=> Signal (SubsigCT a)

The signal to be plotted.

-> IO String

A reporting message.

plot plots one signal in a graph with the default sampling period of 1/200 of the duration of the signal.

plotCT Source #

Arguments

:: (Num a, Show a) 
=> Rational

The sampling period

-> [Signal (SubsigCT a)]

The list of signals to be ploted in the same graph

-> IO String

A messeage reporting what has been done.

plotCT plots a list of signals in the same graph. The sampling period has to be given as argument. In the graph default label names are used to identify the signals.

plotCT' Source #

Arguments

:: (Num a, Show a) 
=> Rational

Sampling period

-> [(Signal (SubsigCT a), String)]

A list of (signal,label) pairs. The signals are plotted and denoted by the corresponding labels in the plot.

-> IO String

A simple message to report completion

plotCT' is the work horse for plotting and the functions plot and plotCT use it with specialising arguments.

plotCT' plots all the signals in the list in one graph. If a label is given for a signal, this label appears in the graph. If the label string is "", a default label like "sig-1" is used.

In addition to displaying the graph on the screen, the following files are created in directory ./fig:

ct-moc-graph.eps
an eps file of the complete graph
ct-moc-graph.pdf
A pdf file of the complete graph
ct-moc-graph-latex.eps
included by ct-moc-graph-latex.tex
ct-moc-graph-latex.tex
This is the tex file that should be included by your latex document. It in turn includes the file ct-moc-graph-latex.eps. These two files have to be used together; the .eps file contains only the graphics, while the .tex file contains the labels and text.

vcdGen Source #

Arguments

:: (Num a, Show a) 
=> Rational

Sampling period; defines for what time stamps the values are written.

-> [(Signal (SubsigCT a), String)]

A list of (signal,label) pairs. The signal values written and denoted by the corresponding labels.

-> IO String

A simple message to report completion

vcdGen dumps the values of a list of signal in VCD (Value Change Dump) format (IEEE Std 1364-2001), which is part of the Verilog standard (http://en.wikipedia.org/wiki/Value_change_dump). There are public domain tools to view VCD files. For instance, GTKWave (http://home.nc.rr.com/gtkwave/) is a popular viewer available for Windows and Linux.

The values are written to the file .figct-moc.vcd. If the file exists, it is overwritten. If the directory does not exist, it is created.

The library for the domain interfaces

The library for the MoC interfaces

The library for the Cyclo-Static Dataflow MoC

The library for the Scenario Aware Dataflow MoC