File line information for expressions
Add ivl_target support for file and line numbers of expressions.
This commit is contained in:
parent
1db19b8703
commit
08752453b4
|
|
@ -512,6 +512,7 @@ NetExpr* PECallFunction::elaborate_sfunc_(Design*des, NetScope*scope, int expr_w
|
||||||
|
|
||||||
NetESFunc*fun = new NetESFunc(peek_tail_name(path_), sfunc_type,
|
NetESFunc*fun = new NetESFunc(peek_tail_name(path_), sfunc_type,
|
||||||
wid, nparms);
|
wid, nparms);
|
||||||
|
fun->set_line(*this);
|
||||||
if (sfunc_info->signed_flag)
|
if (sfunc_info->signed_flag)
|
||||||
fun->cast_signed(true);
|
fun->cast_signed(true);
|
||||||
|
|
||||||
|
|
|
||||||
2
ivl.def
2
ivl.def
|
|
@ -29,6 +29,8 @@ ivl_expr_bits
|
||||||
ivl_expr_def
|
ivl_expr_def
|
||||||
ivl_expr_dvalue
|
ivl_expr_dvalue
|
||||||
ivl_expr_event
|
ivl_expr_event
|
||||||
|
ivl_expr_file
|
||||||
|
ivl_expr_lineno
|
||||||
ivl_expr_name
|
ivl_expr_name
|
||||||
ivl_expr_opcode
|
ivl_expr_opcode
|
||||||
ivl_expr_oper1
|
ivl_expr_oper1
|
||||||
|
|
|
||||||
|
|
@ -646,6 +646,8 @@ extern ivl_nexus_t ivl_event_pos(ivl_event_t net, unsigned idx);
|
||||||
|
|
||||||
extern ivl_expr_type_t ivl_expr_type(ivl_expr_t net);
|
extern ivl_expr_type_t ivl_expr_type(ivl_expr_t net);
|
||||||
extern ivl_variable_type_t ivl_expr_value(ivl_expr_t net);
|
extern ivl_variable_type_t ivl_expr_value(ivl_expr_t net);
|
||||||
|
extern const char*ivl_expr_file(ivl_expr_t net);
|
||||||
|
extern unsigned ivl_expr_lineno(ivl_expr_t net);
|
||||||
|
|
||||||
/* IVL_EX_NUMBER */
|
/* IVL_EX_NUMBER */
|
||||||
extern const char* ivl_expr_bits(ivl_expr_t net);
|
extern const char* ivl_expr_bits(ivl_expr_t net);
|
||||||
|
|
|
||||||
11
t-dll-api.cc
11
t-dll-api.cc
|
|
@ -91,6 +91,17 @@ extern "C" ivl_expr_type_t ivl_expr_type(ivl_expr_t net)
|
||||||
return net->type_;
|
return net->type_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" const char*ivl_expr_file(ivl_expr_t net)
|
||||||
|
{
|
||||||
|
assert(net);
|
||||||
|
return net->file.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" unsigned ivl_expr_lineno(ivl_expr_t net)
|
||||||
|
{
|
||||||
|
assert(net);
|
||||||
|
return net->lineno;
|
||||||
|
}
|
||||||
|
|
||||||
inline static const char *basename(ivl_scope_t scope, const char *inst)
|
inline static const char *basename(ivl_scope_t scope, const char *inst)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -334,6 +334,7 @@ void dll_target::expr_sfunc(const NetESFunc*net)
|
||||||
assert(expr);
|
assert(expr);
|
||||||
|
|
||||||
expr->type_ = IVL_EX_SFUNC;
|
expr->type_ = IVL_EX_SFUNC;
|
||||||
|
FILE_NAME(expr, net);
|
||||||
expr->value_= net->expr_type();
|
expr->value_= net->expr_type();
|
||||||
expr->width_= net->expr_width();
|
expr->width_= net->expr_width();
|
||||||
expr->signed_ = net->has_sign()? 1 : 0;
|
expr->signed_ = net->has_sign()? 1 : 0;
|
||||||
|
|
@ -363,6 +364,7 @@ void dll_target::expr_ternary(const NetETernary*net)
|
||||||
assert(expr);
|
assert(expr);
|
||||||
|
|
||||||
expr->type_ = IVL_EX_TERNARY;
|
expr->type_ = IVL_EX_TERNARY;
|
||||||
|
FILE_NAME(expr, net);
|
||||||
expr->value_= net->expr_type();
|
expr->value_= net->expr_type();
|
||||||
expr->width_ = net->expr_width();
|
expr->width_ = net->expr_width();
|
||||||
expr->signed_ = net->has_sign()? 1 : 0;
|
expr->signed_ = net->has_sign()? 1 : 0;
|
||||||
|
|
@ -429,6 +431,7 @@ void dll_target::expr_ufunc(const NetEUFunc*net)
|
||||||
assert(expr);
|
assert(expr);
|
||||||
|
|
||||||
expr->type_ = IVL_EX_UFUNC;
|
expr->type_ = IVL_EX_UFUNC;
|
||||||
|
FILE_NAME(expr, net);
|
||||||
expr->value_= net->expr_type();
|
expr->value_= net->expr_type();
|
||||||
expr->width_= net->expr_width();
|
expr->width_= net->expr_width();
|
||||||
expr->signed_ = net->has_sign()? 1 : 0;
|
expr->signed_ = net->has_sign()? 1 : 0;
|
||||||
|
|
|
||||||
|
|
@ -34,16 +34,6 @@
|
||||||
#endif
|
#endif
|
||||||
# include <stdlib.h>
|
# 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)
|
bool dll_target::process(const NetProcTop*net)
|
||||||
{
|
{
|
||||||
ivl_process_t obj = (struct ivl_process_s*)
|
ivl_process_t obj = (struct ivl_process_s*)
|
||||||
|
|
|
||||||
18
t-dll.h
18
t-dll.h
|
|
@ -199,6 +199,8 @@ struct ivl_event_s {
|
||||||
struct ivl_expr_s {
|
struct ivl_expr_s {
|
||||||
ivl_expr_type_t type_;
|
ivl_expr_type_t type_;
|
||||||
ivl_variable_type_t value_;
|
ivl_variable_type_t value_;
|
||||||
|
perm_string file;
|
||||||
|
unsigned lineno;
|
||||||
|
|
||||||
unsigned width_;
|
unsigned width_;
|
||||||
unsigned signed_ : 1;
|
unsigned signed_ : 1;
|
||||||
|
|
@ -683,4 +685,20 @@ struct ivl_statement_s {
|
||||||
} u_;
|
} u_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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();
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void FILE_NAME(ivl_expr_t expr, const LineInfo*info)
|
||||||
|
{
|
||||||
|
expr->file = info->get_file();
|
||||||
|
expr->lineno = info->get_lineno();
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -233,8 +233,9 @@ void show_expression(ivl_expr_t net, unsigned ind)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IVL_EX_SFUNC:
|
case IVL_EX_SFUNC:
|
||||||
fprintf(out, "%*s<function=\"%s\", width=%u, %s, type=%s>\n",
|
fprintf(out, "%*s<function=\"%s\", width=%u, %s, type=%s file=%s:%u>\n",
|
||||||
ind, "", ivl_expr_name(net), width, sign, vt);
|
ind, "", ivl_expr_name(net), width, sign, vt,
|
||||||
|
ivl_expr_file(net), ivl_expr_lineno(net));
|
||||||
{ unsigned cnt = ivl_expr_parms(net);
|
{ unsigned cnt = ivl_expr_parms(net);
|
||||||
unsigned idx;
|
unsigned idx;
|
||||||
for (idx = 0 ; idx < cnt ; idx += 1)
|
for (idx = 0 ; idx < cnt ; idx += 1)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue