Skip to content

Commit 06c581b

Browse files
authored
GHC 9.0 support (#48)
1 parent 4c9520d commit 06c581b

File tree

11 files changed

+31
-29
lines changed

11 files changed

+31
-29
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,10 @@ jobs:
5555
clash:
5656
- "1.6.1"
5757
cabal:
58-
- "3.2"
58+
- "3.6"
5959
ghc:
6060
- "8.10.7"
61+
- "9.0.2"
6162

6263
env:
6364
clash_version: ${{ matrix.clash }}

cabal.project

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
packages:
22
clash-protocols.cabal
33

4+
tests: True
5+
46
package clash-prelude
57
-- 'large-tuples' generates tuple instances for various classes up to the
68
-- GHC imposed maximum of 62 elements. This severely slows down compiling
@@ -9,12 +11,6 @@ package clash-prelude
911
flags: -large-tuples
1012

1113
source-repository-package
12-
type: git
13-
location: https://github.com/cchalmers/circuit-notation.git
14-
tag: 2574640364eef12222517af059b9e4a7e6b503a7
15-
16-
source-repository-package
17-
type: git
18-
location: https://github.com/martijnbastiaan/haskell-hedgehog.git
19-
tag: f7d25b0a1927b7c06d69535d5dcfcade560ec624
20-
subdir: hedgehog
14+
type: git
15+
location: https://github.com/cchalmers/circuit-notation.git
16+
tag: 618e37578e699df235f2e7150108b6401731919b

clash-protocols.cabal

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ library
127127
, data-default
128128
, deepseq
129129
, extra
130-
, ghc >= 8.6
130+
, ghc >= 8.7
131131
, hashable
132132
, hedgehog >= 1.0.2
133133
, pretty-show
@@ -164,6 +164,7 @@ library
164164
Protocols.Hedgehog
165165
Protocols.Hedgehog.Internal
166166
Protocols.Internal
167+
167168
Protocols.Plugin
168169

169170
-- 'testProperty' is broken upstream, it reports wrong test names
@@ -218,4 +219,4 @@ test-suite doctests
218219
base,
219220
clash-protocols,
220221
process,
221-
doctest >= 0.17 && < 0.18
222+
doctest

src/Protocols/Avalon/MemMap.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,8 +1225,8 @@ instance
12251225

12261226
simToSigFwd _ = fromList_lazy
12271227
simToSigBwd _ = fromList_lazy
1228-
sigToSimFwd _ = sample_lazy
1229-
sigToSimBwd _ = sample_lazy
1228+
sigToSimFwd _ s = sample_lazy s
1229+
sigToSimBwd _ s = sample_lazy s
12301230

12311231
stallC conf (head -> (stallAck, stalls))
12321232
= withClockResetEnable clockGen resetGen enableGen
@@ -1246,8 +1246,8 @@ instance
12461246

12471247
simToSigFwd _ = fromList_lazy
12481248
simToSigBwd _ = fromList_lazy
1249-
sigToSimFwd _ = sample_lazy
1250-
sigToSimBwd _ = sample_lazy
1249+
sigToSimFwd _ s = sample_lazy s
1250+
sigToSimBwd _ s = sample_lazy s
12511251

12521252
stallC conf (head -> (stallAck, stalls))
12531253
= withClockResetEnable clockGen resetGen enableGen

src/Protocols/Avalon/Stream.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ instance
189189

190190
simToSigFwd _ = fromList_lazy
191191
simToSigBwd _ = fromList_lazy
192-
sigToSimFwd _ = sample_lazy
193-
sigToSimBwd _ = sample_lazy
192+
sigToSimFwd _ s = sample_lazy s
193+
sigToSimBwd _ s = sample_lazy s
194194

195195
stallC conf (head -> (stallAck, stalls))
196196
= withClockResetEnable clockGen resetGen enableGen

src/Protocols/Axi4/Stream.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ instance (KnownAxi4StreamConfig conf, NFDataX userType, KnownDomain dom) =>
136136

137137
simToSigFwd _ = fromList_lazy
138138
simToSigBwd _ = fromList_lazy
139-
sigToSimFwd _ = sample_lazy
140-
sigToSimBwd _ = sample_lazy
139+
sigToSimFwd _ s = sample_lazy s
140+
sigToSimBwd _ s = sample_lazy s
141141

142142
stallC conf (head -> (stallAck, stalls))
143143
= withClockResetEnable clockGen resetGen enableGen

src/Protocols/Df.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ instance (C.KnownDomain dom, C.NFDataX a, C.ShowX a, Show a) => Simulate (Df dom
153153

154154
simToSigFwd _ = C.fromList_lazy
155155
simToSigBwd _ = C.fromList_lazy
156-
sigToSimFwd _ = C.sample_lazy
157-
sigToSimBwd _ = C.sample_lazy
156+
sigToSimFwd _ s = C.sample_lazy s
157+
sigToSimBwd _ s = C.sample_lazy s
158158

159159
stallC conf (C.head -> (stallAck, stalls)) = stall conf stallAck stalls
160160

src/Protocols/Internal.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Internal module to prevent hs-boot files (breaks Haddock)
66
{-# LANGUAGE NamedFieldPuns #-}
77
{-# LANGUAGE TypeFamilyDependencies #-}
88
{-# LANGUAGE UndecidableInstances #-}
9+
{-# LANGUAGE CPP #-}
910
{-# OPTIONS_GHC -fno-warn-orphans #-} -- NFDataX and ShowX for Identity and Proxy
1011

1112
module Protocols.Internal where
@@ -726,9 +727,11 @@ type family KeepType (keep :: Bool) (optionalType :: Type) = t | t -> keep optio
726727
KeepType 'False optionalType = Proxy optionalType
727728

728729
-- TODO this should go into Clash.Prelude (?)
730+
#if __GLASGOW_HASKELL__ <= 900
729731
deriving instance (C.ShowX t) => (C.ShowX (Identity t))
730-
deriving instance (C.ShowX t) => (C.ShowX (Proxy t))
731732
deriving instance (C.NFDataX t) => (C.NFDataX (Identity t))
733+
#endif
734+
deriving instance (C.ShowX t) => (C.ShowX (Proxy t))
732735
deriving instance (C.NFDataX t) => (C.NFDataX (Proxy t))
733736

734737
-- | We want to define operations on 'KeepType' that work for both possibilities

src/Protocols/Plugin.hs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ A GHC source plugin providing a DSL for writing Circuit components. Credits to
33
@circuit-notation@ at <https://github.com/cchalmers/circuit-notation>.
44
-}
55
{-# LANGUAGE OverloadedStrings #-}
6+
{-# LANGUAGE CPP #-}
67

78
module Protocols.Plugin where
89

@@ -16,7 +17,11 @@ import Protocols
1617
import qualified CircuitNotation as CN
1718

1819
-- ghc
20+
#if __GLASGOW_HASKELL__ >= 900
21+
import qualified GHC.Plugins as GHC
22+
#else
1923
import qualified GhcPlugins as GHC
24+
#endif
2025

2126
-- | Type inference helper used by circuit-notation plugin
2227
type CircuitT a b = (Fwd a, Bwd b) -> (Bwd a, Fwd b)

src/Protocols/Wishbone/Standard/Hedgehog.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ driveStandard ExpectOptions {..} reqs =
293293
. C.fromList_lazy
294294
. (emptyWishboneM2S :)
295295
. go eoResetCycles reqs
296-
. C.sample_lazy
296+
. (\s -> C.sample_lazy s)
297297
. snd
298298
where
299299
transferToSignals ::

0 commit comments

Comments
 (0)