copilot-libraries-3.9: Libraries for the Copilot language.
Copyright(c) 2011 National Institute of Aerospace / Galois Inc.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Copilot.Library.Clocks

Description

This library generates new clocks based on a base period and phase.

Example Usage

Also see examples/Clock.hs in the Copilot repository.

    clk ( period 3 ) ( phase 1 )

is equivalent to a stream of values like:

    cycle [False, True, False]

that generates a stream of values

    False True False False True False False True False ...
    0     1    2     3     4    5     6     7    8

That is true every 3 ticks (the period) starting on the 1st tick (the phase).

Synopsis

Documentation

clk Source #

Arguments

:: Integral a 
=> Period a

Period n of clock

-> Phase a

Phase m of clock

-> Stream Bool

Clock signal - True on clock ticks, False otherwise

Generate a clock that counts every n ticks, starting at tick m, by using an array of size n.

clk1 Source #

Arguments

:: (Integral a, Typed a) 
=> Period a

Period n of clock

-> Phase a

Phase m of clock

-> Stream Bool

Clock signal - True on clock ticks, False otherwise

This follows the same convention as clk, but uses a counter variable of integral type a rather than an array.

period :: Integral a => a -> Period a Source #

Constructor for a Period. Note that period must be greater than 0.

phase :: Integral a => a -> Phase a Source #

Constructor for a Phase. Note that phase must be greater than or equal to 0, and must be less than the period.