Issue #361
Verilog::Perl 3.305 doesn't populate the data_type field in a var callback
| Status: | Closed | Start date: | 06/30/2011 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | Wilson Snyder | % Done: | 0% |
|
| Category: | - | |||
| Target version: | - |
Description
I'm using Verilog::Perl 3.305. When using the var callback, I don't get a value for the $data_type argument when the var being instantiated is a covergroup.
- =item $self->var ( $kwd, $name, $objof, $nettype, $data_type, $array, $value )
I was curious if it's possible to get that argument populated with the name of the cover group.
After an email from Wilson he mentioned cover groups are more like structs than normal variables. In this case, I wouldn't mind the $data_type field to be populated with "covergroup" (similar to how struct works).
History
Updated by Wilson Snyder 11 months ago
- Status changed from New to Assigned
I think I might have misunderstood the original question. Are you looking for the members of the covergroup, or the variable that instantiates the covergroup (with new())? Neither are presently supported.
My original reading was the members, but now think you want the latter? If so, that's a resolution problem which the parser doesn't deal with; it's currently up to the application to know what's behind a data type (covergroups being just a data type.)
I realized though that there wasn't a way to know what data types were declared as covergroups, so I added a covergroup and endgroup callback. So, you can build a hash with the covergroup callback, and check it on each var.
There's also an internal symbol table that 'sort of' knows it's a covergroup, but that's not presently exposed for some ugly reasons.
Updated by Wilson Snyder 11 months ago
BTW covergroup/endgroup now in git towards 3.308.
Updated by Jon Nall 11 months ago
Thanks for this quick response.
I should have written a reproducer from the start, but was just busy today -- my apologies. Consider the verilog below. These are the args to the var callbacks I see when it gets parsed.
Note the coverGroupInst has no data_type value at all. It would be useful if it could be 'covergroup' (similar to 'struct').
[K: var][N: myReg][O: module][N: ][D: reg][A: ] [K: var][N: fooA][O: class][N: ][D: reg][A: ] [K: member][N: structA][O: struct][N: ][D: reg][A: ] [K: typedef][N: myStruct][O: module][N: ][D: struct][A: ] [K: var][N: myEvent][O: module][N: ][D: event][A: ] [K: var][N: fooInst][O: module][N: ][D: myFoo][A: ] [K: var][N: structInst][O: module][N: ][D: myStruct][A: ] [K: var][N: coverGroupInst][O: module][N: ][D: ][A: ]
module gc;
reg myReg;
class myFoo;
reg fooA;
endclass
typedef struct
{
reg structA;
} myStruct;
event myEvent;
covergroup myCoverGroup @(myEvent);
myCoverPoint: coverpoint myReg
{
bins A = {1'b0};
bins B = {1'b1};
}
endgroup // myCoverGroup
myFoo fooInst = new;
myStruct structInst;
myCoverGroup coverGroupInst = new;
endmodule
Updated by Wilson Snyder 11 months ago
- Status changed from Assigned to Resolved
Ahh, having a empty data_type is just a typo. Fixed in git towards 3.308.
The var callback will now return "myCoverGroup" - if you want to know that's a covergroup, an application could use the new callback to remember the declaration names, and look it up on the var callback.
Also available in: Atom
![[logo]](/img/veripool_small.png)