clash-prelude-1.8.4: Clash: a functional hardware description language - Prelude library

Copyright | (C) 2021-2024 QBayLogic B.V.
License | BSD2 (see the file LICENSE)
Maintainer | QBayLogic B.V. <devops@qbaylogic.com>
Safe Haskell | Trustworthy
Language | Haskell2010

Clash.Explicit.BlockRam.Internal

Description

Synopsis

- data MemBlob (n :: Nat) (m :: Nat) where
  - MemBlob :: forall (n :: Nat) (m :: Nat). (KnownNat n, KnownNat m) => {..} -> MemBlob n m
- unpackMemBlob :: forall (n :: Nat) (m :: Nat). MemBlob n m -> [BitVector m]
- unpackMemBlob0 :: forall (n :: Nat) (m :: Nat). MemBlob n m -> IO [BitVector m]
- packBVs :: forall a f. (Foldable f, BitPack a) => Maybe Bit -> f a -> Either String (Int, ByteString, ByteString)
- packAsNats :: forall a f. Foldable f => Int -> (a -> Natural) -> f a -> (ByteString, ByteString)
- unpackNats :: Int -> Int -> ByteString -> ByteString -> [Natural]
- unpackW64s :: ByteString -> [Word64]
- unpackEnds :: Int -> Int -> [Word64] -> [Natural]

# Documentation

data MemBlob (n :: Nat) (m :: Nat) where Source #

Efficient storage of memory content

It holds `n` words of ``BitVector` m`.

Constructors

MemBlob |

Fields

- :: forall (n :: Nat) (m :: Nat). (KnownNat n, KnownNat m)
- => { memBlobRunsLen :: !Int
- , memBlobRuns :: Addr#
- , memBlobEndsLen :: !Int
- , memBlobEnds :: Addr#
- } -> MemBlob n m

#### Instances

Instances details

Show (MemBlob n m) Source # |
Instance details Defined in Clash.Explicit.BlockRam.Internal Methods showsPrec :: Int -> MemBlob n m -> ShowS Source # show :: MemBlob n m -> String Source # showList :: [MemBlob n m] -> ShowS Source #

unpackMemBlob :: forall (n :: Nat) (m :: Nat). MemBlob n m -> [BitVector m] Source #

Convert a `MemBlob` back to a list

NB: Not synthesizable

unpackMemBlob0 :: forall (n :: Nat) (m :: Nat). MemBlob n m -> IO [BitVector m] Source #

packBVs :: forall a f. (Foldable f, BitPack a) => Maybe Bit -> f a -> Either String (Int, ByteString, ByteString) Source #

packAsNats :: forall a f. Foldable f => Int -> (a -> Natural) -> f a -> (ByteString, ByteString) Source #

unpackNats :: Int -> Int -> ByteString -> ByteString -> [Natural] Source #

unpackW64s :: ByteString -> [Word64] Source #

unpackEnds :: Int -> Int -> [Word64] -> [Natural] Source #