diff options
author | Nathan Ringo <nathan@remexre.com> | 2024-09-23 21:46:34 -0500 |
---|---|---|
committer | Nathan Ringo <nathan@remexre.com> | 2024-09-23 21:46:34 -0500 |
commit | fc1959bd9887ecc4d4ceb62a53e87abc6f49ef00 (patch) | |
tree | 801fad484692ca226eb2dfdf792338cabe218c72 /fpga/src/TopSim.bs | |
parent | 777da6874bdbda1c83108024eb37dc901e04838e (diff) |
Adds README, moves fpga stuff to a subdirectory.
Diffstat (limited to 'fpga/src/TopSim.bs')
-rw-r--r-- | fpga/src/TopSim.bs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/fpga/src/TopSim.bs b/fpga/src/TopSim.bs new file mode 100644 index 0000000..d0d17cb --- /dev/null +++ b/fpga/src/TopSim.bs @@ -0,0 +1,32 @@ +package TopSim where + +import App +import GetPut +import Uart + +mkTopSim :: Module Empty +mkTopSim = + module + timer :: Reg (Bit 8) <- mkReg 0 + + uart <- mkUart 1 + app <- mkApp uart.recv uart.send + + fakeUart <- mkUart 1 + + rules + when True ==> timer := timer + 1 + when True ==> uart.rxPin fakeUart.txPin + when (timer == 0x00) ==> fakeUart.send.put 0x30 + when (timer == 0x01) ==> fakeUart.send.put 0x30 + when (timer == 0x02) ==> fakeUart.send.put 0x77 + when (timer == 0x03) ==> fakeUart.send.put 0x31 + when (timer == 0x04) ==> fakeUart.send.put 0x32 + when (timer == 0x05) ==> fakeUart.send.put 0x33 + when (timer == 0x06) ==> fakeUart.send.put 0x34 + when (timer == 0x10) ==> fakeUart.send.put 0x30 + when (timer == 0x11) ==> fakeUart.send.put 0x30 + when (timer == 0x12) ==> fakeUart.send.put 0x72 + when (timer == 0xff) ==> $finish + +-- vim: set ft=haskell : |