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

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

ForSyDe.Shallow.MoC.Synchronous.Stochastic

Contents

Description

The stochastic library provides a few stochastic skeletons, which are relatives to the skeletons of the synchronous library. These skeletons are based on two elementary functions, sigmaUn and sigmaGe which provide stochastic signals. The background and motivation for this approach is described in the paper

Axel Jantsch, Ingo Sander, and Wenbiao Wu, "The usage of stochastic processes in embedded system specifications", In Proceedings of the Ninth International Symposium on Hardware and Software Codesign, April 2001 (http://web.it.kth.se/~axel/papers/2001/codes-2001.pdf).

Unfortunately, not all of the suggested skeletons are implemented. In particular, consolidation-based process constructors and all constructors for the untimed and the discrete timed MoCs are missing.

Synopsis

Select based synchronous process constructors

selMapSY Source #

Arguments

:: Int

The seed for the stochastic process

-> (a -> b)

The first alternative function

-> (a -> b)

The second alternative function

-> Signal a

The input signal

-> Signal b

The output signal of the process

The skeleton selMapSY is a stochastic variant of mapSY. It has an internal stochastic process and selects one out of two combinatorial functions depending on the output of the stochastic process.

selScanlSY Source #

Arguments

:: Int

The seed

-> (a -> b -> a)

The first alternative next-state function

-> (a -> b -> a)

The second alternative function

-> a

The initial state

-> Signal b

The input signal

-> Signal a

The output signal

The skeleton selScanlSY is a stochastic variant of scanlSY.

selMealySY Source #

Arguments

:: Int

The seed for the next-state function

-> Int

The seed for the output function

-> (a -> b -> a)

First alternative for the next-state function

-> (a -> b -> a)

Second alternative for the next-state function

-> (a -> b -> c)

First alternative for the output function

-> (a -> b -> c)

Second alternative for the output function

-> a

The initial state

-> Signal b

The input signal

-> Signal c

The output signal

selMealySY is the stochastic variant of mealySY. Both the next-state and the output function is randomly selected based on a uniform distribution.

selMooreSY Source #

Arguments

:: Int

The seed for the next-state function

-> Int

The seed for the output function

-> (a -> b -> a)

First alternative for the next-state function

-> (a -> b -> a)

Second alternative for the next-state function

-> (a -> c)

First alternative for the output function

-> (a -> c)

Second alternative for the output function

-> a

The initial state

-> Signal b

The input signal

-> Signal c

The output signal

selMooreSY is the stochastic variant of mooreSY. Both the next-state and the output function is randomly selected based on a uniform distribution.

Elementary stochastic processes

sigmaUn Source #

Arguments

:: Int

The seed

-> (Int, Int)

The interval from which the stochastic values are taken

-> Signal Int

The sequence of stochastic values

sigmaUn generates a signal list of uniformly distributed Int within the given range and with a given seed.

sigmaGe Source #

Arguments

:: (Float -> Float)

The stochastic distribution

-> Int

The seed

-> (Int, Int)

The range

-> Signal Int

The sequence of stochastic values

sigmaGe is a more general stochastic process. The first argument is a function f which describes the distribution. For each value v in the given range (r1,r2), f(v) is the probability that v is generated.

Note, that the user has to make sure that sum(f(v))=1 for v in (r1,r2).

For illustration consider the following example.

pdist :: Float -> Float
pdist d = 1\/\(2**d\)
pdistsum 1 = pdist 1
pdistsum d = \(pdist d\) + \(pdistsum \(d-1\)\)
pdistnorm :: Float -> Float -> Float
pdistnorm dmax d = 1\/((pdistsum dmax) * (2**d))

pdistnorm dmax d gives the probability of a value <= d;

pdistnorm dmax dmax is always 1.0

Hence, using pdistnorm as a function in sigmaGe gives an exponantial distribution for values in the range \[0, dmax\].