且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

整数到字符串在综合(宽度不匹配)中出错

更新时间:2023-11-14 23:22:28

我不希望'image或'value支持合成-除了在详细说明时运行的断言中.它们将涉及很多处理.

I would not expect 'image or 'value to be supported for synthesis - other than in asserts that run at elaboration time. They would involve a lot of processing.

每当我将整数转换为ASCII时,我都会使用可合成的character'val和character'pos一次处理一个字符,因为它们不涉及任何处理.他们只是将字符转换为其基础的二进制表示形式.

Whenever I have converted integers to ASCII I have processed a character at a time, using character'val and character'pos, which are synthesisable, because they involve no processing; they just convert a character to/from its underlying binary representation.

想想如何实现形象!它涉及除以10的多个部分:如果将其展开为单个增量周期(这是非计时函数调用的语义所要求的),则这是很多硬件.

Think how you would implement 'image! It involves multiple divisions by 10 : that's a LOT of hardware if you unroll it into a single delta cycle (as required by the semantics of an unclocked function call)

每个(几个)时钟周期处理一个数字,您可以将其减少为单个除法,连续减法或过量6加法,或者根据您的硬件资源和时间预算来选择.

Processing a digit per (several) clock cycle(s) you can reduce that to a single division, or successive subtraction, or excess-6 addition, or however you want according to your hardware resources and time budget.

综合工具代表您做出这些决定确实没有任何意义.所以-尽管我承认这在理论上是可行的,但我会惊讶地看到一个合成工具能够正确地做到这一点. (太糟糕了,这种情况不太可能发生,如果您尝试使用synth工具的错误报告,我不会感到惊讶)

It really doesn't make sense for the synthesis tool to make these decisions on your behalf. So - while I concede it's theoretically possible, I would be surprised to see a synth tool that did it correctly. (OTOH it's such an unlikely scenario I'd not be surprised to see bugs in synth tool's error reporting should you try it)