我的验证环境中的 uint 列表上有多个相同的约束。我写了一个宏,所以我只能写一次约束,它将把它们扩展到所有其他列表。例如,我想写:
data_delay : list of uint;
req_delay : list of uint;
keep for each in [data_delay, req_delay] {
soft it == select {
1 : [0]; -- Back to back
5 : [1..5]; -- Short delay
2 : [5..12]; -- Medium delay
1 : [13..40]; -- Long delay
};
};
并且宏将复制列表data_delay
和req_delay
. 我写的宏是:
define <multi_keep_for'statement> "keep for each in \[<detr'name>,...\] (<MEMBERS>{<struct_member>;...})" as computed {
for each in <detr'names> do {
result = appendf("%s keep for each in %s %s", result, it, <MEMBERS>);
};
};
但我得到编译错误:
The type of 'data_delay' is 'list of uint', while expecting a numeric type
我不明白这个问题 - 我用过<detr'name>
它应该代表一个变量的名称而不是数字类型。你明白这个问题吗?感谢您的任何帮助