SystemVerilog: reference argument is illegal inside static task-function declaration
is Function Task static reference argument Illegal SystemVerilog
2023-09-14 09:15:00 时间
1. 问题描述
在systemverilog仿真中碰到仿真器报告如下错误:
ncvlog: *E,REFANA (common.sv,4|26): reference argument is illegal inside static task-function declaration.
出问题的是一个function,其定义如下:
function void DataRead(
input int num_data,
input string InputFileName,
ref logic [7:0] din_i[128],
ref logic [7:0] din_q[128]
);
...funtion body...
2. 解决方案
一般来说,在module/program中定义的tasks/functions缺省为static类型,根据《IEEE 1800 - 2012》—13.5.2: Pass by reference:
It shall be illegal to use argument passing by reference for subroutines with a lifetime of static.
以上这句话是说,对于拥有静态生命时间的子进程(for example, task, function, etc)使用pass-by-reference的方式传递参数是非法的。
解决方案很简单,就是把出问题的function或者task定义为automatic类型。如下所示:
function automatic void DataRead(
input int num_data,
input string InputFileName,
ref logic [7:0] din_i[128],
ref logic [7:0] din_q[128]
);
...
function body
...
[延申]
- 为什么不允许对static类型的task/function使用pass-by-reference的方式进行参数传递呢?
- What is the difference between “static” and “automatic”?
- What is pass-by-reference, pass-by-value, respectively, and what is the difference between them? Furthermore, what is the benefit of pass-by-reference?
关于更多关于pass-by-reference的讨论,可以进一步参考下文:
SystemVerilog: What is and why to use pass-by-reference?
相关文章
- javascript 中function(){},new function(),new Function(),Function 摘录
- ORA-04091: table xxxx is mutating, trigger/function may not see it
- 【COCOS2DX-LUA 脚本开发之七】解决( ERROR IN FUNCTION ‘ADDCHILD’. ARGUMENT #2 IS ‘XX’; ‘CCNODE’ EXPECTED. )异常报错的方法
- [Vue-rx] Disable Buttons While Data is Loading with RxJS and Vue.js
- [Typescript] What is a Function Type ? Function Types and Interfaces - Are They Related ?
- lxml安装问题:Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
- IS-IS详解(八)——深入探究IS-IS DIS选举机制
- Execution error: 'the function name is not a recognized built-in function name'
- Execution error: 'the function name is not a recognized built-in function name'
- D3 dataset - what is usage of key function in data
- the code place where the binding is converted to final value displayed in ui
- why get_expanded_entityset is not called but works in Ke's laptop
- when is valid from and valid to filled in SAP IBASE buffer table
- when is IBASE status changed from inital to created - not answered
- Error response from daemon: Container ************** is not running
- Windows10 启动 Docker Desktop 时报错 Containers feature is disabled
- 关于 SAP UI5 getSAPLogonLanguage is not a function 的错误消息以及 API 版本的讨论
- how is bookmark function implemented in Opportunity
- Spire.Office for Java 5.4.5 is released
- 成功解决NameError: name 'apply' is not defined
- CV之IS:计算机视觉中图像分割(语义分割)最diao炸(完)天(整)的思维导图
- 【QML】解决 “TypeError: Property ‘hello‘ of object CppObject(0x55674a9516a0) is not a function”
- java.util.function.Function的用法
- mysql - 报错 This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled
- TypeError: 'encoding' is an invalid keyword argument for this function
- Ubuntu下is not in the sudoers file 问题解决