【发布时间】:2020-04-23 04:33:37
【问题描述】:
我遇到了以下代码的问题,它应该只是在编译时抛出一个错误 如果我的输入数量不能被我的输出数量整除。
module multiplexer #(parameter N_INPUTS, parameter N_OUTPUTS) (in, out, select);
generate
if (N_INPUTS % N_OUTPUTS != 0) begin
$error("%m ** Illegal Parameter ** NUMBER OF INPUTS(%d) does not divide into NUMBER OF OUTPUTS(%d)", N_INPUTS, N_OUTPUTS);
end
endgenerate
input wire [N_INPUTS-1:0] in;
input wire [$clog2(N_INPUTS/N_OUTPUTS) - 1:0] select;
output wire [N_OUTPUTS-1:0] out;
always @ (select, in) begin
out = in[(select + 1) * N_OUTPUTS - 1:(select + 1) * N_OUTPUTS - N_OUTPUTS];
end
endmodule
但是当我进行分析时,Quartus 不断向我抛出这个错误:
Error (10170): Verilog HDL syntax error at multiplexer.v(5) near text: "$error"; expecting "end". Check for and fix any syntax errors that appear immediately before or at the specified keyword. The Intel FPGA Knowledge Database contains many articles with specific details on how to resolve this error. Visit the Knowledge Database at https://www.altera.com/support/support-resources/knowledge-base/search.html and search for this specific error message number.
我开始怀疑 Quartus 的编译器是否支持 $error 命令(这是我第一次使用它)。
我将非常感谢任何关于该主题的帮助,因为我仍然是该领域的初学者 :)
【问题讨论】:
-
我会试试的。请让我几分钟了解如何启用此功能:P
-
SystemVerilog 是否具有相同的语法和所有内容(基本上只是更多功能)?因为当我上网时,它告诉我将文件的扩展名从 .v(用于 Verilog)更改为 .sv(用于 SystemVerilog)。
-
我会尝试找到一种方法来简单地激活它,因为如果我将我的文件更改为 SystemVerilog,我认为我的其他文件可能会开始出现错误,因为它们都包含 always 块,我注意到 SystemVerilog 作为一些每种逻辑类型的特殊总是阻塞。但是感谢您的所有帮助,我很确定这个问题现在已经解决了。我本来想将您的答案标记为正确的,但您只评论了...
标签: verilog fpga system-verilog quartus intel-fpga