efabless / caravel

Caravel is a standard SoC harness with on chip resources to control and read/write operations from a user-dedicated space.
https://caravel-harness.readthedocs.io/
Apache License 2.0
295 stars 69 forks source link

`make gpio_defaults` can incorrectly parse `user_defines.v` Verilog block comments #539

Open amm-efabless opened 6 months ago

amm-efabless commented 6 months ago

When you run make gpio_defaults on a caravel_user_project, it parses the contents of verilog/rtl/user_defines.v and we've noticed an issue where Verilog block comments are parsed incorrectly and treated as real code.

The following code should result in mag/gpio_defaults_block_1111.mag being created, but instead it uses the value in the comments and so creates mag/gpio_defaults_block_1eee.mag:

`define USER_CONFIG_GPIO_37_INIT 13'h1111
/*
`define USER_CONFIG_GPIO_37_INIT 13'h1eee
*/

...and thus it looks like the latter (unintended, commented) value gets used in synthesis.

I think this came to light because of @d-m-bailey running a check per #532

amm-efabless commented 6 months ago

@DavidRLindley FYI