Skip to content

Commit 6a388e8

Browse files
committed
Add Simulate instance for AXI4Lite
1 parent a308505 commit 6a388e8

File tree

3 files changed

+0
-69
lines changed

3 files changed

+0
-69
lines changed

src/Protocols/Axi4/Lite/Axi4Lite.hs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
{-# LANGUAGE FlexibleContexts #-}
22
{-# LANGUAGE FlexibleInstances #-}
33
{-# LANGUAGE UndecidableInstances #-}
4-
<<<<<<< HEAD
54
{-# LANGUAGE RecordWildCards #-}
6-
=======
7-
>>>>>>> cc790e6... Add AXI4 Lite types
85
{-|
96
Defines datatypes for all five channels of the AXI4 Lite protocol. For more
107
information on AXI4 Lite, see chapter B of the AMBA AXI specification.
@@ -19,11 +16,7 @@ import Clash.Prelude as C
1916
import Control.DeepSeq
2017

2118
-- | AXI4 Lite busses are always either 32 bit or 64 bit.
22-
<<<<<<< HEAD
2319
data BusWidth = Width32 | Width64 deriving (Show, Eq, Generic, NFDataX)
24-
=======
25-
data BusWidth = Width32 | Width64 deriving (Show, Eq)
26-
>>>>>>> cc790e6... Add AXI4 Lite types
2720

2821
type instance Width 'Width32 = 32
2922
type instance Width 'Width64 = 64
@@ -40,10 +33,6 @@ type family ReadBusWidthType (bw :: BusWidth) where
4033
ReadBusWidthType 'Width32 = C.Vec 4 (C.BitVector 8)
4134
ReadBusWidthType 'Width64 = C.Vec 8 (C.BitVector 8)
4235

43-
<<<<<<< HEAD
44-
=======
45-
46-
>>>>>>> cc790e6... Add AXI4 Lite types
4736
---------------------------
4837
--- Write address types ---
4938
---------------------------

src/Protocols/Df.hs

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,12 @@ import qualified Prelude as P
7575
import Clash.Prelude (type (<=))
7676
import Clash.Signal.Internal (Signal)
7777
import qualified Clash.Prelude as C
78-
import qualified Clash.Explicit.Prelude as CE
7978

8079
-- me
8180
import Protocols.Internal
8281
import Protocols.DfLike (DfLike)
8382
import qualified Protocols.DfLike as DfLike
8483

85-
<<<<<<< HEAD
86-
=======
87-
import Debug.Trace
88-
>>>>>>> cc790e6... Add AXI4 Lite types
8984

9085
-- $setup
9186
-- >>> import Protocols
@@ -165,52 +160,6 @@ instance (C.KnownDomain dom, C.NFDataX a, C.ShowX a, Show a) => Drivable (Df dom
165160
sampleC = sample
166161

167162

168-
simulateRight SimulationConfig{..} acks circ =
169-
P.take timeoutAfter $
170-
CE.sample_lazy $
171-
P.snd $
172-
toSignals circ ((), resetAndAcks)
173-
where
174-
resetAndAcks = C.fromList $ (P.map Ack (replicate resetCycles False) <> acks)
175-
176-
simulateLeft SimulationConfig{..} fwds circ = CE.sample_lazy ackSig
177-
where
178-
(ackSig, ()) = toSignals circ (dataSig, ())
179-
dataSig = C.fromList_lazy (ackedData resetCycles fwds (C.sample ackSig))
180-
181-
ackedData resetN _ (_:acks) | resetN > 0 =
182-
NoData : ackedData (resetN - 1) fwds acks
183-
ackedData _ _ [] = C.errorX "Empty acks list."
184-
ackedData _ [] (_:acks) = NoData : ackedData 0 [] acks
185-
ackedData _ (dat:datas) (ack:acks) = case ack of
186-
Ack True -> dat : ackedData 0 (datas) acks
187-
Ack False -> dat : ackedData 0 (dat:datas) acks
188-
189-
190-
191-
simulateManager SimulationConfig{..} acks circ =
192-
P.take timeoutAfter $
193-
CE.sample_lazy $
194-
P.snd $
195-
toSignals circ ((), resetAndAcks)
196-
where
197-
resetAndAcks = C.fromList $ (P.map Ack (replicate resetCycles False) <> acks)
198-
199-
-- TODO: apply simulation config
200-
simulateSubordinate SimulationConfig{..} fwds circ = CE.sample_lazy ackSig
201-
where
202-
(ackSig, ()) = toSignals circ (dataSig, ())
203-
dataSig = C.fromList_lazy (ackedData resetCycles fwds (C.sample ackSig))
204-
205-
ackedData resetN _ (_:acks) | resetN > 0 =
206-
NoData : ackedData (resetN - 1) fwds acks
207-
ackedData _ [] (_:acks) = NoData : ackedData 0 [] acks
208-
ackedData _ (dat:datas) (ack:acks) = case ack of
209-
Ack True -> dat : ackedData 0 (datas) acks
210-
Ack False -> dat : ackedData 0 (dat:datas) acks
211-
212-
213-
214163
instance DfLike dom (Df dom) a where
215164
type Data (Df dom) a = Data a
216165
type Payload a = a

src/Protocols/Internal.hs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -493,13 +493,6 @@ instance Drivable () where
493493
sampleC _ _ = ()
494494

495495

496-
simulateRight _ _ _ = ()
497-
simulateLeft _ _ _ = ()
498-
499-
simulateManager _ _ _ = ()
500-
simulateSubordinate _ _ _ = ()
501-
502-
503496
instance (Simulate a, Simulate b) => Simulate (a, b) where
504497
type SimulateFwdType (a, b) = (SimulateFwdType a, SimulateFwdType b)
505498
type SimulateBwdType (a, b) = (SimulateBwdType a, SimulateBwdType b)

0 commit comments

Comments
 (0)