aboutsummaryrefslogtreecommitdiff
path: root/src/TopSim.bs
blob: 0b77d3bb3132d3c77ed392e90e1dc6bd1f0e579f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package TopSim where

import GetPut
import Top
import Uart

mkTopSim :: Module Empty
mkTopSim =
  module
    timer :: Reg (Bit 8) <- mkReg 0

    uart <- mkUart 1

    rules
      when True ==> timer := timer + 1
      when True ==> uart.rxPin (1 - uart.txPin)
      when (timer == 0x00) ==> uart.send.put 0x6a
      when (timer == 0x40) ==> $finish

-- vim: set ft=haskell :