1,使用某种不常见的语法之前,请充分理解该语法的含义以及所使用的场合。default赋初值不能用于普通的packed数组。
2,参考《IEEE Std1800-2017 IEEE Standard for SystemVerilog--Unified Hardware Design, Specification, and Verification Language》的7.8.6、7.8.7和7.9.11章节,他们都是描述Associative arrays和Associative array methods的,引用原文如下图,仔细分析理解一下红框内的说明:“If a default value is specified, then reading a nonexistent element shall yield the specified default value...”——这里面说明了,当去读取联合数组的不存在的成员时,default的值才会被返回。