@@ -18,7 +18,7 @@ module Protocols.Axi4.ReadAddress
1818
1919 -- * configuration
2020 , Axi4ReadAddressConfig (.. )
21- , GoodAxi4ReadAddressConfig
21+ , KnownAxi4ReadAddressConfig
2222 , ARKeepBurst
2323 , ARKeepSize
2424 , ARIdWidth
@@ -37,6 +37,7 @@ module Protocols.Axi4.ReadAddress
3737 ) where
3838
3939-- base
40+ import Control.DeepSeq (NFData )
4041import Data.Coerce
4142import Data.Kind (Type )
4243import GHC.Generics (Generic )
@@ -187,7 +188,7 @@ newtype S2M_ReadAddress = S2M_ReadAddress
187188-- | Shorthand for a "well-behaved" read address config,
188189-- so that we don't need to write out a bunch of type constraints later.
189190-- Holds for every configuration; don't worry about implementing this class.
190- class
191+ type KnownAxi4ReadAddressConfig conf =
191192 ( KeepTypeClass (ARKeepBurst conf )
192193 , KeepTypeClass (ARKeepSize conf )
193194 , KeepTypeClass (ARKeepRegion conf )
@@ -200,37 +201,14 @@ class
200201 , C. KnownNat (ARIdWidth conf )
201202 , C. KnownNat (ARAddrWidth conf )
202203
203- , Show (RegionType (ARKeepRegion conf ))
204- , Show (BurstLengthType (ARKeepBurstLength conf ))
205- , Show (SizeType (ARKeepSize conf ))
206- , Show (BurstType (ARKeepBurst conf ))
207- , Show (LockType (ARKeepLock conf ))
208- , Show (CacheType (ARKeepCache conf ))
209- , Show (PermissionsType (ARKeepPermissions conf ))
210- , Show (QosType (ARKeepQos conf ))
211-
212- , C. NFDataX (RegionType (ARKeepRegion conf ))
213- , C. NFDataX (BurstLengthType (ARKeepBurstLength conf ))
214- , C. NFDataX (SizeType (ARKeepSize conf ))
215- , C. NFDataX (BurstType (ARKeepBurst conf ))
216- , C. NFDataX (LockType (ARKeepLock conf ))
217- , C. NFDataX (CacheType (ARKeepCache conf ))
218- , C. NFDataX (PermissionsType (ARKeepPermissions conf ))
219- , C. NFDataX (QosType (ARKeepQos conf ))
220- ) => GoodAxi4ReadAddressConfig conf
221-
222- instance
223- ( KeepTypeClass (ARKeepBurst conf )
224- , KeepTypeClass (ARKeepSize conf )
225- , KeepTypeClass (ARKeepRegion conf )
226- , KeepTypeClass (ARKeepBurstLength conf )
227- , KeepTypeClass (ARKeepLock conf )
228- , KeepTypeClass (ARKeepCache conf )
229- , KeepTypeClass (ARKeepPermissions conf )
230- , KeepTypeClass (ARKeepQos conf )
231-
232- , C. KnownNat (ARIdWidth conf )
233- , C. KnownNat (ARAddrWidth conf )
204+ , C. ShowX (RegionType (ARKeepRegion conf ))
205+ , C. ShowX (BurstLengthType (ARKeepBurstLength conf ))
206+ , C. ShowX (SizeType (ARKeepSize conf ))
207+ , C. ShowX (BurstType (ARKeepBurst conf ))
208+ , C. ShowX (LockType (ARKeepLock conf ))
209+ , C. ShowX (CacheType (ARKeepCache conf ))
210+ , C. ShowX (PermissionsType (ARKeepPermissions conf ))
211+ , C. ShowX (QosType (ARKeepQos conf ))
234212
235213 , Show (RegionType (ARKeepRegion conf ))
236214 , Show (BurstLengthType (ARKeepBurstLength conf ))
@@ -249,16 +227,34 @@ instance
249227 , C. NFDataX (CacheType (ARKeepCache conf ))
250228 , C. NFDataX (PermissionsType (ARKeepPermissions conf ))
251229 , C. NFDataX (QosType (ARKeepQos conf ))
252- ) => GoodAxi4ReadAddressConfig conf
230+
231+ , NFData (RegionType (ARKeepRegion conf ))
232+ , NFData (BurstLengthType (ARKeepBurstLength conf ))
233+ , NFData (SizeType (ARKeepSize conf ))
234+ , NFData (BurstType (ARKeepBurst conf ))
235+ , NFData (LockType (ARKeepLock conf ))
236+ , NFData (CacheType (ARKeepCache conf ))
237+ , NFData (PermissionsType (ARKeepPermissions conf ))
238+ , NFData (QosType (ARKeepQos conf ))
239+
240+ , Eq (RegionType (ARKeepRegion conf ))
241+ , Eq (BurstLengthType (ARKeepBurstLength conf ))
242+ , Eq (SizeType (ARKeepSize conf ))
243+ , Eq (BurstType (ARKeepBurst conf ))
244+ , Eq (LockType (ARKeepLock conf ))
245+ , Eq (CacheType (ARKeepCache conf ))
246+ , Eq (PermissionsType (ARKeepPermissions conf ))
247+ , Eq (QosType (ARKeepQos conf ))
248+ )
253249
254250deriving instance
255- ( GoodAxi4ReadAddressConfig conf
251+ ( KnownAxi4ReadAddressConfig conf
256252 , Show userType
257253 ) =>
258254 Show (M2S_ReadAddress conf userType )
259255
260256deriving instance
261- ( GoodAxi4ReadAddressConfig conf
257+ ( KnownAxi4ReadAddressConfig conf
262258 , C. NFDataX userType
263259 ) =>
264260 C. NFDataX (M2S_ReadAddress conf userType )
@@ -307,15 +303,30 @@ data Axi4ReadAddressInfo (conf :: Axi4ReadAddressConfig) (userType :: Type)
307303 deriving (Generic )
308304
309305deriving instance
310- ( GoodAxi4ReadAddressConfig conf
306+ ( KnownAxi4ReadAddressConfig conf
311307 , Show userType ) =>
312308 Show (Axi4ReadAddressInfo conf userType )
313309
314310deriving instance
315- ( GoodAxi4ReadAddressConfig conf
311+ ( KnownAxi4ReadAddressConfig conf
312+ , C. ShowX userType ) =>
313+ C. ShowX (Axi4ReadAddressInfo conf userType )
314+
315+ deriving instance
316+ ( KnownAxi4ReadAddressConfig conf
316317 , C. NFDataX userType ) =>
317318 C. NFDataX (Axi4ReadAddressInfo conf userType )
318319
320+ deriving instance
321+ ( KnownAxi4ReadAddressConfig conf
322+ , NFData userType ) =>
323+ NFData (Axi4ReadAddressInfo conf userType )
324+
325+ deriving instance
326+ ( KnownAxi4ReadAddressConfig conf
327+ , Eq userType ) =>
328+ Eq (Axi4ReadAddressInfo conf userType )
329+
319330-- | Convert 'M2S_ReadAddress' to 'Axi4ReadAddressInfo', dropping some info
320331axi4ReadAddrMsgToReadAddrInfo
321332 :: M2S_ReadAddress conf userType
0 commit comments