| Copyright | (C) 2025-2026 QBayLogic B.V. |
|---|---|
| License | BSD2 (see the file LICENSE) |
| Maintainer | QBayLogic B.V. <devops@qbaylogic.com> |
| Safe Haskell | None |
| Language | Haskell2010 |
Clash.Shockwaves.Internal.Types
Description
Type definitions for Shockwaves.
Synopsis
- type TypeName = String
- type SubSignal = String
- type SignalName = SubSignal
- type Value = String
- type Prec = Integer
- type Render = Maybe (Value, WaveStyle, Prec)
- type LUTName = TypeName
- type SignalMap = Map SignalName TypeName
- type TypeMap = Map TypeName Translator
- type LUTMap = Map LUTName LUT
- type LUT = Map BitList Translation
- type Color = RGB Word8
- data Translation = Translation Render [(SubSignal, Translation)]
- data WaveStyle
- data NumberFormat
- type NumberSpacer = Maybe (Integer, String)
- newtype Structure = Structure [(SubSignal, Structure)]
- data Translator = Translator Int TranslatorVariant
- data TypeRef = TypeRef {}
- data TranslatorVariant
- = TRef TypeName TypeRef
- | TLut LUTName (Maybe LUT) TypeRef
- | TSum [Translator]
- | TAdvancedSum {
- index :: Slice
- defTrans :: Translator
- rangeTrans :: [(ISlice, Translator)]
- | TProduct { }
- | TArray { }
- | TAdvancedProduct {
- sliceTrans :: [(Slice, Translator)]
- hierarchy :: [(SubSignal, Int)]
- valueParts :: [ValuePart]
- preco :: Prec
- | TDuplicate SubSignal Translator
- | TStyled WaveStyle Translator
- | TChangeBits {
- bits :: BitPart
- sub :: Translator
- | TNumber {
- format :: NumberFormat
- spacer :: NumberSpacer
- prefix :: String
- warn :: Bool
- | TConst Translation
- data BitPart
- data ValuePart
- type Slice = (Int, Int)
- type ISlice = (Integer, Integer)
- mergeDuplicateSubsignals :: [(SubSignal, Structure)] -> [(SubSignal, Structure)]
Documentation
type SignalName = SubSignal Source #
Name of a signal.
type Render = Maybe (Value, WaveStyle, Prec) Source #
Rendered value. This can be Nothing is the value does not exists,
or a tuple of the text representation, style, and precedence.
type LUTMap = Map LUTName LUT Source #
Table of LUTs. Usually, the index is a type name, but this is not necessarily the case.
type LUT = Map BitList Translation Source #
A lookup table of Translations.
data Translation Source #
Translation of a value.
The translation consists of a Render value (the representation of the value itself)
and a list of subsignal translations.
Constructors
| Translation Render [(SubSignal, Translation)] |
Instances
The style in which a signal should be displayed.
Constructors
| WSDefault | The default waveform style. It is rendered as |
| WSError | An error value. Errors are propagated by translators. |
| WSHidden | Do not display any value, even if it exists. |
| WSInherit Natural | Copy the style of the nth subsignal. |
| WSNormal | A normal value. |
| WSWarn | A warning value. |
| WSUndef | An undefined value. |
| WSHighImp | A high impedance value. |
| WSDontCare | A value that does not matter. |
| WSWeak | A weakly defined value. |
| WSColor Color | A custom color. See Clash.Shockwaves.Style for more information. |
| WSVar String WaveStyle | A variable in a style configuration file, with a default. |
Instances
| ToJSON WaveStyle Source # | |||||
| NFData WaveStyle Source # | |||||
Defined in Clash.Shockwaves.Internal.Types | |||||
| IsString WaveStyle Source # | A | ||||
Defined in Clash.Shockwaves.Internal.Types Methods fromString :: String -> WaveStyle # | |||||
| Generic WaveStyle Source # | |||||
Defined in Clash.Shockwaves.Internal.Types Associated Types
| |||||
| Show WaveStyle Source # | |||||
| Eq WaveStyle Source # | |||||
| type Rep WaveStyle Source # | |||||
Defined in Clash.Shockwaves.Internal.Types type Rep WaveStyle = D1 ('MetaData "WaveStyle" "Clash.Shockwaves.Internal.Types" "clash-shockwaves-1.1.0-inplace" 'False) (((C1 ('MetaCons "WSDefault" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "WSError" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "WSHidden" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "WSInherit" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Natural)) :+: (C1 ('MetaCons "WSNormal" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "WSWarn" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "WSUndef" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "WSHighImp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "WSDontCare" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "WSWeak" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "WSColor" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Color)) :+: C1 ('MetaCons "WSVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 WaveStyle)))))) | |||||
data NumberFormat Source #
Different number formats.
Constructors
| NFSig | A signed decimal value. |
| NFUns | An unsigned decimal value. |
| NFHex | A hexadecimal value. Supports partially undefined values. |
| NFOct | An octal value. Supports partially undefined values. |
| NFBin | A binary value. Supports partially undefined values. |
Instances
| ToJSON NumberFormat Source # | |||||
Defined in Clash.Shockwaves.Internal.Types Methods toJSON :: NumberFormat -> Value # toEncoding :: NumberFormat -> Encoding # toJSONList :: [NumberFormat] -> Value # toEncodingList :: [NumberFormat] -> Encoding # omitField :: NumberFormat -> Bool # | |||||
| NFData NumberFormat Source # | |||||
Defined in Clash.Shockwaves.Internal.Types Methods rnf :: NumberFormat -> () # | |||||
| Generic NumberFormat Source # | |||||
Defined in Clash.Shockwaves.Internal.Types Associated Types
| |||||
| Show NumberFormat Source # | |||||
Defined in Clash.Shockwaves.Internal.Types Methods showsPrec :: Int -> NumberFormat -> ShowS # show :: NumberFormat -> String # showList :: [NumberFormat] -> ShowS # | |||||
| type Rep NumberFormat Source # | |||||
Defined in Clash.Shockwaves.Internal.Types type Rep NumberFormat = D1 ('MetaData "NumberFormat" "Clash.Shockwaves.Internal.Types" "clash-shockwaves-1.1.0-inplace" 'False) ((C1 ('MetaCons "NFSig" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NFUns" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "NFHex" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "NFOct" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NFBin" 'PrefixI 'False) (U1 :: Type -> Type)))) | |||||
type NumberSpacer = Maybe (Integer, String) Source #
A type for defining spacers and the way they are placed.
A structure value that shows what subsignals are present.
Instances
data Translator Source #
A translator. The translator has a width, indicating the number of bits it
translates, as well as a TranslatorVariant that determines the translation algorithm.
Constructors
| Translator Int TranslatorVariant |
Instances
| ToJSON Translator Source # | |
Defined in Clash.Shockwaves.Internal.Types Methods toJSON :: Translator -> Value # toEncoding :: Translator -> Encoding # toJSONList :: [Translator] -> Value # toEncodingList :: [Translator] -> Encoding # omitField :: Translator -> Bool # | |
| Show Translator Source # | |
Defined in Clash.Shockwaves.Internal.Types Methods showsPrec :: Int -> Translator -> ShowS # show :: Translator -> String # showList :: [Translator] -> ShowS # | |
A type-agnostic reference to various waveform details of a type.
Constructors
| TypeRef | |
Fields
| |
data TranslatorVariant Source #
The translation algorithm used. Translator variants determine how the bits are interpreted, split, manipulated, and in the end, translatated and displayed in the waveform viewer.
Constructors
| TRef TypeName TypeRef | Use the translator of a different type. Note that the width value of the
|
| TLut LUTName (Maybe LUT) TypeRef | A reference to a lookup table. Implement |
| TSum [Translator] | Select one translator to be used based on the first bits of the binary representation. Translate the rest of the bits using the selected translator. To be exact, if k translators are provided, ceil(log2(k)) bits will be consumed to select the translator. No subsignals for the translators are created. Keep in mind that problems may occur if two translators specify subsignals with identical names. |
| TAdvancedSum | Use The selected translator is passed the full binary.
|
Fields
| |
| TProduct | Split the binary data into separate fields, translate each of these, and join together the values. Specifically, for each of the listed translators, consume as many bits as specified by the translator, then pass on the rest of the bits to the other translators. The value is constructed from the values of the subtranslators. A start, stop and separator string can be specified, as well as optional labels to put in front of the different values. Example: data T = T{a::Bool,b::Bool}
translatorVariantT = TProduct
{ subs = [("a",Bool,"b",Bool)],
, start = "T{"
, sep = ","
, stop = "}"
, labels = ["a=","b="]
, preci = -1
, preco = 11
}
|
Fields
| |
| TArray | An array value. This behaves much like |
Fields
| |
| TAdvancedProduct | Advance product type. First, a number of slices of the binary are translated. Then, the subsignals are picked from these translations, and the value is constructed from fixed strings and values from the translators.
|
Fields
| |
| TDuplicate SubSignal Translator | Translate the binary data using the translator specified, and duplicate
the value into a subsignal of the provided name. This duplication applies
the |
| TStyled WaveStyle Translator | Apply a style to a translation, replacing only |
| TChangeBits | Modify the binary input of the contained translator
The binary data is modified using |
Fields
| |
| TNumber | Translate the binary data as an integer. |
Fields
| |
| TConst Translation | A constant translation value. The binary value provided is completely ignored. |
Instances
| Show TranslatorVariant Source # | |
Defined in Clash.Shockwaves.Internal.Types Methods showsPrec :: Int -> TranslatorVariant -> ShowS # show :: TranslatorVariant -> String # showList :: [TranslatorVariant] -> ShowS # | |
Parts of the binary output of TChangeBits.
Each constructor modifies bits in a certain way.
More may be added later.
Constructors
| BPIn | Return the input binary. |
| BPLit BitList | Return the |
| BPSlice Slice BitPart | Return a slice of the input. **Important**: slice indices start to the left, i.e. with the MSB! |
| BPConcat [BitPart] | Pass the binary data onto multiple |
| BPHasUndefined BitPart | Return `1` if there are undefined bits in the binary. |
| BPReverse BitPart | Return bits in reverse order. |
| BPInvert BitPart | Invert 0 and 1. |
| BPAnd [BitPart] | Bitwise and. If values of different lengths are provided, values are zero-padded on the left.
Short-cirtuits ( |
| BPOr [BitPart] | Bitwise or. If values of different lengths are provided, values are zero-padded on the left.
Short-cirtuits ( |
| BPXor [BitPart] | Bitwise xor. If multiple values of different lengths are provided, values are zero-padded on the left. |
| BPOneHot Slice BitPart | Turn a binary value into a one-hot signal based on the provided range. This essentially loops over all values in the range, creating a 1 iff the input BitPart's result is equal to that value. I.e. BPOneHot (0,3) "10" results in "001". |
| BPNHot Slice BitPart | Turn a binary value into a n-hot signal based on the provided range. This essentially loops over all values in the range, creating a 1 iff the input BitPart's result is less than or equal to that value. |
| BPIf BitPart BitPart BitPart BitPart | Switch bitparts based on the first bit in the condition bitpart: `BPIf (true) (false) (undef) (cond)` |
Parts of the value of TAdvancedProduct.
Constructors
| VPLit String | A literal string. |
| VPRef Int Prec | The value of a subtranslation parsed with outer precedence. |