edaa-org / pyEDAA.ProjectModel

An abstract model of EDA tool projects.
https://edaa-org.github.io/pyEDAA.ProjectModel
Other
11 stars 1 forks source link

How can I specify File attributes? #53

Open RasmusGOlsen opened 1 year ago

RasmusGOlsen commented 1 year ago

How can I register attributes to a File object? I want to register an attribute to specify which scopes I want to use the file in. It could e.g. be in a simulation or synthesis scope or both. Maybe there is another way to specify this, that I have missed.

Paebbels commented 1 year ago

This is related to:

Currently, only one UsedIn attribute called UsedInAttribute is implemented for AMD (former Xilinx) Vivado. Vivado uses that attribute like you describe to mention if a file is used in: synthesis, simulation. In addition if the dialog is used with ..., there are dozens of used in options like for routing, placement, drc, ...

The attribute is used via Pythons element syntax:

usedInAttr = vhdlFile[UsedInAttribute]

Example: https://github.com/edaa-org/pyEDAA.ProjectModel/blob/main/pyEDAA/ProjectModel/Xilinx/Vivado.py?ts=2#L157

So if you're looking to solve the problem for Vivado, I did already implement it. If you think this should be generally available, we can talk about it and also about possible values.

While the Vivado solution is oriented on high-level and low-level steps in one toolchain, I can also read your question to distinguish files for separate toolchains like synthesis and simulation, where some files are shared and others are disjunct.

Paebbels commented 1 year ago

On dev branch, I implemented first improvements for this.

Unfortunately, I used __len__() for number of files and number of filesets. This dunder method is now repurposed to the number of attributes on a file, fileset, design, or project.

As a replacement, FileCount, TotalFileCount, FileSetCount and TotalFileSetCount are added.