Packages

c

chisel3

PrintableHelper

implicit final class PrintableHelper extends AnyVal

Implicit for custom Printable string interpolator

Source
package.scala
Linear Supertypes
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. PrintableHelper
  2. AnyVal
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new PrintableHelper(sc: StringContext)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    Any
  2. final def ##: Int
    Definition Classes
    Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def cf(args: Any*): Printable

    Custom string interpolator for generating formatted Printables : cf"..."

    Custom string interpolator for generating formatted Printables : cf"..."

    Enhanced version of scala's f interpolator. Each expression (argument) referenced within the string is converted to a particular Printable depending on the format specifier and type.

    For Chisel types referenced within the String
    For Printable type:

    No explicit format specifier supported - just return the Printable.

    For regular scala types

    Call String.format with the argument and specifier. Default is %s if no specifier is given. Wrap the result in PString Printable.

    For the parts of the StringContext

    Remove format specifiers and if literal percents (need to be escaped with %) are present convert them into Percent Printable. Rest of the string will be wrapped in PString Printable.

    Example:
    1. val w1  = 20.U // Chisel UInt type (which extends Bits)
      val f1 = 30.2 // Scala float type.
      val pable = cf"w1 = $w1%x f1 = $f1%2.2f. This is 100%% clear"
      
      // pable is as follows
      // Printables(List(PString(w1 = ), Hexadecimal(UInt<5>(20)), PString( f1 = ), PString(30.20), PString(. This is 100), Percent, PString( clear)))
    Exceptions thrown

    IllegalArgumentException if the number of parts in the enclosing StringContext does not exceed the number of arguments arg by exactly 1.

    StringContext.InvalidEscapeException if a parts string contains a backslash (\) character that does not start a valid escape sequence.

    UnknownFormatConversionException if literal percent not escaped with % or if the format specifier is not supported for the specific type

  6. def getClass(): Class[_ <: AnyVal]
    Definition Classes
    AnyVal → Any
  7. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  8. def p(args: Any*): Printable

    Custom string interpolator for generating Printables: p"..." mimicks s"..." for non-Printable data)

  9. val sc: StringContext
  10. def toString(): String
    Definition Classes
    Any

Inherited from AnyVal

Inherited from Any

Ungrouped