clash-shockwaves
Copyright(C) 2025-2026 QBayLogic B.V.
LicenseBSD2 (see the file LICENSE)
MaintainerQBayLogic B.V. <devops@qbaylogic.com>
Safe HaskellNone
LanguageHaskell2010

Clash.Shockwaves.Internal.Waveform

Description

The Waveform class, functions derived from it, special Waveform variants such as WaveformLUT, and Waveform instances for default types.

Synopsis

Documentation

defaultRender :: Value -> Render Source #

Get a Render from a Value using WSDefault and precedence 11.

tStyled :: WaveStyle -> Translator -> Translator Source #

Wrap a Translator in a TStyled variant translator with the provided style.

tDup :: SubSignal -> Translator -> Translator Source #

Wrap a Translator in a TDuplicate variant translator with the provided subsignal name.

tRef :: Waveform a => Translator Source #

Generate a translator reference for a type. Also checks whether the translator width matches the value of bitSize for the type: if not, the function errors.

tConst :: Render -> Translator Source #

Create a constant translator that consumes 0 bits and has no subsignals.

tLut :: (Waveform a, WaveformLUT a) => Maybe LUT -> Translator Source #

Create a LUT translator for a type, using either the static LUT or the translation function specified in WaveformLUT

tGeneratedLut :: (Waveform a, WaveformLUT a) => Translator Source #

Create a LUT translator for a type, using the translation function of WaveformLUT.

tStaticLut :: (Waveform a, WaveformLUT a) => LUT -> Translator Source #

Create a LUT translator for a type, using the static LUT in WaveformLUT.

class (Typeable a, BitPack a) => Waveform a where Source #

Waveform is the main class for making types displayable in the waveform viewer. The class is responsible for defining an appropriate translator and subsignal structure, as well as registering types.

To make a LUT approache possible, the class must also be able to translate values, and to register individual values.

By default, Generic is used to automatically derive this behaviour. Extra classes are provided to help implement lookup tables or common types, like numerical translators. Custom implementations are also very possible.

Minimal complete definition

Nothing

Methods

typeName :: TypeName Source #

Provide the type name. Overriding this value is only really useful for derive via strategies.

translator :: Translator Source #

The translator used for the data type. Must match the structure value.

default translator :: WaveformG (Rep a ()) => Translator Source #

constructorStyles :: [WaveStyle] Source #

List of styles used for constructors.

Since assigning different constructors different colors is a very common usecase of the waveform style, this list can be overridden to provides styles for the constructors, in order. To not change a style, use WSDefault.

width :: Int Source #

Deprecated: Use bitSize instead

Defines the width of the translator based on bitSize

Instances

Instances details
Waveform Bit Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Waveform ClockWave Source #

Control the styles of the clock wave through style variables clk_pre, clk_a and clk_b.

Instance details

Defined in Clash.Shockwaves.Internal.Trace.CRE

Waveform EnableWave Source #

Control the styles of the enable wave through style variables enable_on and enable_off.

Instance details

Defined in Clash.Shockwaves.Internal.Trace.CRE

Waveform Int16 Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Waveform Int32 Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Waveform Int64 Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Waveform Int8 Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Waveform Word16 Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Waveform Word32 Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Waveform Word64 Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Waveform Word8 Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Waveform Ordering Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Waveform () Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Waveform Bool Source #

Configure styles through style variables bool_false and bool_true.

Instance details

Defined in Clash.Shockwaves.Internal.Waveform

BitPack Char => Waveform Char Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Waveform Double Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Waveform Float Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Waveform Int Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Waveform Word Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Waveform a => Waveform (Complex a) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Waveform a => Waveform (Erroring a) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Waveform a => Waveform (Overflowing a) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Waveform a => Waveform (Saturating a) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Waveform a => Waveform (Wrapping a) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Waveform a => Waveform (Zeroing a) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

(KnownNat n, BitPack (SNat n)) => Waveform (SNat n) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

KnownNat n => Waveform (BitVector n) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

(1 <= n, KnownNat n) => Waveform (Index n) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

KnownNat n => Waveform (Signed n) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

