-
Notifications
You must be signed in to change notification settings - Fork 270
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
Sigasi VUnit Integration Discussion #347
Comments
I would prefer if such an interface used the Python API. The command line interface is for end user usability not for tool integration. For example: from vunit import get_all_builtins
for library_name, file_name in get_all_builtins():
print(library_name, file_name) |
We don't want all builtin libraries, we only want to find libraries that are actually used. What files are included and what libraries are available depends on the used VHDL version (and perhaps there may be more options in the future?). Both are configured in run.py. How about this: we could run a script like the one above to get the list of builtin library names. Using that list we could do "py run.py -f" and filter using the known builtin libraries. |
Is your use model that the user maintains a |
Yes |
In this case would it not be better to add a general By the way what is the need to differentiate between built-in files and user added files? Is it not between Sigasi-managed and VUnit-managed files that you want to differentiate? If you provided an project.csv to VUnit like you suggest in #348 then you can subtract those files from the ones reported by |
What's about a python method, which exports the vhdl files in a specific format. For example i would like a .tcl Script, which i can load in vivado, so that all source files are added to my project. Same method could be used for other vendor tools. |
After further reflection I do not think using My reasons are as follows:
Based on this reasons I think we should define a Machine-to-Machine data format for Sorry to make this more complicated for you but I think we will be thankful in the future. |
Regarding the format of the JSON export I think it should be something like this: {
"version": "3.7.1",
"files": [
{
"name": "tb_example.vhd",
"library_name": "lib"
},
{
"name": "tb_example_many.vhd",
"library_name": "lib"
}
],
"test_cases": [
{
"name": "lib.tb_example.all",
"file_name": "tb_example.vhd",
"lineno": 18,
"multi_test_simulation": false
},
{
"name": "lib.tb_example_many.test_pass",
"file_name": "tb_example_many.vhd",
"lineno": 22,
"multi_test_simulation": false
},
{
"name": "lib.tb_example_many.test_fail",
"file_name": "tb_example_many.vhd",
"lineno": 25,
"multi_test_simulation": false
},
]
} The version would be the version of VUnit. Using this format we can hide a lot of complexity in how VUnit creates tests case names based on configurations and such. |
I can also think of another reason why using |
I will have an implementation of |
I have implemented the |
@kraigher, since all the files must belong to one and only one library, would it be sensible to use this format instead? "files": {
"lib": [
{ "name": "tb_example_many.vhd" },
{ "name": "tb_example.vhd" }
]
} or "files": {
"lib": {
"tb_example_many.vhd": { },
"tb_example.vhd": { }
}
} Equivalently, for tests: "test_cases": {
"lib.tb_example.all": {
"file_name": "tb_example.vhd",
"lineno": 18,
"multi_test_simulation": false
},
"lib.tb_example_many.test_pass": {
"file_name": "tb_example_many.vhd",
"lineno": 22,
"multi_test_simulation": false
},
"lib.tb_example_many.test_fail": {
"file_name": "tb_example_many.vhd",
"lineno": 25,
"multi_test_simulation": false
},
} or "test_cases": {
"lib": {
"tb_example.all": {
"file_name": "tb_example.vhd",
"lineno": 18,
"multi_test_simulation": false
},
"tb_example_many.test_pass": {
"file_name": "tb_example_many.vhd",
"lineno": 22,
"multi_test_simulation": false
},
"tb_example_many.test_fail": {
"file_name": "tb_example_many.vhd",
"lineno": 25,
"multi_test_simulation": false
},
}
} |
@1138-4eb I see the files and tests as lists of objects with fields. In your files proposal I do not see a nice way of adding more information about each file object without breaking backwards compatibility of the format or adding some other information on the side. With the format I implemented new fields can be added without breaking backwards compatibility. |
@kraigher the main idea was to use library names to group objects. I now edited it according to your comment, in order to allow the addition of more fields without breaking backwards compatibility. |
After your edit of the files proposal you have removed the disadvantage I mentioned. I cannot think of any objective difference between your current proposal and what I implemented. It is a matter of preference if you want to group files by libraries or view the library as a property of the file. Regarding your proposal to break out the library name from the test cases I would prefer to only use full test names in the export to avoid having the IDE needing to duplicate the VUnit logic for creating full test names from the fragments which would inhibit VUnit from changing how names are created in the future. |
My use case is to generate a list of files to be used in a TCL script that runs a synthesis tool. E.g. for {set i 0} {$i < [llength $libs]} {incr i} {
eval "set alib $[lindex $libs $i]"
foreach j $alib {
add_input_file [lindex $dirs $i]/hdl/$j.vhd -format {VHDL_2008} -work [lindex $libs $i]
}
} In order to get all the files that belong to a library, with you current proposal the name must be parsed. So, all the list/array must be processed to get/discard the files corresponding to a library. E.g. to ignore those in library 'test' or 'sim'. A different context where grouping file/test according to the libraries is useful, is to show a tree view in a GUI. If the user wants to see all of them without hierarchy, it is easier for a tool to append fields rather than split them. However, as you say, changing how names are created might be a breaking change. Note that these suggested changes are related to:
files_dict = dict()
for x in vu.get_compile_order():
try:
files_dict[x.library.name].append(x.name)
except:
files_dict[x.library.name]=[x.name]
with open('compile_files.json', 'w') as outfile:
json.dump(files_dict, outfile, indent=2) |
I have to generate a tcl script for the same reason too.
This, or an |
@davidmedinasigasi @lievenlemiengre Have any thoughts on my recent comments regarding |
@kraigher, We think the
|
|
@davidmedinasigasi @lievenlemiengre I just pushed the export json stuff to the master branch now. I also changed the test case line number location into a character offset + length to make it more precise. |
@kraigher I'm currently updating the VUnit integration with Sigasi with the new export-json. So far everything is working as expected with the json, but I'm getting wrong offsets in Windows and I think it's because of the newlines. |
You are probably correct. I will investigate. |
@davidmedinasigasi I tried here with files containing CRLF (\r\n) and I could not reproduce the problem. Sure the problem is not on your side? |
@kraigher I just tested the run project on both windows and linux, both with linux and windows newlines. No matter which of the configurations you run this command on, it always returns the following entry in the json:
Obviously this offset should change depending on the kind of newlines you use ( |
@tivervac I could reproduce the problem and pushed a fix to master. |
@kraigher Thanks! When can we expect to see this in a release? |
@davidmedinasigasi If you can confirm that it works I will make a release now. |
@kraigher It works perfectly |
Good it is part of the latest release. |
@kraigher, I just noticed that when VUnit generates a Json for a system verilog test, the macro offsets are included in the test offset, is that intended? |
What do you mean exactly? |
Does VUnit take in account the macro to calculate the test offset? |
I am still not sure what you mean. The test case scanning if I recall correctly does just find the |
The Sigasi integration is mature enough that this issue can be closed. |
I propose to add a '--vunitFiles' to list all the libraries and files that an external tool like Sigasi needs to import this project.
The difference with '-f' parameter is that will only list the files that are built into vunit.
This is one of the steps for the Vunit integration with Sigasi Studio.
The text was updated successfully, but these errors were encountered: