-
Notifications
You must be signed in to change notification settings - Fork 112
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
parse_pdf_modules.py seems to be not working #1243
Comments
I was thinking, it is probably enough to know which version of the UG953 was used (and could be written in a README). In a mature product (in this case the user guide), is not awaited changes on the primitives. I mean, maybe the first versions are incompleted, but when completed no more primitives are added. |
I had been studying There are 79 modules in I'm missing something? @mithro ? Any idea about that? Under each Primitive sub-section, the string "Primitive: " is found, maybe we need to use it, thinking how to solve the missing ports declarations. |
Hi. So it looks like the version of UG953 I used at the time was 2014.2. I have no idea why that version in particular TBH! It seems very outdated. The UG version should definitely be included in the generated output! The reason the script doesn't work on newer versions of UG953 is because the PDF outline ("TOC") has changed structure. In 2014.2 each entity has indexed subheadings in the TOC - namely Port Descriptions and Available Attributes - that the script uses to figure out which subset of the PDF pages to parse. The newer versions of UG953 do not have this same PDF structure so the script doesn't find anything that matches what it expects, and returns an empty XML. Obviously it is undesirable to be relying an old version of the UG. The script should be updated in order to parse the PDF without needing the TOC, so that different versions can be used. I don't think it is a lot of work, but it is definitely non-trivial. I should have some time these holidays though. Sorry for the confusion! |
Ok, don't worry. Only FYI, I tried with version 2014.2 and 2014.1, both the same:
Whatever, what worries me most is what I said about the number of primitives:
I check 2014.2 and there are also 115 primitives with 79 Port Descriptions (transceivers do not have a port descripction, most LUTs also not, etc). I will think alternatives :P let me know if I can help you. |
It's very strange you get the IndexError exception on 2014_2 when I do not. Regardless, I think I know what causes this and have updated the script to work around it. As a bonus, it can now parse 2015_4 without issue and I have updated the XML file. The initial scope of the script was to just extract the port descriptions, which is why any primitive without ports was excluded. But I don't see why it shouldn't just read out all the elements, so I removed that requirement and the script now extracts all 115 primitives instead of 79. |
Great :-D I will check your commit.
The thing is, that the primitives without Port Desc section, have ports, only the section is missing. Again, I will check what is now generated ;-) |
Looks like with the changes the script can parse up to 2018_2 without issue. They changed the PDF structure in 2018_3, so the script cannot process newer than that without a significant rewrite. Fair point about the port description section being missing sometimes despite having ports. In that sense the script's approach is limited because it relies on that documentation existing. I suppose you could parse the instantiation template instead, but that would also be a potentially significant rewrite. |
Now, as you said, the 115 modules are there :-D but see what happens with, for example, LUT1 to LUT4:
But check for example LUT1, and you will see that It has ports: This is the problem currently. But there are two good news :-D now it works to me with version 2015.4, and I tried with the UG615 (Spartan-6 Libraries Guide for HDL Designs) and it almost works :P failed with:
That I assume that is easy to fix, by you... Haha. In fact, I think that support version 2015.4 is enough and additionally it can also work for Spartan 6 and solve #1246. |
The script doesn't read the instantiation templates, so I guess those particular entities that lack the descriptions table have to be handled manually. The intention was to parse the documentation instead of the code template to avoid any potential licensing issues. Extracting the text is not entirely trivial - the PDF doesn't contain text in paragraphs or even sentences - sometimes a text object is just an individual letter. So text must be transformed and combined by algorithm, which can be error-prone. Annoyingly there are lots of inconsistencies with how the tables are laid out so there need to be rules that correct for certain special cases. In particular, the attributes table for PLL_BASE in UG615 contains stupid separator rows that throw off the text-merging and break the extraction. Otherwise, with some minor fixes I was able to parse UG615 with the latest commit. I did notice some issues though that will need to be addressed with special cases (e.g. ICAP_SPARTAN6). Maybe you can check which ones are problematic and we can resolve in #1246. |
I had a couple of thoughts;
|
|
I checked with several version (not all). The first available is the 2012.2. The last one where the script works is the 2018.2. So, I downloaded all the 201x.2. From 2012.2 to 2014.1 (previously downloaded) the script didn't work in my machine. The first where the script works is the 2014.2. I found something between 2014.2 and 2015.2... Ports order of two components (SRL16E and SRLC32E) changed. I am thinking that... The port order in the Port Description tables is not necessary the real order... Must be checked. Between 2015.2 and 2016.2 an attribute disappeared:
Between 2016.2 and 2017.2 an attribute changed:
Between 2017.2 and 2018.2, two None changed to NONE. |
The two Port Description tables in the previous post, are for SRL16E... Here the port order of this primitive:
|
Hi @mjasperse, your last commit works with 2018.2 which I think that is enough. Moreover, it works with the last doc about Spartan 6 and probably with others, such as Spartan 3 (all), Virtex 4, 5 and 6, because the documents are similar structured. There are still problems, but related with the available resources (the PDF docs). Hi @mithro, I have been studying the primitives in ISE and Vivado. There are several problems with the PDF docs:
I am interested in this topic and I really want to contribute, but I think that another approach must be taken. Let me know your ideas about that. Regards |
@rodrigomelo9 Any chance you are at 36c3, if so you should come say Hi! The idea with the PDF parsing is a first step. It is suppose to generating a baseline of modules which need to be supported to be compatible with the Xilinx tools. It's suppose to be a cross-checking / validation tool to make sure that we haven't missed modules and similar. Once we have the baseline, we will then need to manually create the mapping between the Xilinx names and the names / functionality we use in Project X-Ray (which are similar but not 100% the same). |
No :-( I am actually so far from there, but I will try to be at OSDA in March.
Ok, the actual state of the @mjasperse branch seems great to me in this direction, and can be used also to get modules from Spartan 6 and other families. The script could be moved to utils maybe? As I said, I had been studying the ISE and Vivado primitives these days (where located, which are primitives and which are retargeted wrappers, etc). I think that it could be useful to have a place with all the cells, a library for each device pointing to the respective primitives, and a method (scripts) to test the support status. Anyway, these are things to be followed in another place or issue probably (please, let me know the best option). I suppose that there are persons working on that (to support in Yosys and nextpnr). Are they in sync somewhere? |
Hi @mjasperse I see that you work on
xc7/libraries/parse_pdf_modules.py
.I prepared the conda environment as said in the main README, I downloaded the last ug953 (2019.2) and run:
The output was:
I tried some different versions. With 2017.4 and 2018.3 the same happens. With 2015.4 I get:
I am doing something wrong? Do you remember what version has you used? (could be a part of the XML information :-P ).
Thanks.
The text was updated successfully, but these errors were encountered: