diff options
author | Nathan Ringo <nathan@remexre.com> | 2024-10-20 17:49:23 -0500 |
---|---|---|
committer | Nathan Ringo <nathan@remexre.com> | 2024-10-20 17:49:23 -0500 |
commit | 5c89c77fcf7493778732c12e2b141b5e9fa1f4a3 (patch) | |
tree | 943e0a339d28f8ef3a7aa7aaf8ad09f94ba63186 /fpga/src/Numini.bs | |
parent | ddf01d51c3429c25a57077d93d3309ce0e5d2262 (diff) |
Maybe repaired UART, I2C, and HyperBus (but now getting a weird error)...
Diffstat (limited to 'fpga/src/Numini.bs')
-rw-r--r-- | fpga/src/Numini.bs | 40 |
1 files changed, 12 insertions, 28 deletions
diff --git a/fpga/src/Numini.bs b/fpga/src/Numini.bs index 39990fc..cb26d5e 100644 --- a/fpga/src/Numini.bs +++ b/fpga/src/Numini.bs @@ -5,6 +5,7 @@ package Numini where import Clocks import Connectable import HyperBus +import I2C import Uart -- | The output pins. @@ -30,39 +31,22 @@ interface NuminiOut = hyperbus_rwds_out :: Maybe (Bit 1) hyperbus_dq_out :: Maybe (Bit 8) - i2c_scl :: Bit 1 - i2c_sda_out :: Maybe (Bit 1) + i2c_scl_out :: Bit 1 + i2c_sda_out :: Bit 1 clockFreqHz :: Integer 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 + Wire (Bit 8) -> Wire (Bit 1) -> 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 - {- - -- Make derived clocks and resets. - clk9600 <- mkClockDivider (clockFreqHz / 9600) - clk2M <- mkClockDivider (clockFreqHz / 2_000_000) - clk3M <- mkClockDivider (clockFreqHz / 3_000_000) - reset9600 <- mkReset (clockFreqHz / 9600) True clk9600.slowClock - reset2M <- mkReset (clockFreqHz / 2_000_000) True clk2M.slowClock - reset3M <- mkReset (clockFreqHz / 3_000_000) True clk3M.slowClock - + hyperbus_dq_in i2c_scl_in i2c_sda_in = module -- Make the peripherals. - ch559_uart <- changeSpecialWires (Just clk9600.slowClock) - (Just reset9600.new_rst) Nothing (mkUart ch559_uart_rx) - inkplate_uart <- changeSpecialWires (Just clk2M.slowClock) - (Just reset2M.new_rst) Nothing (mkUart inkplate_uart_rx) - usb_uart <- changeSpecialWires (Just clk9600.slowClock) - (Just reset9600.new_rst) Nothing (mkUart usb_uart_rx) - hyperbus <- changeSpecialWires (Just clk3M.slowClock) - (Just reset3M.new_rst) Nothing (mkHyperBus hyperbus_rwds_in hyperbus_dq_in) - -} - ch559_uart <- (mkUart ch559_uart_rx) - inkplate_uart <- (mkUart inkplate_uart_rx) - usb_uart <- (mkUart usb_uart_rx) - hyperbus <- (mkHyperBus hyperbus_rwds_in hyperbus_dq_in) + ch559_uart <- mkDividedUart (clockFreqHz / 9_600) ch559_uart_rx + inkplate_uart <- mkDividedUart (clockFreqHz / 2_000_000) inkplate_uart_rx + usb_uart <- mkDividedUart (clockFreqHz / 9_600) usb_uart_rx + hyperbus <- mkDividedHyperBus (clockFreqHz / 3_000_000) hyperbus_rwds_in hyperbus_dq_in + i2c <- mkDividedI2C (clockFreqHz / 200_000) i2c_scl_in i2c_sda_in mkConnection usb_uart.send usb_uart.recv @@ -88,7 +72,7 @@ mkNumini ch559_uart_rx inkplate_uart_rx usb_uart_rx hyperbus_rwds_in hyperbus_rwds_out = hyperbus.rwds_out hyperbus_dq_out = hyperbus.dq_out - i2c_scl = 1 - i2c_sda_out = Nothing + i2c_scl_out = i2c.txSCL + i2c_sda_out = i2c.txSDA -- vim: set ft=haskell : |