aboutsummaryrefslogtreecommitdiff
path: root/fpga/src/HyperBus.bs
blob: 2b75b6e0239a548cd09998d3ad5c7d0bee0195a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
-- | A controller for a HyperBus interface, allowing for I/O to four chips.
package HyperBus where

-- | The HyperBus output pins.
interface HyperBusOut =
  ck       :: Bit 1
  ck_n     :: Bit 1
  cs0_n    :: Bit 1
  cs1_n    :: Bit 1
  cs2_n    :: Bit 1
  cs3_n    :: Bit 1
  reset_n  :: Bit 1
  rwds_out :: Maybe (Bit 1)
  dq_out   :: Maybe (Bit 8)

mkHyperBus :: Wire (Bit 1) -> Wire (Bit 8) -> Module HyperBusOut
mkHyperBus rwds_in dq_in = module
  clockPin :: Reg (Bit 1) <- mkReg 0
  rules
    "update_clock_pin": when True ==> do
      clockPin := invert clockPin

  interface HyperBusOut
    ck = clockPin
    ck_n = invert clockPin
    cs0_n = 1
    cs1_n = 1
    cs2_n = 1
    cs3_n = 1
    reset_n = 1
    rwds_out = Nothing
    dq_out = Nothing

-- vim: set ft=haskell :