Copilot-Language / copilot-bluespec

A Copilot backend for generating Bluespec code suitable for FPGAs.
Other
2 stars 0 forks source link

Fix `signum` translation. Refs #14. #17

Closed RyanGlScott closed 1 month ago

RyanGlScott commented 1 month ago

This ensures that the translation of Copilot signum expressions results in Bluespec code that is semantically equivalent. In particular, it ensures that signum e behaves correctly when e is zero, negative zero, or NaN (if e is a floating-point type).

The new translation is heavily inspired by the existing approach in copilot-c99: https://github.com/Copilot-Language/copilot/blob/6034e6d4d95464397ba81e346f40f71213c0ffbd/copilot-c99/src/Copilot/Compile/C99/Expr.hs#L233-L272

Fixes #14.