首页 > 试题广场 >

仔细阅读以下 Verilog `function` 的定义。

[单选题]
仔细阅读以下 Verilog `function` 的定义。下列哪个选项最准确地描述了这段代码存在的主要问题?
function automatic integer my_func;
  input clk, a, b;
  begin
    @(posedge clk);
    my_func = a & b;
  end
endfunction
  • 函数的返回值没有明确的位宽定义
  • 函数内部包含了事件控制语句 (`@`),这是不允许的
  • 函数必须声明为 `static` 类型,而非 `automatic`
  • 函数缺少对其返回值的 `output` 端口声明

这道题你会答吗?花几分钟告诉大家答案吧!