packages feed

atom 1.0.7 → 1.0.8

raw patch · 3 files changed

+45/−21 lines, 3 filesdep ~sybnew-uploaderPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: syb

API changes (from Hackage documentation)

- Language.Atom.Expressions: instance (Expr a) => Eq (E a)
- Language.Atom.Expressions: instance (Expr a) => TypeOf (E a)
- Language.Atom.Expressions: instance (Expr a) => Width (E a)
- Language.Atom.Expressions: instance (Expr a) => Width (V a)
+ Language.Atom.Expressions: instance Expr a => Eq (E a)
+ Language.Atom.Expressions: instance Expr a => TypeOf (E a)
+ Language.Atom.Expressions: instance Expr a => Width (E a)
+ Language.Atom.Expressions: instance Expr a => Width (V a)
- Language.Atom.Common: hysteresis :: (OrdE a) => E a -> E a -> E a -> Atom (E Bool)
+ Language.Atom.Common: hysteresis :: OrdE a => E a -> E a -> E a -> Atom (E Bool)
- Language.Atom.Common: linear :: (FloatingE a) => (E a, E a) -> (E a, E a) -> E a -> E a
+ Language.Atom.Common: linear :: FloatingE a => (E a, E a) -> (E a, E a) -> E a -> E a
- Language.Atom.Common: lookupTable :: (FloatingE a) => [(E a, E a)] -> E a -> E a
+ Language.Atom.Common: lookupTable :: FloatingE a => [(E a, E a)] -> E a -> E a
- Language.Atom.Elaboration: array :: (Expr a) => Name -> [a] -> Atom (A a)
+ Language.Atom.Elaboration: array :: Expr a => Name -> [a] -> Atom (A a)
- Language.Atom.Elaboration: array' :: (Expr a) => Name -> Type -> A a
+ Language.Atom.Elaboration: array' :: Expr a => Name -> Type -> A a
- Language.Atom.Elaboration: var :: (Expr a) => Name -> a -> Atom (V a)
+ Language.Atom.Elaboration: var :: Expr a => Name -> a -> Atom (V a)
- Language.Atom.Expressions: (/=.) :: (EqE a) => E a -> E a -> E Bool
+ Language.Atom.Expressions: (/=.) :: EqE a => E a -> E a -> E Bool
- Language.Atom.Expressions: (<.) :: (OrdE a) => E a -> E a -> E Bool
+ Language.Atom.Expressions: (<.) :: OrdE a => E a -> E a -> E Bool
- Language.Atom.Expressions: (<=.) :: (OrdE a) => E a -> E a -> E Bool
+ Language.Atom.Expressions: (<=.) :: OrdE a => E a -> E a -> E Bool
- Language.Atom.Expressions: (==.) :: (EqE a) => E a -> E a -> E Bool
+ Language.Atom.Expressions: (==.) :: EqE a => E a -> E a -> E Bool
- Language.Atom.Expressions: (>.) :: (OrdE a) => E a -> E a -> E Bool
+ Language.Atom.Expressions: (>.) :: OrdE a => E a -> E a -> E Bool
- Language.Atom.Expressions: (>=.) :: (OrdE a) => E a -> E a -> E Bool
+ Language.Atom.Expressions: (>=.) :: OrdE a => E a -> E a -> E Bool
- Language.Atom.Expressions: bytes :: (Width a) => a -> Int
+ Language.Atom.Expressions: bytes :: Width a => a -> Int
- Language.Atom.Expressions: class (Eq a) => Expr a
+ Language.Atom.Expressions: class Eq a => Expr a
- Language.Atom.Expressions: constant :: (Expr a) => a -> Const
+ Language.Atom.Expressions: constant :: Expr a => a -> Const
- Language.Atom.Expressions: div0_ :: (IntegralE a) => E a -> E a -> a -> E a
+ Language.Atom.Expressions: div0_ :: IntegralE a => E a -> E a -> a -> E a
- Language.Atom.Expressions: div_ :: (IntegralE a) => E a -> E a -> E a
+ Language.Atom.Expressions: div_ :: IntegralE a => E a -> E a -> E a
- Language.Atom.Expressions: eType :: (Expr a) => E a -> Type
+ Language.Atom.Expressions: eType :: Expr a => E a -> Type
- Language.Atom.Expressions: expression :: (Expr a) => E a -> Expression
+ Language.Atom.Expressions: expression :: Expr a => E a -> Expression
- Language.Atom.Expressions: limit :: (OrdE a) => E a -> E a -> E a -> E a
+ Language.Atom.Expressions: limit :: OrdE a => E a -> E a -> E a -> E a
- Language.Atom.Expressions: max_ :: (OrdE a) => E a -> E a -> E a
+ Language.Atom.Expressions: max_ :: OrdE a => E a -> E a -> E a
- Language.Atom.Expressions: maximum_ :: (OrdE a) => [E a] -> E a
+ Language.Atom.Expressions: maximum_ :: OrdE a => [E a] -> E a
- Language.Atom.Expressions: min_ :: (OrdE a) => E a -> E a -> E a
+ Language.Atom.Expressions: min_ :: OrdE a => E a -> E a -> E a
- Language.Atom.Expressions: minimum_ :: (OrdE a) => [E a] -> E a
+ Language.Atom.Expressions: minimum_ :: OrdE a => [E a] -> E a
- Language.Atom.Expressions: mod0_ :: (IntegralE a) => E a -> E a -> a -> E a
+ Language.Atom.Expressions: mod0_ :: IntegralE a => E a -> E a -> a -> E a
- Language.Atom.Expressions: mod_ :: (IntegralE a) => E a -> E a -> E a
+ Language.Atom.Expressions: mod_ :: IntegralE a => E a -> E a -> E a
- Language.Atom.Expressions: mux :: (Expr a) => E Bool -> E a -> E a -> E a
+ Language.Atom.Expressions: mux :: Expr a => E Bool -> E a -> E a -> E a
- Language.Atom.Expressions: rawBits :: (Expr a) => E a -> E Word64
+ Language.Atom.Expressions: rawBits :: Expr a => E a -> E Word64
- Language.Atom.Expressions: typeOf :: (TypeOf a) => a -> Type
+ Language.Atom.Expressions: typeOf :: TypeOf a => a -> Type
- Language.Atom.Expressions: ue :: (Expr a) => E a -> UE
+ Language.Atom.Expressions: ue :: Expr a => E a -> UE
- Language.Atom.Expressions: variable :: (Expr a) => V a -> Variable
+ Language.Atom.Expressions: variable :: Expr a => V a -> Variable
- Language.Atom.Expressions: width :: (Width a) => a -> Int
+ Language.Atom.Expressions: width :: Width a => a -> Int
- Language.Atom.Language: (<==) :: (Assign a) => V a -> E a -> Atom ()
+ Language.Atom.Language: (<==) :: Assign a => V a -> E a -> Atom ()
- Language.Atom.Language: array :: (Expr a) => Name -> [a] -> Atom (A a)
+ Language.Atom.Language: array :: Expr a => Name -> [a] -> Atom (A a)
- Language.Atom.Language: array' :: (Expr a) => Name -> Type -> A a
+ Language.Atom.Language: array' :: Expr a => Name -> Type -> A a
- Language.Atom.Language: class (Expr a) => Assign a
+ Language.Atom.Language: class Expr a => Assign a
- Language.Atom.Language: liftIO :: (MonadIO m) => forall a. IO a -> m a
+ Language.Atom.Language: liftIO :: MonadIO m => forall a. IO a -> m a
- Language.Atom.Language: probe :: (Expr a) => Name -> E a -> Atom ()
+ Language.Atom.Language: probe :: Expr a => Name -> E a -> Atom ()
- Language.Atom.Language: var :: (Expr a) => Name -> a -> Atom (V a)
+ Language.Atom.Language: var :: Expr a => Name -> a -> Atom (V a)
- Language.Atom.Unit: class (Expr a) => Random a
+ Language.Atom.Unit: class Expr a => Random a
- Language.Atom.Unit: printFloatingE :: (FloatingE a) => String -> E a -> Atom ()
+ Language.Atom.Unit: printFloatingE :: FloatingE a => String -> E a -> Atom ()
- Language.Atom.Unit: printIntegralE :: (IntegralE a) => String -> E a -> Atom ()
+ Language.Atom.Unit: printIntegralE :: IntegralE a => String -> E a -> Atom ()
- Language.Atom.Unit: random :: (Random a) => E a
+ Language.Atom.Unit: random :: Random a => E a

