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

Copyright | (C) 2015-2016 University of Twente 2017 Google Inc. 2019 Myrtle Software Ltd 2021-2022 QBayLogic B.V.
License | BSD2 (see the file LICENSE)
Maintainer | QBayLogic B.V. <devops@qbaylogic.com>
Safe Haskell | Trustworthy
Language | Haskell2010

Extensions

- Cpp
- ScopedTypeVariables
- BangPatterns
- ViewPatterns
- DataKinds
- InstanceSigs
- StandaloneDeriving
- DeriveDataTypeable
- DeriveFunctor
- DeriveTraversable
- DeriveFoldable
- DeriveGeneric
- DefaultSignatures
- DeriveLift
- DerivingStrategies
- FlexibleContexts
- MagicHash
- KindSignatures
- PostfixOperators
- TupleSections
- RankNTypes
- TypeOperators
- ExplicitNamespaces
- ExplicitForAll
- BinaryLiterals
- TypeApplications

Clash.Prelude.ROM

Contents

- Asynchronous ROM
- Synchronous ROM synchronized to an arbitrary clock
- Internal

Description

ROMs

Synopsis

- asyncRom :: forall (n :: Nat) addr a. (KnownNat n, Enum addr, NFDataX a) => Vec n a -> addr -> a
- asyncRomPow2 :: forall (n :: Nat) a. (KnownNat n, NFDataX a) => Vec (2 ^ n) a -> Unsigned n -> a
- rom :: forall (dom :: Domain) (n :: Nat) (m :: Nat) a. (NFDataX a, KnownNat n, KnownNat m, HiddenClock dom, HiddenEnable dom) => Vec n a -> Signal dom (Unsigned m) -> Signal dom a
- romPow2 :: forall (dom :: Domain) (n :: Nat) a. (KnownNat n, NFDataX a, HiddenClock dom, HiddenEnable dom) => Vec (2 ^ n) a -> Signal dom (Unsigned n) -> Signal dom a
- asyncRom# :: forall (n :: Nat) a. (KnownNat n, NFDataX a) => Vec n a -> Int -> a

# Asynchronous ROM

asyncRom Source #

Arguments

:: forall (n :: Nat) addr a. (KnownNat n, Enum addr, NFDataX a) |
=> Vec n a | ROM content, also determines the size, `n`, of the ROM NB: MUST be a constant
-> addr | Read address `r`
-> a | The value of the ROM at address `r`

An asynchronous/combinational ROM with space for `n` elements

### See also:

- See Clash.Sized.Fixed and Clash.Prelude.BlockRam for ideas on how to use ROMs and RAMs.
- A large `Vec` for the content may be too inefficient, depending on how it is constructed. See `asyncRomFile` and `asyncRomBlob` for different approaches that scale well.

asyncRomPow2 Source #

Arguments

:: forall (n :: Nat) a. (KnownNat n, NFDataX a) |
=> Vec (2 ^ n) a | ROM content NB: MUST be a constant
-> Unsigned n | Read address `r`
-> a | The value of the ROM at address `r`

An asynchronous/combinational ROM with space for 2^`n` elements

### See also:

- See Clash.Sized.Fixed and Clash.Prelude.BlockRam for ideas on how to use ROMs and RAMs.
- A large `Vec` for the content may be too inefficient, depending on how it is constructed. See `asyncRomFilePow2` and `asyncRomBlobPow2` for different approaches that scale well.

# Synchronous ROM synchronized to an arbitrary clock

rom Source #

Arguments

:: forall (dom :: Domain) (n :: Nat) (m :: Nat) a. (NFDataX a, KnownNat n, KnownNat m, HiddenClock dom, HiddenEnable dom) |
=> Vec n a | ROM content, also determines the size, `n`, of the ROM NB: MUST be a constant
-> Signal dom (Unsigned m) | Read address `r`
-> Signal dom a | The value of the ROM at address `r` from the previous clock cycle

A ROM with a synchronous read port, with space for `n` elements

- NB: Read value is delayed by 1 cycle
- NB: Initial output value is undefined, reading it will throw an `XException`

### See also:

- See Clash.Sized.Fixed and Clash.Prelude.BlockRam for ideas on how to use ROMs and RAMs.
- A large `Vec` for the content may be too inefficient, depending on how it is constructed. See `romFile` and `romBlob` for different approaches that scale well.

romPow2 Source #

Arguments

:: forall (dom :: Domain) (n :: Nat) a. (KnownNat n, NFDataX a, HiddenClock dom, HiddenEnable dom) |
=> Vec (2 ^ n) a | ROM content NB: MUST be a constant
-> Signal dom (Unsigned n) | Read address `r`
-> Signal dom a | The value of the ROM at address `r` from the previous clock cycle

A ROM with a synchronous read port, with space for 2^`n` elements

- NB: Read value is delayed by 1 cycle
- NB: Initial output value is undefined, reading it will throw an `XException`

### See also:

- See Clash.Sized.Fixed and Clash.Prelude.BlockRam for ideas on how to use ROMs and RAMs.
- A large `Vec` for the content may be too inefficient, depending on how it is constructed. See `romFilePow2` and `romBlobPow2` for different approaches that scale well.

# Internal

asyncRom# Source #

Arguments

:: forall (n :: Nat) a. (KnownNat n, NFDataX a) |
=> Vec n a | ROM content, also determines the size, `n`, of the ROM NB: MUST be a constant
-> Int | Read address `r`
-> a | The value of the ROM at address `r`

asyncRom primitive