或者两者兼而有之?试试这个:d 以下为原文
Are you trying to synthesize this or simulate? or both?
Try this:
d <= b[a-2+:2];
www.xilinx.com
完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我有一个设计,我想使用一个reg变量控制另一个总线位如:reg [2:0] a; reg [7:0] b; reg c; reg [2:0] d; case 1:c
案例2:d似乎案例1是可行的但案例2我遇到了错误,抱怨“a”不是常数,为什么?谢谢。 以上来自于谷歌翻译 以下为原文 I have a design, I want to use a reg variable to control another bus bit like: reg [2:0] a; reg [7:0] b; reg c; reg [2:0] d; case 1: c <= b[a]; case 2: d <= b[a:a-2]; It seems case 1 is feasible but case 2 I confronted the errors, which complains that "a" is not a constant, why? Thanks. |
|
相关推荐
7个回答
|
|
我对Verilog了解不多,但我的第一个问题是,如果“a”的值小于2,情况2会发生什么?
----------“我们必须学会做的事情,我们从实践中学习。” - 亚里士多德 以上来自于谷歌翻译 以下为原文 I don't know much about Verilog but my first question would be, what happens in case 2 if the value of "a" is less than 2? ---------- "That which we must learn to do, we learn by doing." - Aristotle |
|
|
|
您好,在这种情况下,我将保证我的设计将是一个伟大或等于2.即使最坏,a小于2,设计中有一个错误,因为位数不会是负数,而不是
它变成了一个大的积极因素(例如:如果a = 1,那么a-2 = 7)。 但这不应该阻止设计的合成。 以上来自于谷歌翻译 以下为原文 Hello, In this case, I will gurantee my design that a will be great or equal than 2. Even worst, a is smaller than 2, there is a bug in the design, since bit number won't be a negative, instead of it becomes a big postive (e.g.: if a=1, then a-2 = 7). But this should not prevent the design be synthesised. |
|
|
|
你想合成这个还是模拟?
或者两者兼而有之?试试这个:d 以下为原文 Are you trying to synthesize this or simulate? or both? Try this: d <= b[a-2+:2]; www.xilinx.com |
|
|
|
嗨bwiec,就我而言,我需要两者,模拟和合成。
但现在我只是尝试合成并面对合成中的错误。 那么有什么方法可以让它合成吗?我采用的当前方法是:d但是如果“d”的宽度很大,如64,128,它肯定会变成一场灾难。 谢谢。 以上来自于谷歌翻译 以下为原文 hi bwiec, In my case, I need both, simulation and synthsis. But now I just try to do synthesis and confronted the error in synthesis. So is there any approach to make it be synthesisable? The current approach I took is : d <= {b[a],b[a-1],b[a-2]}; But if the width of "d" is large, like 64, 128, it definitely becomes a disaster. Thanks. |
|
|
|
bwiec写道:
你想合成这个还是模拟? 或者两者兼而有之?试试这个:d 实际上,因为他最初想要3位,它应该是: d 以下为原文 bwiec wrote:Actually since he originally wanted 3 bits it should either be: d <= b[a-2 +: 3]; or d <= b[a -: 3]; Note that it is never legal to have two variable expressions in a Verilog range, even if they are clearly related like: b[a : a - 2] In that case the difference is always 2 so you'd think it might synthesize gieven the constant bit width. However it's still not legal Verilog, so you need to use the +: or -: Verilog 2001 range syntax, or else assign the bits in a loop, one by one (the only method available in Verilog 95). -- Gabor |
|
|
|
哎呀,好抓!谢谢你的澄清,Gabor。
www.xilinx.com 以上来自于谷歌翻译 以下为原文 Oops, good catch! Thanks for the clarification, Gabor.www.xilinx.com |
|
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
2474 浏览 7 评论
2860 浏览 4 评论
Spartan 3-AN时钟和VHDL让ISE合成时出现错误该怎么办?
2322 浏览 9 评论
3406 浏览 0 评论
如何在RTL或xilinx spartan fpga的约束文件中插入1.56ns延迟缓冲区?
2502 浏览 15 评论
有输入,但是LVDS_25的FPGA内部接收不到数据,为什么?
2180浏览 1评论
请问vc707的电源线是如何连接的,我这边可能出现了缺失元件的情况导致无法供电
645浏览 1评论
求一块XILINX开发板KC705,VC707,KC105和KCU1500
506浏览 1评论
2054浏览 0评论
783浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-2-3 22:08 , Processed in 1.518371 second(s), Total 87, Slave 71 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号