PandA-2024.02
|
#include <vcd_parser.hpp>
Public Types | |
using | vcd_filter_t = UnorderedMapStd< std::string, UnorderedSetStdStable< std::string > > |
this is the type used to select which signals have to be filtered during parsing. More... | |
using | vcd_trace_t = UnorderedMapStd< std::string, CustomUnorderedMapStable< std::string, std::list< sig_variation > >> |
this type is the result of a parse. More... | |
Public Member Functions | |
vcd_parser (const ParameterConstRef ¶ms) | |
constructor More... | |
vcd_trace_t | parse_vcd (const std::string &vcd_file_to_parse, const vcd_parser::vcd_filter_t &selected_signals) |
parses a file selecting only a predefined set of signals. More... | |
Private Member Functions | |
int | vcd_parse_sim () |
Parses all lines that occur in the simulation portion of the VCD file. More... | |
int | vcd_parse_def () |
int | vcd_parse_skip_to_end () |
Parses specified file until $end keyword is seen, ignoring all text inbetween. More... | |
int | vcd_parse_def_var (const std::string &scope) |
Parses definition $var keyword line until $end keyword is seen. More... | |
void | vcd_push_def_scope (std::stack< std::string > &scope) |
Parses definition $scope keyword line until $end keyword is seen. More... | |
void | vcd_pop_def_scope (std::stack< std::string > &scope) |
int | vcd_parse_sim_vector (char *value, unsigned long timestamp) |
Reads the next token from the file and calls the appropriate fuction. More... | |
int | vcd_parse_sim_real (char *value, unsigned long timestamp) |
Reads the next token from the file and calls the appropriate function. More... | |
bool | check_filter_list (const std::string &scope_str, const std::string &name) |
Checks if a signal is to be monitored. More... | |
void | vcd_add_signal (const std::string &scope, const std::string &name, const std::string &vcd_id, const std::string &type, const bool isvect, const unsigned int msb, const unsigned int lsb) |
insert a signal in the maps needed for selecting the vcd data and for relating it back to HDL and C variables More... | |
bool | check_signals () const |
check if the port vectors declarations are consistent More... | |
void | init_variations () |
void | add_variation (const std::string &id, const std::string &value, unsigned long long ts) |
Private Attributes | |
const int | debug_level |
Debug Level. More... | |
std::string | vcd_filename |
name of the vcd file to parse More... | |
FILE * | vcd_fp |
file pointer to the vcd file to parse More... | |
unsigned long | sig_n |
total number of signals in the vcd file More... | |
vcd_filter_t | filtered_signals |
set of signals to select from the vcd file. More... | |
vcd_trace_t | parse_result |
holds the parsed vcd trace during the parsing More... | |
std::map< std::pair< std::string, std::string >, vcd_sig_info > | scope_and_name_to_sig_info |
maps every pair (scope, signal name) to the corresponding sig_info More... | |
std::map< std::string, CustomUnorderedSet< std::pair< std::string, std::string > > > | vcd_id_to_scope_and_name |
maps every signal id in the vcd to the set of the corresponding pairs (scope, hdl signal name) More... | |
Definition at line 85 of file vcd_parser.hpp.
using vcd_parser::vcd_filter_t = UnorderedMapStd<std::string, UnorderedSetStdStable<std::string> > |
this is the type used to select which signals have to be filtered during parsing.
the key of the map is a std::string representing a scope. the value type is a UnorderedSetStd containing all the names of the signal that have to be selected in that scope
Definition at line 101 of file vcd_parser.hpp.
using vcd_parser::vcd_trace_t = UnorderedMapStd<std::string, CustomUnorderedMapStable<std::string, std::list<sig_variation> >> |
this type is the result of a parse.
the primary key is the scope. the secondary key is the name of the signal. the value type is std::list of sig_variation representing the waveform
Definition at line 109 of file vcd_parser.hpp.
|
explicit |
constructor
[in] | params | is the class holding bambu parameters |
Definition at line 48 of file vcd_parser.cpp.
|
private |
Definition at line 590 of file vcd_parser.cpp.
References HIERARCHY_SEPARATOR, vcd_sig_info::lsb, vcd_sig_info::msb, parse_result, scope_and_name_to_sig_info, STR, THROW_ASSERT, symmetry::value, vcd_sig_info::vcd_id_to_bit, and vcd_id_to_scope_and_name.
Referenced by vcd_parse_sim(), vcd_parse_sim_real(), and vcd_parse_sim_vector().
|
private |
Checks if a signal is to be monitored.
[in] | name | is the name of the signal to be monitored. |
[in,out] | scope_str | in input this is the signal scope in the vcd; if the signal has to be monitored the string referenced by this parameter is modified, trimming the initial part of the scope to avoid simulator-dependent path names. After this change the remaining part of the path starts from the top functional unit |
Definition at line 511 of file vcd_parser.cpp.
References filtered_signals.
Referenced by vcd_parse_def_var().
|
private |
check if the port vectors declarations are consistent
Definition at line 557 of file vcd_parser.cpp.
References DEBUG_LEVEL_NONE, vcd_sig_info::is_vec, vcd_sig_info::lsb, vcd_sig_info::msb, PRINT_OUT_MEX, scope_and_name_to_sig_info, and vcd_sig_info::vcd_id_to_bit.
Referenced by vcd_parse_def().
|
private |
Definition at line 577 of file vcd_parser.cpp.
References vcd_sig_info::lsb, vcd_sig_info::msb, parse_result, scope_and_name_to_sig_info, and vcd_id_to_scope_and_name.
Referenced by vcd_parse_sim().
vcd_parser::vcd_trace_t vcd_parser::parse_vcd | ( | const std::string & | vcd_file_to_parse, |
const vcd_parser::vcd_filter_t & | selected_signals | ||
) |
parses a file selecting only a predefined set of signals.
[in] | vcd_file_to_parse | name of the file to parse |
[in] | selected_signals | signals to be selected. all signals are selected if this parameter is empty |
Definition at line 53 of file vcd_parser.cpp.
References debug_level, DEBUG_LEVEL_VERBOSE, filtered_signals, INDENT_DBG_MEX, parse_result, scope_and_name_to_sig_info, sig_n, STR, THROW_ERROR, vcd_filename, vcd_fp, vcd_id_to_scope_and_name, vcd_parse_def(), and vcd_parse_sim().
Referenced by vcd_utility::Exec().
|
private |
insert a signal in the maps needed for selecting the vcd data and for relating it back to HDL and C variables
[in] | scope | is the string representing the scope in the parsed vcd |
[in] | name | the signal name in the parsed vcd |
[in] | vcd_id | a string used as unique identifier for the signal in the vcd |
[in] | type | string describing the signal type |
[in] | isvect | true if the signal is a bit vector |
[in] | msb | most significant bit of the signal |
[in] | lsb | less significant bit of the signal |
Definition at line 526 of file vcd_parser.cpp.
References vcd_sig_info::is_vec, key, vcd_sig_info::lsb, max, min, vcd_sig_info::msb, parse_result, scope_and_name_to_sig_info, THROW_ASSERT, THROW_ERROR, vcd_sig_info::type, and vcd_id_to_scope_and_name.
Referenced by vcd_parse_def_var().
|
private |
Definition at line 321 of file vcd_parser.cpp.
References check_signals(), STR, THROW_ERROR, vcd_filename, vcd_fp, vcd_parse_def_var(), vcd_parse_skip_to_end(), vcd_pop_def_scope(), and vcd_push_def_scope().
Referenced by parse_vcd().
|
private |
Parses definition $var keyword line until $end keyword is seen.
Definition at line 143 of file vcd_parser.cpp.
References check_filter_list(), debug_level, DEBUG_LEVEL_VERBOSE, PRINT_DBG_MEX, sig_n, THROW_ERROR, test_panda::type, vcd_add_signal(), and vcd_fp.
Referenced by vcd_parse_def().
|
private |
Parses all lines that occur in the simulation portion of the VCD file.
Definition at line 443 of file vcd_parser.cpp.
References add_variation(), init_variations(), STR, THROW_ERROR, vcd_filename, vcd_fp, vcd_parse_sim_real(), vcd_parse_sim_vector(), and vcd_parse_skip_to_end().
Referenced by parse_vcd().
|
private |
Reads the next token from the file and calls the appropriate function.
Definition at line 418 of file vcd_parser.cpp.
References add_variation(), THROW_ERROR, and vcd_fp.
Referenced by vcd_parse_sim().
|
private |
Reads the next token from the file and calls the appropriate fuction.
Definition at line 392 of file vcd_parser.cpp.
References add_variation(), THROW_ERROR, and vcd_fp.
Referenced by vcd_parse_sim().
|
private |
Parses specified file until $end keyword is seen, ignoring all text inbetween.
Definition at line 113 of file vcd_parser.cpp.
References THROW_ERROR, and vcd_fp.
Referenced by vcd_parse_def(), and vcd_parse_sim().
|
private |
Definition at line 292 of file vcd_parser.cpp.
References debug_level, DEBUG_LEVEL_VERY_PEDANTIC, PRINT_DBG_MEX, THROW_ERROR, and vcd_fp.
Referenced by vcd_parse_def().
|
private |
Parses definition $scope keyword line until $end keyword is seen.
Definition at line 271 of file vcd_parser.cpp.
References debug_level, DEBUG_LEVEL_VERY_PEDANTIC, HIERARCHY_SEPARATOR, PRINT_DBG_MEX, STR, THROW_ERROR, and vcd_fp.
Referenced by vcd_parse_def().
|
private |
Debug Level.
Definition at line 124 of file vcd_parser.hpp.
Referenced by parse_vcd(), vcd_parse_def_var(), vcd_pop_def_scope(), and vcd_push_def_scope().
|
private |
set of signals to select from the vcd file.
if it's empty all the signals will be selected, otherwise the data about uninteresting signals are discarded to save memory
Definition at line 148 of file vcd_parser.hpp.
Referenced by check_filter_list(), and parse_vcd().
|
private |
holds the parsed vcd trace during the parsing
Definition at line 155 of file vcd_parser.hpp.
Referenced by add_variation(), init_variations(), parse_vcd(), and vcd_add_signal().
|
private |
maps every pair (scope, signal name) to the corresponding sig_info
Definition at line 160 of file vcd_parser.hpp.
Referenced by add_variation(), check_signals(), init_variations(), parse_vcd(), and vcd_add_signal().
|
private |
total number of signals in the vcd file
Definition at line 141 of file vcd_parser.hpp.
Referenced by parse_vcd(), and vcd_parse_def_var().
|
private |
name of the vcd file to parse
Definition at line 131 of file vcd_parser.hpp.
Referenced by parse_vcd(), vcd_parse_def(), and vcd_parse_sim().
|
private |
file pointer to the vcd file to parse
Definition at line 136 of file vcd_parser.hpp.
Referenced by parse_vcd(), vcd_parse_def(), vcd_parse_def_var(), vcd_parse_sim(), vcd_parse_sim_real(), vcd_parse_sim_vector(), vcd_parse_skip_to_end(), vcd_pop_def_scope(), and vcd_push_def_scope().
|
private |
maps every signal id in the vcd to the set of the corresponding pairs (scope, hdl signal name)
Definition at line 165 of file vcd_parser.hpp.
Referenced by add_variation(), init_variations(), parse_vcd(), and vcd_add_signal().