今天写四个FIFO轮询,出现了一个之前没有见过的错误:
翻译成中文是:无法解析 SEND.v(284) 上连接“up_data[63]”的多个常量驱动程序
通过上网查询发现是因为在不同always逻辑块中对同一个变量进行了赋值而产生了冲突
出现错误部分的代码为:
always @(posedge clk or negedge rst_n) begin
if(~rst_n) begin
cnt <= 16'd0;
state <= IDLE;
ch1_rdreq <= 1'b0;
ch2_rdreq <= 1'b0;
ch3_rdreq <= 1'b0;
ch4_rdreq <= 1'b0;
data_valid <= 1'b0;
// up_data <= 64'd0; //这里定义的数是多余的
end
另一部分代码:
begin
case (state)
S1: begin
if(cnt <= 16'd3) begin
up_data <= {head,ch_num};
end
else if(cnt == 16'd4) begin
up_data <= ch1_cnt;
end
else begin
up_data <= ch1_q;
end
end
(这里是单独给up_data定义的,所以上面那部分代码中定义的up_data与这里冲突)
解决方法:删除第一段中对up_data的定义即可。