在systemverilog LRM
中,有一个示例代码来解释强制转换。当我尝试此代码时,出现错误。
typedef struct {
bit isfloat;
union { int i; shortreal f; } n; // anonymous type
} tagged_st; // named structure
typedef bit [$bits(tagged_st) - 1 : 0] tagbits;
tagged_st a [7:0]; // unpacked array of structures
tagbits t = tagbits'(a[3]); / convert structure to array of bits
a[4] = tagged_st'(t); // convert array of bits back to structure
- 首先,对于
$bits()
函数,编译器说the argument of the system function call was not of bit-stream type.
a[3]
其次,当使用 的类型转换进行分配时tagbits
,它说 我的理解是,结构和解包数组也是比特流类型。 希望知道我错过了什么。The source of the target of the bit-stream casting is not of bit-stream type
(cadence 18.09-006)