-
Notifications
You must be signed in to change notification settings - Fork 21
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
Property type considerations #12
Comments
String properties require quotes if they are quoted strings. My processing of Yosys JSON might be messing this up and need to be fixed. So for example:
Should actually be encoded as:
That make sense? |
Yes, that makes sense. I hadn't actually checked that the JSON frontend was doing. I'm still not sure if encoding two fundamentally different types of property into a string is the best option with access to all the power of a proper schema; storing bit vector parameters as a vector of bytes/32-bit words/etc would seem easier to work with to me. |
This immediately runs into problems with LUTs (64-bits) and BRAM init strings (256-bits). As a future extension, we could add a varint property field, but I think operating on verilog encoded strings is probably the right short-term answer. |
Yes, that's why I suggested a vector of bytes/words
Don't have a massive problem with this provided that the semantics are well defined so we don't end up in a situation where different tools have slightly different ideas of what Verilog encoded string means (ime these kinds of differences tend to cause big problems with EDIF interoperability). |
So the initial solution here is to require that user supplied primitive cell parameters follow the format of the default parameters of the library definition (in the device database)! So if the device database primitive cell default is One way to handle the Nexus use of c-style hex constants (e.g. |
I've tried to address this in #19, take a look with that in mind. |
At the moment, it appears like there are three allowed kinds of properties:
The second two of these look reasonable. However, I think it would be prudent to distinguish between a string that is actually a string value (something like https://github.com/YosysHQ/yosys/blob/master/techlibs/nexus/cells_sim.v#L95, Lattice use these a lot) and a string value that is actually containing a bitvector (e.g. encoded as a Verilog constant).
Without that difference being stored; I don't think it will be possible to reliably go back to a Verilog netlist from an interchange netlist - the original value could have either been the bitvector
16'h1234
; or actually a string"16'h1234"
(equivalent to a much longer bitvector containing the ASCII values of those characters).Yosys originally made a similar design mistake in its JSON format and now we have to live with a somewhat horrible escaping scheme involving postfixed spaces for disambiguation: https://github.com/YosysHQ/yosys/blob/master/backends/json/json.cc#L403-L405
The text was updated successfully, but these errors were encountered: