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

Rewrite the xml parser in vpr to be based on DTD and auto generated. #4

Open
mithro opened this issue Dec 30, 2017 · 7 comments
Open

Comments

@mithro
Copy link
Contributor

mithro commented Dec 30, 2017

Currently the xml parser in vpr is hand coded.

It would be good to rip it out and replace it with a auto-generated xml parser based around a DTD which defines the file format.

Create a XML definition using DTD, XSD or Relax-NG -- unsure the best format... See;

Existing XML file formats in order of importance;

New XML file formats needing to be created;

The idea is eventually to auto-generate parser / code structures from the definitions; IE see --

@mithro
Copy link
Contributor Author

mithro commented Dec 30, 2017

XML formats include;

@Laksen
Copy link

Laksen commented Jul 15, 2018

I created schemas for the packed netlist and routing resource formats here: https://gist.github.com/Laksen/dc3fdf65a7eb6bb1186c46381215ac55

They don't match the examples 100% as the examples contain some undocumented values, but that should be easy to change

Gist
VPR XML Schemas

@Laksen
Copy link

Laksen commented Jul 15, 2018

I updated some types to use xs:double instead of xs:decimal to allow scientific notation.
Also a preliminary version of the architecture description has been added. There might be a few bits missing, but with the files I could find they almost passed validation.

There were some inconsistencies like default_* names in <fc> attributes where I chose the values from the documentation

https://gist.github.com/Laksen/cf67f1103e5c539bb44cd183d617aee8

Gist
GitHub is where people build software. More than 28 million people use GitHub to discover, fork, and contribute to over 85 million projects.

@mithro
Copy link
Contributor Author

mithro commented Jul 15, 2018

@Laksen this is awesome! Do you want to send them as a pull request in the https://github.com/SymbiFlow/symbiflow-arch-defs repo? The common/xml directory would be the right place.

GitHub
symbiflow-arch-defs - FOSS architecture definitions of FPGA hardware useful for doing PnR device generation.

@mithro
Copy link
Contributor Author

mithro commented Jul 16, 2018

@Laksen has added a schema for the existing XML formats in the pull request here -> f4pga/f4pga-arch-defs#195 - Thank you so much.

The next steps would be;
a) Figuring out the best way to generate Python and C++ code from the schemas.
b) Designing a new XML format (and appropriate schema) for the placement and route formats from VtR.
c) Using the XML schema's for automatic validation of the files.

@mithro
Copy link
Contributor Author

mithro commented Sep 19, 2018

https://www.codesynthesis.com/products/xsd/ looks pretty good but is under a GPL license and we really want to keep things open. The alternative is probably to follow an example shown at this page https://blind.guru/bmmlcxx.html and use Python + Jinja2 templates to create C++ code.

W3C XML Schema to C++ data binding compiler is an open-source, cross-platform XML Data Binding implementation for C++

@mithro
Copy link
Contributor Author

mithro commented Sep 19, 2018

The best example I have found is https://github.com/mlang/xsdcxx-musicxml

GitHub
Contribute to mlang/xsdcxx-musicxml development by creating an account on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants