Skip to content

Commit

Permalink
change ByteVec to BlobVec
Browse files Browse the repository at this point in the history
  • Loading branch information
lmbollen committed Oct 21, 2022
1 parent 630e294 commit db23b69
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions bittide/src/Bittide/DoubleBufferedRam.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ import Data.Typeable
data ContentType n a
= Vec (Vec n a)
| Blob (MemBlob n (BitSize a))
| ByteVec (Vec (Regs a 8) (MemBlob n 8))
| BlobVec (Vec (Regs a 8) (MemBlob n 8))
| File FilePath
| FileVec (Vec (Regs a 8) FilePath)

instance (Show a, KnownNat n, Typeable a) => Show (ContentType n a) where
show = \case
(Vec _) -> "Vec: " <> nAnda
(Blob _) -> "Blob: " <> nAnda
(ByteVec _) -> "ByteVec: " <> nAnda
(BlobVec _) -> "BlobVec: " <> nAnda
(File fp) -> "File: " <> nAnda <> ", filepath = " <> fp
(FileVec fps) -> "File: " <> nAnda <> ", filepaths = " <> show fps
where
Expand All @@ -59,8 +59,8 @@ initializedRam ::
initializedRam content rd wr = case content of
Vec vec -> blockRam vec rd wr
Blob blob -> bitCoerce <$> blockRamBlob blob rd (bitCoerce <$> wr)
ByteVec byteVec -> registersToData @_ @8 . RegisterBank <$>
bundle ((`blockRamBlob` rd) <$> byteVec <*> unbundle ((`splitWriteInBytes` maxBound) <$> wr))
BlobVec blobVec -> registersToData @_ @8 . RegisterBank <$>
bundle ((`blockRamBlob` rd) <$> blobVec <*> unbundle ((`splitWriteInBytes` maxBound) <$> wr))
File fp -> bitCoerce <$> blockRamFile (SNat @n) fp rd (bitCoerce <$> wr)
FileVec fpVec -> registersToData @_ @8 . RegisterBank <$>
bundle ((\ fp -> blockRamFile (SNat @n) fp rd)
Expand Down Expand Up @@ -151,9 +151,9 @@ wbStorage' initContent wbIn = delayControls wbIn wbOut
readDataB = ramB readAddrB writeEntryB byteSelectB

(ramA, ramB, isReloadable) = case initContent of
NonReloadable (ByteVec (splitAtI -> (b, a))) ->
( blockRamByteAddressable @_ @depth $ ByteVec a
, blockRamByteAddressable @_ @depth $ ByteVec b
NonReloadable (BlobVec (splitAtI -> (b, a))) ->
( blockRamByteAddressable @_ @depth $ BlobVec a
, blockRamByteAddressable @_ @depth $ BlobVec b
, False)
Reloadable _ ->
(blockRamByteAddressableU, blockRamByteAddressableU, True)
Expand Down Expand Up @@ -353,7 +353,7 @@ blockRamByteAddressable initContent readAddr newEntry byteSelect =
registersToData @_ @8 . RegisterBank <$> case initContent of
Blob _ -> deepErrorX "blockRamByteAddressable: Singular MemBlobs are not supported. "
Vec vecOfA -> go (byteRam . Vec <$> transpose (fmap getBytes vecOfA))
ByteVec blobs -> go (fmap (byteRam . Blob) blobs)
BlobVec blobs -> go (fmap (byteRam . Blob) blobs)
File _ -> deepErrorX "blockRamByteAddressable: Singular source files for initial content are not supported. "
FileVec blobs -> go (fmap (byteRam . File) blobs)
where
Expand Down

0 comments on commit db23b69

Please sign in to comment.