@@ -23,6 +23,7 @@ import Test.Tasty.TH (testGroupGenerator)
2323
2424-- clash-protocols (me!)
2525import Protocols
26+ import Protocols.Axi4.Common
2627import Protocols.Axi4.ReadAddress
2728import Protocols.Axi4.ReadData
2829import Protocols.Axi4.Stream
@@ -31,6 +32,7 @@ import Protocols.Axi4.WriteData
3132import Protocols.Axi4.WriteResponse
3233import Protocols.DfConv qualified as DfConv
3334import Protocols.Hedgehog
35+ import Protocols.Internal
3436
3537-- tests
3638import Tests.Protocols.Df qualified as DfTest
@@ -48,6 +50,71 @@ type ConfAR =
4850 'Axi4ReadAddressConfig 'True 'True 2 2 'True 'True 'True 'True 'True 'True
4951type ConfR = 'Axi4ReadDataConfig 'True 2
5052
53+ prop_axi4_convert_write_address_id :: Property
54+ prop_axi4_convert_write_address_id =
55+ DfTest. idWithModelDf
56+ defExpectOptions
57+ (DfTest. genData genInfo)
58+ id
59+ ( C. withClockResetEnable @ C. System C. clockGen C. resetGen C. enableGen $
60+ DfConv. dfConvTestBench
61+ Proxy
62+ Proxy
63+ (repeat True )
64+ (repeat Nothing )
65+ ckt
66+ )
67+ where
68+ ckt ::
69+ (C. HiddenClockResetEnable dom ) =>
70+ Circuit
71+ (Axi4WriteAddress dom ConfAW Int )
72+ (Axi4WriteAddress dom ConfAW Int )
73+ ckt = DfConv. convert Proxy Proxy
74+
75+ genInfo =
76+ (,,)
77+ <$> genWriteAddrInfo
78+ <*> genBurstLen
79+ <*> genBurst
80+ genWriteAddrInfo =
81+ Axi4WriteAddressInfo
82+ <$> Gen. enumBounded
83+ <*> Gen. enumBounded
84+ <*> (toKeepType <$> Gen. enumBounded)
85+ <*> ( toKeepType
86+ <$> ( pure Bs1
87+ C. <|> pure Bs2
88+ C. <|> pure Bs4
89+ C. <|> pure Bs8
90+ C. <|> pure Bs16
91+ C. <|> pure Bs32
92+ C. <|> pure Bs64
93+ C. <|> pure Bs128
94+ )
95+ )
96+ <*> (toKeepType <$> (pure NonExclusiveAccess C. <|> pure ExclusiveAccess ))
97+ <*> ( toKeepType
98+ <$> ( (,,,)
99+ <$> (pure NonBufferable C. <|> pure Bufferable )
100+ <*> (pure NonModifiable C. <|> pure Modifiable )
101+ <*> (pure OtherNoLookupCache C. <|> pure OtherLookupCache )
102+ <*> (pure NoLookupCache C. <|> pure LookupCache )
103+ )
104+ )
105+ <*> ( toKeepType
106+ <$> ( (,,)
107+ <$> (pure Privileged C. <|> pure NotPrivileged )
108+ <*> (pure Secure C. <|> pure NonSecure )
109+ <*> (pure Instruction C. <|> pure Data )
110+ )
111+ )
112+ <*> (toKeepType <$> Gen. enumBounded)
113+ <*> DfTest. genSmallInt
114+
115+ genBurstLen = pure (toKeepType 0 )
116+ genBurst = toKeepType <$> (pure BmFixed C. <|> pure BmIncr C. <|> pure BmWrap )
117+
51118-- also test out the DfConv instance for Axi4Stream
52119
53120prop_axi4_stream_fifo_id :: Property
0 commit comments