KnownNat n => Waveform (Unsigned n) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

KnownDomain dom => Waveform (CREWave dom) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Trace.CRE

KnownDomain dom => Waveform (ResetWave dom) Source #

Control the styles of the reset wave through style variables reset_on and reset_off.

Instance details

Defined in Clash.Shockwaves.Internal.Trace.CRE

(WaveformConst a, BitPack a, Typeable a) => Waveform (WaveformForConst a) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

(Waveform a, WaveformLUT a, BitPack a, Typeable a) => Waveform (WaveformForLut a) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Waveform a => Waveform (Identity a) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Waveform a => Waveform (Down a) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Waveform a => Waveform (Maybe a) Source #

Configure styles through style variables maybe_nothing and maybe_just.

Instance details

Defined in Clash.Shockwaves.Internal.Waveform

(Waveform a, KnownNat d, WaveformRTree (RTreeIsLeaf d) d a) => Waveform (RTree d a) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

(KnownNat n, Waveform a) => Waveform (Vec n a) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

(Waveform a, Waveform b) => Waveform (Either a b) Source #

Configure styles through style variables either_left and either_right.

Instance details

Defined in Clash.Shockwaves.Internal.Waveform

(Waveform a1, Waveform a2) => Waveform (a1, a2) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

(BitPack (Fixed r i f), KnownNat i, KnownNat f, Show (Fixed r i f), Typeable r) => Waveform (Fixed r i f) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

(BitPack a, Typeable a, Typeable f, Typeable s, KnownNFormat f, KnownNSpacer s) => Waveform (WaveformForNumber f s a) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

(Waveform a1, Waveform a2, Waveform a3) => Waveform (a1, a2, a3) Source #

NB: The documentation only shows instances up to 3-tuples. By default, instances up to and including 12-tuples will exist. If the flag large-tuples is set instances up to the GHC imposed limit will exist. The GHC imposed limit is either 62 or 64 depending on the GHC version.

Instance details

Defined in Clash.Shockwaves.Internal.Waveform

defaultTranslator :: (Waveform a, WaveformG (Rep a ())) => Translator Source #

Return the default translator that is derived for a data type. This default can be modified to obtain a slightly different translator.

translate :: (Waveform a, BitPack a) => a -> Translation Source #

Function to translate values. This function creates a translation from the binary representation of the data using translateBin, and the translator.

translateBin :: Waveform a => BitList -> Translation Source #

Translate binary data. Normally, this simply translates the value according to the translator. For LUTs, this involves translating the value back to the original type and translating it using a specially defined translation function.

addTypes :: Waveform a => TypeMap -> TypeMap Source #

Register this type and all its subtypes.

constructorStyles' :: Waveform a => [WaveStyle] Source #

Helper function that fills the constructorStyles list with WSDefault.

hasGeneratedLut :: Waveform a => Bool Source #

Check if the type requires values to be added to LUTs.

structure :: Waveform a => Structure Source #

Return the structure of a type.

addValue :: Waveform a => a -> [LUTMap -> LUTMap] Source #

Add all (sub) values that use TLut to their respective LUTs.

noConstructorSubsignals :: Bool -> Translator -> Translator Source #

Remove constructor subsignals from a (generated) translator. This results in all constructor field subsignals becoming direct subsignals of the toplevel signal. Set rename to True to add the constructor's name as a prefix to the signal name.

Essentially, this function searches through TStyled and TSum for any TDuplicate translators to remove. If renaming subsignals, it then searches through TStyled to rename subsignals in TProduct.

renameFields :: [[String]] -> Translator -> Translator Source #

Rename constructor fields. This is particularly useful for non-record types. The input is a list of a list of field names, per constructor. Errors if the number of constructors/fields does not match the structure of the Translator. For translators other than TProduct, use an empty list of fieldnames.

renameConstructors :: [String] -> Translator -> Translator Source #

Rename the constructors subsignals of a data type. Errors if the number of constructor subsignal names provided is incorrect, or when called on a translator that does not have a sum translator.

inheritSingleFieldStyle :: Translator -> Translator Source #

