ghdl-yosys-plugin
ghdl-yosys-plugin copied to clipboard
Expose src attribute to yosys
Currently the source location data present in GHDL is not preserved when creating a Yosys netlist.
This PR adds the /src
attribute to every cell when present in GHDL.
Note that this does not yet fix the problem where SymbiYosys just displays the instance name, but it's a good change nonetheless. I'll do a bit more digging on the SymbiYosys problem.
This requires PR https://github.com/ghdl/ghdl/pull/898 on GHDL for the Get_Source
function.
Oh, it might be that it needs a dollar prefixed name Otherwise it thinks it is a labeled assertion ( label: assert(x);
) and therefore prints the name instead of the location
There appears to be some logic for this in ghdl.cc
regarding Sname_Artificial
, so maybe there is a bug there. But I'm stuck on magic numbers again. The prefix of my assume gate is a magnificent 378
. Ah... ok... I see...
Do we need to set the location on all gates, or just on assume/assert ?
I mean, in principle there is no reason an AND gate can't have a corresponding source location. It's up to the GHDL side which ones are preserved.
I'm still completely stuck on why assert/assume are not system names in to_str
, so I hope you have an idea what's going on here. Once that's fixed, source locations in SymbiYosys should be working.
What's the status of this and ghdl/ghdl#898 ? My understanding is that not a lot of GHDL cells have a location set, but I think it could be merged and extended later with more locations?