Skip to content

Commit 9889476

Browse files
authored
Merge pull request #866 from diffblue/vlindex-property-sequence
vlindex: properties and sequences
2 parents 88c87f3 + 965753c commit 9889476

File tree

4 files changed

+62
-1
lines changed

4 files changed

+62
-1
lines changed

src/vlindex/verilog_indexer.cpp

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1160,12 +1160,54 @@ void verilog_indexer_parsert::rGenerateBegin()
11601160

11611161
void verilog_indexer_parsert::rProperty()
11621162
{
1163+
next_token(); // property
1164+
1165+
auto name = next_token(); // name
1166+
1167+
{
1168+
idt id;
1169+
id.kind = idt::PROPERTY;
1170+
id.name = name.text;
1171+
id.module = current_module;
1172+
id.file_name = verilog_parser.get_file();
1173+
id.line_number = verilog_parser.get_line_no();
1174+
indexer.add(std::move(id));
1175+
}
1176+
11631177
skip_until(TOK_ENDPROPERTY);
1178+
1179+
// optional label
1180+
if(peek() == TOK_COLON)
1181+
{
1182+
next_token(); // :
1183+
next_token(); // identifier
1184+
}
11641185
}
11651186

11661187
void verilog_indexer_parsert::rSequence()
11671188
{
1168-
skip_until(TOK_ENDSEQUENCE);
1189+
next_token(); // sequence
1190+
1191+
auto name = next_token(); // name
1192+
1193+
{
1194+
idt id;
1195+
id.kind = idt::SEQUENCE;
1196+
id.name = name.text;
1197+
id.module = current_module;
1198+
id.file_name = verilog_parser.get_file();
1199+
id.line_number = verilog_parser.get_line_no();
1200+
indexer.add(std::move(id));
1201+
}
1202+
1203+
skip_until(TOK_ENDPROPERTY);
1204+
1205+
// optional label
1206+
if(peek() == TOK_COLON)
1207+
{
1208+
next_token(); // :
1209+
next_token(); // identifier
1210+
}
11691211
}
11701212

11711213
void verilog_indexer_parsert::rSpecify()
@@ -1452,6 +1494,16 @@ int verilog_index(const cmdlinet &cmdline)
14521494
// Show the module instances.
14531495
show_kind(verilog_indexert::idt::kindt::TASK, indexer);
14541496
}
1497+
else if(cmdline.isset("sequences"))
1498+
{
1499+
// Show the sequences.
1500+
show_kind(verilog_indexert::idt::kindt::SEQUENCE, indexer);
1501+
}
1502+
else if(cmdline.isset("properties"))
1503+
{
1504+
// Show the properties.
1505+
show_kind(verilog_indexert::idt::kindt::PROPERTY, indexer);
1506+
}
14551507
else
14561508
{
14571509
auto total_number_of = indexer.total_number_of();
@@ -1476,6 +1528,10 @@ int verilog_index(const cmdlinet &cmdline)
14761528
<< total_number_of[idt::FUNCTION] << '\n';
14771529
std::cout << "Number of tasks...........: " << total_number_of[idt::TASK]
14781530
<< '\n';
1531+
std::cout << "Number of properties......: "
1532+
<< total_number_of[idt::PROPERTY] << '\n';
1533+
std::cout << "Number of sequences.......: "
1534+
<< total_number_of[idt::SEQUENCE] << '\n';
14791535
std::cout << "Number of module instances: "
14801536
<< total_number_of[idt::INSTANCE] << '\n';
14811537
std::cout << "Number of configurations..: " << total_number_of[idt::CONFIG]

src/vlindex/verilog_indexer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ class verilog_indexert
3535
TYPEDEF,
3636
FUNCTION,
3737
TASK,
38+
PROPERTY,
39+
SEQUENCE,
3840
INSTANCE,
3941
BLOCK,
4042
NET,

src/vlindex/vlindex_parse_options.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ void vlindex_parse_optionst::help()
113113
" {y--udps} \t show a list of the UPDs\n"
114114
" {y--tasks} \t show a list of the tasks\n"
115115
" {y--functions} \t show a list of the functions\n"
116+
" {y--properties} \t show a list of the properties\n"
117+
" {y--sequences} \t show a list of the sequences\n"
116118
" {y--hierarchy} \t show the hierarchy of module instantiations\n"
117119
" {y--verbosity} {u#} \t verbosity level, from 0 (silent) to 10 (everything)\n"
118120
// clang-format on

src/vlindex/vlindex_parse_options.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class vlindex_parse_optionst : public parse_options_baset
2626
"(hierarchy)"
2727
"(modules)"
2828
"(packages)(classes)(interfaces)(udps)(instances)(tasks)(functions)"
29+
"(sequences)(properties)"
2930
"(symlinks)(files)"
3031
"(1800-2017)(1800-2012)(1800-2009)(1800-2005)"
3132
"(1364-2005)(1364-2001)(1364-2001-noconfig)(1364-1995)"

0 commit comments

Comments
 (0)