Wrap constructors with a single field in the WSInherit 0 style. Ignores any structures that are wrapped in a TStyled translator.

withConstructorStyles :: [WaveStyle] -> Translator -> Translator Source #

Apply constructor styles. This wraps TProduct translators and modifies the style of TConst translators. Does nothing if the list of styles is empty. Otherwise, errors if the number of styles does not match the number of constructors.

class WaveformG a where Source #

A class for obtaining the required behaviour of Waveform through GHC.Generics. The exact details might change later; use at your own risk.

Methods

translatorG :: Int -> Translator Source #

Given a bitsize and list of styles for the constructors, provide a translator.

Defined only for full types and constructors

constrTranslatorsG :: [Translator] Source #

Return a list of translators for constructors as subsignals.

Defined for constructors, :+: and types with multiple constructors.

fieldTranslatorsG :: [(SubSignal, Translator)] Source #

Return a list of translators for fields.

Defined for fields, :*:, constructors, and types with a single constructor. Product type subsignals are labeled (numbered) for types and constructors only.

widthG :: Int Source #

Bitsize of a type. Only used to determine the width of constructors (and their fields).

Defined for constructors, :*:, and fields.

translateWithG :: Render -> a -> [(SubSignal, Translation)] Source #

For LUTs. Create translation subsignals from supplied Render value. Duplicate the value if there are multiple constructors, and just translate the fields. If getting the constructor fails, create no subsignals.

Defined for types, :+: and constructors.

translateFieldsG :: a -> [(SubSignal, Translation)] Source #

For LUTs. Translate all fields of a (the) constructor.

Defined for constructors, :*:, fields and types with 1 constructor.

Instances

Instances details
WaveformG (U1 k2) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

(WaveformG (a k2), WaveformG (b k2)) => WaveformG ((a :*: b) k2) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

(WaveformG (a k2), WaveformG (b k2)) => WaveformG ((a :+: b) k2) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

(WaveformG (fields k2), KnownSymbol name, PrecF fix) => WaveformG (C1 ('MetaCons name fix 'False) fields k2) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

(WaveformG (fields k2), KnownSymbol name) => WaveformG (C1 ('MetaCons name fix 'True) fields k2) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

WaveformG ((a :+: b) k2) => WaveformG (D1 m1 (a :+: b) k2) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

(WaveformG (C1 m2 s k2), WaveformG (s k2)) => WaveformG (D1 m1 (C1 m2 s) k2) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

WaveformG (D1 m1 (V1 :: k1 -> Type) k2) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

(Waveform t, KnownSymbol name) => WaveformG (S1 ('MetaSel ('Just name) p q r) (Rec0 t) k2) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Waveform t => WaveformG (S1 ('MetaSel ('Nothing :: Maybe Symbol) p q r) (Rec0 t) k2) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

left :: forall {k1} a (b :: k1 -> Type) (k2 :: k1). (a :*: b) k2 -> a k2 Source #

Lazily get left field.

right :: forall {k1} (a :: k1 -> Type) b (k2 :: k1). (a :*: b) k2 -> b k2 Source #

Lazily get right field.

class (Typeable a, BitPack a) => WaveformLUT a where Source #

Class for easily defining custom translations for a type by using LUTs. To use this class, a type must derive Waveform via WaveformForLut.

Bye default, the implementation uses Generic for defining subsignals and operator precedence, and Show for displaying the value.

Minimal complete definition

Nothing

Methods

structureL :: Structure Source #

Provides the hierarchy of subsignals.

default structureL :: WaveformG (Rep a ()) => Structure Source #

translateL :: a -> Translation Source #

Translate a value. The translations must adhere to the structure defined in structureL. This function must be robust to undefined values!

default translateL :: (Generic a, Show a, WaveformG (Rep a ()), PrecG (Rep a ())) => a -> Translation Source #

staticL :: Maybe [(a, Translation)] Source #

A static lookup table. To use a static lookup table rather than one created from the values found during simulation, set this to a list of values and their translations. Set translateL and structureL to undefined.

Instances

