Skip to content

Conversation

@reillymck
Copy link
Contributor

@reillymck reillymck commented Jul 1, 2025

I am querying a lot if an EDIFNet is GND or VCC, and it saves a lot of runtime for me if this information is a class member.

I also added a check so that when a port is added/created on the net, if it is an output port, then it resets the GND/VCC to unknown.

I am not sure if you guys are also interested in the feature, but I thought I would submit it. To avoid a branch instruction every time a port is added, we could instead invalidate the GND/VCC class member every time (instead of checking isOutput() on the port). This would have no performance impact for me.

@clavin-xlnx
Copy link
Member

I am querying a lot if an EDIFNet is GND or VCC, and it saves a lot of runtime for me if this information is a class member.

I also added a check so that when a port is added/created on the net, if it is an output port, then it resets the GND/VCC to unknown.

I am not sure if you guys are also interested in the feature, but I thought I would submit it. To avoid a branch instruction every time a port is added, we could instead invalidate the GND/VCC class member every time (instead of checking isOutput() on the port). This would have no performance impact for me.

Thanks @reillymck for the PR. I think this could be useful for some use cases. However, RapidWright can process some very large netlists and adding additional class member variables can cause memory usage to go up. Adding two Boolean class members could potentially add 32 bytes per EDIFNet instance which is quite a bit of overhead for two bits of information. We could encode the same two bits in a char, but adding an additional byte would cause alignment issues so it would likely take more than just one byte.

Another implementation would be to use an external map or set that keeps track of the nets that are VCC and GND. This would allow you to keep the EDIFNet object the same size in memory, and only expend the additional memory during the use case where it matters most.

@reillymck
Copy link
Contributor Author

I thought about the external set as well, especially since when I'm running the query, I'm done changing the source pins on all the nets. Good point on the memory overhead.

@reillymck reillymck closed this Jul 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants