Skip to content
Browse files

Documentation updates.

  • Loading branch information...
1 parent 8825a43 commit abcdc2fd09e84dd93608aad66d38ce00768b6616 @leepike committed Sep 30, 2011
Showing with 35 additions and 13 deletions.
  1. +17 −6 Examples/EngineExample.hs
  2. +4 −1 Examples/Examples.hs
  3. +3 −0 Examples/README
  4. +9 −6 README.md
  5. +2 −0 copilot.cabal
  6. 0 { → src}/Language/Copilot.hs
View
23 Examples/EngineExample.hs
@@ -8,25 +8,36 @@ module Main where
import Language.Copilot
import qualified Copilot.Compile.SBV as S
+import qualified Prelude as P
{-
"If the majority of the engine temperature probes exeeds 250 degrees, then the
cooler is engaged and remains engaged until the majority of the engine
- temperature drops to 250 or below. Otherwise, trigger an immediate shutdown
- of the engine." -}
+ temperature probes drop to 250 or below. Otherwise, trigger an immediate
+ shutdown of the engine." -}
engineMonitor :: Spec
engineMonitor = do
- trigger "shutoff" (not overHeat) [arg maj]
+ trigger "shutoff" (not ok) [arg maj]
where
vals = map externW8 ["tmp_probe_0", "tmp_probe_1", "tmp_probe_2"]
- exceed = map (< 250) vals
+ exceed = map (> 250) vals
maj = majority exceed
checkMaj = aMajority exceed maj
- overHeat = (extern "cooler" || (maj && checkMaj)) `since` not maj
+ ok = alwaysBeen ((maj && checkMaj) ==> extern "cooler")
main :: IO ()
main =
- reify engineMonitor >>= S.compile (S.Params { S.prefix = Just "engine" })
+ interpret
+ 10
+ [ input "cooler" cooler, input "tmp_probe_0" two51
+ , input "tmp_probe_1" two51, input "tmp_probe_2" zero]
+ engineMonitor
+ where
+ two51 = [251, 251] P.++ repeat (250 :: Word8)
+ zero = repeat (0 :: Word8)
+ cooler = [True, True] P.++ repeat False
+
+-- reify engineMonitor >>= S.compile (S.Params { S.prefix = Just "engine" })
View
5 Examples/Examples.hs
@@ -12,7 +12,7 @@ import qualified Prelude as P
import Copilot.Language
import Copilot.Language.Prelude hiding (even, odd)
import Copilot.Language.Reify (reify)
-
+import Copilot.Compile.C99
--------------------------------------------------------------------------------
--
@@ -111,5 +111,8 @@ main =
interpret 10 [input "e1" e1, input "e2" e2, input "e3" e3] spec
putStrLn ""
putStrLn ""
+ putStrLn "Atom:"
+ r <- reify spec
+ compile defaultParams r
--------------------------------------------------------------------------------
View
3 Examples/README
@@ -0,0 +1,3 @@
+This directory contains a number of examples. Examples.hs contains the simplest
+examples as well as demonstrating how to use the interpreter and multiple
+back-ends. Other files demonstrate the use of Copilot libraries.
View
15 README.md
@@ -3,7 +3,7 @@ Copilot: a stream DSL
Copilot is a stream (i.e., infinite lists) domain-specific language (DSL) in
Haskell that compiles into embedded C. Copilot is similar in spirit to
languages like Lustre. Copilot contains an interpreter, multiple back-end
-compilers, and other verification tools. See the Examples section below.
+compilers, and other verification tools.
Resources
=========
@@ -36,16 +36,18 @@ Optionally, you may which also to install
that translates to [SBV](http://hackage.haskell.org/package/sbv), using its
code generator to generate hard real-time C code as well. The ad
-* [copilot-discussion](http://hackage.haskell.org/package/copilot-discussion)
+* [copilot-discussion](https://github.com/niswegmann/copilot-discussion)
Contains a tutorial, todos, and other items regarding the Copilot system.
+**Sources** for each package are available on Github as well. Just go to
+[Github](github.com) and search for the package of interest. Feel free to fork!
+
Comments, bug reports, and patches are always welcome. Send them to leepike @
gmail.com
Examples
=========
-
-Please see the files under the [Examples]() directory for a number of examples
+Please see the files under the Examples directory for a number of examples
showing the syntax, use of libraries, and use of the interpreter and back-ends.
The examples is the best way to start.
@@ -72,8 +74,8 @@ equivalent C, to help detect bugs in C back-ends.
Copyright, License
==================
-The Copilot library is distributed with the BSD3 license. The license file contains
-the [BSD3](http://en.wikipedia.org/wiki/BSD_licenses) verbiage.
+Copilot is distributed with the BSD3 license. The license file contains the
+[BSD3](http://en.wikipedia.org/wiki/BSD_licenses) verbiage.
Thanks
======
@@ -83,3 +85,4 @@ Inc. and the National Institute of Aerospace.
The following people have contributed to Copilot: Lee Pike, Nis Wegmann,
Sebastian Niller, Robin Morisset, Alwyn Goodloe, and Levent Erkok.
+
View
2 copilot.cabal
@@ -21,6 +21,8 @@ source-repository head
library
+ hs-source-dirs: src
+
default-language: Haskell2010
ghc-options:
View
0 Language/Copilot.hs → src/Language/Copilot.hs
File renamed without changes.

0 comments on commit abcdc2f

Please sign in to comment.
Something went wrong with that request. Please try again.