alchitry / Alchitry-Labs-V2

Full rewrite of Alchitry Labs
https://alchitry.com/
GNU General Public License v3.0
14 stars 2 forks source link

Implement Lucid Functions in Verilog #18

Closed alchitry closed 2 months ago

alchitry commented 2 months ago

Functions in Lucid that accept constant values such as $pow() are typically replaced at syntesis time with constants.

This limitation leads to two unfortunate side effects.

First, Lucid modules with parameters are duplicated into unique modules without parameters at synthesis so that constants can be replaced in each one. This leads to bloat and potentially worse build performance as the Verilog tools must parse more code.

Second, these functions should be able to be used when the values are known and not just constant. This essentially means being able to use them with for loop variables.

The best fix for both of these is to create Verilog versions of the functions so that they can be properly translated instead of simply replaced.