Skip to content

Commit 0fae693

Browse files
committed
docs(report): new section Including Scala Source Location
1 parent 93f8c5d commit 0fae693

File tree

1 file changed

+21
-1
lines changed
  • source/SpinalHDL/Other language features

1 file changed

+21
-1
lines changed

source/SpinalHDL/Other language features/report.rst

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,27 @@ will result in:
4242
4343
$display("NOTE miaou %t", $time);
4444
45+
Including Scala Source Location
46+
-------------------------------
47+
48+
After 1.13.0, You can optionally include the Scala call-site location (file and line) in the report output, which allows most IDEs to jump to the source when clicking the log line.
49+
50+
There are two ways to enable it:
51+
52+
.. code-block:: scala
53+
54+
// Per-call
55+
report("HELLO", includeSourceLocation = true)
56+
57+
// Globally (for all `report(...)` calls in this elaboration)
58+
SpinalConfig(reportIncludeSourceLocation = true).generateVerilog(new TopLevel)
59+
60+
Example generated output (Verilog):
61+
62+
.. code-block:: verilog
63+
64+
$display("path/to/MyTopLevel.scala:123: NOTE HELLO");
65+
4566
**Automatic Handling of Scala Primitive Types (SpinalHDL ^1.12.2)**
4667

4768
You can embed Scala primitive types (e.g., `Int`, `Boolean`, `Float`, `BigInt`, `BigDecimal`, `Char`, `Byte`, `Short`, `Long`) within `L""` interpolated strings without explicit `.toString()` calls.
@@ -106,4 +127,3 @@ This will produce a compact, readable output like:
106127
.. code-block:: text
107128
108129
PacketHeader(packetLength=0x0c, packetType=0x1, payload=DataPayload(value=0x5678, checksum=0x78))
109-

0 commit comments

Comments
 (0)