Reputation: 21
I am familiar with the collect
command in Specman which returns all of the specified method's extensions. However, show source
for a certain struct only returns the base struct definition and not all the extensions.
is there a command in Specman that is equivalent to collect
but for structs/units?
Upvotes: 0
Views: 157
Reputation: 331
there is no such command in Specman but since e is an incredibly flexible language you can add any command you may need using the powerful e macros.
For example, to implement what you want, you can create a macro that makes use of the reflection Mechanism to get all layers of the desired struct and then print the relevant source lines:
define <struct_collect'command> "s_collect <any>" as {
var line_num:int;
var st:rf_struct = rf_manager.get_struct_by_name("<1>");
if (st==NULL) {
out(append("struct name does not exist : <1>"));
} else {
for each in st.as_a(rf_like_struct).get_layers() {
line_num=it.get_source_line_num();
out(append("In file ",it.get_module().get_name()," line ",line_num, " : ",files.get_text_lines(it.get_module().get_full_file_name(), line_num,line_num)));
};
};
};
you can improve on this macro, by writing the results to a file, or arrange it in a different way.
Cheers
Upvotes: 4