微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 嵌入式设计讨论 > FPGA,CPLD和ASIC > 求助顶层文件

求助顶层文件

时间:10-02 整理:3721RD 点击:
原程序:
module hwdzq
(       input g_clk,auto,
        output reg [6:0] code,
        output reg high,spks
);
wire [7:0] index;
reg [11:0] tone0;
assign index=q;
tone  tone1(
           .index(index),
            .high(high),
            .code(code),
            .tone0(tone0)
             );
            
            
            
reg m4_clk;            
            
speaker   speaker1(
              .g_clk(g_clk),
              .tone1(tone0),
               .spks(spks),
               .m4_clk(m4_clk)
               );
               
               
               
reg [7:0] index0;              
wire m4_clk1;
assign m4_clk1=m4_clk;
               
automusic    automusic1(
               .m4_clk(m4_clk1),
               .g_clk(g_clk),
               .auto(auto),
               .index0(index0)
              );
              
wire [7:0] index5;            
wire [7:0]data;               
wire we;
reg [7:0] q;
assign we=1'b0;               
assign data=8'd0;               
assign index5=index0;
               
qumu2  qumu21(
.address(index5),
.data(data),
.we(we),
.q(q)
);
endmodule
最后全是这个错误:
Error (10663): Verilog HDL Port Connection error at hwdzq.v(27): output or inout port "high" must be connected to a structural net expression
Error (10663): Verilog HDL Port Connection error at hwdzq.v(28): output or inout port "code" must be connected to a structural net expression
Error (10663): Verilog HDL Port Connection error at hwdzq.v(29): output or inout port "tone0" must be connected to a structural net expression
Error: Can't elaborate top-level user hierarchy

the signal high/code is only a net for connection. You declared it as a reg... that why you have such error message,..

俺也遇到同样的问题,同求!

reg [11:0] tone0;
应该定义为wire吧!其他的你自己好好检查下语法。

例化的模块之间相连的信号定义为wire型,上个例化模块的输出可直接当做下个例化模块的输入,不需要在assign赋值

关于wire型和reg型的使用
模块例化的输出必须连接到wire型,always模块的输出必须为reg型;若module的输出信号也在always中赋值,则在端口声明时必须按如下方式:output reg [SIZE-1:0] sig;
赋值的时候,wire型在always外部使用持续赋值:assign sign = (value),注意使用阻塞赋值;reg型在always内部一般使用非阻塞赋值。

请问到底该怎么修改?

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top