Verilog “a”的意义是什么;普通的;开始结束块?

Verilog “a”的意义是什么;普通的;开始结束块?,verilog,system-verilog,Verilog,System Verilog,我正在阅读一些第三方Verilog,发现: function [31:0] factorial; input [3:0] operand; reg [3:0] index; begin factorial = operand ? 1 : 0; for(index = 2; index <= operand; index = index + 1) factorial = index * factorial; e

我正在阅读一些第三方Verilog,发现:

function [31:0] factorial;
    input [3:0] operand;
    reg [3:0] index;

    begin
        factorial = operand ? 1 : 0;
        for(index = 2; index <= operand; index = index + 1)
        factorial = index * factorial;
    end
endfunction
函数[31:0]阶乘;
输入[3:0]操作数;
reg[3:0]指数;
开始
阶乘=操作数?1 : 0;

对于(index=2;index我不知道一般情况,但在这个具体情况下:

If a function contains more than one statement, the statements must be
enclosed in a begin-end or fork-join block. 

来源:

根据SystemVerilog扩展(IEEE标准1800-2009),开始/结束在
函数中是可选的。但是,您的工具集(模拟器等)必须能够理解2005年引入的这种语法。

两个答案都是正确的。如果Verilog任务或函数有多个语句,它们也必须有begin end语句。从SystemVerilog-2005开始,我们取消了将begin end放在已经有begin end.Mos的语句中的要求我们委员会的t成员认为,在已经具有endfunction/endtask的内容中要求一个begin-end是愚蠢的。我的意思是,算了吧!你不认为编译器在得到endtask/endfunction语句时,会发现它在任务或函数的末尾??从任务和函数中删除begin-end吗删除大量无用代码。为SystemVerilog再加一分


问候-Cliff Cummings-Verilog&SystemVerilog Guru

开始/结束
功能
或任务
不再需要SystemVerilog中的多语句。请参阅其他答案。