SystemRDL / systemrdl-compiler

SystemRDL 2.0 language compiler front-end
http://systemrdl-compiler.readthedocs.io
MIT License
226 stars 64 forks source link

JSON (intermediate) format exporter #13

Closed kevbroch closed 5 years ago

kevbroch commented 5 years ago

I am intrigued by your comment in #11 about exporters (HTML, IP-XACT).

Wanted to see what your thoughts are about having a JSON exporter? My interest in this would be to then be able to use that JSON with a template engine to export other formats (doc, sw, uvm).

amykyta3 commented 5 years ago

No plans at the moment. Do you have a specific template engine in mind?

Rather than writing out an intermediate JSON format, have you considered exporting directly from the register model that this compiler generates? In the HTML exporter I mentioned, I use the Jinja template engine to generate the resulting web content directly off of the python register model. I've used Jinja for several projects and have been really happy with its capabilities.

My hesitation is that a "generic" JSON exporter may end up as a very loosely defined goal. The conversion to JSON would inevitably shed a lot of metadata about the register model that may make it pretty design-specific. I ran into this as a "3rd party user" when working with the XML format that ORDT generates - I was always reaching for that extra info that ended up getting discarded.

That said, creating a JSON serializer wouldn't be too difficult to create using the existing API that this project provides + Python's json library.

Be sure to check out the HTML and IP-XACT exporters. I just happened to publish their initial releases to PyPi last night: https://github.com/SystemRDL/RALBot-html https://github.com/SystemRDL/RALBot-ipxact Eventually, I may glue these individual components into a more unified tool.

kevbroch commented 5 years ago

I have used Jinja and am also happy with it. I will definitely look into the HTML exporter (I wasn't watching those repo in gitlab yet but I am now).

My initial thoughts with the JSON exporter is it would provide all the information needed for various functional groups (HW & SW Design, Verification, Docs) but I do see your point of this being a loosely defined goal. With that JSON others in the functional groups would be more comfortable using it and a Jinja2 template to render their outputs.

I really appreciate your feedback and this project!

Best, /<evin

On Wed, Nov 7, 2018 at 9:21 PM Alex Mykyta notifications@github.com wrote:

No plans at the moment. Do you have a specific template engine in mind?

Rather than writing out an intermediate JSON format, have you considered exporting directly from the register model that this compiler generates? In the HTML exporter I mentioned, I use the Jinja http://jinja.pocoo.org template engine to generate the resulting web content directly off of the python register model. I've used Jinja for several projects and have been really happy with its capabilities.

My hesitation is that a "generic" JSON exporter may end up as a very loosely defined goal. The conversion to JSON would inevitably shed a lot of metadata about the register model that may make it pretty design-specific. I ran into this as a "3rd party user" when working with the XML format that ORDT generates - I was always reaching for that extra info that ended up getting discarded.

That said, creating a JSON serializer wouldn't be all to difficult to create using the existing API that this project provides + Python's json library.

Be sure to check out the HTML and IP-XACT exporters. I just happened to publish their initial releases to PyPi last night: https://github.com/SystemRDL/RALBot-html https://github.com/SystemRDL/RALBot-ipxact Eventually, I may glue these individual components into a more unified tool.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/SystemRDL/systemrdl-compiler/issues/13#issuecomment-436876839, or mute the thread https://github.com/notifications/unsubscribe-auth/AAKwc1cnxJBJqp-6K1yCMOu15nvrfN3jks5us79UgaJpZM4YS4ni .