aboutsummaryrefslogtreecommitdiff
path: root/src/Top.bs
diff options
context:
space:
mode:
authorNathan Ringo <nathan@remexre.com>2024-05-06 13:54:59 -0500
committerNathan Ringo <nathan@remexre.com>2024-05-06 13:54:59 -0500
commit65e5d53c2436ff0e3349faf0f49ad6d41197078f (patch)
tree8c42f8f86c42076c43e3955b3e21547b4f81b4fe /src/Top.bs
parent11bce65ecc903e6f11bbbe6cbe05ffd2e259126e (diff)
...
Diffstat (limited to 'src/Top.bs')
-rw-r--r--src/Top.bs16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/Top.bs b/src/Top.bs
index 9fb3b21..7182a98 100644
--- a/src/Top.bs
+++ b/src/Top.bs
@@ -34,6 +34,7 @@ mkTop =
bitState :: Reg (Bit 1) <- mkReg 0
uart <- mkUart (clockFreqHz / 9600)
+ btn1State :: Reg (Bit 1) <- mkReg 0
{-
lastByte :: Reg (Bit 8) <- mkReg 0x21
@@ -46,9 +47,11 @@ mkTop =
lastByte := byte
-}
rules
- "echo": when True ==> do
- byte <- uart.recv.get
- uart.send.put byte
+ -- "echo": when True ==> do
+ -- byte <- uart.recv.get
+ -- uart.send.put byte
+ "say_one": when btn1State /= 0 ==> do
+ uart.send.put 0x31
interface Top
-- RS232
@@ -57,8 +60,8 @@ mkTop =
uart.rxPin bit
tx = uart.txPin
-- Onboard LEDs
- ledR_N = bitState
- ledG_N = uart.bit
+ ledR_N = 1
+ ledG_N = uart.debugBit
-- RGB LED driver
ledRed_N = 1
ledGrn_N = 1
@@ -69,7 +72,8 @@ mkTop =
led3 = 0
led4 = 0
led5 = 0
- btn1 _ = return ()
+ btn1 bit = do
+ btn1State := bit
btn2 _ = return ()
btn3 _ = return ()
{-# verilog mkTop #-}