calyx
calyx copied to clipboard
eDSL: Superior NameGen
The eDSL currently does a quick and dirty job when it comes to name generation.
It maintains a counter starting at 0, and every time it needs to makes a new name for a cell, it does something like {the_op_in_question}_{counter++}
. This is why end up with things like reg_0
, add_1
, mult_2
, etc.
The true solution is something akin to what Calyx itself does:
https://github.com/calyxir/calyx/blob/6f895a1353020ce254860c3aa0fcfa2ba1abf4c4/calyx-utils/src/namegenerator.rs#L7-L10
It actually tracks existing names and avoids clashes. Let's eventually upgrade the eDSL to something like this.
Originally posted by @anshumanmohan in https://github.com/calyxir/calyx/pull/2152#discussion_r1643119305