packages feed

clash 0.1.1.0 → 0.1.1.1

raw patch · 3 files changed

+49/−2 lines, 3 files

Files

CLasH/HardwareTypes.hs view
@@ -10,6 +10,9 @@   , module Prelude   , module Data.Bits   , module Language.Haskell.TH.Lift+  , module Control.Category+  , module Control.Arrow+  , module Control.Monad.Fix   , Bit(..)   , State(..)   , hwand@@ -19,10 +22,13 @@   , RAM   , MemState   , blockRAM+  , Stat+  , simulate+  , (^^^)   ) where  import qualified Prelude as P-import Prelude (Bool(..),Num(..),Eq(..),Ord(..),snd,fst,otherwise,(&&),(||),not)+import Prelude (Bool(..),Num(..),Eq(..),Ord(..),snd,fst,otherwise,(&&),(||),not,(>>),(>>=),fail,return) import Types import Data.Param.Integer (HWBits(..)) import Data.Param.Vector@@ -34,6 +40,10 @@ import Language.Haskell.TH.Lift import Data.Typeable +import Control.Category (Category,(.),id)+import Control.Arrow (Arrow,arr,first,ArrowLoop,loop,(>>>),second,returnA)+import Control.Monad.Fix (mfix)+ newtype State s = State s deriving (P.Show)  -- The plain Bit type@@ -81,3 +91,39 @@               replace mem wraddr data_in             else               mem++-- ==================+-- = Automata Arrow =+-- ==================+newtype Stat i o = A {+     apply :: i -> (o, Stat i o)+}++instance Category Stat where+   (A g) . (A f) = A (\b ->  let (c,f') = f b+                                 (d,g') = g c+                             in (d, g'.f'))+   id = arr id++instance Arrow Stat where+   arr f = A (\b -> (f b, arr f))+   first (A f) = A (\(b,d) -> let (c,f') = f b+                              in ((c,d), first f'))+instance ArrowLoop Stat where+   loop (A f) = A (\i -> let ((c,d), f') = f (i, d)+                         in (c, loop f'))++liftS :: s -> (State s -> i -> (State s,o)) -> Stat i o+liftS init f = A applyS+   where applyS = \i -> let (State s,o) = f (State init) i+                        in (o, liftS s f)++simulate :: Stat b c -> [b] -> [c]+simulate (A f) []     = []+simulate (A f) (b:bs) = let (c,f') = f b in (c : simulate f' bs)++arrState :: s -> (State s -> i -> (State s,o)) -> Stat i o+arrState = liftS++(^^^) :: (State s -> i -> (State s,o)) -> s -> Stat i o+(^^^) f init = arrState init f
CLasH/Normalize.hs view
@@ -1470,6 +1470,7 @@       realfun' <- mkFunction realfun $ Maybe.fromMaybe (error $ "Normalize.getNormalized_maybe(Arrow.liftS): lifted function " ++ pprString realfun ++ "could not be normalized") normalized       -- Associate initial state with lifted function       MonadState.modify tsInitStates (Map.insert realfun' initvalue)+      MonadState.modify tsInitStates (Map.insert bndr initvalue)       -- Make a mapping from the arrow to the lifted function       MonadState.modify tsArrows (Map.insert bndr realfun')       return normalized
clash.cabal view
@@ -1,5 +1,5 @@ name:               clash-version:            0.1.1.0+version:            0.1.1.1 build-type:         Simple synopsis:           CAES Language for Synchronous Hardware (CLaSH) description:        CLaSH is a tool-chain/language to translate subsets of