fusesoc icon indicating copy to clipboard operation
fusesoc copied to clipboard

Add errors key for targets to report error conditions

Open olofk opened this issue 4 years ago • 2 comments

This adds a new key to targets named 'errors' and a get_errors CAPI function. Any item in the errors list that evaluates to a non-empty string will be treated as an error condition and the string will be printed out before exiting FuseSoC. Use-cases include erroring out for unsupported combinations of flags, or disallowing the use of certain simulators

olofk avatar Apr 06 '21 07:04 olofk

Hm, this approach feels a bit too rough to me and not explicit enough.

Could you give an example use case to better illustrate the problem you're trying to solve? What we possibly want to specify is not "a list of errors", but a list of conditions under which a target is usable, and throw an error otherwise.

Another way to think about it: flags could be a requirement (as in something that the dependency solver takes care of) or a conflict.

imphil avatar Apr 07 '21 22:04 imphil

One common use for this would be to set errors: ["!tool_verilator? (Testbench only supports Verilator)"] It could also be used to check for invalid combinations of use flags errors: ["!spi? (boot_from_spi? (spi must be enabled to boot from SPI))"]

olofk avatar Apr 08 '21 11:04 olofk