f4pga / f4pga-arch-defs

FOSS architecture definitions of FPGA hardware useful for doing PnR device generation.
https://f4pga.org
ISC License
256 stars 109 forks source link

Create a Python library for generating VtR arch.xml file #99

Open mithro opened 6 years ago

mithro commented 6 years ago

Currently we generate all the arch.xml files by either;

As @jhol points out, it would be much easier to generate a lot of the definitions in Python and then dump the XML from that.

This would also make it easier to do the many variations of the testing architectures.

mithro commented 6 years ago

We could also look at migen to generate Verilog from the same structures.

mithro commented 6 years ago

The Verilog to arch generator could use this API too...

mithro commented 6 years ago

@jhol has some examples of how this might work here -> https://github.com/jhol/icestorm/blob/vtr-py/icebox/vtr.py

GitHub
jhol/icestorm
icestorm - Project IceStorm - Lattice iCE40 FPGAs Bitstream Documentaion (Reverse Engineered)
mridubhatnagar commented 6 years ago

Have worked on create an XML, parsing an XML, with Python.

Is this what the issue needs?

mithro commented 6 years ago

Hi @mridubhatnagar,

We want to be able to programmatically generate Verilog to Routing FPGA architecture files. These XML files describe the internals of an FPGA.

We could just use the DOM to do this, but the DOM is not a great Python API. It also sucks if we change from using XML format to some other type of format.

So what we are after is a Python API for creating these FPGA structures and then a way to convert these FPGA structures to and from the XML format.

You can see how @jhol was doing this here and use that as inspiration. You can also see our rr_graph library as inspiration too.

One approach to this would be creating an XML schema for the file format and then auto-generating the Python API from that, see the following examples;

lxml.de's objectify might be another way to do this.

The first goal would be to easily generate the same architecture files as found in the testarch repository before building up towards being able to generate much more complicated structure.

If you want to chat more, find mithro on the ##openfpga IRC channel or email me at me@mith.ro.

Hope that helps!

generateDS -- Generate Data Structures from XML Schema
PyXB: Python XML Schema Bindings — PyXB 1.2.6 documentation
GitHub
knorby/pyxsd
pyxsd - Python Class Mappings for XML Schema
mithro commented 6 years ago

Also see the related issue here -> https://github.com/SymbiFlow/ideas/issues/4

mithro commented 5 years ago

There is a WIP at https://github.com/leon575777642/vprgen/tree/master/vprgen

GitHub
leon575777642/vprgen
VPR's architecture description and routing resource graph XML generation API - leon575777642/vprgen