sylefeb / Silice

Silice is an easy-to-learn, powerful hardware description language, that simplifies designing hardware algorithms with parallelism and pipelines.
Other
1.28k stars 77 forks source link

Expression trackers in algorithms body lead to confusing (albeit correct) semantics #235

Open sylefeb opened 1 year ago

sylefeb commented 1 year ago

Expression trackers were previously allowed in the body of algorithms, however their semantics refers either to previous cycle (<::) or to variable as modified within current cycle (<:). This led to confusing situations which, albeit could be understood, were very unnatural.

In addition, careful inspection of the repository of projects showed that in most cases trackers were used in the body, this was due to a lack of variable initialization from expression, e.g. writing:

uint8 a <:: b+1;

when really one meant

uint8 a = b+1;

using b in its current state, while the tracker would use either b from previous cycle or as it was being modified (which was precisely leading to confusion, and getting much worse within pipelines).

Initializing from expressions is now possible, and thus the trackers can be restricted to a unit body or algorithm preamble only. They remain useful in some cases, but this requires some further investigation.

(to be expanded)