Files

Language/Atom/Code.hs view
@@ -16,8 +16,6 @@  import Data.Generics.Uniplate.Data -import Data.Generics.Uniplate.Data- import Language.Atom.Analysis import Language.Atom.Elaboration import Language.Atom.Expressions@@ -45,7 +43,10 @@                                  -- rules?   } --- | Data associated with sampling a hardware clock.+-- | Data associated with sampling a hardware clock.  For the clock to work+-- correctly, you MUST assign @__global_clock@ the current time (accoring to +-- @clockName@) the first time you enter the main Atom-generated function+-- calling your rules. data Clock = Clock    { clockName  :: String        -- ^ C function to sample the clock.  The@@ -229,8 +230,7 @@     case hardwareClock config of       Nothing      -> unlines [codePeriodPhases, "  " ++ globalClk ++ " = " ++ globalClk ++ " + 1;"]       Just clkData -> unlines -        [ "  " ++ setGlobalClk clkData-        , ""+        [ ""         , codePeriodPhases         , "  // In the following we sample the hardware clock, waiting for the next phase."         , ""@@ -249,32 +249,44 @@         , "  else {"         , "    " ++ delayFn ++ "(" ++ phaseConst ++ " - (" ++ currentTime ++ " + ("                   ++ maxConst ++ " - " ++ globalClk ++ ")));"-                          , "  }"+        , ""+        , "  " ++ setGlobalClk clkData         ]-        where +        where           delayFn = delay clkData           maxVal :: Integer-          maxVal  = 2 ^ (case clockType clkData of-                           Word8  -> 8-                           Word16 -> 16-                           Word32 -> 32-                           Word64 -> 64-                           _      -> clkTypeErr) - 1-          declareConst varName c = globalType ++ " const " ++ varName +          maxVal  = case clockType clkData of+                      Word8  -> toInteger (maxBound :: Word8)+                      Word16 -> toInteger (maxBound :: Word16)+                      Word32 -> toInteger (maxBound :: Word32)+                      Word64 -> toInteger (maxBound :: Word64)+                      _      -> clkTypeErr+          declareConst varName c = globalType ++ " const " ++ varName                                    ++ " = " ++ showConst (constType c) ++ ";"           setTime     = currentTime ++ " = " ++ clockName clkData ++ "();"           maxConst    = "__max"           phaseConst = "__phase_len"           currentTime = "__curr_time"-          clkDelta | d <= 0 || d > maxVal = -            error "The delta given for the number of ticks in a phase must be greater than 0."-                   | otherwise = d+          clkDelta | d <= 0+                       = error $ "The delta "+                                 ++ show d+                                 ++ ", given for the number of ticks "+                                 ++ "in a phase must be greater than 0."+                   | d > maxVal+                       = error $ "The delta "+                         ++ show d+                         ++ ", given for the number of ticks in a phase "+                         ++ "must be smaller than "+                         ++ show ( maxVal + 1 )+                         ++ "."+                   | otherwise+                       = d             where d = delta clkData-          errCheck = +          errCheck =             case err clkData of               Nothing    -> ""-              Just errF  -> unlines +              Just errF  -> unlines                 [ "  // An error check for when the phase has already expired."                 , "  // The first disjunct is for when the current time has not overflowed,"                 , "  // and the second for when it has."@@ -314,6 +326,7 @@                                           Word64 -> Word64                                           _      -> clkTypeErr) +  clkTypeErr :: a   clkTypeErr = error "Clock type must be one of Word8, Word16, Word32, Word64."    funcName = if null (cFuncName config) then name else cFuncName config
Language/Atom/Compile.hs view
@@ -6,6 +6,8 @@   ) where  import System.Exit+import Control.Monad (when)+import Data.Maybe (isJust)  import Language.Atom.Code import Language.Atom.Scheduling@@ -21,5 +23,14 @@     Just (state, rules, assertionNames, coverageNames, probeNames) -> do       let schedule' = schedule rules       ruleCoverage <- writeC name config state rules schedule' assertionNames coverageNames probeNames+      when (isJust $ hardwareClock config) (putStrLn hwClockWarning)       return (schedule', ruleCoverage, assertionNames, coverageNames, probeNames) +hwClockWarning :: String+hwClockWarning = unlines+ [ ""+ , "*** Atom WARNING: you are configuring to use a harware clock.  Please remember to assign" + , "    the current time (accoring to your clockName field in Clock) the first time you"+ , "    enter the main Atom-generated function calling your rules."+ , ""+ ]
atom.cabal view
@@ -1,5 +1,5 @@ name:    atom-version: 1.0.7+version: 1.0.8  category: Language, Embedded @@ -36,7 +36,7 @@         base       >= 4.0     && < 5,         mtl        >= 1.1.0.1 && < 1.2,         process    >= 1.0.1.1 && < 1.2,-        syb        >= 0.1.0.0 && < 0.2.0.0,+        syb        >= 0.1.0.0,         uniplate   >= 1.5.0   && < 2.0      exposed-modules: