首页 > 解决方案 > 如何修复此错误“未知模块类型”?

问题描述

我的顶级模特:

 module top (G1, Y1, R1, G2, Y2, R2, BT1, BT2, clk, rst);
 input BT1, BT2, clk, rst;
 output G1, Y1, R1, G2, Y2, R2;
 wire En1, En2, En3, CNT_RES, FF_RES, TC_30, TC_5, GE_15, B1, B2, request;

 Controll_Unit c1(G1, Y1, R1, G2, Y2, R2, CNT_RES, FF_RES, B1, B2, BT1, BT2, clk, rst, En1, En2, En3);

 Counter t1(TC_30, TC_5, GE_15, CNT_RES, FF_RES, rst, clk);

 dff_sr q1(GE_15, clk, request);

 assign En1=TC_30||GE_15&&B1;
 assign En2=TC_30||GE_15&&B2;
 assign En3=TC_5;
 assign request = BT1||BT2;
endmodule

我的 dff 模型:

module dff_sr(output GE_15 ,input clk, request);
reg  GE_15;

always @(posedge clk)
  begin
    if(request)
     GE_15<=1;
  end
   endmodule

为什么我的dff_sr代码有这个未知错误?我想尽快解决这个问题。

标签: verilog

解决方案


您混淆了 ANSI 和非 ANSI 模块端口声明。改变:

module dff_sr(output GE_15 ,input clk, request);
    reg  GE_15;

至:

module dff_sr(output reg GE_15 ,input clk, request);

这使用 ANSI 样式。我没有收到与您相同的错误,但我确实在 Cadence 上收到了此编译警告:

reg  GE_15;
         | xmvlog: *W,ILLPDX : Multiple declarations for a port not allowed
           in module with ANSI list of port declarations (port 'GE_15') [12.3.4(IEEE-2001)].

请参阅 IEEE Std 1800-2017,第 23.2.2 节端口声明


推荐阅读