Skip to content
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

Exception when Setting default fileset in design #59

Open
RasmusGOlsen opened this issue Oct 4, 2023 · 3 comments
Open

Exception when Setting default fileset in design #59

RasmusGOlsen opened this issue Oct 4, 2023 · 3 comments
Labels
Bug Something isn't working Question Further information is requested

Comments

@RasmusGOlsen
Copy link

I get an exception when trying to set the default fileset in the design. Using fileset.Name work, but not with the fileset object. Looking at the source it seems like both ways should be supported.

project = Project('default')
fileset = Fileset('myfileset')
project.DefaultDesign.DefaultFileSet = fileset
  File "/home/rgo/devel/simplhdl/src/simplhdl/__main__.py", line 60, in main
    simpl.create_project(args.projectspec)
  File "/home/rgo/devel/simplhdl/src/simplhdl/simplhdl.py", line 30, in create_project
    project.DefaultDesign.DefaultFileSet = fileset
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rgo/devel/project-template/_env/Project-Template/lib/python3.11/site-packages/pyEDAA/ProjectModel/__init__.py", line 1195, in DefaultFileSet
    raise Exception(f"Fileset '{value}' is not associated to this design.")
Exception: Fileset '/home/rgo/devel/project-template/cores/adder.core/sim/import_list' is not associated to this design.

@DefaultFileSet.setter
def DefaultFileSet(self, value: Union[str, FileSet]) -> None:
if isinstance(value, str):
if (value not in self._fileSets.keys()):
raise Exception(f"Fileset '{value}' is not in this design.")
self._defaultFileSet = self._fileSets[value]
elif isinstance(value, FileSet):
if (value not in self.FileSets):
raise Exception(f"Fileset '{value}' is not associated to this design.")

@Paebbels
Copy link
Member

Paebbels commented Oct 6, 2023

The fileset is not linked / in the same project, that's why the error is

Fileset '....' is not associated to this design.

fileset = Fileset('myfileset')

Is a standalone fileset, not linked to project.

Try this:

project = Project('default')
fileset = Fileset('myfileset', project=project)

project.DefaultDesign.DefaultFileSet = fileset

The idea was: If you have 2 projects (A and B) in your application, you can't mix filesets from A and use/assign them in project B. That's why like 1194 looks up the fileset if its a known fileset, but not yet the default fileset.

@Paebbels Paebbels added the Question Further information is requested label Oct 6, 2023
@RasmusGOlsen
Copy link
Author

Ok, that makes sense, that you cannot assign a default fileset if it's not part of the design. However, I find this line confusing.

fileset = Fileset('myfileset', project=project)

If you create a fileset with a reference to the project, it is not clear to me how the project has a reference to the fileset.
I would believe I would have to do this.

project = Project('default')
fileset = Fileset('myfileset')
project.project.DefaultDesign.AddFileSet(fileset)
project.DefaultDesign.DefaultFileSet = fileset

The AddFileSet method would then set the references to the project and the design for the FileSet and all its children.
I guess the project and design reference should also be a list if the FileSet is part of multiple designs and projects.

@Paebbels
Copy link
Member

Paebbels commented Oct 8, 2023

Almost all objects are double linked. So e.g. a project knows its designs and a design knows its project.

To enhance the speed, keep work from users setting up the linking and ensuring data structure integrity, this linking is done when ever A is linked to B or B to A. I always try to implement data structures that top-down assembly and bottom-up assembly words as well. Sometimes one is slightly faster then the other (usually top-down).

So you can create an object and hand over the parent object (like shown in my example) or you use later a property to set the relation. In both cases the code takes care of linking forward and backward and sometimes ever for updating statistics and fast lookup structures.

Top-down:

project = Project('default')
fileset = Fileset('myfileset', project=project)

Bottom-up:

fileset = Fileset('myfileset')

project = Project('default')
fileset.Project = project

BUG:
As I looked into the code and saw the reverse linking is missing in Fileset. argh

@Paebbels Paebbels added the Bug Something isn't working label Oct 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Question Further information is requested
Development

No branches or pull requests

2 participants