StrInterpOps

dfhdl.core.DFBits$package.DFBits.StrInterpOps
opaque object StrInterpOps

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

object BinStrCtx

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
BinStrCtx.type

Types

opaque type BinStrCtx

Extensions

Extensions

extension (sc: StringContext)
def b: BinStrCtx

Binary Bits Vector String Interpolator

Binary Bits Vector String Interpolator

Syntax:

b"width'bin"
  • bin is a sequence of '0', '1', and '?' characters, indicating a bit bubble.
  • Separators ' ' (space) or '_' (underscore) within bin are ignored.
  • width, followed by a ', is optional and specifies the bit vector's width. If omitted, the width is inferred from the sequence length. If specified, leading zeros are added or the sequence is truncated based on the width. Truncation only occurs if the most significant bits being removed are zeros; otherwise, it triggers a compilation error.

Attributes

Returns

A DFHDL Bits vector.

Note

This interpolator does not accept external arguments through ${arg}.

Example
 b"1"        // Value = 1
 b"1000"     // Value = 1000
 b"8'1000"   // Value = 00001000
 b"3'0100"   // Value = 100
 b"3'1100"   // Compilation error
 b"1?11"     // Value = 1?11 (? indicates a bit bubble)
 b"11_00"    // Value = 1100
def h: BinStrCtx

Hexadecimal Bits Vector String Interpolator

Hexadecimal Bits Vector String Interpolator

Syntax:

h"width'hex"
  • hex is a sequence of hexadecimal characters ('0'-'9', 'A'-'F', 'a'-'f', and '?') where '?' indicates a 4-bit bubble. Each character represents a 4-bit nibble.
  • Separators ' ' (space) or '_' (underscore) within hex are ignored.
  • Binary sequences can be embedded within {bin} tags, allowing integration of binary bit sequences of any length, not necessarily divisible by 4, between hex nibbles.
  • width, followed by a ', is optional and specifies the bit vector's width. If omitted, the width is inferred from the sequence length. If specified, leading zeros are added or the sequence is truncated based on the width. Truncation only occurs if the most significant bits being removed are zeros; otherwise, it triggers a compilation error.

Attributes

Returns

A DFHDL Bits vector.

Note

This interpolator does not accept external arguments through ${arg}.

Example
 h"1"        // Value = 0001
 h"27"       // Value = 00100111
 h"6'27"     // Value = 100111
 h"5'27"     // Compilation error
 h"2?"       // Value = 0010????
 h"F{00}F"   // Value = 1111001111
 h"3_3"      // Value = 00110011