程序:
module Ser_Par_Conv_32(Data_out,write,Data_in,En,clk,rst);
output [31:0] Data_out;
output write;
input Data_in;
input En,clk,rst;
parameter S_idle=0;
parameter S_1=1;
reg state,next_state;
reg [4:0] cnt;
reg Data_out;
reg shift,incr;
always @(posedge clk or posedge rst)
if(rst) begin state<=S_idle;cnt<=0;end
else state<=next_state;
always @(state or En or write) begin
shift=0;
incr=0;
next_state=state;
case(state)
S_idle: if(En) begin next_state=S_1;shift=1;end
S_1: if(!write) begin shift=1;incr=1;end
else if(En) begin shift=1;incr=1;end
else begin next_state=S_idle;incr=1;end
endcase
end
always @(posedge clk or posedge rst)
if(rst) begin cnt<=0;end
else if(shift)Data_out<={Data_in,Data_out[31:1]};
assign write=(cnt==31);
endmodule
报错:
Error (10053): Verilog HDL error at Ser_Par_Couv_32.v(28): can't index object "Data_out" with zero packed or unpacked array dimensions
Error: Quartus II Analysis & Synthesis was unsuccessful. 1 error, 1 warning
Error: Peak virtual memory: 169 megabytes
Error: Processing ended: Sat May 08 00:20:12 2010
Error: Elapsed time: 00:00:03
Error: Total CPU time (on all processors): 00:00:01
Error: Quartus II Full Compilation was unsuccessful. 3 errors, 1 warning
一个为理想不懈前进的人,一个永不言败人!
http://shop57496282.taobao.com/
欢迎光临网上店铺!
我也遇到了
can't index object " " with zero packed or unpacked array dimensions
怎么解决
next_state=state;
是多余的吧
把reg Data_out;
改为reg [31:0] Data_out;看看
回复 板凳 stepan 的帖子
端口定义时,已经说明Data_out是32位的了。
好像不需要在定义为32位的寄存器了。
我弄错了,是需要将reg Data_out; 改为reg [31:0] Data_out。
LZ的代码还有个小错误,您在两个always块中对cnt赋值了。
[
本帖最后由 swfc_qinmm 于 2011-4-18 20:04 编辑 ]
一个为理想不懈前进的人,一个永不言败人!
http://shop57496282.taobao.com/
欢迎光临网上店铺!
虽然说不出为什么,但是的确需要把reg Data_out;改为reg [31:0] Data_out;