【问题标题】:Can't create symbole file for module because port has unsupported type无法为模块创建符号文件,因为端口的类型不受支持
【发布时间】:2020-04-25 02:38:45
【问题描述】:

我遇到了这个奇怪的问题,Quartus 不会为以下代码生成符号文件:

module bin_to_bcd #(parameter N_DIGITS = 4) (count, bcd_output);

input wire [$clog2(9999)-1:0] count;
output reg [(N_DIGITS<<2)-1:0] bcd_output;

integer i;
integer decade;

always @ (count) begin
    bcd_output = 'b0;
    for(i = $clog2(9999) - 1; i >= 0; i = i - 1) begin
        for(decade = 1; decade < N_DIGITS + 1; decade = decade + 1) begin
            if(bcd_output[(decade<<2) - 1 -: 4] >= 5) begin
                bcd_output[(decade<<2) - 1 -: 4] = bcd_output[(decade<<2) - 1 -: 4] + 3;
            end
        end

        bcd_output = bcd_output << 1;
        bcd_output[0] = count[i];
    end
end

endmodule

抛出的错误是:

10016 Can't create symbol/include/instantiation/component file for module "bin_to_bcd" because port "count" has an unsupported type

但是“计数”应该是“输入线”,而且我还有其他类似的代码可以正常工作。 也许我遗漏了一些明显的东西,但如果我能得到任何帮助,我将不胜感激。

我还应该提到,这段代码在 ModelSim-Altera 中的仿真中运行良好。

谢谢。

编辑:如果有人知道如何实现这一点,我还希望能够为输出指定一个数字作为参数。 注意:$clog2({N_DIGITS{9}}) 不起作用...

编辑#2:如果我反应缓慢,我很抱歉我正在处理其他事情。所以问题仍然存在,我还没有弄清楚为什么......这里有一些可能有用的见解。以下代码运行良好,并使用与 $clog2 相同类型的寄存器大小。如果有人看到我发布的代码和这个代码之间有任何差异,请上前大喊“我找到了!”,因为这让我发疯:P

module multiplexer #(parameter N_INPUTS = 2, parameter N_OUTPUTS = 1) (in, out, select);

generate
    if (N_INPUTS % N_OUTPUTS != 0) begin
        illegal_parameter_cant_divide_inputs_by_outputs non_existing_module();
    end
endgenerate

input wire [N_INPUTS-1:0] in;
input wire [$clog2(N_INPUTS/N_OUTPUTS) - 1:0] select; //THIS LINE WORKS FINE
output wire [N_OUTPUTS-1:0] out;

assign out = in[(select + 1) * N_OUTPUTS - 1 -: N_OUTPUTS];

endmodule

编辑#3:我实际上只是注意到多路复用器代码没有正确合成为符号(缺少选择端口...我应用了相同的修复程序,现在可以了)。

再次感谢任何帮助。

【问题讨论】:

  • 我的猜测是 quartus 有 '$clog2' 的问题。尝试只使用一个数字,例如[12:0]
  • 我在其他代码中使用 $clog2 作为大小括号,它们工作正常。但我试过了,现在可以了???有人能告诉我为什么这段代码不起作用,而我的其他一些使用与 count 语句完全相同的语法的代码起作用吗?
  • 语法没有问题。所以,这可能是一个工具错误。尝试最新版本。尝试一一简化代码以找到解决方法。

标签: verilog fpga system-verilog quartus


【解决方案1】:

根据 Verilog-2005 和 SystemVerilog 语法,我无法发现您的代码有任何问题。使用各种模拟器,它在EDAplayground 上运行良好。如果bin_to_bcd.v 文件中,而multiplexer.sv 文件,则可能是文件的解析方式。 $clog2 不是 Verilog-2001 的内置类型,您可能需要确保 Verilog 文件被解析为 2005 而不是 2001。虽然我建议使用 SystemVerilog .sv 文件类型。

至于在N_DIGITS 的基础上制作$clog2(9999) 缩放,使用$clog2(10**N_DIGITS-1)