Instances details
WaveformLUT Bit Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

BitPack Char => WaveformLUT Char Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

WaveformLUT Double Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

WaveformLUT Float Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

KnownDomain dom => WaveformLUT (CREWave dom) Source #

Control the style of a combined disable and reset through style variable reset_on_enable_off.

Instance details

Defined in Clash.Shockwaves.Internal.Trace.CRE

(BitPack (Fixed r i f), KnownNat i, KnownNat f, Show (Fixed r i f), Typeable r) => WaveformLUT (Fixed r i f) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

staticLutL :: WaveformLUT a => Maybe LUT Source #

Return the static LUT of a type with WaveformLUT

staticLut :: BitPack a => [(a, Translation)] -> LUT Source #

Turn a list of (value,translation) pairs into a LUT

translateStaticL :: (Waveform a, WaveformLUT a) => a -> Translation Source #

Translate a value from a type with a static LUT

safeTranslation :: Translation -> Translation Source #

Make sure a Translation is fully defined. If not, return a Translation with "undefined".

translateWith :: (a -> Render) -> (Render -> a -> [(SubSignal, Translation)]) -> a -> Translation Source #

Given a function that renders a value, and a function that (given this Render) prodices the subsignals, create a translation. If rendering fails, "undefined" is displayed. If creating the subsignals fails, no subsignals are shown.

renderShow :: (Show a, Generic a, PrecG (Rep a ())) => a -> Render Source #

Display a value with Show, the default wave style, and operator precedence determined using Generic.

renderWith :: (a -> Value) -> (a -> WaveStyle) -> (a -> Prec) -> a -> Render Source #

Display a value with the provided functions for creating the text value, style and operator precedence.

translateAtomWith :: (a -> Value) -> a -> Translation Source #

Display an atomic value (such as a number) using the provided function to obtain the value. (normal wavestyle, precedence 11).

translateAtomShow :: Show a => a -> Translation Source #

Display an atomic value (like a number) with Show. See translateAtomWith.

translateAtomSigWith :: Show a => (a -> Value) -> a -> Translation Source #

Render an atomic value representing a signed number. If the render value is found to start with -, the precedence is set to 0.

translateAtomSigShow :: Show a => a -> Translation Source #

Render an atomic value representing a signed number using show. See translateAtomSigWith.

splitL :: (Generic a, WaveformG (Rep a ())) => Render -> a -> [(SubSignal, Translation)] Source #

Create subsignals for the constructors and fields. Constructor translations are a copy of the toplevel render value provided.

noSplit :: Render -> a -> [(SubSignal, Translation)] Source #

Create no subsignals for this type.

precL :: (PrecG (Rep a ()), Generic a) => a -> Prec Source #

Get the operator precedence of a value.

newtype WaveformForLut a Source #

Type for deriving Waveform for types implementing WaveformLUT.

type T = ... deriving (...)
deriving via WaveformForLut T instance Waveform T

isntance WaveformLUT T where
  ...

Constructors

WaveformForLut a 

Instances

Instances details
BitPack a => BitPack (WaveformForLut a) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

(Waveform a, WaveformLUT a, BitPack a, Typeable a) => Waveform (WaveformForLut a) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Generic (WaveformForLut a) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Associated Types

type Rep (WaveformForLut a) 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

