'endmodule'之前在模块中找到'module'关键字

问题描述 投票:0回答:1

我正在使用系统verilog中的寄存器处理一个简单的cpu,如下所示:

module register(
input clk, e,
input [7:0]in,
output reg [7:0]out
);

always@(posedge clk or posedge e)
begin
    if(e == 1)
        out <= in;
    else
        out <= out; 
end
endmodule

当我编译所有内容时,我收到以下错误:

Error-[USVSNM] Unsupported System Verilog construct
register.v, 1
lm2
Found 'module' keyword inside a module before the 'endmodule'. Nested 
modules are not supported.


Error-[SE] Syntax error
Following verilog source has syntax error :
"register.v", 2: token is 'input'
input clk, e,
           ^

我在这个问题上摸不着头脑。我只看到模块声明一次,我没有看到我的语法有什么问题。任何帮助表示赞赏!

verilog system-verilog hdl
1个回答
2
投票

我猜你的设计中的某个地方有如下内容:

module upper_module;
// ...
`include "register.v"
// ...
endmoudle

这将创建一个嵌套模块。要修复它,将`include线移动到module上方或endmodule下方。

技术嵌套模块是SystemVerilog的一部分(参见IEEE Std1800-2005§19.6嵌套模块和IEEE Std 1800-2012§23.4嵌套模块),但供应商可能尚未实现此功能。


仅供参考:or posedge e不应该在那里。同步逻辑应该是一个边缘时钟和零到两个异步复位,其中异步复位将触发器分配给内容。

© www.soinside.com 2019 - 2024. All rights reserved.