2014-05-13 19 views
0

我在系統的Verilog寄存器一個簡單的CPU工作如下之前:找到「模塊」模塊內關鍵字「endmodule」

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

[email protected](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, 
     ^

我在這件事上摸不着頭腦。我只看到模塊聲明過一次,而且我的語法沒有看到任何問題。任何幫助表示讚賞!

+0

你說SystemVerilog,但你沒有使用SV構造。 '寄存器'是用Verilog-2001編寫的。 – Greg

回答

2

我猜你的設計某處有類似如下:

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

這將創建一個嵌套模塊。要修復它,請將`include行移動到module以上或endmodule以下。

技術上嵌套模塊是SystemVerilog的的一部分(參見IEEE標準1800年至2005年§ 19.6 嵌套模塊 & IEEE Std 1800-2012 § 23.4 嵌套模塊),然而可能供應商還沒有實現此功能。


FYI:or posedge e不應該在那裏。同步邏輯應該是一個邊沿時鐘和零到兩個異步復位,其中異步復位將觸發器分配給一個內容。

+0

就是這樣!它被包含在模塊聲明之上的另一個模塊中,但該模塊被包含在另一個模塊中,因此是問題所在。謝謝!另外,感謝您對邏輯的輸入,非常感謝。 – anthozep

+0

還有一件事可能是它造成的。我在其中一個模塊中註釋了endmodule語句,因此它在模塊中看到了一個模塊。再次感謝! – anthozep