type Rep (WaveformForLut a) = D1 ('MetaData "WaveformForLut" "Clash.Shockwaves.Internal.Waveform" "clash-shockwaves-1.1.0-inplace" 'True) (C1 ('MetaCons "WaveformForLut" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))
type BitSize (WaveformForLut a) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

type Rep (WaveformForLut a) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

type Rep (WaveformForLut a) = D1 ('MetaData "WaveformForLut" "Clash.Shockwaves.Internal.Waveform" "clash-shockwaves-1.1.0-inplace" 'True) (C1 ('MetaCons "WaveformForLut" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))

class Generic a => PrecG a where Source #

Helper class for determining the precedence and number of fields of a value's constructor.

Minimal complete definition

precG

Methods

precG :: a -> Prec Source #

Operator precedence of a value.

nFields :: Integer Source #

Return the number of fields of a constructor. This is needed to determine whether a constructor is atomic or not.

Instances

Instances details
PrecG (U1 k2) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Methods

precG :: U1 k2 -> Prec Source #

nFields :: Integer Source #

PrecG (V1 k2) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Methods

precG :: V1 k2 -> Prec Source #

nFields :: Integer Source #

(PrecG (a k2), PrecG (b k2)) => PrecG ((a :*: b) k2) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Methods

precG :: (a :*: b) k2 -> Prec Source #

nFields :: Integer Source #

(PrecG (a k2), PrecG (b k2)) => PrecG ((a :+: b) k2) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Methods

precG :: (a :+: b) k2 -> Prec Source #

nFields :: Integer Source #

(PrecG (fields k2), PrecF fix) => PrecG (C1 ('MetaCons name fix 'False) fields k2) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Methods

precG :: C1 ('MetaCons name fix 'False) fields k2 -> Prec Source #

nFields :: Integer Source #

(PrecG (fields k2), PrecF fix) => PrecG (C1 ('MetaCons name fix 'True) fields k2) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Methods

precG :: C1 ('MetaCons name fix 'True) fields k2 -> Prec Source #

nFields :: Integer Source #

PrecG (c k2) => PrecG (D1 m1 c k2) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Methods

precG :: D1 m1 c k2 -> Prec Source #

nFields :: Integer Source #

PrecG (S1 ('MetaSel n p q r) t k2) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Methods

precG :: S1 ('MetaSel n p q r) t k2 -> Prec Source #

nFields :: Integer Source #

class PrecF (f :: FixityI) where Source #

Class for obtaining the runtime precedence of a typelevel fixity value.

Methods

precF :: Prec Source #

Return the precedence of a fixity value as an Integer.

Instances

Instances details
PrecF 'PrefixI Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Methods

precF :: Prec Source #

KnownNat p => PrecF ('InfixI a p) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Methods

precF :: Prec Source #

class (BitPack a, Typeable a) => WaveformConst a where Source #

Helper class for defining a constant translation value. To use this, derive Waveform via WaveformForConst.

Minimal complete definition

constTrans | constRen

Methods

constTrans :: Translation Source #

The constant translation value. Overwrite this if the translation has subsignals.

constRen :: Render Source #

Constant render value. Overwrite this if the constant value has no subsignals.

Instances

Instances details
WaveformConst () Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

(KnownNat n, BitPack (SNat n)) => WaveformConst (SNat n) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

newtype WaveformForConst a Source #

Helper class for deriving Waveform for types implementing WaveformConst.

Constructors

WfConst a 

Instances

Instances details
BitPack a => BitPack (WaveformForConst a) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

(WaveformConst a, BitPack a, Typeable a) => Waveform (WaveformForConst a) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Generic (WaveformForConst a) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Associated Types

type Rep (WaveformForConst a) 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

type Rep (WaveformForConst a) = D1 ('MetaData "WaveformForConst" "Clash.Shockwaves.Internal.Waveform" "clash-shockwaves-1.1.0-inplace" 'True) (C1 ('MetaCons "WfConst" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))
type BitSize (WaveformForConst a) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

type Rep (WaveformForConst a) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

type Rep (WaveformForConst a) = D1 ('MetaData "WaveformForConst" "Clash.Shockwaves.Internal.Waveform" "clash-shockwaves-1.1.0-inplace" 'True) (C1 ('MetaCons "WfConst" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))

newtype WaveformForNumber (f :: NumberFormat) (s :: Maybe NSPair) a Source #

Helper class for deriving Waveform for numerical types. Options are provided at the type level (signed, format).

Example: deriving via WaveformForNumber NFSig ('Just '(3,"_")) instance Waveform (Signed 3)

Constructors

WaveformForNumber a 

Instances

Instances details
BitPack a => BitPack (WaveformForNumber f s a) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Associated Types

type BitSize (WaveformForNumber f s a) 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

(BitPack a, Typeable a, Typeable f, Typeable s, KnownNFormat f, KnownNSpacer s) => Waveform (WaveformForNumber f s a) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Generic (WaveformForNumber f s a) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Associated Types

type Rep (WaveformForNumber f s a) 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

type Rep (WaveformForNumber f s a) = D1 ('MetaData "WaveformForNumber" "Clash.Shockwaves.Internal.Waveform" "clash-shockwaves-1.1.0-inplace" 'True) (C1 ('MetaCons "WaveformForNumber" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))

Methods

from :: WaveformForNumber f s a -> Rep (WaveformForNumber f s a) x #

to :: Rep (WaveformForNumber f s a) x -> WaveformForNumber f s a #

type BitSize (WaveformForNumber f s a) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

type Rep (WaveformForNumber f s a) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

type Rep (WaveformForNumber f s a) = D1 ('MetaData "WaveformForNumber" "Clash.Shockwaves.Internal.Waveform" "clash-shockwaves-1.1.0-inplace" 'True) (C1 ('MetaCons "WaveformForNumber" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))

type NSPair = (Nat, Symbol) Source #

Pair of a Nat and Symbol, used for type-level spacer values.

type DecSpacer = 'Just '(3, "_") Source #

Default spacer for decimal values (_ every 3 digits)

type HexSpacer = 'Just '(2, "_") Source #

Default spacer for hexadecimal values (_ every 2 digits)

type OctSpacer = 'Just '(4, "_") Source #

Default spacer for octal values (_ every 4 digits)

type BinSpacer = 'Just '(8, "_") Source #

Default spacer for binary values (_ every 8 digits)

type SpacerEvery (n :: k) = 'Just '(n, "_") Source #

Add _ every n digits.

type NoSpacer = 'Nothing :: Maybe NSPair Source #

Do not add spacers.

class KnownNFormat (f :: NumberFormat) where Source #

Class for turning a type level NumberFormat into a runtime value.

Methods

formatVal :: proxy f -> NumberFormat Source #

Instances

Instances details
KnownNFormat 'NFBin Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Methods

formatVal :: proxy 'NFBin -> NumberFormat Source #

KnownNFormat 'NFHex Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Methods

formatVal :: proxy 'NFHex -> NumberFormat Source #

KnownNFormat 'NFOct Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Methods

formatVal :: proxy 'NFOct -> NumberFormat Source #

KnownNFormat 'NFSig Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Methods

formatVal :: proxy 'NFSig -> NumberFormat Source #

KnownNFormat 'NFUns Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Methods

formatVal :: proxy 'NFUns -> NumberFormat Source #

class KnownNSpacer (f :: Maybe NSPair) where Source #

Type to get the runtime value of a type-level number spacer.

Methods

spacerVal :: proxy f -> Maybe (Integer, String) Source #

Instances

Instances details
KnownNSpacer ('Nothing :: Maybe NSPair) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Methods

spacerVal :: proxy ('Nothing :: Maybe NSPair) -> Maybe (Integer, String) Source #

(KnownNat n, KnownSymbol s) => KnownNSpacer ('Just '(n, s)) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Methods

spacerVal :: proxy ('Just '(n, s)) -> Maybe (Integer, String) Source #

type family RTreeIsLeaf (d :: Natural) :: Bool where ... Source #

Helper family for implementing Waveform for RTree.

Equations

RTreeIsLeaf 0 = 'True 
RTreeIsLeaf d = 'False 

class WaveformRTree (isLeaf :: Bool) (d :: k) (a :: k1) where Source #

Helper class for implementing Waveform for RTree.

Instances

Instances details
(Waveform (RTree d1 a), Waveform a, d ~ (d1 + 1), KnownNat d, KnownNat d1) => WaveformRTree 'False (d :: Natural) (a :: Type) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

Waveform a => WaveformRTree 'True 0 (a :: Type) Source # 
Instance details

Defined in Clash.Shockwaves.Internal.Waveform

tupleTranslator :: (BitPack t, WaveformG (Rep t ())) => Translator Source #

A translator for displaying values with zero or more fields like tuples. This function will error if called for a type that has more than one constructor!