如何在specman中声明固定长度的列表?

发布于 2024-07-05 06:06:03 字数 295 浏览 7 评论 0 原文

在 E (specman) 中,我想声明列表变量,并且我想修复它们的长度。

对于结构体的成员来说很容易做到:

thread[2] : list of thread_t;

而对于函数中的“常规”变量,上面的方法不起作用,我必须做类似的事情:

var warned : list of bool;
gen warned keeping {
    it.size() == 5;
};

是否有更好的方法来声明固定大小的列表?

In E (specman) I want to declare variables that are lists, and I want to fix their lengths.

It's easy to do for a member of a struct:

thread[2] : list of thread_t;

while for a "regular" variable in a function the above doesn't work, and I have to do something like:

var warned : list of bool;
gen warned keeping {
    it.size() == 5;
};

Is there a better way to declare a list of fixed size?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

雾里花 2024-07-12 06:06:03

像您这样的硬保留只会在初始化时修复大小,但稍后仍然可以添加或删除元素,您是否试图防止这种情况? 我能想到的保证以后不会添加或删除元素的唯一方法是发出一个与大小同步的事件!=预定的数量:

event list_size_changed is true (wanted.size() != 5) @clk;

我可以提供的唯一的另一件事是为硬保留提供一些语法糖:

var warned : list of bool;
keep warned.size() == 5;

A hard keep like you have is only going to fix the size at initialization but elements could still be added or dropped later, are you trying to guard against this condition? The only way I can think of to guarantee that elements aren't added or dropped later is emitting an event synced on the size != the predetermined amount:

event list_size_changed is true (wanted.size() != 5) @clk;

The only other thing that I can offer is a bit of syntactic sugar for the hard keep:

var warned : list of bool;
keep warned.size() == 5;
何时共饮酒 2024-07-12 06:06:03

我对specman一无所知,但固定大小的列表是一个数组,所以这可能会指向你的某个地方。

I know nothing of specman, but a fixed sized list is an array, so that might point you somewhere.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文