clash-compiler icon indicating copy to clipboard operation
clash-compiler copied to clipboard

Some warnings should not be suppressed for test benches

Open DigitalBrains1 opened this issue 2 years ago • 1 comments

The warnings of the form

Integers are dynamically sized in simulation, but fixed-length after synthesis. Use carefully.

are suppressed if they occur in a testbench (ANN TestBench). But this is actually incorrect: they are also fixed-length in HDL simulation, not merely in synthesis. We actually have annotations dontTranslate, warnNonSynthesizable and warnAlways that already provide the necessary distinctions, but all warning entries in YAML primitives map to warnNonSynthesizable.

Suggestion: leave the warning keyword in YAML as it is and introduce another keyword, warnAlways. Then convert warnings that also apply to HDL simulation to warnAlways.

DigitalBrains1 avatar Apr 14 '22 10:04 DigitalBrains1

From Slack:

On this topic, here's the types that'd need changing: Parser would need to be modified to allow the distinction:

https://github.com/clash-lang/clash-compiler/blob/073b01a720f37072f13b8d17bf9bdcfeb797d4a4/clash-lib/src/Clash/Primitives/Types.hs#L269 Than this c should store something else:

https://github.com/clash-lang/clash-compiler/blob/073b01a720f37072f13b8d17bf9bdcfeb797d4a4/clash-lib/src/Clash/Primitives/Types.hs#L164 Which is set in these types:

https://github.com/clash-lang/clash-compiler/blob/073b01a720f37072f13b8d17bf9bdcfeb797d4a4/clash-lib/src/Clash/Primitives/Types.hs#L63-L74 which could maybe be set to:

https://github.com/clash-lang/clash-compiler/blob/073b01a720f37072f13b8d17bf9bdcfeb797d4a4/clash-prelude/src/Clash/Annotations/Primitive.hs#L294-L301

martijnbastiaan avatar Apr 14 '22 10:04 martijnbastiaan