Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[enhancement] Add ability to discern asserts from different instances of the same proc #1874

Open
koblonczek opened this issue Jan 23, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@koblonczek
Copy link

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

In a tree of procs, when one the child procs throws an assertion, there's no way to know which instance of the child proc did it. This hampers debuggability when there are multiple instances of the same proc. Only reference to the file and line are printed. For example, in a system with multiple RAMs this doesn't give enough info which RAM had its assertion violated:

xls/examples/ram.x:254:14-254:106
0252:       let mem_initialized_as_bits =
0253:         std::convert_to_bits_msb0(array_rev(mem_initialized[read_req.addr]));
0254:       assert!(read_req.mask & !mem_initialized_as_bits == uN[NUM_PARTITIONS]:0, "memory_not_initialized")
~~~~~~~~~~~~~~~~~~~^------------------------------------------------------------------------------------------^ FailureError: The program being interpreted failed! memory_not_initialized
0255:     } else { () };

Current best alternative workaround (limit 100 words)

To differentiate between different instances one can add an instantiation parameter that will serve as an "ID" of the proc (while supplying unique values during instantiation) and add additional logging statements:

proc SomeProc<ID: u32, ...> {
  next(state: State) {
    // assertions
    if (!condition) {
      trace_fmt!("{:x} assertion_message", ID);
    } else {};
    assert!(condition, "assertion_message");    
  }
}

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

Having additional info printed about where in the hierarchy the error came from.
Related to #1236, although that one asks for printing hierarchy in trace! and trace_fmt! calls.

@koblonczek koblonczek added the enhancement New feature or request label Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant