完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
我正在使用Vivado并试图计算两个向量的点积,但似乎陷入了杂草。
我在一个向量中有hasync_pattern_size元素(简单来说就是8),而在循环向量中我想要乘以agasint的元素数量要大得多。 我一直缠绕在轴上的是如何并行处理产品的总和。 我的计划是: reg [15:0] index2 = 8'd0; reg签署[31:0] corr_sum; reg签署[31:0] corr_sum_reg; reg [31:0] abs_corr_sum = 32'd0; reg [31:0] abs_corr_sum_reg = 32'd0; 总是@ * //(posedge clock) 开始 //每个传入的样本 abs_corr_sum = 32'd0; sample_data_buffer_I [sample_index] = i_tdata [15:0]; sample_data_buffer_I [circ_buf_size + sample_index] = i_tdata [15:0]; sample_data_buffer_Q [sample_index] = i_tdata [31:16]; sample_data_buffer_Q [circ_buf_size + sample_index] = i_tdata [31:16]; for(index2 = 0; index2 end 然后在第二个块中: 总是@(posedge clock) 开始 corr_sum_reg 但是当corr_sum是负值时,这似乎不正常。 我知道我的cheapo绝对价值转换应该没问题,所以我想我正试图在其他地方试图并行化这个点产品操作。 有没有更简单的方法去做? 以上来自于谷歌翻译 以下为原文 I am using Vivado and am attempting to compute the dot product of two vectors, but seem to be getting stuck in the weeds. I have sync_pattern_size elements (lets say that is 8 for simplicity sake) in one vector, and a much larger number of elements in a circular vector that I want to multiply agasint. Where I keep getting wrapped around the axle is how to handle the sum of the products in parallel. My plan was: reg [15:0] index2 = 8'd0; reg signed [31:0] corr_sum; reg signed [31:0] corr_sum_reg; reg [31:0] abs_corr_sum = 32'd0; reg [31:0] abs_corr_sum_reg = 32'd0; always @*//(posedge clock) begin // for each incoming sample abs_corr_sum = 32'd0; sample_data_buffer_I[sample_index] = i_tdata[15:0]; sample_data_buffer_I[circ_buf_size + sample_index] = i_tdata[15:0]; sample_data_buffer_Q[sample_index] = i_tdata[31:16]; sample_data_buffer_Q[circ_buf_size + sample_index] = i_tdata[31:16]; for (index2 = 0; index2 < sync_pattern_size; index2 = index2 + 1'b1) begin corr_sum = sample_data_buffer_I[index2+sample_index+circ_buf_size-sync_pattern_size] * sync_pattern_I[index2] + sample_data_buffer_Q[index2+sample_index+circ_buf_size-sync_pattern_size] * sync_pattern_Q[index2]; if(corr_sum[31] == 1'b1) begin abs_corr_sum = abs_corr_sum + corr_sum; end else begin abs_corr_sum = abs_corr_sum + corr_sum; end end endAnd then in a second block: always @(posedge clock) begin corr_sum_reg <= corr_sum; abs_corr_sum_reg <= abs_corr_sum; endBut this doesn't seem to work right when the corr_sum is a negative value. I know that my cheapo absolute value convertion should be fine, so I think I am scewing up somewhere else trying to parallelize this dot product operation. Is there any easier way to go about this? |
|
相关推荐
3个回答
|
|
wooshh,答案被删除,因为它被忽略了。
***我们中的许多人都是FPGA爱好者,而不是Xilinx员工。 如果您获得帮助并给予荣誉(明星),您将来可能会继续获得帮助。 如果您有解决方案,请将其标记为解决方案。*** 以上来自于谷歌翻译 以下为原文 wooshh, answer deleted because it was ignored. ***Many of us who help you are just FPGA enthusiasts, and not Xilinx employees. If you receive help, and give kudos (star), you're likely to continue receiving help in the future. If you get a solution, please mark it as a solution.*** |
|
|
|
在提问之后我会评论很多其他问题,但你没有要求提供这种反馈。
对不起,我不确定你的意思是什么? if(corr_sum [31] == 1'b1) 开始 abs_corr_sum = abs_corr_sum + corr_sum; 结束 其他 开始 abs_corr_sum = abs_corr_sum - corr_sum; 结束 当我正在清理我的复制和粘贴时,我遇到了一个错误,你是对的,我没有原来的if语句,这是我有的不起作用: //这是我快速而又肮脏的腹肌(corr_sum)夏天 if(corr_sum [31] == 1'b1) 开始 $ display(“NEG:”,abs_corr_sum,“+”,~corr_sum + 1,“=”,abs_corr_sum + ~corr_sum + 1); abs_corr_sum = abs_corr_sum + ~corr_sum + 1; $显示器( “NEG:”,abs_corr_sum); 结束 其他 开始 $ display(“POS:”,abs_corr_sum,“+”,corr_sum,“=”,abs_corr_sum + corr_sum); abs_corr_sum = abs_corr_sum + corr_sum; $显示器( “POS”,abs_corr_sum); 结束 以上来自于谷歌翻译 以下为原文 A lot of other issues I'd comment on after asking questions, but you didn't ask for that kind of feedback.I'm sorry, I'm not sure what you mean by this? if(corr_sum[31] == 1'b1) begin abs_corr_sum = abs_corr_sum + corr_sum; end else begin abs_corr_sum = abs_corr_sum - corr_sum; endI had an error when I was was cleaning up my copy and paste, you are right, I didn't have my original if-statement right, here is what I have that isn't working: //this is my quick and dirty abs(corr_sum) summer if(corr_sum[31] == 1'b1) begin $display("NEG:",abs_corr_sum,"+", ~corr_sum+1,"=", abs_corr_sum + ~corr_sum+1); abs_corr_sum = abs_corr_sum + ~corr_sum+1; $display("NEG:",abs_corr_sum); end else begin $display("POS:",abs_corr_sum,"+", corr_sum,"=", abs_corr_sum + corr_sum); abs_corr_sum = abs_corr_sum + corr_sum; $display("POS:",abs_corr_sum); end |
|
|
|
wooshh,答案被删除,因为它被忽略了。
***我们中的许多人都是FPGA爱好者,而不是Xilinx员工。 如果您获得帮助并给予荣誉(明星),您将来可能会继续获得帮助。 如果您有解决方案,请将其标记为解决方案。*** 以上来自于谷歌翻译 以下为原文 wooshh, answer deleted because it was ignored. ***Many of us who help you are just FPGA enthusiasts, and not Xilinx employees. If you receive help, and give kudos (star), you're likely to continue receiving help in the future. If you get a solution, please mark it as a solution.*** |
|
|
|
只有小组成员才能发言,加入小组>>
2389 浏览 7 评论
2804 浏览 4 评论
Spartan 3-AN时钟和VHDL让ISE合成时出现错误该怎么办?
2272 浏览 9 评论
3346 浏览 0 评论
如何在RTL或xilinx spartan fpga的约束文件中插入1.56ns延迟缓冲区?
2440 浏览 15 评论
有输入,但是LVDS_25的FPGA内部接收不到数据,为什么?
768浏览 1评论
请问vc707的电源线是如何连接的,我这边可能出现了缺失元件的情况导致无法供电
551浏览 1评论
求一块XILINX开发板KC705,VC707,KC105和KCU1500
388浏览 1评论
1975浏览 0评论
692浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-30 20:19 , Processed in 1.160009 second(s), Total 51, Slave 44 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号