-
Notifications
You must be signed in to change notification settings - Fork 20
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
Add specification of default cell pin values #35
Conversation
It's a bit tricky because the same fields are also being used to encode other info like inversion, but this is how
likewise for nextpnr-xilinx:
|
In fact, a question I have is whether it made sense to have a unified CellPin parameters field, that would comprehend inversion and defaults when the pin is left unconnected. |
Yes, I think that makes sense |
Updated - this is a breaking change due to some renaming, I'm not sure how best we want to handle that wrt RapidWright and python-fpga-interchange changes? |
@gatecat - I need to think a bit more about this. There are a couple of potential complications around this idea. I believe (?) we made an explicit decision that the place and route tools should not be doing transforms on the netlist which this kind of looks like and we have also generally eared on the side of being more strict as well. On the flip side, describing the "default state" of things seems like a potentially good idea too.... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW - There is guidance on how to evolve your protocol at https://capnproto.org/language.html#evolving-your-protocol
@gatecat - Perhaps you have a broader perspective when seeing how things are handled through other architectures. However, from my understanding unused cell pins receive a default pin mapping through the
As you noted, the changes will break compatibility with previous versions. I'm ok to accommodate breaking changes if needed, but we probably want to make it an exceptional process. This topic, however, probably requires some more discussion before moving to that point. |
To give some more context here, consider running the following Verilog through Vivado: module top();
(* keep, dont_touch *) RAMB18E1 ram_i ();
endmodule despite there being no ports given on the RAMB18E1, in practice Vivado will connect some ports to ground, some to Vcc, and leave others floating (I appreciate in hardware connecting to Vcc and left floating are the same, although this may not be the same for non-Xilinx devices): There is currently no logic in Yosys to do this, so it would pass a
It's notable that the interchange format already includes default values for parameters (which Yosys could also handle, and indeed has the data for already), so including the default values for ports doesn't seem such a great step. This would also be needed if cells are created at (post-)PnR time - imagine the equivalent of doing |
It's entirely possible to add this as a new field, separate from the inversion stuff as in the original version of this PR, which wouldn't be a breaking change btw - it's a question of whether we prefer a breaking change at this point, or a (possibly) slightly less neat format. |
@gatecat - On the topic of breaking change verse slightly less neat format, I think we should just get into the habit of never making a breaking change if possible. We should be able to just retire the old inversion stuff and replace it with the new pin properties follow https://capnproto.org/language.html#evolving-your-protocol right? |
@gatecat - Thanks for the RAMB18E1 example, I think I better understand what you are getting at. I can see that in this case there is a lack of default information when no user connectivity information is provided. The straight forward location (for me, at least) to add the default information would be on the
This change would not break backwards compatibility and would provide the most relevant context to the information in my opinion. |
I think |
I am in favor of making the default value property of a cell pin and having them defined for cells rather than within If we don't want a breaking change we can define another list next to |
Done, how does this look? This is no longer a breaking change at all either, which I think is probably better all things considered. |
@gatecat Looks good to me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given this is now backwards compatible and has dependent changes, I'm okay with moving forward.
The addition could use a more comprehensive comment (see the rest of the file for examples).
I've improved the comments a bit in my most recent force-push |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good enough. If Chris confirms he is happy, go ahead and merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, I think I can live with this approach. I'm assuming that cell pin defaults don't change based on which BEL they might be placed on, but that is an underlying assumption.
I added a couple minor considerations/suggestions.
interchange/DeviceResources.capnp
Outdated
|
||
struct DefaultCellConnection { | ||
# What is the name of this cell pin? | ||
name @0 : StringIdx; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the python-fpga-interchange project depends on the $stringRef()
annotation so that it can map the string enumerations into human-readable names. You'll probably want to add them to anything that is of type StringIdx
. Example is on line 384 of the original file:
name @11 : StringIdx $stringRef();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch, fixed
# cases). | ||
enum CellPinValue { | ||
# leave floating | ||
float @0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming we are intentionally being explicit here as I imagine (for Xilinx devices at least), the majority of pins will be float
. If we think spending the extra space is worth it, I can live with this decision. Otherwise, we could just declare float
as the implicit default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A small difference between float
and no entry at all, is that float
will create the cell pin if it's missing together but leave it floating which might matter in some cases and so I'd rather factor in.
In terms of space, I am not so sure that the majority of pins will be float
. Several of the large hard IPs like the PS7/8/9 have a default of ground for the vast majority of their pins (and vcc for most of the others, iirc); and they have thousands of pins.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That make sense, Let's keep it as is.
This adds structures for DeviceResources for the default values for cell pins that are missing or disconnected. Previously the contract was that the synthesis tool would always give cell pins a value, but this has several problems: - existing flows aren't doing this - cells might want to be created by the PnR tool or anything else reading the interchange format - sometimes, floating is a valid default value (for example certain dedicated pins) and the existing contract didn't recognise that - setting all disconnected pins to ground is definitely not correct, vendor tools usually connect disconnected clock enables to Vcc for example. Signed-off-by: gatecat <gatecat@ds0.me>
@acomodi / @mkurc-ant do you have permissions on this repo to merge this? |
This adds structures for DeviceResources for the default values for cell pins that are missing or disconnected.
Previously the contract was that the synthesis tool would always give cell pins a value, but this has several problems: