Skip to content

Commit 22e1b5c

Browse files
committed
Complete haddock coverage
1 parent 6c687b3 commit 22e1b5c

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

clash-protocols.cabal

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ library
148148
Protocols.Hedgehog.Internal
149149
Protocols.Internal
150150
Protocols.Plugin
151-
Protocols.TwoWayDf
152151

153152

154153
-- 'testProperty' is broken upstream, it reports wrong test names

src/Protocols/Axi4/Lite/Axi4Lite.hs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ type family WriteBusWidthType (bw :: BusWidth) where
2323
WriteBusWidthType 'Width32 = C.Vec 4 (Maybe (C.BitVector 8))
2424
WriteBusWidthType 'Width64 = C.Vec 8 (Maybe (C.BitVector 8))
2525

26+
-- | Type family mapping the two available bus widths to vectors of bytes.
2627
type family ReadBusWidthType (bw :: BusWidth) where
2728
ReadBusWidthType 'Width32 = C.Vec 4 (C.BitVector 8)
2829
ReadBusWidthType 'Width64 = C.Vec 8 (C.BitVector 8)
@@ -50,11 +51,13 @@ data M2S_WriteAddress
5051
deriving instance (C.KnownNat (Width aw))
5152
=> Show (M2S_WriteAddress aw)
5253

54+
-- | Ready signal for the write address channel.
5355
data S2M_WriteAddress
5456
= S2M_WriteAddress {
5557
_awready :: Bool
5658
} deriving (Show, Generic, NFDataX)
5759

60+
-- | Protocol type for the write address channel.
5861
data Axi4LiteWA
5962
(dom :: C.Domain)
6063
(aw :: AddrWidth)
@@ -68,6 +71,7 @@ instance Protocol (Axi4LiteWA dom aw) where
6871
--- Write data types ---
6972
------------------------
7073

74+
-- | Data type for the write data channel.
7175
data M2S_WriteData
7276
(bw :: BusWidth)
7377
= M2S_NoWriteData
@@ -83,11 +87,13 @@ deriving instance
8387

8488
deriving instance (NFDataX (WriteBusWidthType bw)) => NFDataX (M2S_WriteData bw)
8589

90+
-- | Ready signal for the write data channel.
8691
data S2M_WriteData
8792
= S2M_WriteData {
8893
_wready :: Bool
8994
} deriving (Show, Generic, NFDataX)
9095

96+
-- | Protocol type for the write data channel
9197
data Axi4LiteWD
9298
(dom :: C.Domain)
9399
(bw :: BusWidth)
@@ -101,17 +107,22 @@ instance Protocol (Axi4LiteWD dom bw) where
101107
--- Write response types ---
102108
----------------------------
103109

110+
-- | Data type for the write response channel. Notice that here the ready signal
111+
-- goes from master to slave instead of the other way around.
104112
data M2S_WriteResponse
105113
= M2S_WriteResponse {
106114
_bready :: Bool
107115
} deriving (Show, Generic, NFDataX)
108116

117+
-- | Data type for the write response channel from slave to master. On this channel
118+
-- the response as defined in A3.4.4 is sent.
109119
data S2M_WriteResponse
110120
= S2M_NoWriteResponse
111121
| S2M_WriteResponse {
112122
_bresp :: RespLite
113123
} deriving (Show, Generic, NFDataX)
114124

125+
-- | Protocol type for the write response channel.
115126
data Axi4LiteWR
116127
(dom :: C.Domain)
117128

@@ -124,6 +135,7 @@ instance Protocol (Axi4LiteWR dom) where
124135
--- Read address types ---
125136
--------------------------
126137

138+
-- | Data type for the read address channel.
127139
data M2S_ReadAddress
128140
(aw :: AddrWidth)
129141
= M2S_NoReadAddress
@@ -136,12 +148,13 @@ deriving instance
136148
(C.KnownNat (Width aw))
137149
=> Show (M2S_ReadAddress aw)
138150

139-
151+
-- | Ready signal for the read address channel.
140152
data S2M_ReadAddress
141153
= S2M_ReadAddress {
142154
_arready :: Bool
143155
} deriving (Show, Generic, NFDataX)
144156

157+
-- | Protocol type for the read address channel.
145158
data Axi4LiteRA
146159
(dom :: C.Domain)
147160
(aw :: AddrWidth)
@@ -156,15 +169,17 @@ instance Protocol (Axi4LiteRA dom aw) where
156169
-----------------------
157170

158171
-- | Acknowledges data from the slave component. This data type needs the 'bw' type
159-
-- to fullfil the injectivity requirement of 'Fwd' in 'Protocol'.
172+
-- to fullfil the injectivity requirement of 'Fwd' in 'Protocol', even though it only
173+
-- contains a ready signal of type 'Bool'.
160174
data M2S_ReadData
161-
(bw :: BusWidth) -- Necessary for the injectivity requirement of Fwd
175+
(bw :: BusWidth)
162176
= M2S_ReadData {
163177
_rready :: Bool
164178
} deriving (Generic, NFDataX)
165179

166180
deriving instance (Show (ReadBusWidthType bw)) => Show (M2S_ReadData bw)
167181

182+
-- | Data type for the data sent over the read data channel from the slave to the master.
168183
data S2M_ReadData
169184
(bw :: BusWidth)
170185
= S2M_NoReadData
@@ -176,6 +191,7 @@ data S2M_ReadData
176191
deriving instance (Show (ReadBusWidthType bw)) => Show (S2M_ReadData bw)
177192
deriving instance (NFDataX (ReadBusWidthType bw)) => NFDataX (S2M_ReadData bw)
178193

194+
-- | Protocol type for the read data channel.
179195
data Axi4LiteRD
180196
(dom :: C.Domain)
181197
(bw :: BusWidth)

0 commit comments

Comments
 (0)