Copilot-Language / copilot-bluespec

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

Support translating struct updates to Bluespec. Refs #10. #13

Closed RyanGlScott closed 1 month ago

RyanGlScott commented 2 months ago

To accomplish this, we leverage Bluespec's functional struct updates. For instance, suppose we have a Copilot struct with fields x :: Field "x" Int32 and y :: Field "y" Int32. If we update a struct's x field to be 42, then the generated Bluespec code would look roughly like v { x = 42 }.

In order to test UpdateField (the copilot-core representation of struct field updates), we also generalize the test suite infrastructure a bit, as we need to be able to display and read struct values. Thankfully, this proves relatively straightforward.

Fixes #10.