您可能还想将$clog2(...) 分配给参数。 ANSI 标头样式示例:

module bin_to_bcd #(
  parameter N_DIGITS = 4,
  parameter IN_BITS = $clog2(10**N_DIGITS-1)
) (
  input wire [IN_BITS-1:0] count,
  output reg [(N_DIGITS<<2)-1:0] bcd_output );

【讨论】:

  • 我什至没有想过要搜索幂符号...谢谢很多 :P 我会尝试你刚才所说的一切,然后回来提供更多信息 :)
  • 使用 ANSI 标头样式可以解决问题,但不知道为什么...我的文件已经是 .sv 并且 Quartus 已设置为将 Verilog 文件编译为 SystemVerilog。
  • 这不是 ANSI 样式的标头,它根据我下面的回答使用总线宽度定义的参数。
  • 是的,对不起,我对这里使用的词感到困惑,我从未听说过“ANSI 标头”(我认为这意味着以某种方式声明参数)。但是你能解释一下为什么这行得通吗……看起来很老套……
  • @ZacharieMcCormick 作为实验,尝试使用非 ANSI 标头将 input wire 更改为 input。自 Verilog-2001 以来,在输入上指定 net_type 是合法的。然而,它在 Verilog-1995 中是非法的。如果它适用于该更改,那么您在 Quartus 中发现了一个错误。无论如何,我尽可能喜欢 ANSI 样式。我只将非 ANSI 用于模糊的极端情况或工具限制。
【解决方案2】:

我能够通过将$clog2 表达式设置为参数,然后使用该参数绑定总线来解决您的错误。

module test #(
    parameter N_DIGITS = 4,
    parameter int M = $clog2(9999) // see here
)(
    count, 
    bcd_output
);

input wire [M-1:0] count; // and here
output reg [(N_DIGITS<<2)-1:0] bcd_output;

integer i;
integer decade;

always @ (count) begin
    bcd_output = 'b0;
    for(i = $clog2(9999) - 1; i >= 0; i = i - 1) begin
        for(decade = 1; decade < N_DIGITS + 1; decade = decade + 1) begin
            if(bcd_output[(decade<<2) - 1 -: 4] >= 5) begin
                bcd_output[(decade<<2) - 1 -: 4] = bcd_output[(decade<<2) - 1 -: 4] + 3;
            end
        end

        bcd_output = bcd_output << 1;
        bcd_output[0] = count[i];
    end
end

endmodule

Can't create symbol/include/instantiation/component file for module "&lt;name&gt;" because port "&lt;name&gt;" has an unsupported type (ID: 10016)

原因:

您试图为 Verilog 设计文件 (.vhd) 中的指定模块创建符号/包含/实例化/组件文件。但是,模块上的指定端口具有符号/包含/实例化/组件文件无法表示的类型。不支持的端口类型包括 SystemVerilog 结构、接口或 modport。通常支持大多数数组或向量类型,但它们的边界必须由常量表达式或涉及模块参数和整数文字的简单算术表达式定义。由于指定端口的类型不受支持,Quartus II 软件无法为模块创建符号/包含/实例化/组件文件。

动作:

在模块声明中省略端口或更改其类型。

https://www.intel.com/content/www/us/en/programmable/quartushelp/13.0/mergedProjects/msgs/msgs/evrfx_symbol_cant_handle_verilog_port.htm

【讨论】:

    【解决方案3】:

    我不确定标准是怎么说的,但最好的做法是始终使用 ANSI 样式的端口,尤其是与 ANSI 样式参数结合使用时。

    这看起来像:

    module bin_to_bcd #(parameter N_DIGITS = 4) (input wire [$clog2(9999)-1:0] count, output reg [(N_DIGITS<<2)-1:0] bcd_output);
    

    【讨论】:

    • OP的声明是绝对正常的,按照标准。
    猜你喜欢
    • 1970-01-01
    • 2015-12-22
    • 1970-01-01
    • 2019-11-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-03
    • 2021-05-18
    相关资源
    最近更新 更多