VHDL 中的案例陈述
在VHDL中编程时,可以在case语句中使用变量吗?该变量将被其中一种情况修改
,即
case task is
when 1 =>
when 2 =>
when number =>
这样可以吗?
When programming in VHDL, can you use a variable in a case statement? This variable will modified by one of the cases
i.e.
case task is
when 1 =>
when 2 =>
when number =>
is this OK?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
用于模拟或综合?
无论哪种方式,从文档:
使用
if
测试number
,可以是:或
您的选择取决于您想要
if task=number
测试的结果还是when ... =>
测试有优先权? (例如,假设无论出于何种原因number=1
,您希望when 1 =>
还是if task=number
最终提供您的结果?)在简单的情况下,
case
语句综合为多路复用器;if
语句综合为比较器和双输入多路复用器。一种会融入另一种。For simulation or synthesis?
Either way, from the documentation:
Use
if
to test fornumber
, either:or
Your choice depends on whether you want the result of the
if task=number
test or of thewhen ... =>
test to have priority? (e.g. assume that for whatever reasonnumber=1
, do you wantwhen 1 =>
orif task=number
to ultimately provide your result?)In the trivial case the
case
statement synthesizes as a multiplexer; theif
statement synthesizes as a comparator and two-input multiplexer. One feeds into the other.