extending extract logic declarations names example to support data structures #1707
Replies: 3 comments 2 replies
|
It's not clear what you're missing. You already have the members of the struct with |
|
thanks for the response. yes, i can get the members but then i need to iterate over them and check their type to find logic variables and once i find one i need to get the variable names and bit width associated with them. that is what the data that i need. for example for the code in question: , i need to be able to find the two logic signals x and y and get the bit with which is 32 bits. the least i need are the variable names, but i havent been able to find that data after extracting the members. |
|
ok, name is not working for some reason: , type i can get it: but i was expecting something in the same lines of what happens with variables that are not defined in a data structure. the type for this is |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
hi,
im trying to extend the example provide for pylang that extracts the names of logic declarations in a file so that it supports data structures defined using typedef in verilog. This is an example of the code I'm parsing:
package definitions; parameter VERSION = "1.1"; typedef enum {ADD, SUB, MUL} opcodes_t; logic [7:0] c; typedef struct { logic [31:0] x, y; opcodes_t opcode; } instruction_t; function automatic [31:0] multiplier (input [31:0] a, b); // code for a custom 32-bit multiplier goes here return a * b; // abstract multiplier (no error detection) endfunction endpackageUsing the code of the example as it is, it is going to extract all logic declarations except for x and y:
I've been working on trying to get to the instruction_t declaraction but has not been succesful. I can get the declaration using:
, and doing some exploration with:
, but i have not been able to get the rest of the data. I assume I should be using a visitor somehow for this, but the calls in the original code doesnt seem to look inside the definition of the data structure. Probably I'm missing something at the moment.
Any suggestion is more than welcome.
thanks.
All reactions