SYSTEMVERILOG中,如何将STRUCT类型数据转换成数组类型?
时间:10-02
整理:3721RD
点击:
代码:
reg
[31:0]
user_cpld_tlp_fifo_wdata ;
pcie_tlp_head_dw0
user_cpld_tlp_dw0 ;
always@(posedge clk or posedge rst)
begin
if(rst)
user_cpld_tlp_fifo_wdata <= 32'h0 ;
else
begin
case(rd_cur_state)
sRD_MKADR
:
begin
user_cpld_tlp_fifo_wdata <= rd_cur_addr ;
end
sRD_MKTLP0
:
begin
user_cpld_tlp_fifo_wdata <= user_cpld_tlp_dw0 ;
end
sRD_MKTLP1
:
begin
user_cpld_tlp_fifo_wdata <= user_cpld_tlp_dw1 ;
end
sRD_MKTLP2
:
begin
user_cpld_tlp_fifo_wdata <= user_cpld_tlp_dw2 ;
end
default
:
begin
user_cpld_tlp_fifo_wdata <= 32'h0 ;
end
endcase
end
end
然后编译报告错误:Error (10928): SystemVerilog error at pcie_rx_process.v(545): struct type cannot be assigned to packed array type - types do not match
就是说我一个一个REG类型很容易转换成STRUCT类型;但是STRUCT类型怎么转换成REG类型?高手赐教。
reg
[31:0]
user_cpld_tlp_fifo_wdata ;
pcie_tlp_head_dw0
user_cpld_tlp_dw0 ;
always@(posedge clk or posedge rst)
begin
if(rst)
user_cpld_tlp_fifo_wdata <= 32'h0 ;
else
begin
case(rd_cur_state)
sRD_MKADR
:
begin
user_cpld_tlp_fifo_wdata <= rd_cur_addr ;
end
sRD_MKTLP0
:
begin
user_cpld_tlp_fifo_wdata <= user_cpld_tlp_dw0 ;
end
sRD_MKTLP1
:
begin
user_cpld_tlp_fifo_wdata <= user_cpld_tlp_dw1 ;
end
sRD_MKTLP2
:
begin
user_cpld_tlp_fifo_wdata <= user_cpld_tlp_dw2 ;
end
default
:
begin
user_cpld_tlp_fifo_wdata <= 32'h0 ;
end
endcase
end
end
然后编译报告错误:Error (10928): SystemVerilog error at pcie_rx_process.v(545): struct type cannot be assigned to packed array type - types do not match
就是说我一个一个REG类型很容易转换成STRUCT类型;但是STRUCT类型怎么转换成REG类型?高手赐教。
没看到struct,代码不清。
