-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A stream DSL for writing embedded C monitors. -- -- Can you write a list in Haskell? Then you can write embedded C code -- using Copilot. Here's a Copilot program that computes the Fibonacci -- sequence (over Word 64s) and tests for even numbers: -- --
--   fib :: Streams
--   fib = do
--    "fib" .= [0,1] ++ var "fib" + (drop 1 $ varW64 "fib")
--    "t" .= even (var "fib")
--      where even :: Spec Word64 -> Spec Bool
--            even w = w `mod` const 2 == const 0
--   
-- -- Copilot contains an interpreter, a compiler, and uses a model-checker -- to check the correctness of your program. The compiler generates -- constant time and constant space C code via Tom Hawkin's Atom (thanks -- Tom!). Copilot was originally developed to write embedded monitors for -- more complex embedded systems, but it can be used to develop a variety -- of functional-style embedded code. @package copilot @version 0.23 -- | Variable names module Language.Copilot.Variables b :: String c :: String d :: String e :: String f :: String g :: String h :: String i :: String j :: String k :: String l :: String m :: String n :: String o :: String p :: String q :: String r :: String s :: String t :: String u :: String v :: String w :: String x :: String y :: String z :: String a :: String -- | Helper functions for writing free-form C code. module Language.Copilot.AdHocC -- | Takes a type and a list of variable names and declares them. varDecl :: Type -> [String] -> String -- | Takes a type and a list of array names and their sizes declares them. arrDecl :: Type -> [(String, Int)] -> String -- | Takes a type and a variable and initializes it. It is YOUR -- responsibility to ensure that val is of type t. varInit :: (Show a) => Type -> String -> a -> String -- | Takes a type and an array and initializes it. It is YOUR -- responsibility to ensure that vals is of type t. arrayInit :: (Show a) => Type -> String -> [a] -> String -- | Declare function prototypes, given a return type, a function name, and -- a | list of argument types. Use Nothing for a return type of -- void. funcDecl :: Maybe Type -> String -> [Type] -> String -- | Add an include of a library includeBracket :: String -> String -- | Add an include of a header file includeQuote :: String -> String printf :: String -> [String] -> String -- | printf, with and without a newline (nl) character. printfNewline :: String -> [String] -> String -- | Help to display. module Language.Copilot.Help helpStr :: String -- | Provides basic types and functions for other parts of Copilot. -- -- If you wish to add a new type, you need to make it an instance of -- Streamable, to add it to -- foldStreamableMaps, mapStreamableMaps, -- and optionnaly to add an ext[Type], a [type] and a var[Type] functions -- in Language.hs to make it easier to use. module Language.Copilot.Core -- | Names of the streams or external variables type Var = String -- | C file name type Name = String -- | Atom period type Period = Int -- | Phase of an Atom phase type Phase = Int -- | Port over which to broadcast information type Port = Int -- | Specification of a stream, parameterized by the type of the values of -- the stream. The only requirement on a is that it should be -- Streamable. data Spec a Var :: Var -> Spec a Const :: a -> Spec a PVar :: Type -> Var -> Phase -> Spec a PArr :: Type -> (Var, Spec b) -> Phase -> Spec a F :: (b -> a) -> (E b -> E a) -> Spec b -> Spec a F2 :: (b -> c -> a) -> (E b -> E c -> E a) -> Spec b -> Spec c -> Spec a F3 :: (b -> c -> d -> a) -> (E b -> E c -> E d -> E a) -> Spec b -> Spec c -> Spec d -> Spec a Append :: [a] -> Spec a -> Spec a Drop :: Int -> Spec a -> Spec a -- | Container for mutually recursive streams, whose specifications may be -- parameterized by different types type Streams = Writer (StreamableMaps Spec) () -- | A named stream type Stream a = (Streamable a) => (Var, Spec a) -- | Container for all the instructions sending data, parameterised by -- different types type Sends = StreamableMaps Send -- | An instruction to send data on a port at a given phase data Send a Send :: (Var, Phase, Port) -> Send a -- | Holds the complete specification of a distributed monitor type DistributedStreams = (Streams, Sends) -- | A type is streamable iff a stream may emit values of that type -- -- There are very strong links between Streamable and -- StreamableMaps : the types aggregated in -- StreamableMaps are exactly the -- Streamable types and that invariant should be kept -- (see methods) class (Expr a, Assign a, Show a) => Streamable a getSubMap :: (Streamable a) => StreamableMaps b -> Map Var (b a) updateSubMap :: (Streamable a) => (Map Var (b a) -> Map Var (b a)) -> StreamableMaps b -> StreamableMaps b unit :: (Streamable a) => a atomConstructor :: (Streamable a) => Var -> a -> Atom (V a) externalAtomConstructor :: (Streamable a) => Var -> V a typeId :: (Streamable a) => a -> String typeIdPrec :: (Streamable a) => a -> String atomType :: (Streamable a) => a -> Type showAsC :: (Streamable a) => a -> String makeTrigger :: (Streamable a) => [(Var, String)] -> StreamableMaps Spec -> ProphArrs -> TmpSamples -> Indexes -> Var -> Spec a -> Atom () -> Atom () class (Streamable a) => Sendable a send :: (Sendable a) => E a -> Port -> Atom () -- | This is a generalization of Streams which is used for -- storing Maps over values parameterized by different types. -- -- It is extensively used in the internals of Copilot, in conjunction -- with foldStreamableMaps and -- mapStreamableMaps data StreamableMaps a SM :: Map Var (a Bool) -> Map Var (a Int8) -> Map Var (a Int16) -> Map Var (a Int32) -> Map Var (a Int64) -> Map Var (a Word8) -> Map Var (a Word16) -> Map Var (a Word32) -> Map Var (a Word64) -> Map Var (a Float) -> Map Var (a Double) -> StreamableMaps a bMap :: StreamableMaps a -> Map Var (a Bool) i8Map :: StreamableMaps a -> Map Var (a Int8) i16Map :: StreamableMaps a -> Map Var (a Int16) i32Map :: StreamableMaps a -> Map Var (a Int32) i64Map :: StreamableMaps a -> Map Var (a Int64) w8Map :: StreamableMaps a -> Map Var (a Word8) w16Map :: StreamableMaps a -> Map Var (a Word16) w32Map :: StreamableMaps a -> Map Var (a Word32) w64Map :: StreamableMaps a -> Map Var (a Word64) fMap :: StreamableMaps a -> Map Var (a Float) dMap :: StreamableMaps a -> Map Var (a Double) -- | An empty streamableMaps. emptySM :: StreamableMaps a -- | Verifies if its argument is equal to emptySM isEmptySM :: StreamableMaps a -> Bool -- | Lookup into the map of the right type in -- StreamableMaps getMaybeElem :: (Streamable a) => Var -> StreamableMaps b -> Maybe (b a) -- | Lookup into the map of the right type in -- StreamableMaps Launch an exception if the index is not -- in it getElem :: (Streamable a) => Var -> StreamableMaps b -> b a -- | This function is used to iterate on all the values in all the maps -- stored by a StreamableMaps, accumulating a value over -- time foldStreamableMaps :: ((Streamable a) => Var -> c a -> b -> b) -> StreamableMaps c -> b -> b -- | This function is used to iterate on all the values in all the maps -- stored by a StreamableMaps, accumulating a value over -- time foldSendableMaps :: (forall a. (Sendable a) => Var -> c a -> b -> b) -> StreamableMaps c -> b -> b mapStreamableMaps :: (forall a. (Streamable a) => Var -> s a -> s' a) -> StreamableMaps s -> StreamableMaps s' mapStreamableMapsM :: (Monad m) => ((Streamable a) => Var -> s a -> m (s' a)) -> StreamableMaps s -> m (StreamableMaps s') -- | Only keeps in sm the values whose key+type are in l. -- Also returns a bool saying whether all the elements in sm were in l. -- Works even if some elements in l are not in sm. Not -- optimised at all. filterStreamableMaps :: StreamableMaps c -> [(Type, Var, b)] -> (StreamableMaps c, Bool) -- | Replace all accepted special characters by sequences of underscores. normalizeVar :: Var -> Var -- | Get the Copilot variables. getVars :: StreamableMaps Spec -> [Var] -- | For each typed variable, this type holds all its successive values in -- an infinite list Beware : each element of one of those lists -- corresponds to a full Atom period, not to a single clock -- tick. type Vars = StreamableMaps [] data BoundedArray a B :: ArrIndex -> (Maybe (A a)) -> BoundedArray a nextSt :: (Streamable a) => StreamableMaps Spec -> ProphArrs -> TmpSamples -> Indexes -> Spec a -> ArrIndex -> E a type Outputs = StreamableMaps V data TmpSamples TmpSamples :: StreamableMaps PhasedValueVar -> StreamableMaps PhasedValueArr -> StreamableMaps PhasedValueIdx -> TmpSamples tmpVars :: TmpSamples -> StreamableMaps PhasedValueVar tmpArrs :: TmpSamples -> StreamableMaps PhasedValueArr tmpIdxs :: TmpSamples -> StreamableMaps PhasedValueIdx emptyTmpSamples :: TmpSamples type ProphArrs = StreamableMaps BoundedArray type Indexes = Map Var (V ArrIndex) data PhasedValueVar a PhV :: Phase -> (V a) -> PhasedValueVar a data PhasedValueArr a PhA :: Phase -> (V a) -> PhasedValueArr a data PhasedValueIdx a PhIdx :: (E a) -> PhasedValueIdx a tmpVarName :: Var -> Phase -> Var tmpArrName :: Var -> Phase -> String -> Var getAtomType :: (Streamable a) => Spec a -> Type instance (Show a) => Show (Spec a) instance Monoid (StreamableMaps Spec) instance Sendable Word8 instance Streamable Double instance Streamable Float instance Streamable Word64 instance Streamable Word32 instance Streamable Word16 instance Streamable Word8 instance Streamable Int64 instance Streamable Int32 instance Streamable Int16 instance Streamable Int8 instance Streamable Bool instance (Eq a) => Eq (Spec a) instance (Streamable a, NumE a, Fractional a) => Fractional (Spec a) instance (Streamable a, NumE a) => Num (Spec a) -- | This module provides a way to check that a Copilot -- specification is compilable module Language.Copilot.Analyser -- | Check a Copilot specification. If it is not compilable, then -- returns an error describing the issue. Else, returns Nothing check :: StreamableMaps Spec -> Maybe Error -- | Used for representing an error in the specification, detected by -- check data Error -- | the BNF is not respected BadSyntax :: String -> Var -> Error -- | A drop expression of less than 0 is used BadDrop :: Int -> Var -> Error -- | if an external variable is sampled at phase 0 then there is no time -- for the stream to be updated BadSamplingPhase :: Var -> Var -> Phase -> Error -- | if an external variable is sampled at phase 0 then there is no time -- for the stream to be updated BadSamplingArrPhase :: Var -> Var -> Phase -> Error -- | External array indexes can only take variables or constants as -- indexes. BadPArrSpec :: Var -> Var -> String -> Error -- | either a variable is not defined, or not with the good type ; there is -- no implicit conversion of types in Copilot BadType :: Var -> Var -> Error -- | The algorithm to compile Copilot specification can only work if -- there is no negative weighted closed path in the specification, as -- described in the original research paper NonNegativeWeightedClosedPath :: [Var] -> Weight -> Error -- | Could be compiled, but would need bigger prophecyArrays DependsOnClosePast :: [Var] -> Var -> Weight -> Weight -> Error -- | If an output depends of a future of an input it will be hard to -- compile to say the least DependsOnFuture :: [Var] -> Var -> Weight -> Error data SpecSet AllSpecSet :: SpecSet FunSpecSet :: SpecSet DropSpecSet :: SpecSet PArrSet :: SpecSet getExternalVars :: StreamableMaps Spec -> [Exs] data ExtVars ExtV :: Phase -> ExtVars ExtA :: Phase -> String -> ExtVars instance Eq ExtVars instance Eq SpecSet instance Show Error -- | The Copilot interpreter. module Language.Copilot.Interpreter -- | The main function of this module. It takes a Copilot -- specification, the values of the monitored values, and returns the -- values of the streams. interpretStreams :: StreamableMaps Spec -> Vars -> Vars -- | Transform the copilot specification in an atom one, and then compile -- that one. module Language.Copilot.Compiler -- | Compiles an Copilot specification to an Atom one. The -- period is given as a Maybe : if it is Nothing, an optimal period will -- be chosen. copilotToAtom :: StreamableMaps Spec -> Sends -> Maybe Period -> [(Var, String)] -> (Period, Atom ()) tmpSampleStr :: String -- | Defines a main() and print statements to easily execute generated -- Copilot specs. module Language.Copilot.AtomToC getPrePostCode :: Name -> StreamableMaps Spec -> [(Type, Var, ExtVars)] -> [(String, Int)] -> Vars -> Period -> (String, String) -- | Generate random specs for testing. We do not generate external array -- indexes. module Language.Copilot.Tests.Random randomStreams :: (RandomGen g) => Operators -> Operators -> Operators -> g -> (StreamableMaps Spec, Vars) data Operator a Operator :: (forall g. (RandomGen g) => (forall a' g'. (Streamable a', Random a', RandomGen g') => g' -> SpecSet -> (Spec a', g')) -> g -> (Spec a, g)) -> Operator a type Operators = StreamableMaps Operator fromOp :: Operator a -> (forall g. (RandomGen g) => (forall a' g'. (Streamable a', Random a', RandomGen g') => g' -> SpecSet -> (Spec a', g')) -> g -> (Spec a, g)) instance Random Type instance (Random a) => Random [a] instance Random Word64 instance Random Word32 instance Random Word16 instance Random Word8 instance Random Int64 instance Random Int32 instance Random Int16 instance Random Int8 -- | Describes the language Copilot. -- -- If you wish to add a new operator, the only modification needed is -- adding it in this module. But if you want it to be used in the random -- generated streams, add it to either opsF, -- opsF2 or opsF3 module Language.Copilot.Language mod :: (Streamable a, IntegralE a) => Spec a -> Spec a -> Spec a -- | Beware : crash without any possible recovery if a division by 0 -- happens. Same risk with mod. Use div0 and mod0 if unsure. div :: (Streamable a, IntegralE a) => Spec a -> Spec a -> Spec a mod0 :: (Streamable a, IntegralE a) => a -> Spec a -> Spec a -> Spec a -- | As mod and div, except that if the division would be by 0, the first -- argument is used as a default. div0 :: (Streamable a, IntegralE a) => a -> Spec a -> Spec a -> Spec a (<) :: (Streamable a, OrdE a) => Spec a -> Spec a -> Spec Bool (<=) :: (Streamable a, OrdE a) => Spec a -> Spec a -> Spec Bool (==) :: (Streamable a, EqE a) => Spec a -> Spec a -> Spec Bool (/=) :: (Streamable a, EqE a) => Spec a -> Spec a -> Spec Bool (>=) :: (Streamable a, OrdE a) => Spec a -> Spec a -> Spec Bool (>) :: (Streamable a, OrdE a) => Spec a -> Spec a -> Spec Bool not :: Spec Bool -> Spec Bool (||) :: Spec Bool -> Spec Bool -> Spec Bool (&&) :: Spec Bool -> Spec Bool -> Spec Bool (^) :: Spec Bool -> Spec Bool -> Spec Bool (==>) :: Spec Bool -> Spec Bool -> Spec Bool data Bool :: * False :: Bool True :: Bool -- | Basic numeric class. -- -- Minimal complete definition: all except negate or (-) class (Eq a, Show a) => Num a (+) :: (Num a) => a -> a -> a (*) :: (Num a) => a -> a -> a (-) :: (Num a) => a -> a -> a negate :: (Num a) => a -> a abs :: (Num a) => a -> a signum :: (Num a) => a -> a fromInteger :: (Num a) => Integer -> a -- | Fractional numbers, supporting real division. -- -- Minimal complete definition: fromRational and (recip or -- (/)) class (Num a) => Fractional a (/) :: (Fractional a) => a -> a -> a -- | Beware : both sides are executed, even if the result of one is later -- discarded mux :: (Streamable a) => Spec Bool -> Spec a -> Spec a -> Spec a class (Streamable a, Integral a) => CastIntTo a cast :: (CastIntTo a, Streamable b, IntegralE b) => Spec b -> Spec a bool :: Spec Bool -> Spec Bool int8 :: Spec Int8 -> Spec Int8 int16 :: Spec Int16 -> Spec Int16 int32 :: Spec Int32 -> Spec Int32 int64 :: Spec Int64 -> Spec Int64 word8 :: Spec Word8 -> Spec Word8 word16 :: Spec Word16 -> Spec Word16 word32 :: Spec Word32 -> Spec Word32 word64 :: Spec Word64 -> Spec Word64 float :: Spec Float -> Spec Float double :: Spec Double -> Spec Double extB :: Var -> Phase -> Spec Bool extI8 :: Var -> Phase -> Spec Int8 extI16 :: Var -> Phase -> Spec Int16 extI32 :: Var -> Phase -> Spec Int32 extI64 :: Var -> Phase -> Spec Int64 extW8 :: Var -> Phase -> Spec Word8 extW16 :: Var -> Phase -> Spec Word16 extW32 :: Var -> Phase -> Spec Word32 extW64 :: Var -> Phase -> Spec Word64 extF :: Var -> Phase -> Spec Float extD :: Var -> Phase -> Spec Double extArrB :: (Streamable a, IntegralE a) => (Var, Spec a) -> Phase -> Spec Bool extArrI8 :: (Streamable a, IntegralE a) => (Var, Spec a) -> Phase -> Spec Int8 extArrI16 :: (Streamable a, IntegralE a) => (Var, Spec a) -> Phase -> Spec Int16 extArrI32 :: (Streamable a, IntegralE a) => (Var, Spec a) -> Phase -> Spec Int32 extArrI64 :: (Streamable a, IntegralE a) => (Var, Spec a) -> Phase -> Spec Int64 extArrW8 :: (Streamable a, IntegralE a) => (Var, Spec a) -> Phase -> Spec Word8 extArrW16 :: (Streamable a, IntegralE a) => (Var, Spec a) -> Phase -> Spec Word16 extArrW32 :: (Streamable a, IntegralE a) => (Var, Spec a) -> Phase -> Spec Word32 extArrW64 :: (Streamable a, IntegralE a) => (Var, Spec a) -> Phase -> Spec Word64 extArrF :: (Streamable a, IntegralE a) => (Var, Spec a) -> Phase -> Spec Float extArrD :: (Streamable a, IntegralE a) => (Var, Spec a) -> Phase -> Spec Double opsF :: Operators -- | opsF, opsF2 and opsF3 are feeded to Tests.Random.randomStreams. They -- allows the random generated streams to include lots of operators. If -- you add a new operator to Copilot, it would be nice to add it to one -- of those, that way it could be used in the random streams used for -- testing. opsF holds all the operators of arity 1, opsF2 of arity 2 and -- opsF3 of arity3 They are StreamableMaps, because operators are sorted -- based on their return type. opsF2 :: Operators opsF3 :: Operators -- | Stream variable reference var :: (Streamable a) => Var -> Spec a -- | A constant stream const :: (Streamable a) => a -> Spec a -- | Drop i elements from a stream. drop :: (Streamable a) => Int -> Spec a -> Spec a -- | Just a trivial wrapper over the Append constructor (++) :: (Streamable a) => [a] -> Spec a -> Spec a -- | Define a stream variable. (.=) :: (Streamable a) => Var -> Spec a -> Streams -- | Allows to build a Sends from specification (..|) :: (Sendable a) => Send a -> Sends -> Sends varB :: Var -> Spec Bool varI8 :: Var -> Spec Int8 varI16 :: Var -> Spec Int16 varI32 :: Var -> Spec Int32 varI64 :: Var -> Spec Int64 varW8 :: Var -> Spec Word8 varW16 :: Var -> Spec Word16 varW32 :: Var -> Spec Word32 varW64 :: Var -> Spec Word64 varF :: Var -> Spec Float varD :: Var -> Spec Double sendW8 :: Var -> (Phase, Port) -> Send Word8 constB :: Bool -> Spec Bool constI8 :: Int8 -> Spec Int8 constI16 :: Int16 -> Spec Int16 constI32 :: Int32 -> Spec Int32 constI64 :: Int64 -> Spec Int64 constW8 :: Word8 -> Spec Word8 constW16 :: Word16 -> Spec Word16 constW32 :: Word32 -> Spec Word32 constW64 :: Word64 -> Spec Word64 constF :: Float -> Spec Float constD :: Double -> Spec Double instance CastIntTo Int64 instance CastIntTo Int32 instance CastIntTo Int16 instance CastIntTo Int8 instance CastIntTo Word64 instance CastIntTo Word32 instance CastIntTo Word16 instance CastIntTo Word8 -- | Provides past-time linear-temporal logic (ptLTL operators). Currently -- won't make unique tmp stream names if you use the same operator twice -- in one stream definition. module Language.Copilot.Libs.PTLTL -- | Did s hold in the previous period? previous :: Var -> Spec Bool -> Streams -- | Has s always held? alwaysBeen :: Var -> Spec Bool -> Streams -- | Did s hold at some time in the past (including the current -- state)? eventuallyPrev :: Var -> Spec Bool -> Streams -- | Once s2 holds, in the following state (period), does -- s1 continuously hold? since :: Var -> (Spec Bool, Spec Bool) -> Streams -- | Only exports instances for Show which allows the printing of streams module Language.Copilot.PrettyPrinter instance Show Streams instance (Show (a Bool), Show (a Int8), Show (a Int16), Show (a Int32), Show (a Int64), Show (a Word8), Show (a Word16), Show (a Word32), Show (a Word64), Show (a Float), Show (a Double)) => Show (StreamableMaps a) -- | The Dispatch module : does all the IO, and offers an unified interface -- to both the interpreter and the compiler. -- -- Also communicates with GCC in order to compile the C code, and then -- transmits the results of the execution of that C code. This -- functionnality is mostly used to check automatically the equivalence -- between the interpreter and the compiler. The Dispatch module only -- parses the command-line arguments before calling that module. module Language.Copilot.Dispatch -- | This function is the core of Copilot : it glues together -- analyser, interpreter and compiler, and does all the IO. It can be -- called either from interface (which justs decodes the command-line -- argument) or directly from the interactive prompt in ghci. -- streams is a specification, inputExts allows the -- user to give at runtime values for the monitored variables. Useful for -- testing on randomly generated values and specifications, or for the -- interpreted version. be chooses between compilation or -- interpretation, and if compilation is chosen (AtomToC) holds a few -- additionnal informations. see description of BackEnd -- iterations just gives the number of periods the specification -- must be executed. If you would rather execute it by hand, then just -- choose AtomToC for backEnd and 0 for iterations verbose -- determines what is output. dispatch :: StreamableMaps Spec -> Sends -> Vars -> BackEnd -> Iterations -> Verbose -> IO () data BackEnd Opts :: AtomToC -> BackEnd Interpreter :: BackEnd data AtomToC AtomToC :: Name -> String -> Maybe Period -> Interpreted -> String -> String -> Maybe (String, String) -> [(Var, String)] -> [(String, Int)] -> AtomToC -- | Name of the C file to generate cName :: AtomToC -> Name -- | Options to pass to the compiler gccOpts :: AtomToC -> String -- | The optional period getPeriod :: AtomToC -> Maybe Period -- | Interpret the program or not interpreted :: AtomToC -> Interpreted -- | Where to put the executable outputDir :: AtomToC -> String -- | Which compiler to use compiler :: AtomToC -> String -- | Code to replace the default initialization and main prePostCode :: AtomToC -> Maybe (String, String) -- | A list of Copilot variable C function name pairs. The C funciton is -- called if the Copilot stream becomes True. The Stream must be of -- Booleans and the C function must be of type void foo(void). triggers :: AtomToC -> [(Var, String)] arrDecs :: AtomToC -> [(String, Int)] data Interpreted Interpreted :: Interpreted NotInterpreted :: Interpreted type Iterations = Int data Verbose OnlyErrors :: Verbose DefaultVerbose :: Verbose Verbose :: Verbose instance Eq Verbose -- | Used by the end-user to easily give its arguments to dispatch. module Language.Copilot.Interface data Options baseOpts :: Options test :: Int -> Options -> IO () interpret :: Streams -> Int -> Options -> IO () compile :: Streams -> Name -> Options -> IO () verify :: FilePath -> Int -> IO () -- | The main function interface :: Options -> IO () help :: IO () setS :: DistributedStreams -> Options -> Options -- | Sets the environment for simulation by giving a mapping of external -- variables to lists of values. E.g., -- --
--   setE (emptySM {w32Map = fromList [("ext", [0,1..])]}) ...
--   
-- -- sets the external variable names ext to take the natural -- numbers, up to the limit of Word32. setE :: Vars -> Options -> Options -- | Sets the options for the compiler, e.g., -- --
--   setC "-O2" ...
--   
-- -- Sets gcc options. setC :: String -> Options -> Options setO :: Name -> Options -> Options -- | Manually set the period for the program. Otherwise, the minimum -- required period is computed automatically. E.g., -- -- setP 100 ... sets the period to be 100. The period must be -- at least 1. setP :: Period -> Options -> Options setI :: Options -> Options -- | Sets the code to precede and follow the copilot specification If -- nothing, then code appropriate for communication with the interpreter -- is generated setPP :: (String, String) -> Options -> Options -- | Sets the number of iterations of the program to simulation: -- -- setN 50 simulations the program for 50 steps. setN :: Int -> Options -> Options -- | Set the verbosity level. setV :: Verbose -> Options -> Options setR :: Int -> Options -> Options -- | Sets the directory into which the output of compiled programs should -- be placed. If the directory does not exist, it will be created. setDir :: String -> Options -> Options -- | Sets the compiler to use, given as a path to the executable. The -- default is "gcc". setGCC :: String -> Options -> Options -- | Give C function triggers for Copilot Boolean streams. The tiggers fire -- if the stream becoms true. setTriggers :: [(Var, String)] -> Options -> Options setArrs :: [(String, Int)] -> Options -> Options -- | Basic error checking for other libraries. module Language.Copilot.Libs.ErrorChks nOneChk :: String -> Int -> Spec a -> Spec a nPosChk :: String -> Int -> Spec a -> Spec a int16Chk :: String -> Int -> Spec a -> Spec a -- | Queries into how long until properties hold or fail. We use Int16 to -- return the value, so your queries must not require looking more than -- 32,767 periods :) . Thus, in the following, the parameter n -- must be 0 <= n <= 32,767. -1 indicates the test failed. module Language.Copilot.Libs.Indexes -- | Returns the smallest m <= n such that drop m s is -- true, and -1 if no such m exists. soonest :: Int -> Spec Bool -> Spec Int16 -- | Returns the smallest m <= n such that drop m s is -- false, and -1 if no such m exists. soonestFail :: Int -> Spec Bool -> Spec Int16 -- | Returns the largest m <= n such that drop m s is -- true, and -1 if no such m exists. latest :: Int -> Spec Bool -> Spec Int16 -- | Returns the largest m <= n such that drop m s is -- false, and -1 if no such m exists. latestFail :: Int -> Spec Bool -> Spec Int16 -- | Bounded Linear Temporal Logic (LTL) operators. module Language.Copilot.Libs.LTL -- | Property s holds for the next n periods. If n == -- 0, then s holds in the current period. We require n -- >= 0. E.g., if p = always 2 s, then we have the -- following relationship between the streams generated: s => T T -- T T F F F F ... p => T T F F F F F F ... always :: Int -> Spec Bool -> Spec Bool -- | Property s holds at the next period. next :: Spec Bool -> Spec Bool -- | Property s holds at some period in the next n -- periods. If n == 0, then s holds in the current -- period. We require n >= 0. E.g., if p = eventually 2 -- s, then we have the following relationship between the streams -- generated: s => F F F F T F T F ... p => F F T T T T T T -- ... eventually :: Int -> Spec Bool -> Spec Bool -- | until n s0 s1 means that eventually n s1, and up -- until at least the period before s1 holds, s0 -- continuously holds. until :: Int -> Spec Bool -> Spec Bool -> Spec Bool -- | release n s0 s1 means that either always n s1, or -- s1 holds up to and including the period at which s0 -- becomes true. release :: Int -> Spec Bool -> Spec Bool -> Spec Bool -- | Basic bounded statistics. In the following, a bound n is -- given stating the number of periods over which to compute the -- statistic (n == 1 computes it only over the current period). module Language.Copilot.Libs.Statistics -- | Maximum value. max :: (Streamable a, NumE a) => Int -> Spec a -> Spec a -- | Minimum value. min :: (Streamable a, NumE a) => Int -> Spec a -> Spec a -- | Summation. sum :: (Streamable a, NumE a) => Int -> Spec a -> Spec a -- | Mean value. n must not overflow for word size a for -- streams over which computation is peformed. mean :: (Streamable a, Fractional a, NumE a) => Int -> Spec a -> Spec a module Language.Copilot.Examples.StatExamples t0 :: Streams tMean :: Streams module Language.Copilot module Language.Copilot.Examples.Examples fib :: Streams t1 :: Streams t2 :: Streams t3 :: Streams t4 :: Streams t5 :: Streams yy :: Streams zz :: Streams xx :: Streams engine :: Streams dist :: DistributedStreams gcd :: Word16 -> Word16 -> Streams gcd' :: Streams testCoercions :: Streams testCoercionsInt :: Streams testRules :: Streams i8 :: Streams trap :: Streams testArr :: Streams t99 :: Streams module Language.Copilot.Examples.LTLExamples module Language.Copilot.Examples.PTLTLExamples tstdatprv :: Streams tprv :: Streams tstdatAB :: Streams tAB :: Streams tstdatEP :: Streams tEP :: Streams tstdat1Sin :: Streams tstdat2Sin :: Streams tSin :: Streams tSinExt :: Streams