SimLog

chisel3.SimLog
See theSimLog companion object
sealed trait SimLog

A file or I/O device to print to in simulation

val log = SimLog.file("logfile.log")
log.printf(cf"in = $in%0d\n")

val stderr = SimLog.StdErr
stderr.printf(cf"in = $in%0d\n")

// SimLog filenames themselves can be Printable.
// Be careful to avoid uninitialized registers.
val idx = Wire(UInt(8.W))
val log2 = SimLog.file(cf"logfile_$idx%0d.log")
log2.printf(cf"in = $in%0d\n")

Attributes

Companion
object
Source
SimLog.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def flush()(implicit sourceInfo: SourceInfo): Unit

Flush any buffered output immediately

Flush any buffered output immediately

Attributes

Source
SimLog.scala
def printf(pable: Printable)(implicit sourceInfo: SourceInfo): Printf

Prints a message in simulation

Prints a message in simulation

Prints a message every cycle. If defined within the scope of a when block, the message will only be printed on cycles that the when condition is true.

Does not fire when in reset (defined as the encapsulating Module's reset). If your definition of reset is not the encapsulating Module's reset, you will need to gate this externally.

May be called outside of a Module (like defined in a function), uses the current default clock and reset. These can be overriden with withClockAndReset.

Value parameters

pable

Printable to print

Attributes

See also

Printable documentation

Source
SimLog.scala

Inherited methods

def printf(fmt: String, data: Bits*)(using SourceInfo): Printf

Prints a message in simulation

Prints a message in simulation

Prints a message every cycle. If defined within the scope of a when block, the message will only be printed on cycles that the when condition is true.

Does not fire when in reset (defined as the encapsulating Module's reset). If your definition of reset is not the encapsulating Module's reset, you will need to gate this externally.

May be called outside of a Module (like defined in a function), uses the current default clock and reset. These can be overriden with withClockAndReset.

==Format Strings==

This method expects a ''format string'' and an ''argument list'' in a similar style to printf in C. The format string expects a String that may contain ''format specifiers'' For example:

 printf("myWire has the value %d\n", myWire)

This prints the string "myWire has the value " followed by the current value of myWire (in decimal, followed by a newline.

There must be exactly as many arguments as there are format specifiers

===Format Specifiers===

Format specifiers are prefixed by %. If you wish to print a literal %, use %%.

  • %d - Decimal
  • %x - Hexadecimal
  • %b - Binary
  • %c - 8-bit Character
  • %n - Name of a signal
  • %N - Full name of a leaf signal (in an aggregate)
  • %% - Literal percent
  • %m - Hierarchical name of the current module
  • %T - Simulation time

Value parameters

data

format string varargs containing data to print

fmt

printf format string

Attributes

Inherited from:
SimLogIntf (hidden)
Source
SimLogIntf.scala