Copyright  (C) 20132016 University of Twente 2017 Google Inc. 

License  BSD2 (see the file LICENSE) 
Maintainer  Christiaan Baaij <christiaan.baaij@gmail.com> 
Safe Haskell  Safe 
Language  Haskell2010 
Whereas the output of a Mealy machine depends on current transition, the output of a Moore machine depends on the previous state.
Moore machines are strictly less expressive, but may impose laxer timing requirements.
Synopsis
 moore :: HiddenClockReset domain gated synchronous => (s > i > s) > (s > o) > s > Signal domain i > Signal domain o
 mooreB :: (Bundle i, Bundle o, HiddenClockReset domain gated synchronous) => (s > i > s) > (s > o) > s > Unbundled domain i > Unbundled domain o
 medvedev :: HiddenClockReset domain gated synchronous => (s > i > s) > s > Signal domain i > Signal domain s
 medvedevB :: (Bundle i, Bundle s, HiddenClockReset domain gated synchronous) => (s > i > s) > s > Unbundled domain i > Unbundled domain s
Moore machine
:: HiddenClockReset domain gated synchronous  
=> (s > i > s)  Transfer function in moore machine form:

> (s > o)  Output function in moore machine form:

> s  Initial state 
> Signal domain i > Signal domain o  Synchronous sequential function with input and output matching that of the moore machine 
Create a synchronous function from a combinational function describing a moore machine
macT :: Int  Current state > (Int,Int)  Input > Int  Updated state macT s (x,y) = x * y + s mac :: HiddenClockReset domain gated synchronous =>Signal
domain (Int, Int) >Signal
domain Int mac =moore
mac id 0
>>>
simulate mac [(1,1),(2,2),(3,3),(4,4)]
[0,1,5,14... ...
Synchronous sequential functions can be composed just like their combinational counterpart:
dualMac :: HiddenClockReset domain gated synchronous => (Signal
domain Int,Signal
domain Int) > (Signal
domain Int,Signal
domain Int) >Signal
domain Int dualMac (a,b) (x,y) = s1 + s2 where s1 =moore
mac id 0 (bundle
(a,x)) s2 =moore
mac id 0 (bundle
(b,y))
:: (Bundle i, Bundle o, HiddenClockReset domain gated synchronous)  
=> (s > i > s)  Transfer function in moore machine form:

> (s > o)  Output function in moore machine form:

> s  Initial state 
> Unbundled domain i > Unbundled domain o  Synchronous sequential function with input and output matching that of the moore machine 
A version of moore
that does automatic Bundle
ing
Given a functions t
and o
of types:
t :: Int > (Bool, Int) > Int o :: Int > (Int, Bool)
When we want to make compositions of t
and o
in g
using moore
, we have to
write:
g a b c = (b1,b2,i2) where (i1,b1) =unbundle
(moore
t o 0 (bundle
(a,b))) (i2,b2) =unbundle
(moore
t o 3 (bundle
(i1,c)))
Using mooreB
however we can write:
g a b c = (b1,b2,i2) where (i1,b1) =mooreB
t o 0 (a,b) (i2,b2) =mooreB
t o 3 (i1,c)