blob: c9085022b7fe7fecd76c8121b2feffedd17f44ee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
-- | A simple clock package.
package Clock where
interface Clock =
clk :: Bool
-- TODO: Make a multiclock that uses one count for all the sub-clocks in the
-- design.
mkClock :: Bit n -> Module Clock
mkClock divisor =
module
count :: Reg (Bit n) <- mkReg 0
rules
when True ==> count := if count == divisor - 1 then 0 else count + 1
interface Clock
clk = count == 0
-- vim: set ft=haskell :
|