l3u      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghi j k l m n o p q r s t u v w x y z { | } ~        !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abc d e f g h i j k l m n o p qrstJportable experimentalforsyde-dev@ict.kth.se&Automatically generate an instance of u!"! for one data type. For example: !{-# LANGUAGE TemplateHaskell #-} module Colour where  import Language.Haskell.TH.Lift  data RGB = Red | Green | Blue  %-- Generate the Lift instance of RGB $(deriveLift1 ''RGB)  Version of  deriveLif1* used to automatically generate instances 2 of Lift for multiple data types. For instance: !{-# LANGUAGE TemplateHaskell #-} module Colour where  import Language.Haskell.TH.Lift  data RGB = Red | Green | Blue  $data Num a => Pixel a = Pixel a a a  --- Generate Lift instances for RGB and Pixel $$(mapM deriveLift [''RGB, ''Pixel]) portable experimentalforsyde-dev@ict.kth.se6lift twice, getting the meta AST (the AST of the AST) #portable experimentalforsyde-dev@ict.kth.se      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstportable experimentalforsyde-dev@ict.kth.seA System identifier A Port identifier A process identifier non-portable (Template Haskell) experimentalforsyde-dev@ict.kth.seportable experimentalforsyde-dev@ict.kth.se vThe data type 0 is defined as an instance of w$% and x$%. '_' represents the value /< while a present value is represented with its value, e.g. . 1 is represented as '1'. - The function -Q extends a function in order to process absent extended values. If the input is ("bottom"), the output will also be ("bottom"). 0The data type 0' has two constructors. The constructor /@ is used to model the absence of a value, while the constructor ." is used to model present values. 1 The function 1- converts a usual value to a present value. 2 The function 2' extracts the inner value contained in 0 3 Similar to 2, but without default value 4The functions 4% checks for the presence of a value. 5The functions 5$ checks for the absence of a value. 6 The function 6 is identical to - and should be used in future. -./0123456 0/.231654- portable experimentalforsyde-dev@ict.kth.secNot operation over bits gConvert a bit to a boolean hConvert a boolean to a bit yJversion of fromBitVector supplying a default initial value from which to  start working cdefghijklmnopfdecghijklmnopportable experimentalforsyde-dev@ict.kth.se The function 5 performs a standard Discrete Fourier Transformation  The function 7 implements a fast Fourier transform (FFT) algorithm, ; for computing the DFT, when the size N is a power of 2. portable experimentalforsyde-dev@ict.kth.seb8All kinds of FIR-filters can now be modeled by means of b. The E only argument needed is the list of coefficients, which is given as C a vector of any size. To illustrate this, an 8-th order band pass  filter is modeled as follows. V bp = fir "fir Id" $(vectorTH [0.06318761339784, 0.08131651217682, 0.09562326700432, V 0.10478344432968, 0.10793629404886, 0.10478344432968, W 0.09562326700432, 0.08131651217682, 0.06318761339784 ]) bbportable experimentalforsyde-dev@ict.kth.seportable experimentalforsyde-dev@ict.kth.se0789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`anon-portable (Template Haskell) experimentalforsyde-dev@ict.kth.se+7The process constructor 7& is used to construct a finite state J machine process without output decoder. It takes an initial value and K a function for the next state decoder. The process constructor behaves + similar to the Haskell prelude function 7 and has the value of < the new state as its output value as illustrated by the  following example. $This is in contrast to the function E, which has its current  state as its output value. 89Creates a constant process. A process which outputs the + same signal value in every clock cycle. 9The process constructor 9 takes an identifier and a G combinational function as arguments and returns a process with one 0 input signal and one output signal. :The process constructor : takes an identifier and a B combinational function as arguments and returns a process with + two input signals and one output signal. ;The process constructor ; takes an identifier and a C combinational function as arguments and returns a process with / three input signals and one output signal. <The process constructor < takes an identifier and a C combinational function as arguments and returns a process with . four input signals and one output signal. =The process constructor = takes an identifier and a C combinational function as arguments and returns a process with . five input signals and one output signal. >The process constructor > takes an identifier and a C combinational function as arguments and returns a process with . five input signals and one output signal. ?The process constructor ?( creates a process network that maps a K function onto all signals in a vector of signals. The identifier is used M as the identifier prefix of the processes created (a number starting with 1 & will be appended to each identifier) @The process constructor @ works as :, but takes a L vector of signals as input. AThe process constructor A) delays the signal one event cycle M by introducing an initial value at the beginning of the output signal. M Note, that this implies that there is one event (the first) at the M output signal that has no corresponding event at the input signal. M One could argue that input and output signals are not fully synchronized, M even though all input events are synchronous with a corresponding output D event. However, this is necessary to initialize feed-back loops. BThe process constructor B delays the signal n events by A introducing n identical default values. It creates a chain of A  processes. CThe process constructor C behaves like 7, but has two  input signals. DThe process constructor C behaves like 7, but has two  input signals. EThe process constructor E% is used to construct a finite state J machine process without output decoder. It takes an initial value and a G function for the next state decoder. The process constructor behaves , similarly to the Haskell prelude function 7. In contrast to the  process constructor 7, here the output value is the current state % and not the one of the next state. FThe process constructor F behaves like E , but has  two input signals. GThe process constructor F behaves like E , but has  two input signals. HThe process constructor H! is used to model state machines  of "Moore"4 type, where the output only depends on the current D state. The process constructor is based on the process constructor  E;, since it is natural for state machines in hardware, that > the output operates on the current state and not on the next C state. The process constructors takes a function to calculate the F next state, another function to calculate the output and a value for  the initial state. GIn contrast the output of a process created by the process constructor  K> depends not only on the state, but also on the input values. IThe process constructor I behaves like H, but has two  input signals. JThe process constructor I behaves like H, but has two  input signals. KThe process constructor melaySY$ is used to model state machines of  "Mealy"> type, where the output only depends on the current state and C the input values. The process constructor is based on the process  constructor E,, since it is natural for state machines in H hardware, that the output operates on the current state and not on the H next state. The process constructors takes a function to calculate the J next state, another function to calculate the output and a value for the  initial state. HIn contrast the output of a process created by the process constructor  H9 depends only on the state, but not on the input values. LThe process constructor L behaves like K , but has  two input signals. MThe process constructor L behaves like K , but has  two input signals. NThe process constructor Nx discards the values who do not fulfill a predicate given by a predicate function and replaces them with absent events. O The process O5 takes a function and an initial state and generates G an infinite signal starting with the initial state as first output I followed by the recursive application of the function on the current > state. The state also serves as output value. JThe process that has the infinite signal of natural numbers as output is M con structed by  sourceSY "naturals" (+1) 0 PThe process constructor P creates a process that fills a signal K with present values by replacing absent values with a given value. The - output signal is not any more of the type 0 . QThe process constructor Q creates a process that fills a signal K with values by replacing absent values by the preceding present value. H Only in cases, where no preceding value exists, the absent value is J replaced by a default value. The output signal is not any more of the  type 0. RThe process constructor R( creates a process that synchronizes a L signal of absent extended values with another signal of absent extended L values. The output signal has the value of the first signal whenever an ! event has a present value and /% when the event has an absent value. S The process S "zips"* two incoming signals into one signal of  tuples. T The process T works as S!, but takes three input signals. U The process U works as S , but takes four input signals. V The process V works as S , but takes five input signals. W The process W works as S, but takes six input signals. X The process X "unzips"& a signal of tuples into two signals. Y The process Y "unzips"( a signal of tuples into three signals. Z The process Z "unzips"' a signal of tuples into four signals. [ The process [ "unzips"' a signal of tuples into five signals. \ The process \ "unzips"& a signal of tuples into six signals. ] The process ] "zips"/ a signal of vectors into a vector of signals. ^ The process ^ "unzips") a vector of n signals into a signal of  vectors. _ The process _7 selects always the first value from a signal of pairs ` The process `8 selects always the second value from a signal of pairs a The function a5 groups values into a vector of size n, which takes J n cycles. While the grouping takes place the output from this process  consists of absent values. +789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`a+89:;<=>@AB7CDEFGHIJKLMONPQRSTUVWXYZ[\]^?_`a&portable experimentalforsyde-dev@ict.kth.se+      !"#$%&'()*+,qrst%non-portable (Template Haskell, LSTV) experimentalforsyde-dev@ict.kth.se5 takes a system definition and generates a function = able simulate a System using a list-based representation  of its signals. zBcheck that there will only be output as long as there are inputs portable experimentalforsyde-dev@ict.kth.seq-alternative of t , note that 2 compileModelSim will implicitly be set to True rIGiven a System Definition whose name is a valid VHDL _basic_ identifier  (call it "A" ) generate A.vhd% in current working directory using  default compilation options. N Imp: the input and output signal names of A must be valid VHDL identifiers - (basic or extended) and different to clk and reset @ which are reserved for the main clock and reset signals sr<-alternative which allows setting VHDL compilation options. tIGenerate a function which, given a system definition and some simulation  stimuli: $ Writes a VHDL model of the system L Simulates the VHDL model with Modelsim getting the results back to Haskell      qrstrstq     portable experimentalforsyde-dev@ict.kth.se+3Given a System Definition whose name is A generate  A.graphml in current < working directory using the default compilation options. ,+7-alternative which allows setting GraphML compilation  options.  !"#$%&'()*+,+,$()*&"#% !''portable experimentalforsyde-dev@ict.kth.se  !"#$%&'()*+,-./0123456789:;<VWXYZ[\]^{_|`abcdefghijklmnopqrstuvwxyz{|}~portable experimentalforsyde-dev@ict.kth.se}The data type Y is defined as an instance of w$% and x$%. '_' represents the value X< while a present value is represented with its value, e.g. W 1 is represented as '1'. V The function VQ extends a function in order to process absent extended values. If the input is ("bottom"), the output will also be ("bottom"). YThe data type Y' has two constructors. The constructor X@ is used to model the absence of a value, while the constructor W" is used to model present values. Z The function Z- converts a usual value to a present value. [ The function [) converts a value from a extended value. \The functions \% checks for the presence of a value. ]The functions ]$ checks for the absence of a value. ^ The function ^ is identical to V and should be used in future. VWXYZ[\]^ YXW[Z^]\V( portable  experimentalforsyde-dev@ict.kth.sepijklmnopqrstuvwxyz{|}~portable experimentalforsyde-dev@ict.kth.seportable experimentalforsyde-dev@ict.kth.se~Extended version of $),, which will add zeros to the shorter list. L)Multiplication operation of polynomials. MPolynomial data type. N#Division operation of polynomials. O$Addition operations of polynomials. P Power operation of polynomials. QSome helper functions below. +To get the coefficients of the polynomial. JKLMNOPQRSTU MJKOLNPQRSTUportable experimentalforsyde-dev@ict.kth.se ?;To judge whether the input bit-vector is in a proper form. CHTo transform the input integer to a bit-vector with specified number of  bits. D1To transform the input bit-vecotr to an integer. E6To add even parity bit on the bit-vector in the tail. F5To add odd parity bit on the bit-vector in the tail. G&To remove the parity bit in the tail. H,To check the even parity of the bit-vector. I+To check the odd parity of the bit-vector. Helper function of C. Helper function of D. =>?@ABCDEFGHI B@=>CDEFAGHI?portable experimentalforsyde-dev@ict.kth.se _The data type _E has an additional parameter, that determines the size of the queue. `,A queue is modeled as a list. The data type `% modelles an queue of infinite size. aa, pushes one element into an infinite queue. bb3 pushes a list of elements into an infinite queue. cc* pops one element from an infinite queue. dd+ transforms a list into an infinite queue. ee) pushes one element into a finite queue. ff0 pushes a list of elements into a finite queue. gg' pops one element from a finite queue. hh+ transforms a list into an infinite queue. {_|`abcdefgh `_abcdefgh portable experimentalforsyde-dev@ict.kth.sekEThis constant gives the default time step for sampling and plotting.  Its value is 10ns. mFFor the digital-analog conversion we have two different possibilities ' which is determined by this data type m . oFThe type of a sub-signal of a continuous signal. It consisits of the > function and the interval on which the function is defined. G The continuous time signal is then defined as a sequence of SubsigCT  elements: Signal SubsigCT pp @ is a process constructor with one input and one output signal. 5 It instantiates a combinatorial, stateless process. qq $ is a process constructor just like p  but operates on  two input signals. rr , is a delay process which simply delays the I output but does not buffer it. The value at each time t is the same as 0 for the input signal, after the initial delay. ss 1 shifts the shape of the input signal by delay  to the right. tGinitCT takes an initial signal, outputs it and then copies its second G input signal, which is delayed by the duration of the initial signal.  The delay is realized by r  uThe state-full constructor u  resembles a Mealy machine. vThe state-full constructor v  resembles a Moore machine. ww * amplifies an input by a constant factor: xx " adds two input signals together. yy ( multiplies two input signals together. zz ' takes the absolute value of a signal. {{ ; generates a sinus signal with the given frequency defined 2 over a given period. The function is defined as f(x)=sin(2*pi*freq*x). |?constCT generates a constant signal for a given time duration. }BzeroCT generates a constant 0 signal for the given time duration. ~~ 3 converts an untimes or synchronous signal into a  continuous time signal.  The process ~ ) converts a signal of the digital domain 5 into a continuous time signal. There are two modes, j , E which makes a smooth transition between adjacent digital values and  i 6, where the analog value directly follows the digital  value. This means that in i -mode a staircase function ( remains a staircase function, while in j  the staircase . function would resemble at least partially a  saw tooth -curve. :The resolution of the converter is given by the parameter  k . Note, that the process ~ # is an ideal component, i.e. there K are no losses due to a limited resolution due to a fixed number of bits.  The process  & converts a continuous time signal to C an untimed or synchronous signal. The first parameter gives the % sampling period of the converter. Note, that the process   is an ideal component, G i.e. there are no losses due to a limited resolution due to a fixed  number of bits. IapplyF1 applies a function on a sub-signal, which means the function of 3 the subsignal is transformed to another function: FapplyF2 works just like applyF1 but operates on two incoming signals. CapplyG1 is used to apply a next-state function. A very interesting F question is, what should be an argument to the next-state function: @ the incoming function, defining the value of the input signal? 5 or the incoming function and the incoming interval? I or the value of the incoming signal at a particular point, e.g. at the " left most point of the interval? M To give the next-state function the interval itself as argument, would mean G that the process becomes time variant process, i.e. its behaviour is J dependent on the absolute time values. This is not a good thing to have! J Another possibility may be to give a sub-signal that is relative to the K current evaluation, i.e. the left most point is always 0. Would that make  sense? JcutEq partitions the two signals such that the partitioning are identical L in both result signals, but only up to the duration of the shorter of the  two signals:  = allows to see how a signal is partitioned into sub-signals. ' It returns the sequence of intervals.  ? plots one signal in a graph with the default sampling period  of 1/#200 of the duration of the signal.  A plots a list of signals in the same graph. The sampling period H has to be given as argument. In the graph default label names are used  to identify the signals.  2 is the work horse for plotting and the functions   and   % use it with specialising arguments.  ? plots all the signals in the list in one graph. If a label is P given for a signal, this label appears in the graph. If the label string is  "", a default label like "sig-1" is used. GIn 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.tex1 This is the tex file that should be included K by your latex document. It in turn includes , the file ct-moc-graph-latex.eps. 4 These two files have to be used together; 5 the .eps file contains only the graphics, 7 while the .tex file contains the labels and % text. OvcdGen 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 .fig#ct-moc.vcd. If the file exists, it @is overwritten. If the directory does not exist, it is created. : computes the values of a signal with a given step size. E It returns a list with (x, (f x)) pairs of type [(Rational,Rational)]. #ijklmnopqrstuvwxyz{|}~#olkpqvurstwxyzn{|}mij~portable experimentalforsyde-dev@ict.kth.se' The operator '- concatinates two signals into one signal. ( The function ( returns the n-th event in a signal. The numbering of events in a signal starts with 0. There is also an operator version of this function, '(!-)'. +A signal is defined as a list of events. An event has a tag and a value. The tag of an event is defined by the position in the list. A signal is defined as an instance of the classes x$% and w$%/. The signal 1 :- 2 :- NullS is represented as {1,2}. , The function , converts a list into a signal. - The function - converts a signal into a list. . The function ." creates a signal with one value. / The function / checks if a signal is empty. 0 The function 02 gives the first value - the head - of a signal. 1 The function 1* gives the rest of the signal - the tail. 3 The function 3) returns the first n values of a signal. 4 The function 4+ drops the first $n$ values from a signal. 5 The function 5 takes three parameters, an offset, a stepsize and a signal and returns some elements of the signal such as in the following example:  1 Signal> selectS 2 3 (signal[1,2,3,4,5,6,7,8,9,10])  {3,6,9} :: Signal Integer 6 The operator '-:'- adds at an element to a signal at the tail. 7 The function 7 returns the length of a finite signal. 8 The function 80 creates an infinite signal. The first argument fI is a function that is applied on the current value. The second argument x& gives the first value of the signal. $ Signal> takeS 5 (infiniteS (*3) 1) ! {1,3,9,27,81} :: Signal Integer 9 The function 9 creates a signal with n values x. :The combinator : takes two processes p1 and p2] and and generates a process network, where a signal is split and processed by the processes p1 and p2. ; The function ;< transforms a signal into a string of the following format:  ! Signal> writeS (signal[1,2,3,4,5])   1n2n3n4n5n :: [Char] < The function <. transforms a formatted string into a signal.   Signal> readS  1n2n3n4n5n :: Signal Int  {1,2,3,4,5} :: Signal Int '()*+,-./0123456789:;<+*)6'2,-./01(347895;<:* portable  experimentalforsyde@kth.seC  !"#$'()*+,-./0123456789:;<VWXYZ[\]^ portable experimentalforsyde-dev@ict.kth.se The skeleton   is a stochastic variant of   8. It has an internal stochastic process and selects one C out of two combinatorial functions depending on the output of the  stochastic process.  The skeleton   is a stochastic variant of  .  1 is the stochastic variant of mooreSY. Both the G next-state and the output function is randomly selected based on a  uniform distribution.  1 is the stochastic variant of mealySY. Both the G next-state and the output function is randomly selected based on a  uniform distribution.  = generates a signal list of uniformly distributed Int within ) the given range and with a given seed.  ? is a more general stochastic process. The first argument is a F function f which describes the distribution. For each value v in the E given range (r1,r2), f(v) is the probability that v is generated. HNote, that the user has to make sure that sum(f(v))=1 for v in (r1,r2). 1For illustration consider the following example.   pdist :: Float -> Float  pdist d = 1\/\(2**d\)  pdistsum 1 = pdist 1 1 pdistsum d = \(pdist d\) + \(pdistsum \(d-1\)\)  & pdistnorm :: Float -> Float -> Float 2 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   gives an exponantial & distribution for values in the range [0, dmax]. portable experimentalforsyde-dev@ict.kth.se% The function %5 performs a standard Discrete Fourier Transformation & The function &n implements a fast Fourier transform (FFT) algorithm, for computing the DFT, when the size N is a power of 2. %&%& portable experimentalforsyde-dev@ict.kth.se'The process constructor  q takes a combinational function as argument and returns a process with four input signals and one output signal. The process constructor  r takes a combinational function as argument and returns a process with three input signals and one output signal. The process constructor  p takes a combinational function as argument and returns a process with two input signals and one output signal.  The process   "zips"/ a signal of vectors into a vector of signals. The process constructor  o takes a combinational function as argument and returns a process with one input signal and one output signal. The process constructor  Y creates a process network that maps a function onto all signals in a vector of signals. The process constructor   works as  *, but takes a vector of signals as input. The process constructor  $ delays the signal one event cycle K by introducing an initial value at the beginning of the output signal. G Note, that this implies that there is one event (the first) at the G output signal that has no corresponding event at the input signal. M One could argue that input and output signals are not fully synchronized, M even though all input events are synchronous with a corresponding output D event. However, this is necessary to initialize feed-back loops. The process constructor  J delays the signal n events by introducing n identical default values. The process constructor   is used to construct a finite state machine process without output decoder. It takes an initial value and a function for the next state decoder. The process constructor behaves similar to the Haskell prelude function  c and has the value of the new state as its output value as illustrated by the following example.  3 SynchronousLib> scanldSY (+) 0 (signal [1,2,3,4])   {1,3,6,10} :: Signal Integer $This is in contrast to the function  4, which has its current state as its output value. The process constructor   behaves like  , but has two input signals. The process constructor   behaves like  , but has three input signals. The process constructor   is used to construct a finite state machine process without output decoder. It takes an initial value and a function for the next state decoder. The process constructor behaves similar to the Haskell prelude function  ). In contrast to the process constructor  O here the output value is the current state and not the one of the next state.  2 SynchronousLib> scanlSY (+) 0 (signal [1,2,3,4])  {0,1,3,6} :: Signal Integer The process constructor   behaves like  , but has two input signals. The process constructor   behaves like  , but has three input signals. The process constructor  $ is used to model state machines of "Moore"w type, where the output only depends on the current state. The process constructor is based on the process constructor  , since it is natural for state machines in hardware, that the output operates on the current state and not on the next state. The process constructors takes a function to calculate the next state, another function to calculate the output and a value for the initial state. GIn contrast the output of a process created by the process constructor  > depends not only on the state, but also on the input values. The process constructor   behaves like  , but has two input signals. The process constructor   behaves like  , but has three input signals. The process constructor melaySY$ is used to model state machines of "Mealy" type, where the output only depends on the current state and the input values. The process constructor is based on the process constructor  , since it is natural for state machines in hardware, that the output operates on the current state and not on the next state. The process constructors takes a function to calculate the next state, another function to calculate the output and a value for the initial state. GIn contrast the output of a process created by the process constructor  9 depends only on the state, but not on the input values. The process constructor   behaves like  , but has two input signals. The process constructor   behaves like  , but has three input signals. The process constructor  x discards the values who do not fulfill a predicate given by a predicate function and replaces them with absent events.  The process   takes a function and an initial state and generates an infinite signal starting with the initial state as first output followed by the recursive application of the function on the current state. The state also serves as output value. YThe process that has the infinite signal of natural numbers as output is constructed by  + SynchronousLib> takeS 5 (sourceSY (+1) 0)  {0,1,2,3,4} :: Signal Integer The process constructor   creates a process that fills{ a signal with present values by replacing absent values with a given value. The output signal is not any more of the type Y. The process constructor   creates a process that fills a signal with values by replacing absent values by the preceding present value. Only in cases, where no preceding value exists, the absent value is replaced by a default value. The output signal is not any more of the type Y. The process constructor   creates a process that synchronizes a signal of absent extended values with another signal of absent extended values. The output signal has the value of the first signal whenever an event has a present value and X% when the event has an absent value.  The process   "zips"1 two incoming signals into one signal of tuples.  The process   works as  !, but takes three input signals.  The process   works as   , but takes four input signals.  The process   works as   , but takes four input signals.  The process   works as   , but takes four input signals.  The process   "unzips"& a signal of tuples into two signals.  The process   works as   , but has three output signals.  The process   works as  , but has four output signals.  The process   works as  , but has four output signals.  The process   works as  , but has four output signals.  The process   "unzips"/ a vector of signals into a signal of vectors.  The process  8 selects always the first value from a signal of pairs.  The process  9 selects always the second value from a signal of pairs. '' portable experimentalforsyde-dev@ict.kth.se !The domain interface constructor   takes a parameter k" and downsamples an input signal. "The domain interface constructors   takes a parameter k and upsamples an input signal. !The domain interface constructor  0 converts two parallel signals into one signal. !The domain interface constructor  1 converts three parallel signals into one signal !The domain interface constructor  0 converts four parallel signals into one signal !The domain interface constructor  0 converts one signal into two parallel signals. !The domain interface constructor  2 converts one signal into three parallel signals. !The domain interface constructor  1 converts one signal into four parallel signals. !The domain interface constructor  . converts n parallel signals into one signal. "The domain interface constructors  . converts one signal into n parallel signals. portable experimentalforsyde-dev@ict.kth.se The process % implements a synchronous model of a B FIFO with infinite size. The FIFOs take a list of values at each B event cycle and output one value. There is a delay of one cycle.  The process  implements a FIFO with finite ? size. The FIFOs take a list of values at each event cycle and 2 output one value. There is a delay of one cycle.  The process * implements a synchronous memory. It uses  access functions of the type 'Read adr' and 'Write adr value'.  The process ( merges two input signals into a single E signal. The process has an internal buffer in order to prevent loss D of data. The process is deterministic and outputs events according = to their time tag. If there are two valid values at on both 9 signals. The value of the first signal is output first.  The function ( groups values into a vector of size n, A which takes n cycles. While the grouping takes place the output . from this process consists of absent values.  The process ( implements a counter, that counts from  min to max. The process  has no input and its output is  an infinite signal.  portable experimentalforsyde-dev@ict.kth.seThe function firSY implements a FIR-filter for the synchronous computational model. All kinds of FIR-filters can now be modeled by means of  . The only argument needed is the list of coefficients, which is given as a vector of any size. To illustrate this, an 8-th order band pass filter is modeled as follows. L bp = firSY (vector [0.06318761339784, 0.08131651217682, 0.09562326700432, L 0.10478344432968, 0.10793629404886, 0.10478344432968, M 0.09562326700432, 0.08131651217682, 0.06318761339784 ]) portable experimentalforsyde-dev@ict.kth.seThe first parameter of  is a constant integer defining the number of tokens consumed in every evaluation cycle. The second argument is a function on lists of the input type and returning a list of the output type. For instance,   r2 = mapU 1 f  where f :: [Int] -> [Int]  f [x] = [2*x] adefines a process r2 which consumes one token in each evaluation cycle and multiplies it by two. X has an internal state which is visible at the output. The first argument is a function 'gamma' which, given the state returns the number of tokens consumed next. The second argument is the next state function and the third is the initial state. The process constructor  creates a state machine of Moore type. In addition to the next state function they also have an output encoding function. The output depends directly on the internal state. The process constructor  creates a state machine of Moore type. In addition to the next state function they also have an output encoding function. The output depends directly on the internal state. c is used to initialise a signal. Its first argument is prepended to its second argument, a signal. portable experimentalforsyde-dev@ict.kth.seThe FIR filter. Let '[x_n]' denote the input signal, '[y_n]' denote the ouput  signal, and '[h_n]'; the impulse response of the filter. Suppose the length of 5 the impulse responses is M samples. The formula for '[y_n]' is  $sum_{k=0}^{M-1} h_k*x_{n-k}$. The solver mode. KThe autoregressive filter is the simplest IIR filter. It is characterized  by a list of numbers '[a_1,a_2,...,a_M]' called the autoregression " coefficients and a single number b called the gain. M is the order of  the filter. Let '[x_n]' denote the input signal, '[y_n]' denote the ouput  signal. The formula for '[y_n]' is $s"um_{k=1}^M {a_k*y_{n-k}+b*x_n}$. J Although it is an IIR filter, here we only get the same length of ouput  signal as the input signal. 5The ARMA filter combines the FIR and AR filters. Let '[x_n]' denote the  input signal, '[y_n]'* denote the ouput signal. The formula for '[y_n]' is  $sHum_{k=1}^M {a_k*y_{n-k}+b*x_n} + sum_{i=0}^{N-1} b_i*x_{n-i}$. The ARMA N filter can be defined as the composition of an FIR filter having the impulse  reponse '[b_0,b_1,...,b_N-1]') and an AR filter having the regression  coefficients '[a_1,a_2,...,a_M]' and a gain of '1'. Although it is an IIR O filter, here we only get the same length of ouput signal as the input signal. ?The general linear filter in S-domain at CT-MoC. As the kernel H implementation is in Z-domain, the smapling rate should be specified. D It is used on the S-transformation with the following forms, with + coefficients for the descending powers of s and m < n.  8 b_0*s^m + b_1*s^m-1 + ... + b_m-1*s^1 + b_m*s^0 GH(s) = ------------------------------------------------ (Eq 1) 8 a_0*s^n + a_1*s^n-1 + ... + a_n-1*s^1 + a_n*s^0 IIf we multiply both the numerator and the denominator with s^-n, we get # another equivelent canonical form  ? b_0*s^m-n + b_1*s^m-n-1 + ... + b_m-1*s^1-n + b_m*s^-n GH(s) = ----------------------------------------------------- (Eq 2) : a_0*s^0 + a_1*s^-1 + ... + a_n-1*s^1-n + a_n*s^-n 0To instantiate a filter, with sampling interval 'T ' , we use  % filter1 = sLinearFilter T [1] [2,1] ,to get a filter with the transfer function   1 H(s) = --------  2*s + 1 and  ) filter2 = sLinearFilter T [2,1] [1,2,2] 1to get another filter with the transfer function   2*s +1 H(s) = ----------------  s^2 + 2*s + 2 There are two solver modes,  and . M Caused by the precision problem, the time interval in CT uses Rational data @ type and the digital data types in all the domains are Double. 'The general linear filter in Z-domain. Es2z domain coefficient tranformation with a specified sampling rate. : The Tustin transformation is used for the transfer, with   2(z - 1) G s = ---------- (Eq 3)  T(z + 1)  in which, T is the sampling interval. CThe Z-domain to ARMA coefficient tranformation. It is used on the  Z-transfer function  ? b_0*z^m-n + b_1*z^m-n-1 + ... + b_m-1*z^1-n + b_m*z^-n GH(z) = ----------------------------------------------------- (Eq 4) : a_0*z^0 + a_1*z^-1 + ... + a_n-1*z^1-n + a_n*z^-n which is normalized as  = b_0/a_0*z^m-n + b_1/a_0*z^m-n-1 + ... + b_m/a_0*z^-n GH(z) = ------------------------------------------------------- (Eq 5) @ 1 + a_1/a_0*z^-1 + ... + a_n-1/a_0*z^1-n + a_n/a_0*z^-n The implementation coudl be  Ay(k) = b_0/a_0*x_k+m-n + b_1/a_0*x_k+m-n-1 + ... + b_m/a_0*x_k-n G (Eq 6) = - a_1/a_0*y_k-1 - ... - a_n/a_0*y_k-n 8Then, we could get the coefficients of the ARMA filter. +Digital filter using Runge Kutta 4 solver. 5RK-4 to solve the 1st-order ODEs, with input signal. HOne step RK-4 for the 1st-order ordinary differential equations (ODEs). Computes the inner product. %Repeat an element for a given times. KMaintain a fixed length of list like Fifo, except the outputs are ignored. +portable experimentalforsyde-dev@ict.kth.se%&{_|`abcdefghportable experimentalforsyde-dev@ict.kth.se To generate the s, v1, v2 value 2To generate an infinite Signal of Gaussian values 3To get a uniform random variable in the range [0, 1] @To generate an infinite signal of unit normal random variables,  with the specified seed portable experimentalforsyde-dev@ict.kth.se" The function + returns the first n elements of a vector.  The function ) drops the first n elements of a vector.  The function ; returns the n-th element in a vector, starting from zero.  The function  generates a vector with a given number of elements starting from an initial element using a supplied function for the generation of elements.   Vector> iterateV 5 (+1) 1  <1,2,3,4,5> :: Vector Integer The higher-order functions S folds a function from the left to the right over a vector using an initial value.  The function ' returns the last element of a vector.  The function 0 returns all but the last elements of a vector.  The function % creates a vector with one element.  The operator '( +)' concatinates two vectors. The data type  B is modeled similar to a list. It has two data type constructors.  $ constructs the empty vector, while ':>'z constructsa vector by adding an value to an existing vector. Using the inheritance mechanism of Haskell we have declared   as an instance of the classes x$% and w$%. 8| This means that the vector 1:>2:>3:>NullV is shown as  1,2,3.  The function   converts a list into a vector.  The function  converts a vector into a list.  The function  returns $, if a vector is empty.  The function - returns the number of elements in a value.  The function " replaces an element in a vector. The functions ( returns the first element of a vector. The functions 1 returns all, but the first element of a vector.  The function  selects elements in the vector. The first argument gives the initial element, starting from zero, the second argument gives the stepsize between elements and the last argument gives the number of elements.  The function 5 groups a vector into a vector of vectors of size n.  The operator '(<:)') adds an element at the end of a vector. The higher-order function 1 applies a function on all elements of a vector. The higher-order function , applies a function pairwise on to vectors. The higher-order functions T folds a function from the right to the left over a vector using an initial value. The higher-function v takes a predicate function and a vector and creates a new vector with the elements for which the predicate is true.  The function + zips two vectors into a vector of tuples.  The function - unzips a vector of tuples into two vectors.  The function . shifts a value from the left into a vector.  The function / shifts a value from the right into a vector.  The function ] rotates a vector to the right. Note that this fuction does not change the size of a vector.  The function  ] rotates a vector to the left. Note that this fuctions does not change the size of a vector. ! The function !5 transforms a vector of vectors to a single vector. " The function ". reverses the order of elements in a vector. # The function #k behaves in the same way, but starts with the application of the supplied function to the supplied value.   Vector> generateV 5 (+1) 1  <2,3,4,5,6> :: Vector Integer $ The function $H generates a vector with a given number of copies of the same element.   Vector> copyV 7 5 # <5,5,5,5,5,5,5> :: Vector Integer $  !"#$$  !" #$portable experimentalforsyde-dev@ict.kth.seThe data type  defines two access patterns. The data type  is modeled as a vector.  The function L creates a new memory, where the number of entries is given by a parameter.  The function C gives the new state of the memory, after an access to a memory. A x$%( operation leaves the memory unchanged.  The function A gives the output of the memory after an access to the memory. A , operation gives an absent value as output. -.portable experimentalforsyde-dev@ict.kth.se Translate a $/ to a Template Haskell !" A .6 represents the forall part and constraints of a type  (see !") ( For instance, the context of the type   ( forall a b. (Show a, Show b) => (a,b)    is forall a b. (Show a, Show b) =>  where a and b% are the the context variables and  (Show a, Show b) are the context constraints . constructor $Empty context for monomorphic types 7Tells if the context corresponds to a polymorphic type 0Returns the variable names related to a context  Returns the context constraints  Builds a !"" type out of a context and a type 1Obtains the arguments and return type of a given !"  (normally a function)  together with its .( (non-empty if the type is polymorphic) "Obtains the type constructor of a !" together with its  arguments and its .( (non-empty if the type is polymorphic) &Form a function type out of two types HRebuild a type out of a constructor, its argument types and its context  (inverse of .) ?Rebuild a function type out of its argument types, return type  and context (inverse of !") Give the template haskell !" of a Typeable object )Gives the corresponding Template Haskell !" of a $/ 0portable experimentalforsyde-dev@ict.kth.se1Obtains the arguments and return type of a given $/  (normally a function)  together with its Context( (non-empty if the type is polymorphic) 1portable experimentalforsyde-dev@ict.kth.seKThe state contains the list of values obtained form the foldable container M and a String indicating the name of the function currectly being executed  State monad containing ZipState 4pops the first element of the list inside the state 8pop a value form the state and supply it to the second " argument of a binary function 2portable experimentalforsyde-dev@ict.kth.seMaximum tuple size 3portable experimentalforsyde-dev@ict.kth.seA context error: a 3, with context information (indicating where  the error ocurred) 2Expression translation errors in the VHDL backend 0Function translation errors in the VHDL backend *All Errors thrown or displayed in ForSyDe &type indicating a location in the user' s source  code 0A context: it indicates where an error ocurred. ,Set a process context from a system context 7Set a process function context from a process context 4Set a process value context from a process context EThrows a an error caused by improper use of a user-exported function Throws an internal error ,lift an Either expression to an Error Monad -An error reporting function for Quasi monads E Executing in the monad will stop inmideately after calling qError  Note, it does not work for GHC<6.8  see  /http://hackage.haskell.org/trac/ghc/ticket/1265 ,Stop execution, find the enclosing qRecover D if a recover is not found, it is considered as an internal error 8 and the string provided will used as a reference to  the origin of the error.  Note, it does not work for GHC<6.8  see  /http://hackage.haskell.org/trac/ghc/ticket/1265 4Output a trace message in a quasi monad (similar to $4) Print an Error Print a VHDL compilation error "Print a GraphML compilation error IWe make ForSyDeErr an instance of the Error class to be able to throw it  as an exception. 3< represents failure using Left ForSyDeErr or a successful " result of type a using Right a 3 is implicitly an instance of  [56] ("Error e => MonadError e (Either e))  [$7] (Error e => Monad (Either e))  Show errors $help function for the show instance       !"#$%&'()*+,-./012345678L876543210/.-,+*)('&%$#"!      8portable experimentalforsyde-dev@ict.kth.seCA signal can be seen as wire which carries values of certain type F and which can be connected and processed by the two computational @ entities of a ForSyDe system: processes and block instances. 9A process node E Note that vectors and transformed to lists puls an Int parameter  indicating its size :BThe node connection is carried out by directed edges modelled as D Unsafe Unmutable References (allowing to share nodes) connected B in the output->input direction (remember we are using trees). J Since the node to which the edge is directed can have various outputs C (e.g a system instance) the edge is tagged to indicate to what  output it refers to. ;)We tie the knot to connect nodes through :8s, building a Tree which  can have shared nodes. That is done by storing ;8,s as the the input information of each node M of the tree. Child nodes of the tree are closer to the inputs of the system ( and parents are closer to the outputs. <A ;8, or more preciselly its root :8, is after all, how ) signals are implemented in the netlist. =9The different outputs which the different nodes can have >FA node of the netlist can be either a process, component instances or / special nodes to help traversing the graph. CSince the netlist graph is implemented with trees, they only store K information about their inputs (which are their child nodes in the tree). ?Get the output tags of a node @Get the tag of a signal A!Generate a signal pointing to an B node CGenerate a reference to a new D node E%Generate the output signal of a node F=Evaluate the output of a process within a synchronous period 4 The inputs and outputs are given in dynamic form GFThe netlist of a system is modelled as a directed cyclic graph but is J really equivalently implemented as a set of (possibly overlapping) trees ( capable of sharing nodes between them. GThere is no specific data structure for the netlist itself. Instead, a L netlist is simply represented by its outputs. Each output is the root node  of a tree (;8:). The NlTrees can (and probably will) have common nodes. GIt is important to note that, due to the use of trees, the only way to  traverse a G8$ is from its outputs to its inputs. &HIJKLMNO9:DPQRSTUVBW;<=>?@ACEFXYZ[G\]G>9:=?;<@ACEF9non-portable (LSTV) experimentalforsyde-dev@ict.kth.se^@Traversing monad, stacking state and error transformers over ST _@Traversing monad, stacking state and error transformers over IO `BtraverseSIO traverses a netlist and returns a final user-defined  traversing state (s ) given: J new: generates a new (and normally unique) tag for the outputs of each K netlist node given the traversing state (which is possibly updated  as well). E define: given the output tags of a node, current iteration state, / and the output tags of its children, define A generates the netlist of that node, possibly updating  the traversing state  FIXME: shoudn'3t the arguments of define go the other way around? # first inputs then outputs. - FIXME: why are tags needed in define? [oinfo] should be enough. M tags are ugly in general (see the pattern matches) fix this problem. ab$:-monad version of `9 cObtain the arguments of a node ^_`adc_`^adc;portable experimentalforsyde-dev@ict.kth.seeb$: version of f; g9A unique identifier which univocally designates a table fA  URefTable a b & Unsafe References to a value of type a (key of the table)  * Values of type b associated to each key *Here is how we implement Tables of URefs: HA Table is nothing but a unique tag, of type TableTag. TableTag can be M anything, as long as it is easy to create new ones, and we can compare them # for equality. (I chose IORef ()). GSo how do we store URefs in a Table? We do not want the Tables keeping M track of their URefs (which would be disastrous when the table becomes big, 0 and we would not have any garbage collection). HInstead, every URef keeps track of the value it has in each table it is H in. This has the advantage that we have a constant lookup time (if the K number of Tables we are using is small), and we get garbage collection of  table entries for free. h4An Unsafe Unmutable Reference to a value of type a An h;B is implemented as follows: it has two pieces of information. The M first one is an updatable list of entries for each table it is a member in. G Since the types of the Tables vary, the URef has no idea what type of : values it is supposed to store. So we use dynamic types. LSince it is an updatable list, it is an IORef, which we also use to compare  two h;Cs. The second part is just the value the URef is pointing at (this : can never change anyway since references are unmutable). ,FIXME: why IORef? it should maybe be STRef? > Besides: Is it guaranteed that the values of an IORef 2 are not changed by the garbage collector? i<Create a new Unsafe Unmutable Reference to a Haskell object HThis operation, as explained in the Observable sharing paper, can cuase / side-effects, since the value returned (the h;) is not determined by : the arguments of the function (i.e. different calls to i; with & the same argument return different h;s). jRead the value pointed by the h;. kCreate a new table l$Query the value corresponding to an h; mAdd an (h; a, b) pair entry to the table nb$: version of k; ob$: version of l; pb$: version of m; q4Generates a memoizated version of a function taking h; values rs$% version of q; tb$: version of q; efhijklmnopqrthijfkmlenpoqrt<non-portable (GHC libraries) experimentalforsyde-dev@ict.kth.seuA value of type u< (from Unsafe Dynamic) can " implicitly any Haskell value. $It is unsafe because, as opposed to  Data.Dynamic, v3Converts an arbitrary value into an object of type u<. I It is unsafe because it does not provide type information during the  transformation w Converts a u<- object back into an ordinary Haskell value. = It is unsafe because there is no way to unsure converting 9 back to the correct original Haskell type. Thus, this K function should be used with care since it can cuase disastrous errors. e.g. disastrousCast :: a -> b 5 disastrousCast = unsafeToDyn . unsafeFromDyn %The following program would coredump 6 main = putStr (disastrousCast 1 :: String) uvwuvw=portable experimentalforsyde-dev@ict.kth.se AClass used to describe a System function. It uses the same trick  as  Text.Printf0 to implement the variable number of arguments. x=Given a function type expressed with Template Haskell, check C whether it complies with the expected type of a system function @ and, in that case, provide the type and number of the system  inputs and outputs. y(Unsafely transform from a dynamic value zParse a proctype value @Multiparameter class to transform a System Function into an IO F Simulation Function, able to externally simulate a System using a - list-based representation of its signals. {Transforms a TH//String version of a simulation function into a # standard simulation function.  Again, the length of input/&output lists of the list version must ? match with the argument number and return tuple size of the  simulation function. GMultiparameter class to transform a System Function into a Simulation J Function, able to simulate a System using a list-based representation  of its signals. |;Transforms a dynamic-list version of a simulation function ( into a standard simulation function.  Note the length of input/2output lists of the list version must match with I the argument number and return tuple size of the simulation function. }DGets the result of applying a system function to input port signals * whose name is given in first argument. 1 In case the input id list is not long enough, "default" will be used % as the id of the remaining ports. ~@Transforms a primitive-signal-list version of a system function $ into a standard system function.  Note the length of input/2output lists of the list version must match with E the argument number and return tuple size of the system function. 8Check the output types of the system function given its & constructor and its type arguments (Check if a type corresponds to a signal x{|}~ }~|{x>non-portable (Template Haskell) experimentalforsyde-dev@ict.kth.se?portable experimentalforsyde-dev@ict.kth.se!The Primitive System Definition. @ Instead of just providing the value, a reference is provided ' to allow sharing between instances. >Interface, describes the input or output ports of the system. : Each entry contains the name of the port and its type. The System Definition value Output interface ?We add a phantom parameter to indicate the type of the system EIn order to check the system for identifier duplicates we keep track J of the process identifiers and of the accumulated subsytem definitions BCheck that the system netlist does not contain process identifier > duplicates (i.e. different processes with the same process K identifier) or instances of different systems with the same identifier. K In case there are no duplicates, the list of nested subsystems together # with the the logic is returned. Error prone version of ? 9Indicates wether a system is combinational or sequential I In practice, a system is sequential if if contains a delay process or > a sequential system instance, otherwise its combinational. Identifier of the System System netlist %List of all unique nested subsystems - (i.e. flattened tree, without duplicates, / of all the systems in lower levels of the  hierarchy) ? of the system Input interface ?? constructor KBuilds a system definition out of a system function describing the system  and its port identifers. CURRENTLY BROKEN, do not use! ??' constructor, Template Haskell version KBuilds 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 ? over ? is that it I reports errors (e.g duplicated port and process identifiers) earlier, , at host-language (Haskell) compile-time. 1In addition, due to the use of Template Haskell, ? is > aware of the source location at which it was called, making 0 further error reports friendlier to the user. ?? constructor, Template Haskell !" version  Builds a ??& out of the name of a system function  and its port identifers. 5The 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 ? over ? is that it  doesn''t suffer from the Template Haskell bug  /http://hackage.haskell.org/trac/ghc/ticket/18006, or in other words, it allows to declare the system 5 defintion and system function in the same module. However, since it doesn',t have acces to the system function itself, N it can only give early error reports related to incorrect port identifiers F (process identifier duplicate errors will be reported at runtime). ACheck that the system definition ports match certain lengths and  don't containt duplicates 7Generate a lambda expression to transform a tuple of N  s into a  a list of <s Find a duplicate in a list <Generate a TypeRep expression given a Template Haskell Type J note that the use of typeOf cannot lead to errors since all the signal L types in a system function are guaranteed to be Typeable by construction GGenerate an interface given its identifiers and Template Haskell Types @portable experimentalforsyde-dev@ict.kth.seGenerates an instance of a  in the form of ! function out of the name of a  with the same type as its I system function. The resulting function can then be used to plug the ' instance to the rest of the system. Anon-portable (Template Haskell) experimentalforsyde-dev@ict.kth.se$A process Function default argument 0 Either a process function AST or a value AST 3A ProcFunAST bundled with its type representation: @ Why a TypeRep and not the Type provided by Template Haskell? ; We could use the type signature provided by TH but ...  1) We don'0t want to force the user to provide a signature  2) We don'5t want to handle polymorphic types. We just want the @ monomorphic type used by the process using the procfun.  Why not just including the $/ in ProcFunAST? L We need the context of the process to know what monomorphic types are H going to be used. Thus it is imposible to guess the TypeRep within  the code of newProcFun. A process Function AST AA ProcFun bundled with its type representation. This type is not 3 exported to the end user. Only used internally. A Process Function =Sets a default value for an argument of the process function >Sets a default value for an argument of the process function 2 when the argument is a process function itself !Template Haskell constructor for AA&, here is an example on how to use it  # plus1Fun :: ProcFun (Int -> Int) 2 plus1Fun = $(newProcFun [d| plus1 :: Int -> Int 3 plus1 n = n + 1 |]) 0transform a ProcFun into a Dynamic TypedProcFun +tranform the arguments and return value of  a ProcFun to dynamic Value of the function Function Name  (FIXME: maybe just a String?) Function clauses Value of the function where was it created 9Check the decarations passed to newProcFun to be correct Bnon-portable (Template Haskell) experimentalforsyde-dev@ict.kth.seB constructor C%non-portable (non-standard instances) experimentalforsyde-dev@ict.kth.seGData type describing an algebraic enumerated type (i.e. an algrebraic 1 type whose data constructors have arity zero) 2Class used to constrain the arguments (values and ProcFun s) taken by  process constructors BGet the associated enumerated type-definitions of certain value,  taking nesting in account. For example:  module MyMod where   data Colour = Blue | Red  deriving (Data, Typeable)  data Shapes = Circle | Square  deriving (Data, Typeable)  2 getEnums (Prst Blue, Circle) = 7 fromList [EnumAlgTy "MyMod.Colour" ["Blue", "Red"], < EnumAlgTy "MyMod.Shapes" ["Circle", "Square"]] Read a process type Dnon-portable (Template Haskell) experimentalforsyde-dev@ict.kth.seTell if a member of Data belongs to an enumerated type  and return its description. CPhony type used to check if a data constructor is enumerate (has ) Tell if a member of Data belongs to an enumerated type Enon-portable (Template Haskell) experimentalforsyde-dev@ict.kth.se7Pretty printing class with associated printing options Pretty printing class EJoin two documents vertically leaving n vertical spaces between them 2apply sep to a list of prettyprintable elements, # previously interspersing commas 3Only append if both of the documents are non-empty 3Only append if both of the documents are non-empty 9Enclose in parenthesis only if the document is non-empty 5Enclose in parenthesis only if the predicate is True Fportable experimentalforsyde-dev@ict.kth.se<Global tranlsation table from Template Haskell function and B constructor Names to VHDL expressions. The table works like this C(function, constant constructor name, (arity, function to obtain a ? VHDL expression < provided its E arguments are already G translated to VHDL )) Gnon-portable (Template Haskell) experimentalforsyde-dev@ict.kth.seM package_body  [ PACKAGE ] and [ package_simple_name ] are not allowed package_declaration  [ PACKAGE ] and [ package_simple_name ] are not allowed architecture_body  [ ARCHITECTURE ] and [ architecture_simple_name ] are not allowed mode * INOUT | BUFFER | LINKAGE are not allowed package_declarative_item M only type declarations, subtype declarations and subprogram specifications - (working as subprogram_declaration) allowed subtype-declaration type_declaration ) only full_type_declarations are allowed  only subprogram_body is allowed  constraint $ Only index constraints are allowed range  the direction must always be "to" type_declaration E only composite types and enumeration types (a specific scalar type) enumeration_type_definition 0 enumeration literals can only be identifiers record_type_definition  [ record_type_simple_name ] not allowed array_type_definition $ unconstrained_array_definition " constrained_array_definition O A TypeMark is used instead of a subtype_indication. If subtyping is required, ! declare a subtype explicitly. index_constraint element_declaration 3 multi-identifier element declarations not allowed 9 element_subtype_definition is simplified to a type_mark attribute_name  signatures are not allowed  slice_name  indexed_name K note that according to the VHDL93 grammar the index list cannot be empty selected_name suffix / no character or operator symbols are accepted prefix ! only names (no function calls) signal_declaration  We don' t allow the  id1,id2,id3( syntax, only one identifier is allowed  at once G Resolution functions and constraints are not allowed, thus a TypeMark * is used instead of a subtype_indication  Signal kinds are not allowed subprogram_declarative_item + only varaible declarations are allowed. subprogram_specification  Only Functions are allowed  [Pure | Impure] is not allowed / Only an identifier is valid as the designator H In the formal parameter list only variable declarations are accepted subprogram_body . No subprogram kind nor designator is allowed variable_declaration $ identifier lists are not allowed subtype_indication * resolution functions are not permitted interface_variable_declaration  [variable] is not allowed  We don' t allow the  id1,id2,id3( syntax, only one identifier is allowed  Mode is not allowed G Resolution functions and constraints are not allowed, thus a TypeMark E is used instead of a subtype_indication. If subtyping is required,  declare a subtype explicitly. discrete_range  only ranges are allowed case_statement_alternative ) it is incorrect to have an empty [Choice] helper type, it doesn' t exist in the origianl grammar helper type, they doesn' t exist in the origianl grammar  type_mark  We don'3t distinguish between type names and subtype names  We dont'9 support selected names, only simple names because we won't need G name selection (i.e. Use clauses will make name selection unnecesary) process_statement  The label is mandatory : Only simple names are accepted in the sensitivity list " No declarative part is allowed "component_instantiation_statement  No generics supported " The port map aspect is mandatory 'concurrent_signal_assignment_statement A Only conditional_signal_assignment is allowed (without options) : The LHS (targets) are simply signal names, no aggregates block_statement  Generics are not supported G The port_clause (with only signals) and port_map_aspect are mandatory  The ending [ block_label ] is not allowed concurrent_statement I only block statements, component instantiations and signal assignments  are allowed block_declarative_item < Only subprogram bodies and signal declarations are allowed interface_signal_declaration  We don' t allow the  id1,id2,id3( syntax, only one identifier is allowed  at once  The Mode is mandatory  Bus is not allowed # Preasigned values are not allowed 7 Subtype indications are not allowed, just a typemark F Constraints are not allowed: just add a new type with the constarint # in ForSyDe.vhd if it is required  actual_part & We only accept an actual_designator,  #function_name ( actual_designator ) and type_mark ( actual_designator )  are not allowed  formal_part A We only accept a formal_designator (which is a name after all), = in the forme of simple name (no need for selected names)  #function_name ( formal_designator ) and type_mark ( formal_designator )  are not allowed actual_designator conditional_waveforms  Helper type, it doesn't exist in the VHDL grammar  Helper type, it doesn't exist in the VHDL grammar   waveform ' although it is possible to leave [Expr] empty, that's obviously not  valid VHDL waveform  waveform_element  Null is not accepted  port_map_aspect instantiated_unit F Only Entities are allowed and their architecture cannot be specified sequential_statement / Only If, case, return, for loops, assignment, wait for procedure calls  allowed. 6 Only for loops are allowed (thus loop_statement doesn't exist) and cannot  be provided labels. $ The target cannot be an aggregate. / General wait statements are not allowed, only wait for , It is incorrect to have an empty [CaseSmAlt]  simple_name label element_association  only one choice is allowed function_call literal @ Literals are expressed as a string (remember we are generating  code, not parsing) 9expression, instead of creating an AST like the grammar F (see commented section below) we made our own expressions which are  easier to handle, but which don't don't show operand precedence 2 (that is a responsibility of the pretty printer) choice I although any expression is allowed the grammar specfically only allows / simple_expressions (not covered in this AST) association_element name ! operator_names are not allowed Reserved identifiers 'Obtain the String of a VHDL identifier Junsafely create a basic VHDLId (without cheking if the string is correct) Eunsafely create an exteded VHDLId (without cheking if the string is  correct) KCreate a VHDL basic identifier from a String, previously checking if the  String is correct FCreate a VHDL extended identifier from a String, previously checking K if the String is correct. The input string must not include the initial B and ending backslashes nad the intermediate backslashes shouldn't be escaped. HUnsafely append a string to a VHDL identifier (i.e. without checking if % the resulting identifier is valid)  5special characters as defined in the VHDL93 standard !;other special characters as defined in the VHDL93 standard "Logical Operators precedence # Relational Operators Precedence $Shift Operators Precedence %Plus Operators precedence &Sign Operators Precedence ' Multplying Operators Precedecne (#Miscellaneous Operators Precedence )*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_     `ab !"#$%&'(cdefghijklmnopqrstuvwxyz{|}~Rb !\^]_     "#$%&'(Hnon-portable (Template Haskell) experimentalforsyde-dev@ict.kth.se>Prints an expression taking precedence and left associativity  in account &Number of spaces used for indentation &Prettyprint an binary infix operator #Prettyprint unary prefix operators Iportable experimentalforsyde-dev@ict.kth.seBtup VHLID record suffix tup string record suffix default function identifier value element identifier 2reset and clock signal identifiers in String form EStandard context clause used in all generated vhdl files. It imports 8reset and clock signal identifiers in basic VHDLId form "types" identifier work identifier std identifier textio identifier range attribute identifier range attribute identifier event attribute identifie absent function identifier present function identifier  fromAbstExt function identifier &unsafeFromAbstExt function identifier value element suffix *isPresent function and element identifier isAbsent function identifier ?ex (operator ! in original Haskell source) function identifier Esel (function select in original Haskell source) function identifier ltplus (function (<3+) in original Haskell source) function identifier Hplusplus (function (++) in original Haskell source) function identifier empty function identifier Fplusgt (function (+>) in original Haskell source) function identifier singleton function identifier length function identifier Fisnull (function null in original Haskell source) function identifier replace function identifier head function identifier last function identifier init function identifier tail function identifier take function identifier drop function identifier shiftl function identifier shiftr function identifier rotl function identifier reverse function identifier reverse function identifier !toBitVector8 function identifier "toBitVector16 function identifier "toBitVector32 function identifier #fromBitVector8 function identifier $fromBitVector16 function identifier $fromBitVector32 function identifier copy function identifier show function identifier *write function idenfier (from std.textio) )output file identifier (from std.textio) Stardard logic type mark boolean type mark fsvec_index typemark natural typemark "int32 typemark (defined in ForSyDe's VHDL library) "int32 typemark (defined in ForSyDe's VHDL library) "int32 typemark (defined in ForSyDe's VHDL library) !int8 typemark (defined in ForSyDe's VHDL library) string typemark true expression false expression '0' bit expression '1' bit expression tup VHDLName suffix EEJportable experimentalforsyde-dev@ict.kth.se&Write a design file to a file in disk Kportable experimentalforsyde-dev@ict.kth.seInternal VHDL-Monad version of ForSyDe.Backend.writeVHDL , (Note: the initial and final CWD will be / ) CWrite the global traversing results (i.e. the library design file) * accumulated in the state of the monad LTraverse the netlist and write the local results (i.e. system design files) .Traverse the netlist of a System Definition, > returning the (implicit) final traversing state and a list  containing the K of each output of the system 'new'* traversing function for the VHDL backend 'define'* traversing function for the VHDL backend W           !"#$%&'()*+,-./012345W           !"#$%&'()*+,-./012345Lportable experimentalforsyde-dev@ict.kth.se-Action to perform by Quartus VHDL Compilation options KRecursivity, should the parent systems of system instances be compiled as  well? LOptions passed to Quartus II by the VHDL Backend. Most of them are optional ) and Quartus will use a default value.  It contains:  What action to perform K Optinally, the minimum acceptable clock frequency (fMax) expressed in MHz J FPGA family and specific device model (both are independently optional). 9 Pin assignments, in the form (VHDL Pin, FPGA Pin). Note C that Quartus will automatically split composite VHDL ports  Debug level <Global Results accumulated throughout the whole compilation ;Local result accumulated during the traversal of a netlist Empty initial traversing state initialize the local state %empty global VHDL compilation result Default traversing options VHDL traversing State. (see $ForSyDe.Netlist.Traverse.traverseSIO) VHDL backend monad $empty local VHDL compilation result ,Initial trnaslation namespace for functions  Translation namespace. CThis type provides the number of fresh names already generated and X a tranlsation table from Template Haskell Names to VHDL Expressions (a symbol table). 4 It only makes sense in a process-function context.  7Execute certain operation with a concrete local state. G The initial local state is restored after the operation is executed  AExecute certain operation with the initial translation namespace E The initial namespace is restored after the operation is executed   Empty initial traversing state -Print a message to stdout if in verbose mode COptions to check if the model is synthesizable, all options except + the action to take are set to default. "Check if we are in recursive mode 6Check if we want to compile the results with modelsim 'Set VHDL options inside the VHDL monad  Add a signal declaration to the L in the State Add a statement to the L in the State )Find a previously translated custom type )Add enumerated types to the global state Check if a Template haskell !" corresponding to C a Enumerated-type data constructor is present in the enumerated F types accumulated in the global state and return the corresponding  VHDL identifier. BAdd a cutom type to the global results and type translation table +Add type declaration to the global results .Add subtype declaration to the global results 1Add an unconstrained FSVec to the global results 'Add a subprogram to the global results dAdd a TH-name (arity, VHDL expression construtor fucntion) pair to the translation namespace table .Get a fresh VHDL Identifier and increment the @ tranlation-namespace-count of freshly generated identifiers. @Note that all user-supplied identifiers (process ids, port ids, < and function parameters) are translated to extended VHDL E identifiers. That, together with the fact that basic and extended A VHDL identifers live in different namespaces, guarantees that B freshly generated basic VHDL identifiers cannot clash with the " ones supplied by the frontend. Lift an 7 value to the VHDL monad setting current error context  for the error # liftEProne :: EProne a -> VHDLM a 5Throw a ForSyDe error, setting current error context  ;Execute certain operation with a concrete process context. C The initial context is restored after the operation is executed 9 Note: the initial context must be a system context or InconsistenContexts  will be raised. !DExecute certain operation with a concrete process function context. C The initial context is restored after the operation is executed ; Note: the initial context must be a process context or  InconsistenContexts will be raised. "DExecute certain operation with a concrete process function context. C The initial context is restored after the operation is executed ; Note: the initial context must be a process context or  InconsistenContexts will be raised. GIntermediate signal information. Tag generated for each output of each % node found during the traversal. - (see ForSyDe.Netlist.Traverse.traverseSIO). M It contains the VHDL intemediate signal name associated with the process  output.  Debug mode (Analyze the generated code with Quartus )Compile the generated code with Modelsim V           !"#$%&'()*+,-./012345,      !"Mportable experimentalforsyde-dev@ict.kth.se67prepare the translation namespace for an input pattern 7/Translate a local TH name to a VHDL Identifier 8JTranslate a VHDL identifier and a type to an interface signal declaration 91translate a port identifier to a VHDL Identifier : translate a $/ to a VHDL   We don'7t distinguish between a type and its version nested in  & since it makes no difference in VHDL ;ATranslate a System Definition to an Entity, explicitly returning / the VHDL identifiers of its output signals. < Translate a  ZipwithNSY/ process to a block returning a declaration of  the resulting signal. = Translate a  ZipwithxSY/ process to a block returning a declaration of  the resulting signal. > Translate a UnzipNSY/ process to a block returning a declaration of  the resulting signal. ? Translate a UnzipxSY/ process to a block returning a declaration of  the resulting signal. @ Translate a DelaySY/ process to a block returning a declaration of  the resulting signal. A=Translate a System instance into a VHDL component instantion 2 returning the declartion of the output signals B5Translate a VHDL Signal to a VHDL Signal declaration C8Translate a Port to a VHDL Interface signal declaration D3Translate a system identifier to a VHDL identifier E4Translate a process identifier to a VHDL identifier FTranslate a custom $/ to a VHDL  G;Really do the translation (customTR2TM deals with caching) HFSVec? ? FSVecs are translated to subtypes of unconstrained vectors. = All FSVec operations are translated as operations for the  unconstrained type. 1Transform an enumerated Algebraic type to a VHDL > TypeMark adding its default function to the global results I&Translation table for primitive types JThrow a function error K'Translate a typed function ast to VHDL LGCheck if a process function AST fulfils the VHDL backend restrictions. N It returs the function TH-name its input paterns and its body expression. MJGet the spec of a VHDL function from the Haskell function name, its type N and its input patterns. This function also takes care of initalizing the  translation namespace. Ftranslated function spec, function name, inpt parameters, input types  and return types N)Translate an input pattern to a VHDLID, = making the necessary changes in the translation namespace OThrow an expression error P<Create the unique statement of a VHDL from a TH expression. Q2Translate a case alternative from Haskell to VHDL R4Translate a Haskell expression to a VHDL expression STranslate an integer to VHDL "6789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVW";<=>?@AB8C7DE9:FGHIJKLMN6OPQRSTUVWNportable experimentalforsyde-dev@ict.kth.seXAGenerate a simple signal assignment, from a VHDL identifier to a  VHDL identifier YDGenerate a list of association from two lists of signal identifiers 3 The first one establishes the formal parameters Z>Generate a function call from two lists of signal identifiers 4 The first list establishes the formal parameters ["Generate a list of asignments (in  form) of intermediate signals ? (first argument) to final output signals (second argument) \#Generate a function call asignment ]:Generate a simple assignment from an expression to a name ^CGenerate a system design file for a system from the global system  identifier, B local traversing results and the translated entity declaration _7Generate a library design file from the global results `9Generate a port map from two lists of signal identifiers 4 The first list establishes the formal parameters aJGenerate a function call from the Function Name and a list of expressions  (its arguments) b;version of genExprFCall which requires exactly n arguments cDGenerate a function call from the Function Name (constant function) dList version of genExprFCall0 eKGenerate a function call from the Function Name and an expression argument fList version of genExprFCall1 gMGenerate a function call from the Function Name and two expression arguments hList version of genExprFCall2 iMGenerate a function call from the Function Name and two expression arguments jList version of genExprFCall4 kKGenerate a procedure call from the Function Name and a list of expressions  (its arguments) lFGenerate a procedure call from the Function Name (constant procedure) mLGenerate a procedure call from the Function Name and an expression argument nFGenerate a procedure call from the Function Name and four expression  arguments oEGenerate a procedure call from the Function Name and two expression  arguments pGGenerate the default functions for an unconstrained custom vector type q7Generate the default functions for a custom tuple type r;Generate the default functions for a custom abst_ext_ type s=Generate the default functions for a custom enumeration type t0Apply the range attribute out of a simple name XuYZ[\]^_`abcdefghijklmnopqrst[X\]^_Y`ZabcdefghijklmnoupqrstOportable experimentalforsyde-dev@ict.kth.sev:Parse the output of the testbench (a tab separated files) 7 into strings denoting the individual output signals w1write a test bench, using a clock cycle of 10 ns , (Note: the initial and final CWD will be / ) xGenerate the Context Clause y,Generates an empty entity fot the testbench zgenerate the architecture {/generate the assignments for the input stimuli |0generates a clock process with a period of 10ns }generate the output process vwwvPportable experimentalforsyde-dev@ict.kth.se~!Analyze the results with Quartus , (Note: the initial and final CWD will be  systemNamevhdl ) $Generate the content of quartus.tcl F Note that, even in windows, the tcl interpreter requires pathnames  to use "/" instead of "\" ~~Qportable experimentalforsyde-dev@ict.kth.se 2Generate a testbench and execute it with Modelsim , (Note: the initial and final CWD will be / ) .Compile the generated VHDL code with Modelsim , (Note: the initial and final CWD will be  systemNamevhdl )  Run vlib  Run vmap  Run vmap  Run vsim run a ModelSim command BRun a process, previously announcing a message and waiting for it  to finnish its execution. short-circuit and for monads Rportable experimentalforsyde-dev@ict.kth.seEdge Node Main AST type, a graph Snon-portable (Template Haskell) experimentalforsyde-dev@ict.kth.se'The only accepted pretyprinting option &Number of spaces used for indentation :pretty print a Graph with XML headers and key definitions Eport separation space when connecting to a node which surpasses the  minimum height #Calculate the dimensions of a Node 9Calculate the number of input and output ports of a node  Tportable experimentalforsyde-dev@ict.kth.se&Write a design file to a file in disk Uportable experimentalforsyde-dev@ict.kth.se"Internal GraphML-Monad version of 'ForSyDe.Backend.writeGraphML FTraverse the netlist and write the local results (i.e. system graphs) .Traverse the netlist of a System Definition, > returning the (implicit) final traversing state and a list  containing the UU of each output of the system 'new'- traversing function for the GraphML backend 'define'- traversing function for the GraphML backend 2 !"#$%&'()*2 !"#$%&'()*Vportable experimentalforsyde-dev@ict.kth.se$GraphML Compilation options %KRecursivity, should the parent systems of system instances be compiled as  well? & Debug level <Global Results accumulated throughout the whole compilation  (empty right now) ;Local result accumulated during the traversal of a netlist Empty initial traversing state initialize the local state 'Default traversing options GraphML traversing State. (see $ForSyDe.Netlist.Traverse.traverseSIO) GraphMLM backend monad 'empty local GraphML compilation result 7Execute certain operation with a concrete local state. G The initial local state is restored after the operation is executed  Empty initial traversing state (empty global GraphML compilation result -Print a message to stdout if in verbose mode "Check if we are in recursive mode +Check if we want to generate yFiles markup -Set GraphML options inside the GraphML monad  Add a signal declaration to the V in the State Add a statement to the V in the State Lift an : value to the GraphML monad setting current error context  for the error 5Throw a ForSyDe error, setting current error context ;Execute certain operation with a concrete process context. C The initial context is restored after the operation is executed 9 Note: the initial context must be a system context or InconsistenContexts  will be raised. EIntermediate edge information. Tag generated for each output of each % node found during the traversal. - (see ForSyDe.Netlist.Traverse.traverseSIO). , It contains the GraphML node identifier ; and port identifier associated with the process output. *Generate yFiles markup? 1 !"#$%&'()*$&%'CWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                               !"#$%&'()*+,-./0123456789:;<=>?@ABCDE|}FGH?IJKLAMANAOAP8=Q=R=S?T?U?VWLXLYLZL[L\L]L^L_L`LaL`LbLXLcLdLeLfLgLhLiLjLkLlLm@nVoVpVqVrVsVoVtVuVvVwVxVyz{|}~:              !"$$/ $ $------.$/!".!"...........!"..$/.0111111112333333333333333$4333356$3$$$$$$$$7$4$$7$7$7$7$7$7$7$7$7$7$7$7$7$7$7$7$7$7$7$7$7$7$7 $7 $7 $7 $7 $7$7$7$7$555556565656565555 3!3"3#3$3%33&3'3(3)3*3+3,3-3.3/303132333435363738393:3;3<3=3>3?3@3A3B3C3D3E3F3G3H3I3J3K3L3M3N3O3P3Q3R3S3T3U3V3W3X8Y8Z8[8\8]8^8_8`8a8b8c8d8e8f8g8h8i8j8k8l8m8n8o8p8q8r8s8t8u8v8Z8w88x8[8y8g9z9{9|9}$~99;;;;;;;;;;;;;;$;<<<==========??????????????I!"????????????AAAAAMAAAAAAAAAAAAAAAAAABBBBBBBBBBBCCCCCDDDDDEEEEEEEEEEEEEEEEEEFGGGGGGGGGGGGGGGGGGGGGGGGGGG G G G G GGGGGGGGGGGGGGGGGGG G!G"G#G$G%G&G'G(G)G*G+G,G-G.G/G0G1G2G3G4G5G6G7G8G9G:G;G<GGGGGG GGG GG=GGG>GGG%GGGG?G@GAGBGGG GGCGDGEGFGGGGGHGIG&GJGKG GLGMGGGGNGGOGPG<GQGRGNGSGTGUGVGWGXGYGZG[G\G]G^G_G`GaGbGcGdGeGfGgGhGiGjGkGlGmGnGoGpGqGrGsGtGuGvGwGGxGyGzG G{G|G}G~GGGGGGGGGGGGGGGGGGGGGGGGGGHHHHIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIJKKKKLKKLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL L L L L LLLLLLLLLLLLLLLLLLL M!M"M#M$M%M&M'M(M)M*M+M,M-M.M/M0M1M2M3M4M5M6M7M8M9M:M;M<M=M>M?M@MAMBNCNDNENFNGNHNINJNKNLNMNNNONPNQNRNSNTNUNVNWNXNYNZN[N\N]N^N_N`OaObOcOdOeOfOgOhPiPjQkQlQmQnQoQpQqQrQsRtRuRvRwRxRyRzR{RtRvS|SS}S~SSSSSSSTUUUVVUUVVVVVVVVVVVVVVVVVVVVVVV V V VVVVVVVVVV ForSyDe-3.0ForSyDe.ProcessForSyDe.Shallow.VectorForSyDe.Shallow.DFTForSyDe.Shallow.SignalForSyDe.Shallow.BitVectorForSyDe.Shallow.PolyArithForSyDe.Shallow.AbsentExtForSyDe.Shallow.QueueForSyDe.Shallow.CTLibForSyDe.Shallow.SynchronousLibForSyDe.Shallow.StochasticLib ForSyDe.Shallow.DomainInterfacesForSyDe.Shallow.FIRForSyDe.Shallow.UntimedLibForSyDe.Shallow.AdaptivityLibForSyDe.Shallow.GaussianForSyDe.Shallow.Memory%ForSyDe.Shallow.SynchronousProcessLibForSyDe.Shallow.FilterLib ForSyDe.DFT ForSyDe.IdsForSyDe.SystemLanguage.Haskell.TH.Lift!Language.Haskell.TH.LiftInstancesForSyDe.SignalForSyDe.Backend.SimulateForSyDe.Backend.VHDLForSyDe.Backend.GraphMLForSyDe.AbsentExtForSyDe.Process.SynchProc ForSyDe.FIR ForSyDe.Bittemplate-haskellLanguage.Haskell.TH.SyntaxForSyDebasePreludeForSyDe.BackendForSyDe.ShallowForSyDe.Shallow.MoCLib Data.ListForSyDe.Shallow.CoreLibForSyDe.Shallow.UtilityLib Data.Bool Paths_ForSyDeLanguage.Haskell.TH.TypeLib Data.TypeableData.Typeable.TypeRepLibData.Traversable.GenericZipWithForSyDe.ConfigForSyDe.ForSyDeErr Debug.Trace mtl-1.1.0.1Control.Monad.Error.Class Control.MonadForSyDe.NetlistForSyDe.Netlist.TraverseControl.Monad.STForSyDe.OSharingForSyDe.OSharing.UDynamicForSyDe.System.SysFunForSyDe.System.SysFun.InstancesForSyDe.System.SysDefForSyDe.System.InstantiateForSyDe.Process.ProcFunForSyDe.Process.ProcValForSyDe.Process.ProcType"ForSyDe.Process.ProcType.InstancesForSyDe.Backend.Ppr$ForSyDe.Backend.VHDL.GlobalNameTableForSyDe.Backend.VHDL.ASTForSyDe.Backend.VHDL.PprForSyDe.Backend.VHDL.ConstantsForSyDe.Backend.VHDL.FileIOForSyDe.Backend.VHDL.Traverse#ForSyDe.Backend.VHDL.Traverse.VHDLMForSyDe.Backend.VHDL.TranslateForSyDe.Backend.VHDL.GenerateForSyDe.Backend.VHDL.TestBenchForSyDe.Backend.VHDL.QuartusForSyDe.Backend.VHDL.ModelsimForSyDe.Backend.GraphML.ASTForSyDe.Backend.GraphML.PprForSyDe.Backend.GraphML.FileIO ForSyDe.Backend.GraphML.Traverse)ForSyDe.Backend.GraphML.Traverse.GraphMLMProcTypetakeVdropVatViterateVfoldrVlastVinitVunitV<+>:>NullVVectorvector fromVectornullVlengthVreplaceVheadVtailVselectVgroupV<:mapVzipWithVfoldlVfilterVzipVunzipVshiftlVshiftrVrotrVrotlVconcatVreverseV generateVcopyVdftfft+-+atS:-NullSSignalsignal fromSignalunitSnullSheadStailS!-takeSdropSselectS-:lengthS infiniteScopySfanSwriteSreadSOddEven isBitVectorParity addParityBit BitVectorintToBitVectorbitVectorToIntaddEvenParityBitaddOddParityBitremoveParityBit isEvenParity isOddParityPolyPairPolymulPolydivPolyaddPoly powerPolygetCoef scalePoly addPolyCoef subPolyCoef scalePolyCoef abstExtFuncPrstAbstAbstExtabstExt fromAbstExt isPresentisAbsentpsi FiniteQueueQueuepushQ pushListQpopQqueuepushFQ pushListFQpopFQ finiteQueueDAholdDAlineartimeStepSubsigCTDACModedurationcombCTcombCT2delayCTshiftCTinitCTmealyCTmooreCTscaleCTaddCTmultCTabsCTsineWaveconstCTzeroCT d2aConverter a2dConverterapplyF1applyF2applyG1cutEqtakeCTdropCT startTime showPartsplotplotCTplotCT'vcdGen zipWith4SY zipWith3SY zipWithSYzipxSYmapSYmapxSY zipWithxSYdelaySYdelaynSYscanlSYscanl2SYscanl3SYscanldSY scanld2SY scanld3SYmooreSYmoore2SYmoore3SYmealySYmealy2SYmealy3SYfilterSYsourceSYfillSYholdSYwhenSYzipSYzip3SYzip4SYzip5SYzip6SYunzipSYunzip3SYunzip4SYunzip5SYunzip6SYunzipxSYfstSYsndSYselMapSY selScanlSY selMooreSY selMealySYsigmaUnsigmaGedownDIupDI par2ser2DI par2ser3DI par2ser4DI ser2par2DI ser2par3DI ser2par4DI par2serxDI ser2parxDIfirSYzipWithUmapUcombUcomb2Ucomb2UCscanUmooreUmealyUzipUzipUs zipWith3U zipWith4UunzipUsourceUsinkUinitUapplyfSYapplyfUpGaussianNoiseAdrWriteMemReadAccessMemoryMemSizenewMemmemState memOutput fifoDelaySYfiniteFifoDelaySYmemorySYmergeSYgroupSY counterSYRK4S2Z firFilter SolverMode arFilterTrimarmaFilterTrim sLinearFilter zLinearFilters2zCoef h2ARMACoefSysIdPortIdProcIdSysDef deriveLift1 deriveLiftmetaLiftProcFun defArgValdefArgPF newProcFunSysFunSysFunToIOSimFunSysFunToSimFun newSysDef newSysDefTHnewSysDefTHNamesimulate QuartusOpsFullCompilationAnalysisAndSynthesisAnalysisAndElaboration VHDLVerbose VHDLNormalVHDLNonRecursive VHDLRecursiveVHDLOps QuartusActionVHDLRecursivityVHDLDebugLeveldefaultVHDLOpscheckSynthesisQuartusactionfMaxfpgaFamiliyDevice pinAssigs debugVHDLrecursivityVHDL execQuartuscompileModelsim instantiate GraphMLOpsGraphMLNonRecursiveGraphMLRecursiveGraphMLVerbose GraphMLNormalGraphMLRecursivityGraphMLDebugLeveldefaultGraphMLOps debugGraphMLrecursivityGraphML yFilesMarkup writeGraphMLwriteGraphMLOpsunsafeFromAbstExtconstSY zipWith5SY zipWith6SYfirnotLHBit bitToBool boolToBit toBitVector8fromBitVector8 toBitVector16fromBitVector16 toBitVector32fromBitVector32 toBitVector64fromBitVector64writeAndModelsimVHDLOps writeVHDL writeVHDLOpswriteAndModelsimVHDLLift showsAbstExtGHC.ShowShowGHC.ReadfromBitVectorDefcheckInsFQQ zipWithExtGHC.ListzipWithintToBitVector'bitVectorToInt'samplerk4FilterDigitalrks4InSYrks4iprodrepeatN fixedList svGeneratoruniform pUnitNormXYGHC.BaseTrueversion getBinDir getLibDir getDataDir getLibexecDirgetDataFileName typeRep2TypeTypeRepTypeContextForallT mkContext monoContextisPolycontextVarNamescontextConstraints mkForallTunArrowTunAppT-->reAppTreArrowTArrowTthTypeOf tyCon2TypeTyCon dynTHTypeZipStateZipMpop supplySecond zipWithTFzipTF zipWithTFM zipWithTFA maxTupleSize ContextErr ForSyDeErr VHDLExpErr VHDLFunErrLocsetProcC setProcFunC setProcValCuErrorintError liftEitherqErrorqGiveUp qPutTraceMsg putTraceMsg printErrorprintVHDLErrorprintGraphMLErrorEProne MonadErrorMonadshowIfaceLengthfail>>=>>returnControl.Monad.FixmfixFunctorMonadFix MonadPlustrace Data.FunctionfixapliftM5liftM4liftM3liftM2liftMunlesswhen replicateM_ replicateMfoldM_foldM zipWithM_zipWithM mapAndUnzipMjoinforever<=<msumforM_forMfilterMguardsequence sequence_mapMmapM_mplusmzero>=>=<<fmapControl.Monad.ErrorErrorT mapErrorT runErrorTstrMsgnoMsg catchError throwErrorErrorControl.Monad.Translift MonadTransliftIOMonadIOEmptyCProcCSysDefCProcFunCProcValCCaseGuardedBodyUnsupportedCasePatCaseWhereConstructCurryUnsupportedUnkownIdentifierUnsupportedLiteralSectionLambdaAbstraction ConditionalLetCaseDoListComprehensionArithSeqList SignatureRecord Unsupported InsParamNumUnsupportedFunPatMultipleClausesFunGuardedBodyFunWhereConstruct GeneralErrInconsistentContextsEvalErr NonVarName IncomSysF InIfaceLengthOutIfaceLength MultPortId MultProcId SubSysIdClash NonSysDefIncorrProcFunDecs InconsOutTagInconsSysDefPort DynMisMatch SigMisMatchInLengthMisMatch EmptyVHDLId IncVHDLBasId IncVHDLExtIdUntranslatableVHDLFunUntranslatableVHDLExpUnsupportedType ReservedIdUnsupportedProc QuartusFailedModelsimFailedOtherNlProcNlEdgeNlTreeNlSignal NlNodeOutNlNodeoutTags nlSignalNlOut newInPortInPort newSysInsSysIns newNodeOutSigevalNetlist SysInsOut UnzipxSYOut UnzipNSYOut DelaySYOut ZipWithxSYOut ZipWithNSYOutConstOut InPortOutDelaySYUnzipxSYUnzipNSY ZipWithxSY ZipWithNSYConstProcunSignalrootEdge netlistOutsTravSESTTravSEIO traverseSEIO traverseSESTGHC.STST arguments traverseST URefTableST URefTableIO URefTableTagURefnewURefreadURefnewURefTableIOqueryIO addEntryIOnewURefTableSTqueryST addEntrySTmemoURef memoURefIO GHC.IOBaseIO memoURefSTUDynamic unsafeToUDynunsafeFromUDyn checkSysFType unsafeFromDyn parseProcTypefromTHStrSimFun fromDynSimFun applySysFunfromListSysFuncheckSysFOutputs isSignalTfunOutInstances PrimSysDefIface SysDefValoIface CheckState checkSysDefnewSysDefEProneSysLogicsidnetlistsubSyslogiciIfaceNamecheckSysDefPortssignalTup2ListfindDup type2TypeRepgenIface unPrimSysDefunSysDef Sequential CombinationallocDefArgTypedProcFunAST ProcFunAST TypedProcFun procFun2DyncontProcFun2Dyntvalnameclsvalpfloc checkDecstptyptpEnumstpasttpfloctastparsast mkProcValProcVal ProcValAST mkProcValASTexpValexpTypexpEnumsdynvalAST EnumAlgTygetEnums readProcTypegenTupInstances getEnumAlgTy IsConsEnum isConsEnum unIsConsEnumPprOpsPprvNSpacescommaSep$++$<++>parensNonEmptyparensIfdotvSpace multiVSpaceppr_list pprOps_listvSemivCommahCommapprOpspprglobalNameTable PackageBody PackageDecArchBodyModePackageDecItem SubtypeDecTypeDecPackageBodyDecItem ConstraintRangeTypeDef EnumTypeDef RecordTypeDef ArrayTypeDefIndexConstraint ElementDec AttribName SliceName IndexedName SelectedNameSuffixPrefixSigDecSubProgDecItem SubProgSpec SubProgBodyVarDec SubtypeIn IfaceVarDec DiscreteRange CaseSmAltElseElseIfTypeMarkProcSm CompInsSmConSigAssignSmBlockSmConcSm BlockDecItem IfaceSigDec ActualPart FormalPart ActualDesig ConWformsWhenWhenElseWform WformElem PMapAspectInsUnitSeqSm SimpleNameLabel ElemAssocFCallLiteralExprChoice AssocElemVHDLName reservedWords fromVHDLIdunsafeVHDLBasicIdunsafeVHDLExtId mkVHDLBasicId mkVHDLExtIdunsafeIdAppend specialCharsotherSpecialChars logicalPrecrelationalPrec shiftPrecplusPrecsignPrecmultPrecmiscPrec DesignFile:<==: UnaffectedUseLibrary:.:IUEntityTDETDRTDA ConsArrayDefUnconsArrayDefOthersChoiceE:=>:FunctionAllSSimple EntityDecOutIn LibraryUnit ContextItemExtendedBasicVHDLIdAndOrXorNandNorXnor:=::/=::<::<=::>::>=:SllSrlSlaSraRolRor:+::-::&:NegPos:*::/:ModRem:**:AbsNotPrimNamePrimLit PrimFCall AggregateADNameADExprOpenCSBSmCSSASmCSISmCSPSmIfSmCaseSmReturnSmForSM:=WaitFor SigAssignProcCallSPVDSPSBBDISPBBDISDNSimple NSelectedNIndexedNSlice NAttribute AttribRangeToRangePDITDPDISDPDISSLUEntityLUArch LUPackageDec LUPackageBody pprExprPrecnestValpprExprPrecInfixpprExprPrecPrefixtupVHDLIdSuffix tupStrSuffix defaultIdvalueIdclockStrcommonContextClauseclockIdtypesIdworkIdstdIdtextioIdrangeIdimageIdeventIdabsentId presentId fromAbstExtIdunsafeFromAbstExtId valueSuffix isPresentId isAbsentIdexIdselIdltplusId plusplusIdemptyIdplusgtId singletonIdlengthIdisnullId replaceIdheadIdlastIdinitIdtailIdtakeIddropIdshiftlIdshiftrIdrotlIdrotrId reverseIdtoBitVector8IdtoBitVector16IdtoBitVector32IdfromBitVector8IdfromBitVector16IdfromBitVector32IdcopyIdshowIdwriteIdoutputId std_logicTM booleanTM fsvec_indexTM naturalTMint64TMint32TMint16TMint8TMstringTMtrueExpr falseExprlowExprhighExpr tupVHDLSuffixresetStrresetId defaultSNwriteDesignFile writeVHDLMwriteGlobalVHDLMwriteLocalVHDLM traverseVHDLM IntSignalInfonewVHDL defineVHDLTransNameSpaceGlobalTravResult GlobalVHDLSTLocalTravResult LocalVHDLST VHDLTravSTinitGlobalVHDLST initLocalSTemptyGlobalTravResultVHDLMemptyLocalTravResultinitTransNameSpace withLocalSTwithInitTransNameSpaceinitVHDLTravSTdebugMsgisRecursiveSetisCompileModelsimSet setVHDLOps addSigDecaddStmlookupCustomType addEnumTypes getEnumConsId addCustomType addTypeDec addSubtypeDecaddUnconsFSVecaddSubProgBodyaddTransNamePairgenFreshVHDLId liftEProne throwFError withProcC withProcFunC withProcValCtypeDecs subtypeDecs subProgBodiesarchDecsarchSms globalSysDefops globalRes enumTypes typeTabletransUnconsFSVecs currSysDefcontexttransNameSpacelocalReslocalglobalfreshNameCount nameTablepreparePatNameSpacetransTHName2VHDLtransVHDLId2IfaceSigDectransPortId2VHDL transTR2TMtransSysDef2EnttransZipWithN2BlocktransZipWithx2BlocktransUnzipNSY2BlocktransUnzipxSY2BlocktransDelay2BlocktransSysIns2CompInstransVHDLName2SigDectransPort2IfaceSigDectransSysId2VHDLtransProcId2VHDL customTR2TM doCustomTR2TMenumAlg2TypeDec primTypeTablefunErrtransProcFun2VHDLcheckProcFunASTtransProcFunSpectransInputPat2VHDLIdexpErrtransFunBodyExp2VHDLtransMatch2VHDLCaseSmAlt transExp2VHDLtransInteger2VHDLtransTLNat2InttransInt2TLNat fSVecTyConunAppgenSignalAssign genAssocElemsgenFCall genOutAssignsgenFCallAssign genExprAssigngenSysDesignFilegenLibDesignFilegenPMap genExprFCall genExprFCallN genExprFCall0genExprFCall0L genExprFCall1genExprFCall1L genExprFCall2genExprFCall2L genExprFCall4genExprFCall4LgenExprProcCallgenExprProcCall0genExprProcCall1genExprProcCall2genExprProcCall4genUnconsVectorFuns genTupleFunsgenAbstExtFunsgenEnumAlgFunsapplyRangeAttribgenAssocparseTestBenchOutwriteVHDLTestBenchgenVHDLTestBenchContextgenVHDLTestBenchEntitygenVHDLTestBenchArchgenStimuliAssigns genClkProc genOutputProc callQuartusgen_quartus_tclexecuteTestBenchModelsimcompileResultsModelsimrun_vlibrun_vmaprun_vcomrun_vsimrunModelsimCommandrunWait<&&> GraphMLEdge GraphMLNode GraphMLGraphGraphMLGraphId GraphMLNodeId GraphMLPortIdProcNodeOutNode YFilesMarkuppprGraphWithHeadersportSepnodeDimsnIOPortsport process_type value_arg procfun_arginstance_parent writeGraph writeGraphMLMwriteLocalGraphMLMtraverseGraphML newGraphML defineGraphMLGlobalGraphMLSTLocalGraphMLST GraphMLTravSTinitGlobalGraphMLSTGraphMLMinitGraphMLTravSTgenyFilesMarkup setGraphMLOpsaddEdgeaddNodenodesedges