完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
你好!
我在spartan-6的设计中有一个子采样模块。 这个模块有几个内存实例化(Verilog描述,不是原始的),每个通道都有相同的写数据总线,所以它们都有相同的内容。 但他们有不同的读取数据路径。 并且一些路径仅从上部存储器阵列获取数据。 在设计实现和硬件测试之后,我发现这些数据路径无法正常工作。 行为模拟还可以。 我用chipcope调试了设计,发现实际读取数据对应存储在低内存阵列中的一个! 我创建简单的代码来发现问题。 这里是: 模块顶部( 输入clk1, 输入mem_we, 输入[3:0] mem_waddr, 输入[7:0] mem_wdat, 输入clk2, 输入[1:0] mem_raddr_ext, 输出[7:0] mem_rdat_o ); (* ram_style =“发布”*) reg [7:0] mem [15:0]; 最初开始 MEM [0] = 8'h0; MEM [1] = 8'h1; MEM [2] = 8'h2; MEM [3] = 8'h3; MEM [4] = 8'h4; MEM [5] = 8'h5; MEM [6] = 8'h6; MEM [7] = 8'h7; MEM [8] = 8'h8; MEM [9] = 8'h9; MEM [10] = 8'ha; MEM [11] = 8'hb; MEM [8] = 8'hc; MEM [13] = 8'hd; MEM [14] = 8'he; MEM [15] = 8'hf; 结束 永远@(posedge clk1) if(mem_we)开始 MEM [mem_waddr [3:0]] 正如您所看到的,这是简单而传统的分布式RAM描述,具有全宽写入地址和仅高2位读取地址。 以及我们在实施后得到的结果: 1)RTL原理图。 Mram_mem1 ADDRB LSB的常数部分(2'h2)在哪里? 2)FPGA编辑器。 同样的情况。 我们总是读低记忆内容!!! 我可以使用至少两个workarrounds - 原始实例化或为每个具有实际内存大小的通道创建代码(确切地说每个通道需要的大小)。 但这并不是一个有趣的决定。 可能是我做错了什么。 如果是这样的话我会很高兴的。 但如果不是...... 我花了很多时间来定位bug(这是一个bug吗?)我想我的帖子可以帮助别人避免浪费时间。 谢谢。 附: 我没有做时序模拟,可能会显示错误。 以上来自于谷歌翻译 以下为原文 Hello! I have a subsampling module in my design on spartan-6. This module has several memory instantiation (Verilog description, not primitive) with the same write data bus at every channel, so they're all have the same content. But they have different read data path. And some paths take data only from upper memory array. After design implementation and hardware test I have discovered that this data paths did not work properly. Behavioral simulation was ok. I debugged design with chipscope, and found out that actually the read data corresponds one stored in low memory array! I create simple code to discover the problem. Here it is: module top( input clk1, input mem_we, input [3:0] mem_waddr, input [7:0] mem_wdat, input clk2, input [1:0] mem_raddr_ext, output [7:0] mem_rdat_o ); (* ram_style = "distributed" *)reg [7:0] mem [15:0];initial beginmem[0]=8'h0;mem[1]=8'h1;mem[2]=8'h2;mem[3]=8'h3;mem[4]=8'h4;mem[5]=8'h5;mem[6]=8'h6;mem[7]=8'h7;mem[8]=8'h8;mem[9]=8'h9;mem[10]=8'ha;mem[11]=8'hb;mem[8]=8'hc;mem[13]=8'hd;mem[14]=8'he;mem[15]=8'hf;endalways @(posedge clk1) if(mem_we) begin mem[mem_waddr[3:0]] <= mem_wdat[7:0]; end wire [3:0] mem_raddr={mem_raddr_ext[1:0], 2'h2};reg [7:0] mem_rdat=8'h0;always @(posedge clk2) mem_rdat<=mem[mem_raddr];assign mem_rdat_o=mem_rdat;endmoduleAs you can see, this is simple and traditional distributed RAM description with full wide write address and only upper 2 bits read address. And what we have in result after implemetation: 1) RTL schematic. Where is the constant part (2'h2) of Mram_mem1 ADDRB LSBs???? 2) FPGA Editor. The same situation. We are always read low memory content!!! I can use at least two workarrounds - primitive instantiation or create code for every channel with actual memory size (exactly size every channel needs). But it is not interesting decision. May be I did anything wrong. I'll be glad if it is so. But if not.... I spent a lot of time to localize the bug (is it a bug?) and I think my post can help somebody to avoid the waste of time. Thank you. P.S. I did not do timing simulation, may be it''ll show the bug. |
|
相关推荐
8个回答
|
|
首先 - 它不是“错误”,而是“优化”。
你已经描述了一个16字的存储器,你只读过4个字。 任何从未读出的单词都不需要实现。 谷歌为 术语“只写内存”,看看为什么。 你应该至少做一个行为模拟来确保记忆 做你想要的。 从理论上讲,如果你在FPGA编辑器中查看块 您应该看到4个内存位置的INIT值与单词的值匹配 初始块的2,6,10和14。 此外 - 您初次化位置8两次的任何原因 还是一个错字: initial beginmem [0] = 8'h0; mem [1] = 8'h1; mem [2] = 8'h2; mem [3] = 8'h3; mem [4] = 8'h4; mem [5] = 8'h5; MEM [6] = 8'h6; MEM [7] = 8'h7; MEM [8] = 8'h8; MEM [9] = 8'h9; MEM [10] = 8'ha; MEM [11] = 8'hb; MEM [8] = 8'hc; MEM [13] = 8'hd; MEM [14] = 8'he; MEM [15] = 8'hf;端 问候, 的Gabor - Gabor 以上来自于谷歌翻译 以下为原文 First - It's not a "bug" it's an "optimization." You've described a 16-word memory of which you only ever read 4 words. Any words that are never read out need not be implemented. Google for the term "write-only memory" to see why. You should at least do a behavioral simulation to make sure that the memory does what you want. Theoretically, if you look into the block in the FPGA editor you should see the 4 memory location INIT values match the values for words 2, 6, 10, and 14 of your initial block. Also -- any reason you initialized location 8 twice or was it a typo: initial begin mem[0]=8'h0; mem[1]=8'h1; mem[2]=8'h2; mem[3]=8'h3; mem[4]=8'h4; mem[5]=8'h5; mem[6]=8'h6; mem[7]=8'h7; mem[8]=8'h8; mem[9]=8'h9; mem[10]=8'ha; mem[11]=8'hb; mem[8]=8'hc; mem[13]=8'hd; mem[14]=8'he; mem[15]=8'hf; end Regards, Gabor -- Gabor |
|
|
|
好。
初始值它只是一个copypast错误。 那不是在这里,也不在那里。 让我们从理论开始。 忘记初始值。 仔细查看fpga编辑器截图。 LUT用作存储器 1)写入地址总线mem_waddr [3:0]映射在LUT端口WA [4:1]上,和 2)读取映射在LUT端口A [2:1]上的地址总线mem_raddr_ext [1:0]。 显然,它只会被低内存读取! 据我理解RAM操作理论,要从所需的高端存储区读取数据,mem_raddr_ext [1:0]应该映射到端口A [4:3],A [2:1]应该等于2'h2(mem_raddr) = {mem_raddr_ext [1:0],2'h2})!!!! 你在谈论什么样的优化? 并且练习。 我的设计在这种RAM“优化”中工作错误。 我有chipcope screenshorts与sequantial读取错误的数据。 我有完整的功能项目与workarround我已实例化RAM32M原语与固定地址映射应该是。 在我的开始帖子中,我写了“行为模拟没问题”。 P.S。:初始值。 我查看了fpga编辑器LUT的初始值 - 它们与它们应该是相同的并且如下所述: A5LUT:#RAM:O5 = 0x0000AAAA A5RAMMODE:DPRAM32 A6LUT:#RAM:O6 = 0x0000CCCC0000CCCC B5LUT:#RAM:O5 = 0x0000F0F0 B5RAMMODE:DPRAM32 B6LUT:#RAM:O6 = 0x0000FF000000FF00 我没有请求帮助来修复我的错误。 我认为XST优化算法有错误。 我试图找出是否帮助他人。 以上来自于谷歌翻译 以下为原文 Ok. Initial value it's just a copypast error. That's neither here nor there. Lets start with theory. Forget about initial values. Look carefully at fpga editor screenshot. LUT is used as memory with 1) write address bus mem_waddr[3:0] mapped on LUT port WA[4:1],and 2) read address bus mem_raddr_ext[1:0] mapped on LUT port A[2:1]. Obviously, it will be read only low memory arrea! As I understand theory of RAM operation, to read data from the desired upper memory area , mem_raddr_ext[1:0] should be mapped to port A[4:3] and A[2:1] should be equal to 2'h2 (mem_raddr={mem_raddr_ext[1:0], 2'h2})!!!! What kind of optimization you are talking about? And practice. I have the design working wrong with such a RAM "optimization". I have chipscope screenshorts with sequantial read of wrong data. And I have completely functional project with workarround where I have instantiated RAM32M primitive with fixed addresses mapping as it should be. In my start post I wrote "Behavioral simulation was ok." P.S.: Initial values. I looked at fpga editor LUT initial values - they are the same as they should be and as they were described: A5LUT:#RAM:O5=0x0000AAAA A5RAMMODE:DPRAM32 A6LUT:#RAM:O6=0x0000CCCC0000CCCC B5LUT:#RAM:O5=0x0000F0F0 B5RAMMODE:DPRAM32 B6LUT:#RAM:O6=0x0000FF000000FF00 I don't ask for help to fix my bug. I think that XST optimization algorithm has an error. And I try to find out if it is so to help others. |
|
|
|
好。
- 我现在看到...... 绝对是一个错误,但仍然看起来很奇怪,并不确定为什么其他许多人 会遇到这个。 如果你只需要四个字的记忆就扔掉了 其他十二个,似乎你可以选择额外的两个写地址位 写入启用并创建一个四字内存。 原来是其他的吗? 用于未访问的单词? 如果我不得不猜测XST错误,我会说合成器只能找到你需要的 四个字,但搞砸了地址转换。 你用鞋帮尝试了吗? 两位常数而不是下面两位? 就像是: wire [3:0] mem_waddr_int = {mem_waddr [1:0],mem_waddr [3:2]};总是@(posedge clk1)if(mem_we)begin mem [mem_waddr_int] end wire [3:0] mem_raddr = {2 'h2,mem_raddr_ext [1:0]}; reg [7:0] mem_rdat = 8'h0;总是@(posedge clk2)mem_rdat 也很高兴知道你正在运行哪个工具版本。 很多错误都被破坏了 适用于S6和V6的“新解析器”。 - Gabor 自己试过(ISE 12.1): 所以似乎是高位比特中的常量低位搞乱,高位映射中的常量 正确。 - Gabor 以上来自于谷歌翻译 以下为原文 O.K. - I see that now... Definitely a bug, but still seems like an odd thing to do, and not sure why many others would come across this. If you only need four words of memory and throw away the other twelve, it would seem that you could just gate the extra two write address bits into the write enable and make a four-word memory. Was there originally some other use for the non-accessed words? If I had to guess about the XST bug, I'd say the synthesizer figured out you only needed four words, but messed up the address conversion. Did you try this using the upper two bits constant instead of the lower two? Something like: wire [3:0] mem_waddr_int = {mem_waddr[1:0],mem_waddr[3:2]}; always @(posedge clk1) if(mem_we) begin mem[mem_waddr_int] <= mem_wdat[7:0]; end wire [3:0] mem_raddr={2'h2,mem_raddr_ext[1:0]}; reg [7:0] mem_rdat=8'h0; always @(posedge clk2) mem_rdat<=mem[mem_raddr]; Also it would be nice to know which tool version you're running. A lot of bugs have cropped up with the "new parser" for S6 and V6. -- Gabor Tried it myself (ISE 12.1) : So it seems to be the constant low bits messing up the implementation, constants in the high bits maps correctly. -- Gabor |
|
|
|
我还尝试使用V5代替S6的原始代码。
它没有显示问题, 所以它必须在S6 V6的“新解析器”中: 我建议打开一个网络案例。 - Gabor - Gabor 以上来自于谷歌翻译 以下为原文 I also tried the original code using V5 instead of S6. It does not show the problem, so it must be in the "new parsers" for S6 V6: I would suggest opening a web case. -- Gabor -- Gabor |
|
|
|
我使用的是13.2版
我已经发现了一段时间的问题,并试图将常量移动到高位的两位地址。 Everething还可以。 在我的原始设计中,我完全按照您的建议制定了解决方 我为每个频道创建了实际尺寸的记忆。 但从“良好的代码风格”:)和可读性的角度来看,这种结构并不优雅。 哎呀,你已经回答了自己。 对不起,我现在在我的工作场所,不能及时回答...... 以上来自于谷歌翻译 以下为原文 I'm using version 13.2 I have discovered the problem for some time and tried to move constant to upper two bits of address. Everething was ok. In my original design I made workaround exactly you proposed. I created memories with sizes actual for each channel. But this construction is not elegant from the point of view of "good code style" : )and readability. Ooops, you have already answered to yourself. Sorry I am at my workplace right now and can't answer promptly... |
|
|
|
我又尝试了一件事 - ISE 11.5
似乎11.5仍然使用Spartan 6的“旧”解析器。它给出了与我相同的结果 发布于V5。 这将是另一种解决方法,尽管有许多改进 对于可能使其他解决方案更好的新工具版本。 问候, 的Gabor - Gabor 以上来自于谷歌翻译 以下为原文 I tried one more thing - ISE 11.5 It seems that 11.5 still uses the "old" parsers for Spartan 6. It gives the same results as I posted for V5. So that would be another workaround, although there are many improvements for the newer tool versions that may make other workarounds a better choice. Regards, Gabor -- Gabor |
|
|
|
感谢Gabor的关注。
你能给我写一些关于“网络案例”的话。 它是什么? 以上来自于谷歌翻译 以下为原文 Thank you Gabor for your attention. Can you write me some words about "web case". What is it? |
|
|
|
“WebCase” - 直接联系Xilinx支持工程师的方法。
请参阅:HTTP://www.xilinx.com/support/clearexpress/websupport.htm ------------------------------------------“如果它不起作用 模拟,它不会在板上工作。“ 以上来自于谷歌翻译 以下为原文 "WebCase" - a method of contacting Xilinx support engineers directly. See: http://www.xilinx.com/support/clearexpress/websupport.htm ------------------------------------------ "If it don't work in simulation, it won't work on the board." |
|
|
|
只有小组成员才能发言,加入小组>>
2388 浏览 7 评论
2803 浏览 4 评论
Spartan 3-AN时钟和VHDL让ISE合成时出现错误该怎么办?
2270 浏览 9 评论
3338 浏览 0 评论
如何在RTL或xilinx spartan fpga的约束文件中插入1.56ns延迟缓冲区?
2438 浏览 15 评论
有输入,但是LVDS_25的FPGA内部接收不到数据,为什么?
768浏览 1评论
请问vc707的电源线是如何连接的,我这边可能出现了缺失元件的情况导致无法供电
551浏览 1评论
求一块XILINX开发板KC705,VC707,KC105和KCU1500
386浏览 1评论
1975浏览 0评论
692浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-28 22:27 , Processed in 1.564877 second(s), Total 90, Slave 74 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号