diff --git a/src/Protocols/Axi4/Common.hs b/src/Protocols/Axi4/Common.hs index 183224c4..7f5d5427 100644 --- a/src/Protocols/Axi4/Common.hs +++ b/src/Protocols/Axi4/Common.hs @@ -72,10 +72,10 @@ data SKeepStrobe (strobeType :: KeepStrobe) where SNoStrobe :: SKeepStrobe 'NoStrobe -- | Extracts Nat from 'IdWidth', 'AddrWidth', and 'LengthWidth' -type family Width (a :: k) :: Nat where - Width ('IdWidth n) = n - Width ('AddrWidth n) = n - Width ('LengthWidth n) = n +type family Width (a :: k) :: Nat --where +type instance Width ('IdWidth n) = n +type instance Width ('AddrWidth n) = n +type instance Width ('LengthWidth n) = n -- | Enables or disables 'BurstMode' type family BurstType (keepBurst :: KeepBurst) where diff --git a/src/Protocols/Axi4/Lite/Axi4Lite.hs b/src/Protocols/Axi4/Lite/Axi4Lite.hs index b1c4e65e..aa5d07c4 100644 --- a/src/Protocols/Axi4/Lite/Axi4Lite.hs +++ b/src/Protocols/Axi4/Lite/Axi4Lite.hs @@ -17,6 +17,9 @@ import Control.DeepSeq -- | AXI4 Lite busses are always either 32 bit or 64 bit. data BusWidth = Width32 | Width64 deriving (Show, Eq) +type instance Width 'Width32 = 32 +type instance Width 'Width64 = 64 + -- | AXI4 Lite defines a strobe signal to signify which bytes of the input -- signal should be committed to memory. The strobe signal is encoded in -- the 'Maybe' data type. Strobing is mandatory in AXI4 Lite. @@ -178,6 +181,13 @@ data M2S_Axi4Lite m2s_rd :: M2S_ReadData bw } +deriving instance + ( Show (ReadBusWidthType bw) + , Show (WriteBusWidthType bw) + , KnownNat (Width aw) + , KnownNat (Width bw)) + => Show (M2S_Axi4Lite aw bw) + -- | Product type of the types of the five different channels in the direction of slave to master. data S2M_Axi4Lite (aw :: AddrWidth) @@ -190,6 +200,13 @@ data S2M_Axi4Lite s2m_rd :: S2M_ReadData bw } +deriving instance + ( Show (ReadBusWidthType bw) + , Show (WriteBusWidthType bw) + , KnownNat (Width aw) + , KnownNat (Width bw)) + => Show (S2M_Axi4Lite aw bw) + -- | Type for the full AXI4 Lite protocol. data Axi4Lite (dom :: C.Domain)