1
當我去模仿我的頂層模塊賽靈思Vivado 2016.4,我收到了特殊的錯誤:Vivado辛錯誤:「根範圍內聲明是不允許的Verilog 95/2K模式」
ERROR: [VRFC 10-1342] root scope declaration is not allowed in verilog 95/2K mode [<...>/header.vh]
我我正在使用內置的Vivado仿真器,並指定了Verilog 2001。我header.vh如下所示:
`ifndef _header_vh_
`define _header_vh_
function integer clog2;
input integer value;
begin
value = value - 1;
for (clog2 = 0; value > 0; clog2 = clog2 + 1)
value = value >> 1;
end
endfunction
`endif
但從方法論角度,聲明函數和其他任何在根範圍內會引起項目的問題,由於不同地區和IPS之間可能的名稱衝突。所以,不要這樣做,總是把它包裝在一個模塊或一個系統verilog包中。 – Serge