<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--Rendered using the Haskell Html Library v0.2--> <HTML ><HEAD ><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" ><TITLE >ForSyDe.Shallow.StochasticLib</TITLE ><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css" ><SCRIPT SRC="haddock-util.js" TYPE="text/javascript" ></SCRIPT ><SCRIPT TYPE="text/javascript" >window.onload = function () {setSynopsis("mini_ForSyDe-Shallow-StochasticLib.html")};</SCRIPT ></HEAD ><BODY ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="topbar" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD ><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" " ></TD ><TD CLASS="title" >ForSyDe-3.1.1: ForSyDe's Haskell-embedded Domain Specific Language.</TD ><TD CLASS="topbut" ><A HREF="src/ForSyDe-Shallow-StochasticLib.html" >Source code</A ></TD ><TD CLASS="topbut" ><A HREF="index.html" >Contents</A ></TD ><TD CLASS="topbut" ><A HREF="doc-index.html" >Index</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="modulebar" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD ><FONT SIZE="6" >ForSyDe.Shallow.StochasticLib</FONT ></TD ><TD ALIGN="right" ><TABLE CLASS="narrow" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="infohead" >Portability</TD ><TD CLASS="infoval" >portable</TD ></TR ><TR ><TD CLASS="infohead" >Stability</TD ><TD CLASS="infoval" >experimental</TD ></TR ><TR ><TD CLASS="infohead" >Maintainer</TD ><TD CLASS="infoval" >forsyde-dev@ict.kth.se</TD ></TR ></TABLE ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="section4" ><B >Contents</B ></TD ></TR ><TR ><TD ><DL ><DT ><A HREF="#1" >Select based synchronous process constructors </A ></DT ><DT ><A HREF="#2" >Elementary stochastic processes </A ></DT ></DL ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" >Description</TD ></TR ><TR ><TD CLASS="doc" ><P >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, <TT ><A HREF="ForSyDe-Shallow-StochasticLib.html#v%3AsigmaUn" >sigmaUn</A ></TT > and <TT ><A HREF="ForSyDe-Shallow-StochasticLib.html#v%3AsigmaGe" >sigmaGe</A ></TT > which provide stochastic signals. The background and motivation for this approach is described in the paper </P ><P >Axel Jantsch, Ingo Sander, and Wenbiao Wu, "The usage of stochastic processes in embedded system specifications", In <EM >Proceedings of the Ninth International Symposium on Hardware and Software Codesign</EM >, April 2001 (<A HREF="http://web.it.kth.se/~axel/papers/2001/codes-2001.pdf" >http://web.it.kth.se/~axel/papers/2001/codes-2001.pdf</A >). </P ><P >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. </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" >Synopsis</TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="decl" ><A HREF="#v%3AselMapSY" >selMapSY</A > :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> (a -> b) -> (a -> b) -> <A HREF="ForSyDe-Shallow-Signal.html#t%3ASignal" >Signal</A > a -> <A HREF="ForSyDe-Shallow-Signal.html#t%3ASignal" >Signal</A > b</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AselScanlSY" >selScanlSY</A > :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> (a -> b -> a) -> (a -> b -> a) -> a -> <A HREF="ForSyDe-Shallow-Signal.html#t%3ASignal" >Signal</A > b -> <A HREF="ForSyDe-Shallow-Signal.html#t%3ASignal" >Signal</A > a</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AselMealySY" >selMealySY</A > :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> (a -> b -> a) -> (a -> b -> a) -> (a -> b -> c) -> (a -> b -> c) -> a -> <A HREF="ForSyDe-Shallow-Signal.html#t%3ASignal" >Signal</A > b -> <A HREF="ForSyDe-Shallow-Signal.html#t%3ASignal" >Signal</A > c</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AselMooreSY" >selMooreSY</A > :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> (a -> b -> a) -> (a -> b -> a) -> (a -> c) -> (a -> c) -> a -> <A HREF="ForSyDe-Shallow-Signal.html#t%3ASignal" >Signal</A > b -> <A HREF="ForSyDe-Shallow-Signal.html#t%3ASignal" >Signal</A > c</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AsigmaUn" >sigmaUn</A > :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> (<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A >, <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A >) -> <A HREF="ForSyDe-Shallow-Signal.html#t%3ASignal" >Signal</A > <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AsigmaGe" >sigmaGe</A > :: (<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3AFloat" >Float</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3AFloat" >Float</A >) -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> (<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A >, <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A >) -> <A HREF="ForSyDe-Shallow-Signal.html#t%3ASignal" >Signal</A > <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="1" ><A NAME="1" >Select based synchronous process constructors </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:selMapSY" ><A NAME="v%3AselMapSY" ></A ></A ><B >selMapSY</B ></TD ><TD CLASS="declbut" ><A HREF="src/ForSyDe-Shallow-StochasticLib.html#selMapSY" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="arg" >:: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A ></TD ><TD CLASS="rdoc" >The seed for the stochastic process </TD ></TR ><TR ><TD CLASS="arg" >-> a -> b</TD ><TD CLASS="rdoc" >The first alternative function </TD ></TR ><TR ><TD CLASS="arg" >-> a -> b</TD ><TD CLASS="rdoc" >The second alternative function </TD ></TR ><TR ><TD CLASS="arg" >-> <A HREF="ForSyDe-Shallow-Signal.html#t%3ASignal" >Signal</A > a</TD ><TD CLASS="rdoc" >The input signal </TD ></TR ><TR ><TD CLASS="arg" >-> <A HREF="ForSyDe-Shallow-Signal.html#t%3ASignal" >Signal</A > b</TD ><TD CLASS="rdoc" >The output signal of the process </TD ></TR ><TR ><TD CLASS="ndoc" COLSPAN="2" >The skeleton <TT ><A HREF="ForSyDe-Shallow-StochasticLib.html#v%3AselMapSY" >selMapSY</A ></TT > is a stochastic variant of <TT ><A HREF="ForSyDe-Shallow-SynchronousLib.html#v%3AmapSY" >mapSY</A ></TT >. It has an internal stochastic process and selects one out of two combinatorial functions depending on the output of the stochastic process. </TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:selScanlSY" ><A NAME="v%3AselScanlSY" ></A ></A ><B >selScanlSY</B ></TD ><TD CLASS="declbut" ><A HREF="src/ForSyDe-Shallow-StochasticLib.html#selScanlSY" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="arg" >:: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A ></TD ><TD CLASS="rdoc" >The seed </TD ></TR ><TR ><TD CLASS="arg" >-> a -> b -> a</TD ><TD CLASS="rdoc" >The first alternative next-state function </TD ></TR ><TR ><TD CLASS="arg" >-> a -> b -> a</TD ><TD CLASS="rdoc" >The second alternative function </TD ></TR ><TR ><TD CLASS="arg" >-> a</TD ><TD CLASS="rdoc" >The initial state </TD ></TR ><TR ><TD CLASS="arg" >-> <A HREF="ForSyDe-Shallow-Signal.html#t%3ASignal" >Signal</A > b</TD ><TD CLASS="rdoc" >The input signal </TD ></TR ><TR ><TD CLASS="arg" >-> <A HREF="ForSyDe-Shallow-Signal.html#t%3ASignal" >Signal</A > a</TD ><TD CLASS="rdoc" >The output signal </TD ></TR ><TR ><TD CLASS="ndoc" COLSPAN="2" >The skeleton <TT ><A HREF="ForSyDe-Shallow-StochasticLib.html#v%3AselScanlSY" >selScanlSY</A ></TT > is a stochastic variant of <TT ><A HREF="ForSyDe-Shallow-SynchronousLib.html#v%3AscanlSY" >scanlSY</A ></TT >. </TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:selMealySY" ><A NAME="v%3AselMealySY" ></A ></A ><B >selMealySY</B ></TD ><TD CLASS="declbut" ><A HREF="src/ForSyDe-Shallow-StochasticLib.html#selMealySY" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="arg" >:: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A ></TD ><TD CLASS="rdoc" >The seed for the next-state function </TD ></TR ><TR ><TD CLASS="arg" >-> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A ></TD ><TD CLASS="rdoc" >The seed for the output function </TD ></TR ><TR ><TD CLASS="arg" >-> a -> b -> a</TD ><TD CLASS="rdoc" >First alternative for the next-state function </TD ></TR ><TR ><TD CLASS="arg" >-> a -> b -> a</TD ><TD CLASS="rdoc" >Second alternative for the next-state function </TD ></TR ><TR ><TD CLASS="arg" >-> a -> b -> c</TD ><TD CLASS="rdoc" >First alternative for the output function </TD ></TR ><TR ><TD CLASS="arg" >-> a -> b -> c</TD ><TD CLASS="rdoc" >Second alternative for the output function </TD ></TR ><TR ><TD CLASS="arg" >-> a</TD ><TD CLASS="rdoc" >The initial state </TD ></TR ><TR ><TD CLASS="arg" >-> <A HREF="ForSyDe-Shallow-Signal.html#t%3ASignal" >Signal</A > b</TD ><TD CLASS="rdoc" >The input signal </TD ></TR ><TR ><TD CLASS="arg" >-> <A HREF="ForSyDe-Shallow-Signal.html#t%3ASignal" >Signal</A > c</TD ><TD CLASS="rdoc" >The output signal </TD ></TR ><TR ><TD CLASS="ndoc" COLSPAN="2" ><TT ><A HREF="ForSyDe-Shallow-StochasticLib.html#v%3AselMealySY" >selMealySY</A ></TT > is the stochastic variant of mealySY. Both the next-state and the output function is randomly selected based on a uniform distribution. </TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:selMooreSY" ><A NAME="v%3AselMooreSY" ></A ></A ><B >selMooreSY</B ></TD ><TD CLASS="declbut" ><A HREF="src/ForSyDe-Shallow-StochasticLib.html#selMooreSY" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="arg" >:: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A ></TD ><TD CLASS="rdoc" >The seed for the next-state function </TD ></TR ><TR ><TD CLASS="arg" >-> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A ></TD ><TD CLASS="rdoc" >The seed for the output function </TD ></TR ><TR ><TD CLASS="arg" >-> a -> b -> a</TD ><TD CLASS="rdoc" >First alternative for the next-state function </TD ></TR ><TR ><TD CLASS="arg" >-> a -> b -> a</TD ><TD CLASS="rdoc" >Second alternative for the next-state function </TD ></TR ><TR ><TD CLASS="arg" >-> a -> c</TD ><TD CLASS="rdoc" >First alternative for the output function </TD ></TR ><TR ><TD CLASS="arg" >-> a -> c</TD ><TD CLASS="rdoc" >Second alternative for the output function </TD ></TR ><TR ><TD CLASS="arg" >-> a</TD ><TD CLASS="rdoc" >The initial state </TD ></TR ><TR ><TD CLASS="arg" >-> <A HREF="ForSyDe-Shallow-Signal.html#t%3ASignal" >Signal</A > b</TD ><TD CLASS="rdoc" >The input signal </TD ></TR ><TR ><TD CLASS="arg" >-> <A HREF="ForSyDe-Shallow-Signal.html#t%3ASignal" >Signal</A > c</TD ><TD CLASS="rdoc" >The output signal </TD ></TR ><TR ><TD CLASS="ndoc" COLSPAN="2" ><TT ><A HREF="ForSyDe-Shallow-StochasticLib.html#v%3AselMooreSY" >selMooreSY</A ></TT > is the stochastic variant of mooreSY. Both the next-state and the output function is randomly selected based on a uniform distribution. </TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="2" ><A NAME="2" >Elementary stochastic processes </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:sigmaUn" ><A NAME="v%3AsigmaUn" ></A ></A ><B >sigmaUn</B ></TD ><TD CLASS="declbut" ><A HREF="src/ForSyDe-Shallow-StochasticLib.html#sigmaUn" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="arg" >:: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A ></TD ><TD CLASS="rdoc" >The seed </TD ></TR ><TR ><TD CLASS="arg" >-> (<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A >, <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A >)</TD ><TD CLASS="rdoc" >The interval from which the stochastic values are taken </TD ></TR ><TR ><TD CLASS="arg" >-> <A HREF="ForSyDe-Shallow-Signal.html#t%3ASignal" >Signal</A > <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A ></TD ><TD CLASS="rdoc" >The sequence of stochastic values </TD ></TR ><TR ><TD CLASS="ndoc" COLSPAN="2" ><TT ><A HREF="ForSyDe-Shallow-StochasticLib.html#v%3AsigmaUn" >sigmaUn</A ></TT > generates a signal list of uniformly distributed Int within the given range and with a given seed. </TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:sigmaGe" ><A NAME="v%3AsigmaGe" ></A ></A ><B >sigmaGe</B ></TD ><TD CLASS="declbut" ><A HREF="src/ForSyDe-Shallow-StochasticLib.html#sigmaGe" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="arg" >:: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3AFloat" >Float</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#t%3AFloat" >Float</A ></TD ><TD CLASS="rdoc" >The stochastic distribution </TD ></TR ><TR ><TD CLASS="arg" >-> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A ></TD ><TD CLASS="rdoc" >The seed </TD ></TR ><TR ><TD CLASS="arg" >-> (<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A >, <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A >)</TD ><TD CLASS="rdoc" >The range </TD ></TR ><TR ><TD CLASS="arg" >-> <A HREF="ForSyDe-Shallow-Signal.html#t%3ASignal" >Signal</A > <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A ></TD ><TD CLASS="rdoc" >The sequence of stochastic values </TD ></TR ><TR ><TD CLASS="ndoc" COLSPAN="2" ><P ><TT ><A HREF="ForSyDe-Shallow-StochasticLib.html#v%3AsigmaGe" >sigmaGe</A ></TT > 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. </P ><P >Note, that the user has to make sure that sum(f(v))=1 for v in (r1,r2). </P ><P >For illustration consider the following example. </P ><PRE > pdist :: Float -> Float pdist d = 1\/\(2**d\) pdistsum 1 = pdist 1 pdistsum d = \(pdist d\) + \(pdistsum \(d-1\)\) </PRE ><PRE > pdistnorm :: Float -> Float -> Float pdistnorm dmax d = 1\/((pdistsum dmax) * (2**d)) </PRE ><P ><TT >pdistnorm dmax d</TT > gives the probability of a value <= d; </P ><P ><TT >pdistnorm dmax dmax</TT > is always 1.0 </P ><P >Hence, using pdistnorm as a function in <TT ><A HREF="ForSyDe-Shallow-StochasticLib.html#v%3AsigmaGe" >sigmaGe</A ></TT > gives an exponantial distribution for values in the range [0, dmax]. </P ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="botbar" >Produced by <A HREF="http://www.haskell.org/haddock/" >Haddock</A > version 2.6.1</TD ></TR ></TABLE ></BODY ></HTML >