Open
Description
Right now source locations are collected in an unspecified format that has an ad-hoc serialization to Yosys RTLIL and is also used in ad-hoc ways in other places. We should define a structured format which provides the following capabilities:
- Storing filename, start line, start column, end line, end column (unclear if 0-based or 1-based is preferable; will have to be adjusted for RTLIL output anyway).
- Combining several locations into an ordered sequence where the first one is "most specific" and the last one is "least specific". The definitions of these is intentionally ambiguous; editors will show the "most specific" location on the primary go-to-source (i.e. click or double click), but show all of the locations in order.
An example of where source locations would form an ordered sequence:
- Elaboration, where each next
Elaboratable
returned by anelaborate
method adds another source location. Currently, all of this information is lost (see Attachsrc
attributes to emittedmodule
s andcell
s #1130). lib.wiring
, where anIn(1)
could be created viaSignature({"ready": In(1)})
which itself is created viastream: Signature({"ready": In(1)})
in aComponent
, which itself is created elsewhere. Currently, almost all of that information (except for the location of theIn(1)
, which can be quite uninformative) is lost.
An alternative option is to provide a more complex data structure (dict? dict of lists?) for the list of source location, but this seems excessive, poorly defined, and would likely have to be flattened for Yosys anyways.
This issue is not about stabilizing the source location format. The actual Amaranth objects representing them remain unstable.
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity