Make statement file lineno available to targets.
Make the Verilog file/lineno of statements available to loadable code generators. Make sure the information is properly set for system task calls.
This commit is contained in:
parent
7975e14b5c
commit
1db19b8703
|
|
@ -47,6 +47,8 @@ class LineInfo {
|
|||
void set_file(perm_string f);
|
||||
void set_lineno(unsigned n);
|
||||
|
||||
perm_string get_file() const { return file_; }
|
||||
unsigned get_lineno() const { return lineno_; }
|
||||
private:
|
||||
perm_string file_;
|
||||
unsigned lineno_;
|
||||
|
|
|
|||
|
|
@ -2102,6 +2102,7 @@ NetProc* PCallTask::elaborate_sys(Design*des, NetScope*scope) const
|
|||
}
|
||||
|
||||
NetSTask*cur = new NetSTask(peek_tail_name(path_), eparms);
|
||||
cur->set_line(*this);
|
||||
return cur;
|
||||
}
|
||||
|
||||
|
|
|
|||
2
ivl.def
2
ivl.def
|
|
@ -170,6 +170,8 @@ ivl_process_scope
|
|||
ivl_process_stmt
|
||||
ivl_process_type
|
||||
|
||||
ivl_statement_file
|
||||
ivl_statement_lineno
|
||||
ivl_statement_type
|
||||
|
||||
ivl_stmt_block_count
|
||||
|
|
|
|||
|
|
@ -1611,9 +1611,16 @@ extern ivl_attribute_t ivl_process_attr_val(ivl_process_t net, unsigned idx);
|
|||
* The ivl_statement_type() function returns the type code for the
|
||||
* statement. This is the major type, and implies which of the later
|
||||
* functions are applicable to the statement.
|
||||
*
|
||||
* the ivl_statement_file() and _lineno() functions return the source
|
||||
* file and line number of the statement in the Verilog source. This
|
||||
* information is useful for diagnostic information.
|
||||
*/
|
||||
extern ivl_statement_type_t ivl_statement_type(ivl_statement_t net);
|
||||
|
||||
extern const char* ivl_statement_file(ivl_statement_t net);
|
||||
extern unsigned ivl_statement_lineno(ivl_statement_t net);
|
||||
|
||||
/*
|
||||
* The following functions retrieve specific single values from the
|
||||
* statement. These values are the bits of data and parameters that
|
||||
|
|
|
|||
10
t-dll-api.cc
10
t-dll-api.cc
|
|
@ -1642,6 +1642,16 @@ extern "C" ivl_statement_type_t ivl_statement_type(ivl_statement_t net)
|
|||
return net->type_;
|
||||
}
|
||||
|
||||
extern "C" const char* ivl_statement_file(ivl_statement_t net)
|
||||
{
|
||||
return net->file.str();
|
||||
}
|
||||
|
||||
extern "C" unsigned ivl_statement_lineno(ivl_statement_t net)
|
||||
{
|
||||
return net->lineno;
|
||||
}
|
||||
|
||||
extern "C" ivl_scope_t ivl_stmt_block_scope(ivl_statement_t net)
|
||||
{
|
||||
switch (net->type_) {
|
||||
|
|
|
|||
|
|
@ -34,6 +34,15 @@
|
|||
#endif
|
||||
# include <stdlib.h>
|
||||
|
||||
/*
|
||||
* The FILE_NAME function is a shorthand for attaching file/line
|
||||
* information to the statement object.
|
||||
*/
|
||||
static inline void FILE_NAME(ivl_statement_t stmt, const LineInfo*info)
|
||||
{
|
||||
stmt->file = info->get_file();
|
||||
stmt->lineno = info->get_lineno();
|
||||
}
|
||||
|
||||
bool dll_target::process(const NetProcTop*net)
|
||||
{
|
||||
|
|
@ -196,6 +205,7 @@ void dll_target::proc_assign(const NetAssign*net)
|
|||
assert(stmt_cur_->type_ == IVL_ST_NONE);
|
||||
|
||||
stmt_cur_->type_ = IVL_ST_ASSIGN;
|
||||
FILE_NAME(stmt_cur_, net);
|
||||
|
||||
stmt_cur_->u_.assign_.delay = 0;
|
||||
|
||||
|
|
@ -223,6 +233,8 @@ void dll_target::proc_assign_nb(const NetAssignNB*net)
|
|||
assert(stmt_cur_->type_ == IVL_ST_NONE);
|
||||
|
||||
stmt_cur_->type_ = IVL_ST_ASSIGN_NB;
|
||||
FILE_NAME(stmt_cur_, net);
|
||||
|
||||
stmt_cur_->u_.assign_.delay = 0;
|
||||
|
||||
/* Make the lval fields. */
|
||||
|
|
@ -254,6 +266,7 @@ bool dll_target::proc_block(const NetBlock*net)
|
|||
{
|
||||
assert(stmt_cur_);
|
||||
assert(stmt_cur_->type_ == IVL_ST_NONE);
|
||||
FILE_NAME(stmt_cur_, net);
|
||||
|
||||
/* First, count the statements in the block. */
|
||||
unsigned count = 0;
|
||||
|
|
@ -317,6 +330,7 @@ void dll_target::proc_case(const NetCase*net)
|
|||
{
|
||||
assert(stmt_cur_);
|
||||
assert(stmt_cur_->type_ == IVL_ST_NONE);
|
||||
FILE_NAME(stmt_cur_, net);
|
||||
|
||||
switch (net->type()) {
|
||||
case NetCase::EQ:
|
||||
|
|
@ -377,6 +391,7 @@ bool dll_target::proc_cassign(const NetCAssign*net)
|
|||
|
||||
assert(stmt_cur_);
|
||||
assert(stmt_cur_->type_ == IVL_ST_NONE);
|
||||
FILE_NAME(stmt_cur_, net);
|
||||
|
||||
stmt_cur_->type_ = IVL_ST_CASSIGN;
|
||||
|
||||
|
|
@ -395,6 +410,7 @@ bool dll_target::proc_condit(const NetCondit*net)
|
|||
{
|
||||
assert(stmt_cur_);
|
||||
assert(stmt_cur_->type_ == IVL_ST_NONE);
|
||||
FILE_NAME(stmt_cur_, net);
|
||||
|
||||
stmt_cur_->type_ = IVL_ST_CONDIT;
|
||||
stmt_cur_->u_.condit_.stmt_ = (struct ivl_statement_s*)
|
||||
|
|
@ -421,6 +437,7 @@ bool dll_target::proc_deassign(const NetDeassign*net)
|
|||
{
|
||||
assert(stmt_cur_);
|
||||
assert(stmt_cur_->type_ == IVL_ST_NONE);
|
||||
FILE_NAME(stmt_cur_, net);
|
||||
|
||||
stmt_cur_->type_ = IVL_ST_DEASSIGN;
|
||||
|
||||
|
|
@ -434,6 +451,7 @@ bool dll_target::proc_delay(const NetPDelay*net)
|
|||
{
|
||||
assert(stmt_cur_);
|
||||
assert(stmt_cur_->type_ == IVL_ST_NONE);
|
||||
FILE_NAME(stmt_cur_, net);
|
||||
|
||||
ivl_statement_t tmp = (struct ivl_statement_s*)
|
||||
calloc(1, sizeof(struct ivl_statement_s));
|
||||
|
|
@ -474,6 +492,7 @@ bool dll_target::proc_disable(const NetDisable*net)
|
|||
{
|
||||
assert(stmt_cur_);
|
||||
assert(stmt_cur_->type_ == IVL_ST_NONE);
|
||||
FILE_NAME(stmt_cur_, net);
|
||||
|
||||
stmt_cur_->type_ = IVL_ST_DISABLE;
|
||||
stmt_cur_->u_.disable_.scope = lookup_scope_(net->target());
|
||||
|
|
@ -503,6 +522,7 @@ void dll_target::proc_forever(const NetForever*net)
|
|||
{
|
||||
assert(stmt_cur_);
|
||||
assert(stmt_cur_->type_ == IVL_ST_NONE);
|
||||
FILE_NAME(stmt_cur_, net);
|
||||
|
||||
stmt_cur_->type_ = IVL_ST_FOREVER;
|
||||
|
||||
|
|
@ -522,6 +542,7 @@ bool dll_target::proc_release(const NetRelease*net)
|
|||
{
|
||||
assert(stmt_cur_);
|
||||
assert(stmt_cur_->type_ == IVL_ST_NONE);
|
||||
FILE_NAME(stmt_cur_, net);
|
||||
|
||||
stmt_cur_->type_ = IVL_ST_RELEASE;
|
||||
|
||||
|
|
@ -535,6 +556,7 @@ void dll_target::proc_repeat(const NetRepeat*net)
|
|||
{
|
||||
assert(stmt_cur_);
|
||||
assert(stmt_cur_->type_ == IVL_ST_NONE);
|
||||
FILE_NAME(stmt_cur_, net);
|
||||
|
||||
stmt_cur_->type_ = IVL_ST_REPEAT;
|
||||
|
||||
|
|
@ -560,6 +582,7 @@ void dll_target::proc_stask(const NetSTask*net)
|
|||
unsigned nparms = net->nparms();
|
||||
assert(stmt_cur_);
|
||||
assert(stmt_cur_->type_ == IVL_ST_NONE);
|
||||
FILE_NAME(stmt_cur_, net);
|
||||
|
||||
stmt_cur_->type_ = IVL_ST_STASK;
|
||||
/* System task names are lex_strings strings. */
|
||||
|
|
@ -581,6 +604,7 @@ bool dll_target::proc_trigger(const NetEvTrig*net)
|
|||
{
|
||||
assert(stmt_cur_);
|
||||
assert(stmt_cur_->type_ == IVL_ST_NONE);
|
||||
FILE_NAME(stmt_cur_, net);
|
||||
|
||||
stmt_cur_->type_ = IVL_ST_TRIGGER;
|
||||
stmt_cur_->u_.wait_.nevent = 1;
|
||||
|
|
@ -606,6 +630,7 @@ void dll_target::proc_utask(const NetUTask*net)
|
|||
{
|
||||
assert(stmt_cur_);
|
||||
assert(stmt_cur_->type_ == IVL_ST_NONE);
|
||||
FILE_NAME(stmt_cur_, net);
|
||||
|
||||
stmt_cur_->type_ = IVL_ST_UTASK;
|
||||
stmt_cur_->u_.utask_.def = lookup_scope_(net->task());
|
||||
|
|
@ -615,6 +640,7 @@ bool dll_target::proc_wait(const NetEvWait*net)
|
|||
{
|
||||
assert(stmt_cur_);
|
||||
assert(stmt_cur_->type_ == IVL_ST_NONE);
|
||||
FILE_NAME(stmt_cur_, net);
|
||||
|
||||
stmt_cur_->type_ = IVL_ST_WAIT;
|
||||
stmt_cur_->u_.wait_.stmt_ = (struct ivl_statement_s*)
|
||||
|
|
@ -708,6 +734,7 @@ void dll_target::proc_while(const NetWhile*net)
|
|||
{
|
||||
assert(stmt_cur_);
|
||||
assert(stmt_cur_->type_ == IVL_ST_NONE);
|
||||
FILE_NAME(stmt_cur_, net);
|
||||
|
||||
stmt_cur_->type_ = IVL_ST_WHILE;
|
||||
stmt_cur_->u_.while_.stmt_ = (struct ivl_statement_s*)
|
||||
|
|
|
|||
3
t-dll.h
3
t-dll.h
|
|
@ -607,6 +607,9 @@ struct ivl_signal_s {
|
|||
*/
|
||||
struct ivl_statement_s {
|
||||
enum ivl_statement_type_e type_;
|
||||
perm_string file;
|
||||
unsigned lineno;
|
||||
|
||||
union {
|
||||
struct { /* IVL_ST_ASSIGN IVL_ST_ASSIGN_NB
|
||||
IVL_ST_CASSIGN, IVL_ST_DEASSIGN */
|
||||
|
|
|
|||
|
|
@ -323,8 +323,9 @@ void show_statement(ivl_statement_t net, unsigned ind)
|
|||
break;
|
||||
|
||||
case IVL_ST_STASK: {
|
||||
fprintf(out, "%*sCall %s(%u parameters);\n", ind, "",
|
||||
ivl_stmt_name(net), ivl_stmt_parm_count(net));
|
||||
fprintf(out, "%*sCall %s(%u parameters); /* %s:%u */\n",
|
||||
ind, "", ivl_stmt_name(net), ivl_stmt_parm_count(net),
|
||||
ivl_statement_file(net), ivl_statement_lineno(net));
|
||||
for (idx = 0 ; idx < ivl_stmt_parm_count(net) ; idx += 1)
|
||||
if (ivl_stmt_parm(net, idx))
|
||||
show_expression(ivl_stmt_parm(net, idx), ind+4);
|
||||
|
|
|
|||
Loading…
Reference in New Issue