Add file/line information to procedural warnings and darray fixes
When -pfileline=1 is used the queue procedural warnings have file and line information added to the messages. Also switch the trace debugging to be off by default. Also, Add some preliminary missing darray functionality.
This commit is contained in:
parent
61884e559c
commit
112ebb48d8
|
|
@ -1,4 +1,4 @@
|
|||
.TH iverilog 1 "Oct 23rd, 2019" "" "Version %M.%n%E"
|
||||
.TH iverilog 1 "Aug 10th, 2020" "" "Version %M.%n%E"
|
||||
.SH NAME
|
||||
iverilog - Icarus Verilog compiler
|
||||
|
||||
|
|
@ -317,7 +317,10 @@ This is the default. The vvp target generates code for the vvp
|
|||
runtime. The output is a complete program that simulates the design
|
||||
but must be run by the \fBvvp\fP command. The -pfileline=1 option
|
||||
can be used to add procedural statement debugging opcodes to the
|
||||
generated code.
|
||||
generated code. These opcodes are also used to generate file and
|
||||
line information for procedural warning/error messages. To enable
|
||||
the debug command tracing us the trace command (trace on) from
|
||||
the vvp interactive prompt.
|
||||
.TP 8
|
||||
.B fpga
|
||||
This is a synthesis target that supports a variety of fpga devices,
|
||||
|
|
@ -630,7 +633,7 @@ Tips on using, debugging, and developing the compiler can be found at
|
|||
|
||||
.SH COPYRIGHT
|
||||
.nf
|
||||
Copyright \(co 2002\-2019 Stephen Williams
|
||||
Copyright \(co 2002\-2020 Stephen Williams
|
||||
|
||||
This document can be freely redistributed according to the terms of the
|
||||
GNU General Public License version 2.0
|
||||
|
|
|
|||
|
|
@ -3024,6 +3024,8 @@ NetExpr* PEConcat::elaborate_expr(Design*des, NetScope*scope,
|
|||
{
|
||||
switch (ntype->base_type()) {
|
||||
case IVL_VT_QUEUE:
|
||||
// FIXME: Does a DARRAY support a zero size?
|
||||
case IVL_VT_DARRAY:
|
||||
if (parms_.size() == 0) {
|
||||
NetENull*tmp = new NetENull;
|
||||
tmp->set_line(*this);
|
||||
|
|
@ -3813,6 +3815,7 @@ NetExpr* PEIdent::elaborate_expr(Design*des, NetScope*scope,
|
|||
<< endl;
|
||||
}
|
||||
|
||||
// FIXME: The real array to queue is failing here.
|
||||
if (net->unpacked_dimensions() != use_comp.index.size()) {
|
||||
cerr << get_fileline() << ": sorry: "
|
||||
<< "Net " << net->name()
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012-2015 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2012-2020 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
|
|
@ -21,6 +21,58 @@
|
|||
# include <string.h>
|
||||
# include <assert.h>
|
||||
|
||||
void darray_new(ivl_type_t element_type, unsigned size_reg)
|
||||
{
|
||||
int wid;
|
||||
char*signed_char;
|
||||
ivl_variable_type_t type = ivl_type_base(element_type);
|
||||
|
||||
if ((type == IVL_VT_BOOL) || (type == IVL_VT_LOGIC)) {
|
||||
int msb, lsb;
|
||||
// bool objects are vectorable, but for now only support
|
||||
// a single dimensions.
|
||||
assert(ivl_type_packed_dimensions(element_type) == 1);
|
||||
msb = ivl_type_packed_msb(element_type, 0);
|
||||
lsb = ivl_type_packed_lsb(element_type, 0);
|
||||
wid = msb>=lsb ? msb - lsb : lsb - msb;
|
||||
wid += 1;
|
||||
signed_char = ivl_type_signed(element_type) ? "s" : "";
|
||||
} else {
|
||||
// REAL or STRING objects are not packable.
|
||||
assert(ivl_type_packed_dimensions(element_type) == 0);
|
||||
wid = 0;
|
||||
signed_char = "";
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case IVL_VT_REAL:
|
||||
fprintf(vvp_out, " %%new/darray %u, \"r\";\n",
|
||||
size_reg);
|
||||
break;
|
||||
|
||||
case IVL_VT_STRING:
|
||||
fprintf(vvp_out, " %%new/darray %u, \"S\";\n",
|
||||
size_reg);
|
||||
break;
|
||||
|
||||
case IVL_VT_BOOL:
|
||||
fprintf(vvp_out, " %%new/darray %u, \"%sb%d\";\n",
|
||||
size_reg, signed_char, wid);
|
||||
break;
|
||||
|
||||
case IVL_VT_LOGIC:
|
||||
fprintf(vvp_out, " %%new/darray %u, \"%sv%d\";\n",
|
||||
size_reg, signed_char, wid);
|
||||
break;
|
||||
|
||||
default:
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
|
||||
clr_word(size_reg);
|
||||
}
|
||||
|
||||
static int eval_darray_new(ivl_expr_t ex)
|
||||
{
|
||||
int errors = 0;
|
||||
|
|
@ -37,46 +89,7 @@ static int eval_darray_new(ivl_expr_t ex)
|
|||
ivl_type_t element_type = ivl_type_element(net_type);
|
||||
assert(element_type);
|
||||
|
||||
switch (ivl_type_base(element_type)) {
|
||||
int msb, lsb, wid;
|
||||
case IVL_VT_REAL:
|
||||
// REAL objects are not packable.
|
||||
assert(ivl_type_packed_dimensions(element_type) == 0);
|
||||
fprintf(vvp_out, " %%new/darray %u, \"r\";\n", size_reg);
|
||||
break;
|
||||
case IVL_VT_STRING:
|
||||
// STRING objects are not packable.
|
||||
assert(ivl_type_packed_dimensions(element_type) == 0);
|
||||
fprintf(vvp_out, " %%new/darray %u, \"S\";\n", size_reg);
|
||||
break;
|
||||
case IVL_VT_BOOL:
|
||||
// bool objects are vectorable, but for now only support
|
||||
// a single dimensions.
|
||||
assert(ivl_type_packed_dimensions(element_type) == 1);
|
||||
msb = ivl_type_packed_msb(element_type, 0);
|
||||
lsb = ivl_type_packed_lsb(element_type, 0);
|
||||
wid = msb>=lsb? msb - lsb : lsb - msb;
|
||||
wid += 1;
|
||||
fprintf(vvp_out, " %%new/darray %u, \"%sb%d\";\n", size_reg,
|
||||
ivl_type_signed(element_type) ? "s" : "", wid);
|
||||
break;
|
||||
case IVL_VT_LOGIC:
|
||||
// logic objects are vectorable, but for now only support
|
||||
// a single dimensions.
|
||||
assert(ivl_type_packed_dimensions(element_type) == 1);
|
||||
msb = ivl_type_packed_msb(element_type, 0);
|
||||
lsb = ivl_type_packed_lsb(element_type, 0);
|
||||
wid = msb>=lsb? msb - lsb : lsb - msb;
|
||||
wid += 1;
|
||||
fprintf(vvp_out, " %%new/darray %u, \"%sv%d\";\n", size_reg,
|
||||
ivl_type_signed(element_type) ? "s" : "", wid);
|
||||
break;
|
||||
|
||||
default:
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
clr_word(size_reg);
|
||||
darray_new(element_type, size_reg);
|
||||
|
||||
if (init_expr && ivl_expr_type(init_expr)==IVL_EX_ARRAY_PATTERN) {
|
||||
unsigned idx;
|
||||
|
|
|
|||
|
|
@ -936,12 +936,14 @@ static int show_stmt_assign_darray_pattern(ivl_statement_t net)
|
|||
ivl_lval_t lval = ivl_stmt_lval(net, 0);
|
||||
ivl_expr_t rval = ivl_stmt_rval(net);
|
||||
|
||||
ivl_signal_t var= ivl_lval_sig(lval);
|
||||
ivl_signal_t var = ivl_lval_sig(lval);
|
||||
ivl_type_t var_type= ivl_signal_net_type(var);
|
||||
assert(ivl_type_base(var_type) == IVL_VT_DARRAY);
|
||||
|
||||
ivl_type_t element_type = ivl_type_element(var_type);
|
||||
unsigned idx;
|
||||
unsigned size_reg = allocate_word();
|
||||
|
||||
#if 0
|
||||
unsigned element_width = 1;
|
||||
if (ivl_type_base(element_type) == IVL_VT_BOOL)
|
||||
|
|
@ -949,7 +951,16 @@ static int show_stmt_assign_darray_pattern(ivl_statement_t net)
|
|||
else if (ivl_type_base(element_type) == IVL_VT_LOGIC)
|
||||
element_width = width_of_packed_type(element_type);
|
||||
#endif
|
||||
// FIXME: This should allocate enough space for the pattern if needed.
|
||||
|
||||
// FIXME: At the moment we reallocate the array space.
|
||||
// This probably should be a resize to avoid values glitching
|
||||
/* Allocate at least enough space for the array patter. */
|
||||
fprintf(vvp_out, " %%ix/load %u, %u, 0;\n", size_reg, ivl_expr_parms(rval));
|
||||
/* This can not have have a X/Z value so clear flag 4. */
|
||||
fprintf(vvp_out, " %%flag_set/imm 4, 0;\n");
|
||||
darray_new(element_type, size_reg);
|
||||
fprintf(vvp_out, " %%store/obj v%p_0;\n", var);
|
||||
|
||||
assert(ivl_expr_type(rval) == IVL_EX_ARRAY_PATTERN);
|
||||
for (idx = 0 ; idx < ivl_expr_parms(rval) ; idx += 1) {
|
||||
switch (ivl_type_base(element_type)) {
|
||||
|
|
@ -999,34 +1010,26 @@ static int show_stmt_assign_sig_darray(ivl_statement_t net)
|
|||
assert(ivl_stmt_opcode(net) == 0);
|
||||
assert(part == 0);
|
||||
|
||||
if (mux && (ivl_type_base(element_type)==IVL_VT_REAL)) {
|
||||
if (mux && (ivl_type_base(element_type) == IVL_VT_REAL)) {
|
||||
draw_eval_real(rval);
|
||||
|
||||
/* The %set/dar expects the array index to be in index
|
||||
/* The %store/dar/r expects the array index to be in index
|
||||
register 3. Calculate the index in place. */
|
||||
draw_eval_expr_into_integer(mux, 3);
|
||||
|
||||
fprintf(vvp_out, " %%store/dar/r v%p_0;\n", var);
|
||||
|
||||
} else if (mux && ivl_type_base(element_type)==IVL_VT_STRING) {
|
||||
|
||||
/* Evaluate the rval into the top of the string stack. */
|
||||
} else if (mux && ivl_type_base(element_type) == IVL_VT_STRING) {
|
||||
draw_eval_string(rval);
|
||||
|
||||
/* The %store/dar/s expects the array index to me in index
|
||||
/* The %store/dar/str expects the array index to me in index
|
||||
register 3. Calculate the index in place. */
|
||||
draw_eval_expr_into_integer(mux, 3);
|
||||
|
||||
fprintf(vvp_out, " %%store/dar/str v%p_0;\n", var);
|
||||
|
||||
} else if (mux) {
|
||||
draw_eval_vec4(rval);
|
||||
resize_vec4_wid(rval, ivl_stmt_lwidth(net));
|
||||
|
||||
/* The %store/dar/vec4 expects the array index to be in index
|
||||
register 3. Calculate the index in place. */
|
||||
draw_eval_expr_into_integer(mux, 3);
|
||||
|
||||
fprintf(vvp_out, " %%store/dar/vec4 v%p_0;\n", var);
|
||||
|
||||
} else if (ivl_expr_type(rval) == IVL_EX_ARRAY_PATTERN) {
|
||||
|
|
@ -1140,14 +1143,14 @@ static int show_stmt_assign_sig_queue(ivl_statement_t net)
|
|||
|
||||
} else if (mux && (ivl_type_base(element_type) == IVL_VT_REAL)) {
|
||||
draw_eval_real(rval);
|
||||
/* The %store/dar expects the array index to be in
|
||||
/* The %store/qdar expects the array index to be in
|
||||
index register 3. */
|
||||
draw_eval_expr_into_integer(mux, 3);
|
||||
fprintf(vvp_out, " %%store/qdar/r v%p_0, %d;\n", var, idx);
|
||||
|
||||
} else if (mux && ivl_type_base(element_type) == IVL_VT_STRING) {
|
||||
draw_eval_string(rval);
|
||||
/* The %store/dar expects the array index to be in
|
||||
/* The %store/qdar expects the array index to be in
|
||||
index register 3. */
|
||||
draw_eval_expr_into_integer(mux, 3);
|
||||
fprintf(vvp_out, " %%store/qdar/str v%p_0, %d;\n", var, idx);
|
||||
|
|
@ -1157,7 +1160,7 @@ static int show_stmt_assign_sig_queue(ivl_statement_t net)
|
|||
ivl_type_base(element_type) == IVL_VT_LOGIC);
|
||||
draw_eval_vec4(rval);
|
||||
resize_vec4_wid(rval, ivl_stmt_lwidth(net));
|
||||
/* The %store/dar expects the array index to be in
|
||||
/* The %store/qdar expects the array index to be in
|
||||
index register 3. */
|
||||
draw_eval_expr_into_integer(mux, 3);
|
||||
fprintf(vvp_out, " %%store/qdar/v v%p_0, %d, %u;\n", var, idx,
|
||||
|
|
|
|||
|
|
@ -286,4 +286,7 @@ extern void clr_flag(int idx);
|
|||
extern unsigned local_count;
|
||||
extern unsigned thread_count;
|
||||
|
||||
extern void darray_new(ivl_type_t element_type, unsigned size_reg);
|
||||
|
||||
|
||||
#endif /* IVL_vvp_priv_H */
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2011-2012 Cary R. (cygcary@yahoo.com)
|
||||
* Copyright (C) 2011-2020 Cary R. (cygcary@yahoo.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -80,8 +80,7 @@ vpiHandle vpip_build_file_line(char*description, long file_idx, long lineno)
|
|||
{
|
||||
struct __vpiFileLine*obj = new struct __vpiFileLine;
|
||||
|
||||
/* Turn on the diagnostic output when we find a %file_line. */
|
||||
show_file_line = true;
|
||||
/* You can turn on the diagnostic output if we find a %file_line. */
|
||||
code_is_instrumented = true;
|
||||
|
||||
if (description) obj->description = vpip_name_string(description);
|
||||
|
|
|
|||
142
vvp/vthread.cc
142
vvp/vthread.cc
|
|
@ -41,6 +41,7 @@
|
|||
# include <cassert>
|
||||
|
||||
# include <iostream>
|
||||
# include <sstream>
|
||||
# include <cstdio>
|
||||
|
||||
using namespace std;
|
||||
|
|
@ -296,6 +297,13 @@ struct vthread_s {
|
|||
/* These are used to pass non-blocking event control information. */
|
||||
vvp_net_t*event;
|
||||
uint64_t ecount;
|
||||
/* Save the file/line information when available. */
|
||||
private:
|
||||
char *filenm_;
|
||||
unsigned lineno_;
|
||||
public:
|
||||
void set_fileline(char *filenm, unsigned lineno);
|
||||
string get_fileline();
|
||||
|
||||
inline void cleanup()
|
||||
{
|
||||
|
|
@ -305,6 +313,8 @@ struct vthread_s {
|
|||
stack_str_.clear();
|
||||
pop_object(stack_obj_size_);
|
||||
}
|
||||
free(filenm_);
|
||||
filenm_ = 0;
|
||||
assert(stack_vec4_.empty());
|
||||
assert(stack_real_.empty());
|
||||
assert(stack_str_.empty());
|
||||
|
|
@ -315,6 +325,28 @@ struct vthread_s {
|
|||
inline vthread_s::vthread_s()
|
||||
{
|
||||
stack_obj_size_ = 0;
|
||||
filenm_ = 0;
|
||||
lineno_ = 0;
|
||||
}
|
||||
|
||||
void vthread_s::set_fileline(char *filenm, unsigned lineno)
|
||||
{
|
||||
assert(filenm);
|
||||
if (!filenm_ || (strcmp(filenm_, filenm) != 0)) {
|
||||
free(filenm_);
|
||||
filenm_ = strdup(filenm);
|
||||
}
|
||||
lineno_ = lineno;
|
||||
}
|
||||
|
||||
inline string vthread_s::get_fileline()
|
||||
{
|
||||
ostringstream buf;
|
||||
if (filenm_) {
|
||||
buf << filenm_ << ":" << lineno_ << ": ";
|
||||
}
|
||||
string res = buf.str();
|
||||
return res;
|
||||
}
|
||||
|
||||
void vthread_s::debug_dump(ostream&fd, const char*label)
|
||||
|
|
@ -334,6 +366,10 @@ void vthread_s::debug_dump(ostream&fd, const char*label)
|
|||
fd << "**** args_vec4 array (" << args_vec4.size() << ")..." << endl;
|
||||
for (size_t idx = 0 ; idx < args_vec4.size() ; idx += 1)
|
||||
fd << " " << idx << ": " << args_vec4[idx] << endl;
|
||||
fd << "**** file/line (";
|
||||
if (filenm_) fd << filenm_;
|
||||
else fd << "<no file name>";
|
||||
fd << ":" << lineno_ << ")" << endl;
|
||||
fd << "**** Done ****" << endl;
|
||||
}
|
||||
|
||||
|
|
@ -347,6 +383,10 @@ __vpiScope* vthread_scope(struct vthread_s*thr)
|
|||
|
||||
struct vthread_s*running_thread = 0;
|
||||
|
||||
string get_fileline()
|
||||
{
|
||||
return running_thread->get_fileline();
|
||||
}
|
||||
|
||||
void vthread_push_vec4(struct vthread_s*thr, const vvp_vector4_t&val)
|
||||
{
|
||||
|
|
@ -408,16 +448,16 @@ template <class VVP_QUEUE> static vvp_queue*get_queue_object(vthread_t thr, vvp_
|
|||
vvp_fun_signal_object*obj = dynamic_cast<vvp_fun_signal_object*> (net->fun);
|
||||
assert(obj);
|
||||
|
||||
vvp_queue*dqueue = obj->get_object().peek<vvp_queue>();
|
||||
if (dqueue == 0) {
|
||||
vvp_queue*queue = obj->get_object().peek<vvp_queue>();
|
||||
if (queue == 0) {
|
||||
assert(obj->get_object().test_nil());
|
||||
dqueue = new VVP_QUEUE;
|
||||
vvp_object_t val (dqueue);
|
||||
queue = new VVP_QUEUE;
|
||||
vvp_object_t val (queue);
|
||||
vvp_net_ptr_t ptr (net, 0);
|
||||
vvp_send_object(ptr, val, thr->wt_context);
|
||||
}
|
||||
|
||||
return dqueue;
|
||||
return queue;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -2476,12 +2516,14 @@ bool of_DELETE_ELEM(vthread_t thr, vvp_code_t cp)
|
|||
|
||||
int64_t idx_val = thr->words[3].w_int;
|
||||
if (thr->flags[4] == BIT4_1) {
|
||||
cerr << "Warning: skipping queue delete() with undefined index."
|
||||
cerr << thr->get_fileline()
|
||||
<< "Warning: skipping queue delete() with undefined index."
|
||||
<< endl;
|
||||
return true;
|
||||
}
|
||||
if (idx_val < 0) {
|
||||
cerr << "Warning: skipping queue delete() with negative index."
|
||||
cerr << thr->get_fileline()
|
||||
<< "Warning: skipping queue delete() with negative index."
|
||||
<< endl;
|
||||
return true;
|
||||
}
|
||||
|
|
@ -2490,17 +2532,19 @@ bool of_DELETE_ELEM(vthread_t thr, vvp_code_t cp)
|
|||
vvp_fun_signal_object*obj = dynamic_cast<vvp_fun_signal_object*> (net->fun);
|
||||
assert(obj);
|
||||
|
||||
vvp_queue*dqueue = obj->get_object().peek<vvp_queue>();
|
||||
if (dqueue == 0) {
|
||||
cerr << "Warning: skipping delete(" << idx
|
||||
vvp_queue*queue = obj->get_object().peek<vvp_queue>();
|
||||
if (queue == 0) {
|
||||
cerr << thr->get_fileline()
|
||||
<< "Warning: skipping delete(" << idx
|
||||
<< ") on empty queue." << endl;
|
||||
} else {
|
||||
size_t size = dqueue->get_size();
|
||||
size_t size = queue->get_size();
|
||||
if (idx >= size) {
|
||||
cerr << "Warning: skipping out of range delete(" << idx
|
||||
cerr << thr->get_fileline()
|
||||
<< "Warning: skipping out of range delete(" << idx
|
||||
<< ") on queue of size " << size << "." << endl;
|
||||
} else {
|
||||
dqueue->erase(idx);
|
||||
queue->erase(idx);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2533,11 +2577,11 @@ bool of_DELETE_TAIL(vthread_t thr, vvp_code_t cp)
|
|||
vvp_fun_signal_object*obj = dynamic_cast<vvp_fun_signal_object*> (net->fun);
|
||||
assert(obj);
|
||||
|
||||
vvp_queue*dqueue = obj->get_object().peek<vvp_queue>();
|
||||
assert(dqueue);
|
||||
vvp_queue*queue = obj->get_object().peek<vvp_queue>();
|
||||
assert(queue);
|
||||
|
||||
unsigned idx = thr->words[cp->bit_idx[0]].w_int;
|
||||
dqueue->erase_tail(idx);
|
||||
queue->erase_tail(idx);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -4538,7 +4582,8 @@ bool of_NEW_DARRAY(vthread_t thr, vvp_code_t cp)
|
|||
} else if (strcmp(text,"S") == 0) {
|
||||
obj = new vvp_darray_string(size);
|
||||
} else {
|
||||
cerr << "Internal error: Unsupported dynamic array type: "
|
||||
cerr << get_fileline()
|
||||
<< "Internal error: Unsupported dynamic array type: "
|
||||
<< text << "." << endl;
|
||||
assert(0);
|
||||
}
|
||||
|
|
@ -5150,13 +5195,15 @@ static bool qinsert(vthread_t thr, vvp_code_t cp, unsigned wid=0)
|
|||
vvp_queue*queue = get_queue_object<QTYPE>(thr, net);
|
||||
assert(queue);
|
||||
if (idx < 0) {
|
||||
cerr << "Warning: cannot insert at a negative ";
|
||||
cerr << thr->get_fileline()
|
||||
<< "Warning: cannot insert at a negative ";
|
||||
print_queue_type(value);
|
||||
cerr << " index (" << idx << "). ";
|
||||
print_queue_value(value);
|
||||
cerr << " was not added." << endl;
|
||||
} else if (thr->flags[4] != BIT4_0) {
|
||||
cerr << "Warning: cannot insert at an undefined ";
|
||||
cerr << thr->get_fileline()
|
||||
<< "Warning: cannot insert at an undefined ";
|
||||
print_queue_type(value);
|
||||
cerr << " index. ";
|
||||
print_queue_value(value);
|
||||
|
|
@ -5240,7 +5287,8 @@ static bool qpop_b(vthread_t thr, vvp_code_t cp, unsigned wid=0)
|
|||
queue->pop_back();
|
||||
} else {
|
||||
qdefault(value, wid);
|
||||
cerr << "Warning: pop_back() on empty ";
|
||||
cerr << thr->get_fileline()
|
||||
<< "Warning: pop_back() on empty ";
|
||||
print_queue_type(value);
|
||||
cerr << "." << endl;
|
||||
}
|
||||
|
|
@ -5289,7 +5337,8 @@ static bool qpop_f(vthread_t thr, vvp_code_t cp, unsigned wid=0)
|
|||
queue->pop_front();
|
||||
} else {
|
||||
qdefault(value, wid);
|
||||
cerr << "Warning: pop_front() on empty ";
|
||||
cerr << thr->get_fileline()
|
||||
<< "Warning: pop_front() on empty ";
|
||||
print_queue_type(value);
|
||||
cerr << "." << endl;
|
||||
}
|
||||
|
|
@ -5768,15 +5817,18 @@ bool of_STORE_DAR_R(vthread_t thr, vvp_code_t cp)
|
|||
vvp_darray*darray = obj->get_object().peek<vvp_darray>();
|
||||
|
||||
if (adr < 0)
|
||||
cerr << "Warning: cannot write to a negative array<real> index ("
|
||||
cerr << thr->get_fileline()
|
||||
<< "Warning: cannot write to a negative array<real> index ("
|
||||
<< adr << ")." << endl;
|
||||
else if (thr->flags[4] != BIT4_0)
|
||||
cerr << "Warning: cannot write to an undefined array<real> index."
|
||||
cerr << thr->get_fileline()
|
||||
<< "Warning: cannot write to an undefined array<real> index."
|
||||
<< endl;
|
||||
else if (darray)
|
||||
darray->set_word(adr, value);
|
||||
else
|
||||
cerr << "Warning: cannot write to an undefined array<real>."
|
||||
cerr << thr->get_fileline()
|
||||
<< "Warning: cannot write to an undefined array<real>."
|
||||
<< endl;
|
||||
|
||||
return true;
|
||||
|
|
@ -5798,15 +5850,18 @@ bool of_STORE_DAR_STR(vthread_t thr, vvp_code_t cp)
|
|||
vvp_darray*darray = obj->get_object().peek<vvp_darray>();
|
||||
|
||||
if (adr < 0)
|
||||
cerr << "Warning: cannot write to a negative array<string> index ("
|
||||
cerr << thr->get_fileline()
|
||||
<< "Warning: cannot write to a negative array<string> index ("
|
||||
<< adr << ")." << endl;
|
||||
else if (thr->flags[4] != BIT4_0)
|
||||
cerr << "Warning: cannot write to an undefined array<string> index."
|
||||
cerr << thr->get_fileline()
|
||||
<< "Warning: cannot write to an undefined array<string> index."
|
||||
<< endl;
|
||||
else if (darray)
|
||||
darray->set_word(adr, value);
|
||||
else
|
||||
cerr << "Warning: cannot write to an undefined array<string>."
|
||||
cerr << thr->get_fileline()
|
||||
<< "Warning: cannot write to an undefined array<string>."
|
||||
<< endl;
|
||||
|
||||
return true;
|
||||
|
|
@ -5828,15 +5883,18 @@ bool of_STORE_DAR_VEC4(vthread_t thr, vvp_code_t cp)
|
|||
vvp_darray*darray = obj->get_object().peek<vvp_darray>();
|
||||
|
||||
if (adr < 0)
|
||||
cerr << "Warning: cannot write to a negative array<vector["
|
||||
cerr << thr->get_fileline()
|
||||
<< "Warning: cannot write to a negative array<vector["
|
||||
<< value.size() << "]> index (" << adr << ")." << endl;
|
||||
else if (thr->flags[4] != BIT4_0)
|
||||
cerr << "Warning: cannot write to an undefined array<vector["
|
||||
cerr << thr->get_fileline()
|
||||
<< "Warning: cannot write to an undefined array<vector["
|
||||
<< value.size() << "]> index." << endl;
|
||||
else if (darray)
|
||||
darray->set_word(adr, value);
|
||||
else
|
||||
cerr << "Warning: cannot write to an undefined array<vector["
|
||||
cerr << thr->get_fileline()
|
||||
<< "Warning: cannot write to an undefined array<vector["
|
||||
<< value.size() << "]>." << endl;
|
||||
|
||||
return true;
|
||||
|
|
@ -6017,13 +6075,15 @@ static bool store_qdar(vthread_t thr, vvp_code_t cp, unsigned wid=0)
|
|||
vvp_queue*queue = get_queue_object<QTYPE>(thr, net);
|
||||
assert(queue);
|
||||
if (idx < 0) {
|
||||
cerr << "Warning: cannot assign to a negative ";
|
||||
cerr << thr->get_fileline()
|
||||
<< "Warning: cannot assign to a negative ";
|
||||
print_queue_type(value);
|
||||
cerr << " index (" << idx << "). ";
|
||||
print_queue_value(value);
|
||||
cerr << " was not added." << endl;
|
||||
} else if (thr->flags[4] != BIT4_0) {
|
||||
cerr << "Warning: cannot assign to an undefined ";
|
||||
cerr << thr->get_fileline()
|
||||
<< "Warning: cannot assign to an undefined ";
|
||||
print_queue_type(value);
|
||||
cerr << " index. ";
|
||||
print_queue_value(value);
|
||||
|
|
@ -6387,15 +6447,19 @@ bool of_SUBSTR_VEC4(vthread_t thr, vvp_code_t cp)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool of_FILE_LINE(vthread_t, vvp_code_t cp)
|
||||
bool of_FILE_LINE(vthread_t thr, vvp_code_t cp)
|
||||
{
|
||||
if (show_file_line) {
|
||||
vpiHandle handle = cp->handle;
|
||||
vpiHandle handle = cp->handle;
|
||||
if (show_file_line)
|
||||
cerr << vpi_get_str(vpiFile, handle) << ":"
|
||||
<< vpi_get(vpiLineNo, handle) << ": ";
|
||||
cerr << vpi_get_str(_vpiDescription, handle);
|
||||
cerr << endl;
|
||||
}
|
||||
<< vpi_get(vpiLineNo, handle) << ": "
|
||||
<< vpi_get_str(_vpiDescription, handle) << endl;
|
||||
|
||||
/* When it is available, keep the file/line information in the
|
||||
thread for error/warning messages. */
|
||||
thr->set_fileline(vpi_get_str(vpiFile, handle),
|
||||
vpi_get(vpiLineNo, handle));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -484,7 +484,8 @@ vvp_queue_real::~vvp_queue_real()
|
|||
*/
|
||||
static void print_copy_is_too_big(size_t src_size, unsigned max_size, string qtype)
|
||||
{
|
||||
cerr << "Warning: queue<" << qtype << "> is bounded to have at most "
|
||||
cerr << get_fileline()
|
||||
<< "Warning: queue<" << qtype << "> is bounded to have at most "
|
||||
<< max_size << " elements, source has " << src_size << " elements." << endl;
|
||||
}
|
||||
|
||||
|
|
@ -538,7 +539,8 @@ void vvp_queue_real::set_word_max(unsigned adr, double value, unsigned max_size)
|
|||
if (!max_size || (queue.size() < max_size))
|
||||
queue.push_back(value);
|
||||
else
|
||||
cerr << "Warning: assigning to queue<real>[" << adr << "] is"
|
||||
cerr << get_fileline()
|
||||
<< "Warning: assigning to queue<real>[" << adr << "] is"
|
||||
" outside bound (" << max_size << "). " << value
|
||||
<< " was not added." << endl;
|
||||
else
|
||||
|
|
@ -550,7 +552,8 @@ void vvp_queue_real::set_word(unsigned adr, double value)
|
|||
if (adr < queue.size())
|
||||
queue[adr] = value;
|
||||
else
|
||||
cerr << "Warning: assigning to queue<real>[" << adr << "] is outside "
|
||||
cerr << get_fileline()
|
||||
<< "Warning: assigning to queue<real>[" << adr << "] is outside "
|
||||
"of size (" << queue.size() << "). " << value
|
||||
<< " was not added." << endl;
|
||||
}
|
||||
|
|
@ -567,7 +570,8 @@ void vvp_queue_real::insert(unsigned idx, double value, unsigned max_size)
|
|||
{
|
||||
// Inserting past the end of the queue
|
||||
if (idx > queue.size())
|
||||
cerr << "Warning: inserting to queue<real>[" << idx << "] is "
|
||||
cerr << get_fileline()
|
||||
<< "Warning: inserting to queue<real>[" << idx << "] is "
|
||||
"outside of size (" << queue.size() << "). " << value
|
||||
<< " was not added." << endl;
|
||||
// Inserting at the end
|
||||
|
|
@ -575,12 +579,14 @@ void vvp_queue_real::insert(unsigned idx, double value, unsigned max_size)
|
|||
if (!max_size || (queue.size() < max_size))
|
||||
queue.push_back(value);
|
||||
else
|
||||
cerr << "Warning: inserting to queue<real>[" << idx << "] is"
|
||||
cerr << get_fileline()
|
||||
<< "Warning: inserting to queue<real>[" << idx << "] is"
|
||||
" outside bound (" << max_size << "). " << value
|
||||
<< " was not added." << endl;
|
||||
else {
|
||||
if (max_size && (queue.size() == max_size)) {
|
||||
cerr << "Warning: insert("<< idx << ", " << value << ") removed "
|
||||
cerr << get_fileline()
|
||||
<< "Warning: insert("<< idx << ", " << value << ") removed "
|
||||
<< queue.back() << " from already full bounded queue<real> ["
|
||||
<< max_size << "]." << endl;
|
||||
queue.pop_back();
|
||||
|
|
@ -609,7 +615,8 @@ void vvp_queue_real::push_back(double value, unsigned max_size)
|
|||
if (!max_size || (queue.size() < max_size))
|
||||
queue.push_back(value);
|
||||
else
|
||||
cerr << "Warning: push_back(" << value
|
||||
cerr << get_fileline()
|
||||
<< "Warning: push_back(" << value
|
||||
<< ") skipped for already full bounded queue<real> ["
|
||||
<< max_size << "]." << endl;
|
||||
}
|
||||
|
|
@ -617,7 +624,8 @@ void vvp_queue_real::push_back(double value, unsigned max_size)
|
|||
void vvp_queue_real::push_front(double value, unsigned max_size)
|
||||
{
|
||||
if (max_size && (queue.size() == max_size)) {
|
||||
cerr << "Warning: push_front(" << value << ") removed "
|
||||
cerr << get_fileline()
|
||||
<< "Warning: push_front(" << value << ") removed "
|
||||
<< queue.back() << " from already full bounded queue<real> ["
|
||||
<< max_size << "]." << endl;
|
||||
queue.pop_back();
|
||||
|
|
@ -667,7 +675,8 @@ void vvp_queue_string::set_word_max(unsigned adr, const string&value, unsigned m
|
|||
if (!max_size || (queue.size() < max_size))
|
||||
queue.push_back(value);
|
||||
else
|
||||
cerr << "Warning: assigning to queue<string>[" << adr << "] is"
|
||||
cerr << get_fileline()
|
||||
<< "Warning: assigning to queue<string>[" << adr << "] is"
|
||||
" outside bound (" << max_size << "). \"" << value
|
||||
<< "\" was not added." << endl;
|
||||
else
|
||||
|
|
@ -679,7 +688,8 @@ void vvp_queue_string::set_word(unsigned adr, const string&value)
|
|||
if (adr < queue.size())
|
||||
queue[adr] = value;
|
||||
else
|
||||
cerr << "Warning: assigning to queue<string>[" << adr << "] is outside "
|
||||
cerr << get_fileline()
|
||||
<< "Warning: assigning to queue<string>[" << adr << "] is outside "
|
||||
"of size (" << queue.size() << "). \"" << value
|
||||
<< "\" was not added." << endl;
|
||||
}
|
||||
|
|
@ -696,7 +706,8 @@ void vvp_queue_string::insert(unsigned idx, const string&value, unsigned max_siz
|
|||
{
|
||||
// Inserting past the end of the queue
|
||||
if (idx > queue.size())
|
||||
cerr << "Warning: inserting to queue<string>[" << idx << "] is "
|
||||
cerr << get_fileline()
|
||||
<< "Warning: inserting to queue<string>[" << idx << "] is "
|
||||
"outside of size (" << queue.size() << "). \"" << value
|
||||
<< "\" was not added." << endl;
|
||||
// Inserting at the end
|
||||
|
|
@ -704,14 +715,16 @@ void vvp_queue_string::insert(unsigned idx, const string&value, unsigned max_siz
|
|||
if (!max_size || (queue.size() < max_size))
|
||||
queue.push_back(value);
|
||||
else
|
||||
cerr << "Warning: inserting to queue<string>[" << idx << "] is"
|
||||
cerr << get_fileline()
|
||||
<< "Warning: inserting to queue<string>[" << idx << "] is"
|
||||
" outside bound (" << max_size << "). \"" << value
|
||||
<< "\" was not added." << endl;
|
||||
else {
|
||||
if (max_size && (queue.size() == max_size)) {
|
||||
cerr << "Warning: insert("<< idx << ", \"" << value << "\") removed \""
|
||||
<< queue.back() << "\" from already full bounded queue<string> ["
|
||||
<< max_size << "]." << endl;
|
||||
cerr << get_fileline()
|
||||
<< "Warning: insert("<< idx << ", \"" << value << "\") removed \""
|
||||
<< queue.back() << "\" from already full bounded queue<string> ["
|
||||
<< max_size << "]." << endl;
|
||||
queue.pop_back();
|
||||
}
|
||||
// Inserting at the beginning
|
||||
|
|
@ -738,7 +751,8 @@ void vvp_queue_string::push_back(const string&value, unsigned max_size)
|
|||
if (!max_size || (queue.size() < max_size))
|
||||
queue.push_back(value);
|
||||
else
|
||||
cerr << "Warning: push_back(\"" << value
|
||||
cerr << get_fileline()
|
||||
<< "Warning: push_back(\"" << value
|
||||
<< "\") skipped for already full bounded queue<string> ["
|
||||
<< max_size << "]." << endl;
|
||||
}
|
||||
|
|
@ -746,7 +760,8 @@ void vvp_queue_string::push_back(const string&value, unsigned max_size)
|
|||
void vvp_queue_string::push_front(const string&value, unsigned max_size)
|
||||
{
|
||||
if (max_size && (queue.size() == max_size)) {
|
||||
cerr << "Warning: push_front(\"" << value << "\") removed \""
|
||||
cerr << get_fileline()
|
||||
<< "Warning: push_front(\"" << value << "\") removed \""
|
||||
<< queue.back() << "\" from already full bounded queue<string> ["
|
||||
<< max_size << "]." << endl;
|
||||
queue.pop_back();
|
||||
|
|
@ -796,7 +811,8 @@ void vvp_queue_vec4::set_word_max(unsigned adr, const vvp_vector4_t&value, unsig
|
|||
if (!max_size || (queue.size() < max_size))
|
||||
queue.push_back(value);
|
||||
else
|
||||
cerr << "Warning: assigning to queue<vector>[" << adr << "] is"
|
||||
cerr << get_fileline()
|
||||
<< "Warning: assigning to queue<vector>[" << adr << "] is"
|
||||
" outside bound (" << max_size << "). " << value
|
||||
<< " was not added." << endl;
|
||||
else
|
||||
|
|
@ -808,7 +824,8 @@ void vvp_queue_vec4::set_word(unsigned adr, const vvp_vector4_t&value)
|
|||
if (adr < queue.size())
|
||||
queue[adr] = value;
|
||||
else
|
||||
cerr << "Warning: assigning to queue<vector>[" << adr << "] is outside "
|
||||
cerr << get_fileline()
|
||||
<< "Warning: assigning to queue<vector>[" << adr << "] is outside "
|
||||
"of size (" << queue.size() << "). " << value
|
||||
<< " was not added." << endl;
|
||||
}
|
||||
|
|
@ -825,7 +842,8 @@ void vvp_queue_vec4::insert(unsigned idx, const vvp_vector4_t&value, unsigned ma
|
|||
{
|
||||
// Inserting past the end of the queue
|
||||
if (idx > queue.size())
|
||||
cerr << "Warning: inserting to queue<vector[" << value.size()
|
||||
cerr << get_fileline()
|
||||
<< "Warning: inserting to queue<vector[" << value.size()
|
||||
<< "]>[" << idx << "] is outside of size (" << queue.size()
|
||||
<< "). " << value << " was not added." << endl;
|
||||
// Inserting at the end
|
||||
|
|
@ -833,12 +851,14 @@ void vvp_queue_vec4::insert(unsigned idx, const vvp_vector4_t&value, unsigned ma
|
|||
if (!max_size || (queue.size() < max_size))
|
||||
queue.push_back(value);
|
||||
else
|
||||
cerr << "Warning: inserting to queue<vector[" << value.size()
|
||||
cerr << get_fileline()
|
||||
<< "Warning: inserting to queue<vector[" << value.size()
|
||||
<< "]>[" << idx << "] is outside bound (" << max_size
|
||||
<< "). " << value << " was not added." << endl;
|
||||
else {
|
||||
if (max_size && (queue.size() == max_size)) {
|
||||
cerr << "Warning: insert("<< idx << ", " << value << ") removed "
|
||||
cerr << get_fileline()
|
||||
<< "Warning: insert("<< idx << ", " << value << ") removed "
|
||||
<< queue.back() << " from already full bounded queue<vector["
|
||||
<< value.size() << "]> [" << max_size << "]." << endl;
|
||||
queue.pop_back();
|
||||
|
|
@ -867,7 +887,8 @@ void vvp_queue_vec4::push_back(const vvp_vector4_t&value, unsigned max_size)
|
|||
if (!max_size || (queue.size() < max_size))
|
||||
queue.push_back(value);
|
||||
else
|
||||
cerr << "Warning: push_back(" << value
|
||||
cerr << get_fileline()
|
||||
<< "Warning: push_back(" << value
|
||||
<< ") skipped for already full bounded queue<vector["
|
||||
<< value.size() << "]> [" << max_size << "]." << endl;
|
||||
}
|
||||
|
|
@ -875,7 +896,8 @@ void vvp_queue_vec4::push_back(const vvp_vector4_t&value, unsigned max_size)
|
|||
void vvp_queue_vec4::push_front(const vvp_vector4_t&value, unsigned max_size)
|
||||
{
|
||||
if (max_size && (queue.size() == max_size)) {
|
||||
cerr << "Warning: push_front(" << value << ") removed "
|
||||
cerr << get_fileline()
|
||||
<< "Warning: push_front(" << value << ") removed "
|
||||
<< queue.back() << " from already full bounded queue<vector["
|
||||
<< value.size() << "]> [" << max_size << "]." << endl;
|
||||
queue.pop_back();
|
||||
|
|
|
|||
|
|
@ -244,4 +244,6 @@ class vvp_queue_vec4 : public vvp_queue {
|
|||
std::deque<vvp_vector4_t> queue;
|
||||
};
|
||||
|
||||
extern string get_fileline();
|
||||
|
||||
#endif /* IVL_vvp_darray_H */
|
||||
|
|
|
|||
Loading…
Reference in New Issue