google / grumpy

Grumpy is a Python to Go source code transcompiler and runtime.
Apache License 2.0
10.55k stars 647 forks source link

pythonparser for FPGA #329

Closed joeblew99 closed 7 years ago

joeblew99 commented 7 years ago

Its just a co-incidence but i have been working on FPGA stuff the last week. Am trying out code generating from golang --> fpga.

I noticed your using m-labs Python parser ( https://github.com/m-labs/pythonparser ) , which was originally developed for python <--> FPGA (verilog, and others) code gen and synthesis. So this means that grumpy is parsing the python to AST, and then codegens the golang right ? What do you think about the viability of codegen the opposite direction? golang --> python --> FPGA

BTW there is another framework that does this and the code is alarmingly similar to golang. http://cx-lang.org/

trotterdylan commented 7 years ago

golang --> python --> FPGA is certainly doable, but Grumpy's (and pythonparser's) implementation is very tied to Python being the source language, so it'd offer no help going the other direction.

joeblew99 commented 7 years ago

i was thinking of back porting the Migen python code to golang using grumpy. This would take python out of the loop. Then its golang --> verilog.

https://github.com/m-labs/migen https://sourcegraph.com/github.com/m-labs/migen@master/-/blob/migen/__init__.py#L8:14

The FHDL is the key.