gpt4 book ai didi

verilog : Variable index is not supported in signal

转载 作者:行者123 更新时间:2023-12-02 01:28:07 26 4
gpt4 key购买 nike

我收到一条错误消息,提示“信号不支持索引”。据我所见,错误出现在非阻塞分配的左侧。为什么下面的代码会出错,是否有解决方法?

...
parameter width = 32;
parameter size = 3;

input clk, reset;
input [width*size-1:0] A;
input [width*size-1:0] B;
output [width*size-1:0] result;

reg signed [width*size-1:0] partials;
reg signed [width-1:0] temp;
reg signed [width-1:0] currenta;
reg signed [width-1:0] currentb;
wire signed [width-1:0] temp1wire;
...
integer k = 0;
always @ (posedge clk)
begin
currenta[width-1:0] <= A[width*k +: width];
k = k+1
currentb[width-1:0] <= B[width*k +: width];
partials[width*k +: width] <= temp1wire;
end
Add Add1(clk, temp1wire, currenta, currentb);
...

此代码是执行向量加法并将结果保存在 partials[width*k +: width] 的顺序 block 的一部分。

最佳答案

我找到了 this在 Xilinx 论坛上:

"XST works fine with the indexed part-select operator "+:" if it is on the right-hand side (RHS) of the assignment. It also works fine when it is on the left-hand side (LHS) AND the starting index is a constant. Your case uses a variable as the starting index on the LHS and that what XST doesn't like although it's legal."

关于verilog : Variable index is not supported in signal,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35874284/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com