You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Alternative to #2. Algorithms are defined via sympy symbolic expressions solely to enable term permutation in summations. But such permutations would also be possible in a Python AST.
Why not ast.parse a function definition to extract its AST? Some feature (i.e. node) pruning is necessary as most Python features are way beyond scope and would be near impossible to transfer upon C or HDL generation, but otherwise this approach would greatly simplify algorithm definitions and potentially boost speed -- sympy is just too slow.
Definition of done
Define a Python language subset to support.
At the very least, variables, arithmetic operators, integer literals.
Implement a function (or decorator) to extract the AST.
Refactor ltitop.algorithm module to deal with the new AST.
Rewrite algorithm definitions in ltitop.topology using plain Python.
Additional considerations
Generators and list comprehensions would be super useful when defining sums and products, but, if supported, these have to be expanded upon AST extraction (or term permutation will not be possible). Also, the feature set must be kept at a minimum -- enough to guarantee that algorithms are simply describing operations on a data-flow (or code generation may not be possible).
The text was updated successfully, but these errors were encountered:
Rationale
Alternative to #2. Algorithms are defined via
sympy
symbolic expressions solely to enable term permutation in summations. But such permutations would also be possible in a Python AST.Why not
ast.parse
a function definition to extract its AST? Some feature (i.e. node) pruning is necessary as most Python features are way beyond scope and would be near impossible to transfer upon C or HDL generation, but otherwise this approach would greatly simplify algorithm definitions and potentially boost speed --sympy
is just too slow.Definition of done
ltitop.algorithm
module to deal with the new AST.ltitop.topology
using plain Python.Additional considerations
Generators and list comprehensions would be super useful when defining sums and products, but, if supported, these have to be expanded upon AST extraction (or term permutation will not be possible). Also, the feature set must be kept at a minimum -- enough to guarantee that algorithms are simply describing operations on a data-flow (or code generation may not be possible).
The text was updated successfully, but these errors were encountered: