From 253e73cd5b00fe71761cfebff167b171a6af4473 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Wed, 21 Aug 2024 11:05:43 -0400 Subject: [PATCH 1/3] Clarify ambiguous deriving strategies --- clash-protocols/src/Protocols/Avalon/Stream.hs | 4 +++- clash-protocols/src/Protocols/Axi4/ReadAddress.hs | 3 ++- clash-protocols/src/Protocols/Axi4/ReadData.hs | 3 ++- clash-protocols/src/Protocols/Axi4/Stream.hs | 3 ++- clash-protocols/src/Protocols/Axi4/WriteAddress.hs | 3 ++- clash-protocols/src/Protocols/Axi4/WriteData.hs | 3 ++- clash-protocols/src/Protocols/Axi4/WriteResponse.hs | 3 ++- clash-protocols/src/Protocols/Wishbone.hs | 3 ++- 8 files changed, 17 insertions(+), 8 deletions(-) diff --git a/clash-protocols/src/Protocols/Avalon/Stream.hs b/clash-protocols/src/Protocols/Avalon/Stream.hs index af5167d0..cc732787 100644 --- a/clash-protocols/src/Protocols/Avalon/Stream.hs +++ b/clash-protocols/src/Protocols/Avalon/Stream.hs @@ -4,6 +4,7 @@ {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE UndecidableInstances #-} +{-# LANGUAGE DerivingStrategies #-} -- Hashable (Unsigned n) {-# OPTIONS_GHC -fno-warn-orphans #-} @@ -140,7 +141,8 @@ Manager can only send 'AvalonStreamM2S' when '_ready' was true @readyLatency@ clock cycles ago. -} newtype AvalonStreamS2M (readyLatency :: Nat) = AvalonStreamS2M {_ready :: Bool} - deriving (Generic, C.NFDataX, C.ShowX, Eq, NFData, Show, Bundle) + deriving stock (Generic, Show, Eq) + deriving anyclass (C.NFDataX, C.ShowX, NFData, Bundle) -- | Type for Avalon Stream protocol. data AvalonStream (dom :: Domain) (conf :: AvalonStreamConfig) (dataType :: Type) diff --git a/clash-protocols/src/Protocols/Axi4/ReadAddress.hs b/clash-protocols/src/Protocols/Axi4/ReadAddress.hs index e165fb92..d23b06fc 100644 --- a/clash-protocols/src/Protocols/Axi4/ReadAddress.hs +++ b/clash-protocols/src/Protocols/Axi4/ReadAddress.hs @@ -188,7 +188,8 @@ data -- | See Table A2-5 "Read address channel signals" newtype S2M_ReadAddress = S2M_ReadAddress {_arready :: Bool} - deriving (Show, Generic, C.NFDataX) + deriving stock (Show, Generic) + deriving anyclass (C.NFDataX) {- | Shorthand for a "well-behaved" read address config, so that we don't need to write out a bunch of type constraints later. diff --git a/clash-protocols/src/Protocols/Axi4/ReadData.hs b/clash-protocols/src/Protocols/Axi4/ReadData.hs index 4d9d27d7..653a103f 100644 --- a/clash-protocols/src/Protocols/Axi4/ReadData.hs +++ b/clash-protocols/src/Protocols/Axi4/ReadData.hs @@ -111,7 +111,8 @@ data -- | See Table A2-6 "Read data channel signals" newtype M2S_ReadData = M2S_ReadData {_rready :: Bool} - deriving (Show, Generic, C.NFDataX) + deriving stock (Show, Generic) + deriving anyclass (C.NFDataX) {- | Shorthand for a "well-behaved" read data config, so that we don't need to write out a bunch of type constraints later. diff --git a/clash-protocols/src/Protocols/Axi4/Stream.hs b/clash-protocols/src/Protocols/Axi4/Stream.hs index 4c093d8d..767ef19b 100644 --- a/clash-protocols/src/Protocols/Axi4/Stream.hs +++ b/clash-protocols/src/Protocols/Axi4/Stream.hs @@ -102,7 +102,8 @@ Manager may not decide whether or not to send 'Nothing' based on the '_tready' signal. -} newtype Axi4StreamS2M = Axi4StreamS2M {_tready :: Bool} - deriving (Generic, C.NFDataX, C.ShowX, Eq, NFData, Show, Bundle) + deriving stock (Show, Eq, Generic) + deriving anyclass (C.NFDataX, C.ShowX, NFData, Bundle) -- | Type for AXI4 Stream protocol. data Axi4Stream (dom :: Domain) (conf :: Axi4StreamConfig) (userType :: Type) diff --git a/clash-protocols/src/Protocols/Axi4/WriteAddress.hs b/clash-protocols/src/Protocols/Axi4/WriteAddress.hs index 6ebb67d3..2c9a3b05 100644 --- a/clash-protocols/src/Protocols/Axi4/WriteAddress.hs +++ b/clash-protocols/src/Protocols/Axi4/WriteAddress.hs @@ -185,7 +185,8 @@ data -- | See Table A2-2 "Write address channel signals" newtype S2M_WriteAddress = S2M_WriteAddress {_awready :: Bool} - deriving (Show, Generic, C.NFDataX) + deriving stock (Show, Generic) + deriving anyclass (C.NFDataX) {- | Shorthand for a "well-behaved" write address config, so that we don't need to write out a bunch of type constraints later. diff --git a/clash-protocols/src/Protocols/Axi4/WriteData.hs b/clash-protocols/src/Protocols/Axi4/WriteData.hs index 3bfc207d..cf1b1740 100644 --- a/clash-protocols/src/Protocols/Axi4/WriteData.hs +++ b/clash-protocols/src/Protocols/Axi4/WriteData.hs @@ -105,7 +105,8 @@ data -- | See Table A2-3 "Write data channel signals" newtype S2M_WriteData = S2M_WriteData {_wready :: Bool} - deriving (Show, Generic, C.NFDataX) + deriving stock (Show, Generic) + deriving anyclass (C.NFDataX) {- | Shorthand for a "well-behaved" write data config, so that we don't need to write out a bunch of type constraints later. diff --git a/clash-protocols/src/Protocols/Axi4/WriteResponse.hs b/clash-protocols/src/Protocols/Axi4/WriteResponse.hs index 53b46c13..dc7df4b7 100644 --- a/clash-protocols/src/Protocols/Axi4/WriteResponse.hs +++ b/clash-protocols/src/Protocols/Axi4/WriteResponse.hs @@ -90,7 +90,8 @@ data -- | See Table A2-4 "Write response channel signals" newtype M2S_WriteResponse = M2S_WriteResponse {_bready :: Bool} - deriving (Show, Generic, C.NFDataX) + deriving stock (Show, Generic) + deriving anyclass (C.NFDataX) {- | Shorthand for a "well-behaved" write response config, so that we don't need to write out a bunch of type constraints later. diff --git a/clash-protocols/src/Protocols/Wishbone.hs b/clash-protocols/src/Protocols/Wishbone.hs index ac22ed71..1ad0593f 100644 --- a/clash-protocols/src/Protocols/Wishbone.hs +++ b/clash-protocols/src/Protocols/Wishbone.hs @@ -171,7 +171,8 @@ instance (C.ShowX dat) => Show (WishboneS2M dat) where increase throughput by reducing handshake-overhead -} newtype CycleTypeIdentifier = CycleTypeIdentifier (C.BitVector 3) - deriving (NFData, C.Generic, C.NFDataX, Show, C.ShowX, Eq, C.BitPack) + deriving stock (Eq, Show, C.Generic) + deriving anyclass (NFData, C.NFDataX, C.ShowX, C.BitPack) pattern Classic From 5acd9ee4bf2ac12bda016505d0af63e473afd93a Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Wed, 21 Aug 2024 17:57:51 -0400 Subject: [PATCH 2/3] clash-protocols: Drop ghc dependency Only clash-protocols-base needs to depend upon ghc. --- clash-protocols/clash-protocols.cabal | 1 - 1 file changed, 1 deletion(-) diff --git a/clash-protocols/clash-protocols.cabal b/clash-protocols/clash-protocols.cabal index 1017ec5b..b7749934 100644 --- a/clash-protocols/clash-protocols.cabal +++ b/clash-protocols/clash-protocols.cabal @@ -119,7 +119,6 @@ library , data-default , deepseq , extra - , ghc >= 8.7 && < 9.7 , hashable , hedgehog >= 1.0.2 , lifted-async From d6be966f8e4124b6338e99736069b04a700f6b2e Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Wed, 21 Aug 2024 17:58:10 -0400 Subject: [PATCH 3/3] Allow building with ghc-9.10 --- clash-protocols-base/clash-protocols-base.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clash-protocols-base/clash-protocols-base.cabal b/clash-protocols-base/clash-protocols-base.cabal index a35f14ee..e78bac3b 100644 --- a/clash-protocols-base/clash-protocols-base.cabal +++ b/clash-protocols-base/clash-protocols-base.cabal @@ -105,7 +105,7 @@ library , data-default , deepseq , extra - , ghc >= 8.7 && < 9.7 + , ghc >= 8.7 && < 9.11 , hashable , tagged , template-haskell