clash-lang / clash-compiler

Haskell to VHDL/Verilog/SystemVerilog compiler
https://clash-lang.org/
Other
1.42k stars 150 forks source link

Clash doesn’t pick the name of the function being specialized #2508

Closed martijnbastiaan closed 5 months ago

martijnbastiaan commented 1 year ago

Christiaan described this as:

It doesn’t pick the name of the function being specialized when it has a NOINLINE, while the argument being specialized on does not

over at https://github.com/clash-lang/clash-compiler/issues/2502#issuecomment-1592916523. I'm actually unsure why we would ever pick solely the argument's name instead of the function's name.

martijnbastiaan commented 1 year ago

I've proposed a patch that does the, IMO, more sensible thing:

Given a global binder accum and an application mealy accum, Clash now calls the new, specialized binder mealy_accum instead of just accum. This more accurately reflects the body of the function and will result in more sensible file names. For example, previously Clash would generate a separate file accum.{v,vhdl} that contained the inlined bodies of both mealy and accum. AFter this patch, it will generate mealy_accum.{v,vhdl}.