vpiScope

时间: 2023-08-02 admin IT培训

vpiScope

vpiScope

在LRM中vpiScope的含义是 containing scope object,这点不太好理解,做了一点实验,用于说明它的含义

在iverilog里面:

vpiScope iterator on vpiScope objects.

    In the VPI, the normal way to iterate over vpiScope objects
    contained within a vpiScope object, is the vpiInternalScope
    iterator. Icarus Verilog adds support for the vpiScope
    iterator of a vpiScope object, that iterates over *everything*
    the is contained in the current scope. This is useful in cases
    where one wants to iterate over all the objects in a scope
    without iterating over all the contained types explicitly.

 iverilog对vpiScope做了扩展,即可以通过vpi_iterate获取某个scope下的subscope,比如可以这样。

vpiHandle iter = vpi_iterate(vpiScope, item);vpiHandle sub;while(NULL != (sub = vpi_scan(iter))){fprintf(stderr, "name:%s\n", vpi_get_str(vpiFullName, sub));}

同时,可以通过vpi_handle(vpiScope, item) 获取上一级的scope

vpiHandle scope = vpi_handle(vpiScope, item);

标准LRM

这时,可以通过vpi_handle(vpiScope,item) 获取上一级的scope,通过

vpi_iterate(vpiInternalScope, item) 来获取本scope里面的scope

iverilog 获取hierarchy tree_yuexiangallan的博客-CSDN博客