aboutsummaryrefslogtreecommitdiff
path: root/fpga/src/Numini.bs
diff options
context:
space:
mode:
authorNathan Ringo <nathan@remexre.com>2024-10-08 14:27:19 -0500
committerNathan Ringo <nathan@remexre.com>2024-10-08 14:27:19 -0500
commit08d727e9886cde6a367906999e96a33f7ba37f33 (patch)
tree919da00f9d4bdc451be53f558c4b42bef7c487fd /fpga/src/Numini.bs
parented3e96b5eaae71d035e14569b107040c3538f849 (diff)
Reorganization and rewiring.
Diffstat (limited to 'fpga/src/Numini.bs')
-rw-r--r--fpga/src/Numini.bs77
1 files changed, 77 insertions, 0 deletions
diff --git a/fpga/src/Numini.bs b/fpga/src/Numini.bs
new file mode 100644
index 0000000..58c2c38
--- /dev/null
+++ b/fpga/src/Numini.bs
@@ -0,0 +1,77 @@
+-- | The main board, set up to be wired to either the Inkplate's top-level or
+-- the simulator's. This insulates us from Bluesim's lack of Inout support.
+package Numini where
+
+import Clock
+import HyperBus
+import Uart
+
+-- | The output pins.
+interface NuminiOut =
+ ch559_uart_tx :: Bit 1
+ inkplate_uart_tx :: Bit 1
+ usb_uart_tx :: Bit 1
+
+ led_r_n :: Bit 1
+ led_g_n :: Bit 1
+
+ rgb_r_n :: Bit 1
+ rgb_g_n :: Bit 1
+ rgb_b_n :: Bit 1
+
+ hyperbus_ck :: Bit 1
+ hyperbus_ck_n :: Bit 1
+ hyperbus_cs0_n :: Bit 1
+ hyperbus_cs1_n :: Bit 1
+ hyperbus_cs2_n :: Bit 1
+ hyperbus_cs3_n :: Bit 1
+ hyperbus_reset_n :: Bit 1
+ hyperbus_rwds_out :: Maybe (Bit 1)
+ hyperbus_dq_out :: Maybe (Bit 8)
+
+ i2c_scl :: Bit 1
+ i2c_sda_out :: Maybe (Bit 1)
+
+clockFreqHz :: Bit 24
+clockFreqHz = 12_000_000
+
+mkNumini :: Wire (Bit 1) -> Wire (Bit 1) -> Wire (Bit 1) -> Wire (Bit 1) ->
+ Wire (Bit 8) -> Wire (Bit 1) -> Module NuminiOut
+mkNumini ch559_uart_rx inkplate_uart_rx usb_uart_rx hyperbus_rwds_in
+ hyperbus_dq_in i2c_sda_in = module
+ clk9600 <- mkClock (clockFreqHz / 9600)
+ clk2M <- mkClock (clockFreqHz / 2_000_000)
+ clk3M <- mkClock (clockFreqHz / 3_000_000)
+
+ ch559_uart <- mkUart ch559_uart_rx clk9600
+ inkplate_uart <- mkUart inkplate_uart_rx clk2M
+ usb_uart <- mkUart usb_uart_rx clk9600
+
+ hyperbus <- mkHyperBus hyperbus_rwds_in hyperbus_dq_in clk3M
+
+ interface NuminiOut
+ ch559_uart_tx = ch559_uart.tx
+ inkplate_uart_tx = inkplate_uart.tx
+ usb_uart_tx = usb_uart.tx
+
+ led_r_n = 1
+ led_g_n = 1
+
+ rgb_r_n = 1
+ rgb_g_n = 1
+ rgb_b_n = 1
+
+ hyperbus_ck = hyperbus.ck
+ hyperbus_ck_n = hyperbus.ck_n
+ hyperbus_cs0_n = hyperbus.cs0_n
+ hyperbus_cs1_n = hyperbus.cs1_n
+ hyperbus_cs2_n = hyperbus.cs2_n
+ hyperbus_cs3_n = hyperbus.cs3_n
+ hyperbus_reset_n = hyperbus.reset_n
+ hyperbus_rwds_out = hyperbus.rwds_out
+ hyperbus_dq_out = hyperbus.dq_out
+
+ i2c_scl = 1
+ i2c_sda_out = Nothing
+
+-- vim: set ft=haskell :