xls icon indicating copy to clipboard operation
xls copied to clipboard

Add source location directives in DSLX for trace/error logging

Open mikex-oss opened this issue 1 year ago • 0 comments

What's hard to do? (limit 100 words)

In SystemVerilog (and similar constructs exist in various software languages), we can use `__FILE__ and `__LINE__ to access the current source location, which can be useful for traces and other logging.

The example given in LRM 22.13 is:

$display("Internal error: null handle at %s, line %d.",
`__FILE__, `__LINE__);

This would dump something like:

Internal error: null handle at platforms/deepsea/logic/gfc/rtl/foo.sv, line 7.

I don't think DSLX users currently have the ability to express this.

Current best alternative workaround (limit 100 words)

As I don't think this can be expressed through DSLX currently, the source info will be omitted.

Your view of the "best case XLS enhancement" (limit 100 words)

Provide similar directives in DSLX that users can use in trace_fmt! and possibly elsewhere to highlight where the dump is coming from.

mikex-oss avatar Jun 07 '24 18:06 mikex-oss