Skip to content
This repository has been archived by the owner on Sep 6, 2024. It is now read-only.

Commit

Permalink
reformat with make format
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthijsMu committed Mar 6, 2024
1 parent 69a7822 commit bc3cffd
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/Clash/Cores/Ethernet/PacketStream.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand All @@ -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)
Expand Down

0 comments on commit bc3cffd

Please sign in to comment.