From bc3cffd8fd0664185df29429b2abd5099d97f4c6 Mon Sep 17 00:00:00 2001 From: MatthijsMu <93450301+MatthijsMu@users.noreply.github.com> Date: Wed, 6 Mar 2024 12:36:07 +0100 Subject: [PATCH] reformat with make format --- src/Clash/Cores/Ethernet/PacketStream.hs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Clash/Cores/Ethernet/PacketStream.hs b/src/Clash/Cores/Ethernet/PacketStream.hs index b74e8b65..886bb6ae 100644 --- a/src/Clash/Cores/Ethernet/PacketStream.hs +++ b/src/Clash/Cores/Ethernet/PacketStream.hs @@ -55,17 +55,16 @@ deriving instance => NFDataX (PacketStreamM2S dataWidth metaType) -- | --- >>> PacketStreamM2S @3 @() ((0x34):> (0x43):> (0x21):>Nil :: Vec 3 (BitVector 8)) (Just 1 :: Maybe (Index 3)) () True == PacketStreamM2S @3 @() ((0x34):> (0x43):> (0x24):>Nil :: Vec 3 (BitVector 8)) (Just 1 :: Maybe (Index 3)) () True +-- >>> PacketStreamM2S @3 @() ((0x34):> (0x43):> (0x21):>Nil :: Vec 3 (BitVector 8)) (Just 1 :: Maybe (Index 3)) () True == PacketStreamM2S @3 @() ((0x34):> (0x43):> (0x24):>Nil :: Vec 3 (BitVector 8)) (Just 1 :: Maybe (Index 3)) () True -- True --- >>> PacketStreamM2S @3 @() ((0x34):> (0x43):> (0x21):>Nil :: Vec 3 (BitVector 8)) (Just 1 :: Maybe (Index 3)) () True == PacketStreamM2S @3 @() ((0x35):> (0x43):> (0x24):>Nil :: Vec 3 (BitVector 8)) (Just 1 :: Maybe (Index 3)) () True +-- >>> PacketStreamM2S @3 @() ((0x34):> (0x43):> (0x21):>Nil :: Vec 3 (BitVector 8)) (Just 1 :: Maybe (Index 3)) () True == PacketStreamM2S @3 @() ((0x35):> (0x43):> (0x24):>Nil :: Vec 3 (BitVector 8)) (Just 1 :: Maybe (Index 3)) () True -- False --- >>> PacketStreamM2S @3 @() ((0x34):> (0x43):> (0x21):>Nil :: Vec 3 (BitVector 8)) (Just 0 :: Maybe (Index 3)) () True == PacketStreamM2S @3 @() ((0x34):> (0x23):> (0x24):>Nil :: Vec 3 (BitVector 8)) (Just 0 :: Maybe (Index 3)) () True +-- >>> PacketStreamM2S @3 @() ((0x34):> (0x43):> (0x21):>Nil :: Vec 3 (BitVector 8)) (Just 0 :: Maybe (Index 3)) () True == PacketStreamM2S @3 @() ((0x34):> (0x23):> (0x24):>Nil :: Vec 3 (BitVector 8)) (Just 0 :: Maybe (Index 3)) () True -- True --- >>> PacketStreamM2S @3 @() ((0x34):> (0x23):> (0x24):>Nil :: Vec 3 (BitVector 8)) (Just 0 :: Maybe (Index 3)) () True == PacketStreamM2S @3 @() ((0x34):> (0x23):> (0x24):>Nil :: Vec 3 (BitVector 8)) (Just 1 :: Maybe (Index 3)) () True +-- >>> PacketStreamM2S @3 @() ((0x34):> (0x23):> (0x24):>Nil :: Vec 3 (BitVector 8)) (Just 0 :: Maybe (Index 3)) () True == PacketStreamM2S @3 @() ((0x34):> (0x23):> (0x24):>Nil :: Vec 3 (BitVector 8)) (Just 1 :: Maybe (Index 3)) () True -- False --- >>> PacketStreamM2S @3 @() ((0x34):> (0x23):> (0x24):>Nil :: Vec 3 (BitVector 8)) (Nothing) () True == PacketStreamM2S @3 @() ((0x34):> (0x23):> (0x24):>Nil :: Vec 3 (BitVector 8)) (Nothing) () True +-- >>> PacketStreamM2S @3 @() ((0x34):> (0x23):> (0x24):>Nil :: Vec 3 (BitVector 8)) (Nothing) () True == PacketStreamM2S @3 @() ((0x34):> (0x23):> (0x24):>Nil :: Vec 3 (BitVector 8)) (Nothing) () True -- True - instance ( KnownNat dataWidth, Eq metaType) => Eq (PacketStreamM2S dataWidth metaType) where st1 == st2 = _meta st1 == _meta st2 && @@ -79,13 +78,12 @@ instance ( KnownNat dataWidth, Eq metaType) => Eq (PacketStreamM2S dataWidth met -> Vec dataWidth (BitVector 8) -> Vec dataWidth (BitVector 8) -> Bool - eqFrom n vec1 vec2 + eqFrom n vec1 vec2 | n == (maxBound @(Index dataWidth)) = vec1 == vec2 | otherwise = eqFrom (succ n) (0 +>> vec1) (0 +>> vec2) _ -> False - -- Orphan hashable instances deriving instance (KnownNat n) => Hashable (BitVector n) deriving instance (KnownNat n) => Hashable (Index n)