Add more file/line and scope information to the ivl interface, etc.

This patch adds/fixes the following:

  Adds file/line information to a UDP definition.

  Prints an error message if a UDP is passed signals wider than 1 bit.
  A UDP should supports a range, but the compiler currently does not.

  Add scope information for constants.

  Fix the Icarus extension UDP table entry element 'h' to use h.

  The ivl_udp_init() value is a char not unsigned.

  Add FILE_NAME() for a bunch more of the ivl interface objects.
This commit is contained in:
Cary R 2011-02-06 19:47:11 -08:00 committed by Stephen Williams
parent 131a3d81d8
commit 427aef8cc4
13 changed files with 137 additions and 48 deletions

5
PUdp.h
View File

@ -1,7 +1,7 @@
#ifndef __PUdp_H
#define __PUdp_H
/*
* Copyright (c) 1998-2004 Stephen Williams (steve@picturel.com)
* Copyright (c) 1998-2011 Stephen Williams (steve@picturel.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
@ -20,6 +20,7 @@
*/
# include <map>
# include "LineInfo.h"
# include "StringHeap.h"
# include "svector.h"
# include "verinum.h"
@ -47,7 +48,7 @@ class PExpr;
* If the UDP is sequential, the "initial" member is taken to be the
* initial value assigned in the source, or 'x' if none is given.
*/
class PUdp {
class PUdp : public LineInfo {
public:
explicit PUdp(perm_string n, unsigned nports);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998-2010 Stephen Williams (steve@icarus.com)
* Copyright (c) 1998-2011 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
@ -1867,6 +1867,13 @@ void PGModule::elaborate_udp_(Design*des, PUdp*udp, NetScope*scope) const
} else {
connect(sig->pin(0), net->pin(0));
}
if (sig->vector_width() != 1) {
cerr << get_fileline() << ": error: "
<< "Output port expression " << *pins[0]
<< " is too wide (" << sig->vector_width()
<< ") expected 1." << endl;
des->errors += 1;
}
}
/* Run through the pins, making netlists for the pin
@ -1879,7 +1886,7 @@ void PGModule::elaborate_udp_(Design*des, PUdp*udp, NetScope*scope) const
NetExpr*expr_tmp = elab_and_eval(des, scope, pins[idx], 1, 1);
if (expr_tmp == 0) {
cerr << "internal error: Expression too complicated "
"for elaboration:" << pins[idx] << endl;
"for elaboration:" << *pins[idx] << endl;
continue;
}
NetNet*sig = expr_tmp->synthesize(des, scope, expr_tmp);
@ -1889,6 +1896,13 @@ void PGModule::elaborate_udp_(Design*des, PUdp*udp, NetScope*scope) const
delete expr_tmp;
connect(sig->pin(0), net->pin(idx));
if (sig->vector_width() != 1) {
cerr << get_fileline() << ": error: "
<< "Input port expression " << *pins[idx]
<< " is too wide (" << sig->vector_width()
<< ") expected 1." << endl;
des->errors += 1;
}
}
// All done. Add the object to the design.

View File

@ -19,6 +19,7 @@ ivl_const_delay
ivl_const_file
ivl_const_lineno
ivl_const_real
ivl_const_scope
ivl_const_signed
ivl_const_type
ivl_const_width
@ -281,6 +282,8 @@ ivl_switch_type
ivl_switch_width
ivl_udp_init
ivl_udp_file
ivl_udp_lineno
ivl_udp_name
ivl_udp_nin
ivl_udp_row

View File

@ -561,6 +561,9 @@ extern ivl_discipline_t ivl_design_discipline(ivl_design_t des, unsigned idx);
* ivl_const_nex
* Return the ivl_nexus_t of the output for the constant.
*
* ivl_const_scope
* Return the scope this constant was defined in.
* ivl_const_signed
* Return true (!0) if the constant is a signed value, 0 otherwise.
*
@ -587,6 +590,7 @@ extern ivl_variable_type_t ivl_const_type(ivl_net_const_t net);
extern const char* ivl_const_bits(ivl_net_const_t net);
extern ivl_expr_t ivl_const_delay(ivl_net_const_t net, unsigned transition);
extern ivl_nexus_t ivl_const_nex(ivl_net_const_t net);
extern ivl_scope_t ivl_const_scope(ivl_net_const_t net);
extern int ivl_const_signed(ivl_net_const_t net);
extern unsigned ivl_const_width(ivl_net_const_t net);
extern double ivl_const_real(ivl_net_const_t net);
@ -1025,13 +1029,15 @@ extern ivl_attribute_t ivl_logic_attr_val(ivl_net_logic_t net, unsigned idx);
extern int ivl_udp_sequ(ivl_udp_t net);
extern unsigned ivl_udp_nin(ivl_udp_t net);
extern unsigned ivl_udp_init(ivl_udp_t net);
extern char ivl_udp_init(ivl_udp_t net);
extern const char* ivl_udp_row(ivl_udp_t net, unsigned idx);
extern unsigned ivl_udp_rows(ivl_udp_t net);
extern const char* ivl_udp_name(ivl_udp_t net);
extern const char* ivl_udp_file(ivl_udp_t net);
extern unsigned ivl_udp_lineno(ivl_udp_t net);
extern const char* ivl_lpm_file(ivl_lpm_t net);
extern unsigned ivl_lpm_lineno(ivl_lpm_t net);
extern unsigned ivl_lpm_lineno(ivl_lpm_t net);
/* LPM
* These functions support access to the properties of LPM

View File

@ -2165,6 +2165,8 @@ class NetUDP : public NetNode {
unsigned nin() const { return pin_count()-1; }
bool is_sequential() const { return udp->sequential; }
perm_string udp_name() const { return udp->name_; }
perm_string udp_file() const { return udp->get_file(); }
unsigned udp_lineno() const { return udp->get_lineno(); }
char get_initial() const;
private:

View File

@ -4803,7 +4803,7 @@ udp_input_sym
| 'f' { $$ = 'f'; }
| 'F' { $$ = 'F'; }
| 'l' { $$ = 'l'; }
| 'h' { $$ = 'H'; }
| 'h' { $$ = 'h'; }
| 'B' { $$ = 'B'; }
| 'r' { $$ = 'r'; }
| 'R' { $$ = 'R'; }

View File

@ -1312,6 +1312,7 @@ void pform_make_udp(perm_string name, list<perm_string>*parms,
} else {
PUdp*udp = new PUdp(name, parms->size());
FILE_NAME(udp, file, lineno);
// Detect sequential udp.
if (pins[0]->get_wire_type() == NetNet::REG)
@ -1392,6 +1393,7 @@ void pform_make_udp(perm_string name, bool synchronous_flag,
} else {
PUdp*udp = new PUdp(name, pins.count());
FILE_NAME(udp, file, lineno);
// Detect sequential udp.
udp->sequential = synchronous_flag;

View File

@ -211,6 +211,12 @@ extern "C" double ivl_const_real(ivl_net_const_t net)
return net->b.real_value;
}
extern "C" ivl_scope_t ivl_const_scope(ivl_net_const_t net)
{
assert(net);
return net->scope;
}
extern "C" int ivl_const_signed(ivl_net_const_t net)
{
assert(net);
@ -838,12 +844,12 @@ extern "C" int ivl_udp_sequ(ivl_udp_t net)
return net->sequ;
}
extern "C" unsigned ivl_udp_nin(ivl_udp_t net)
extern "C" unsigned ivl_udp_nin(ivl_udp_t net)
{
return net->nin;
}
extern "C" unsigned ivl_udp_init(ivl_udp_t net)
extern "C" char ivl_udp_init(ivl_udp_t net)
{
return net->init;
}
@ -867,6 +873,16 @@ extern "C" const char* ivl_udp_name(ivl_udp_t net)
return net->name;
}
extern "C" const char* ivl_udp_file(ivl_udp_t net)
{
return net->file.str();
}
extern "C" unsigned ivl_udp_lineno(ivl_udp_t net)
{
return net->lineno;
}
extern "C" const char* ivl_lpm_basename(ivl_lpm_t net)
{
return net->name;
@ -1010,7 +1026,6 @@ extern "C" ivl_nexus_t ivl_lpm_enable(ivl_lpm_t net)
}
}
/* The file name and line number are only set for system functions! */
extern "C" const char* ivl_lpm_file(ivl_lpm_t net)
{
return net->file.str();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2010 Stephen Williams (steve@icarus.com)
* Copyright (c) 2000-2011 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
@ -158,11 +158,10 @@ void dll_target::expr_access_func(const NetEAccess*net)
expr_ = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
expr_->type_ = IVL_EX_BACCESS;
expr_->value_ = IVL_VT_REAL;
expr_->file = net->get_file();
expr_->lineno = net->get_lineno();
expr_->width_ = 1;
expr_->signed_= 1;
expr_->sized_ = 1;
FILE_NAME(expr_, net);
expr_->u_.branch_.branch = net->get_branch()->target_obj();
expr_->u_.branch_.nature = net->get_nature();
@ -186,6 +185,7 @@ void dll_target::expr_binary(const NetEBinary*net)
expr_->width_= net->expr_width();
expr_->signed_ = net->has_sign()? 1 : 0;
expr_->sized_= 1;
FILE_NAME(expr_, net);
expr_->u_.binary_.op_ = net->op();
expr_->u_.binary_.lef_ = left;
@ -204,6 +204,7 @@ void dll_target::expr_concat(const NetEConcat*net)
cur->width_ = net->expr_width();
cur->signed_ = net->has_sign() ? 1 : 0;
cur->sized_ = 1;
FILE_NAME(cur, net);
cur->u_.concat_.rept = net->repeat();
cur->u_.concat_.parms = net->nparms();
@ -336,6 +337,7 @@ void dll_target::expr_scope(const NetEScope*net)
expr_ = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
expr_->type_ = IVL_EX_SCOPE;
FILE_NAME(expr_, net);
expr_->value_= IVL_VT_VOID;
expr_->u_.scope_.scope = lookup_scope_(net->scope());
}
@ -347,6 +349,7 @@ void dll_target::expr_netenum(const NetENetenum*net)
expr_ = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
expr_->type_ = IVL_EX_ENUMTYPE;
FILE_NAME(expr_, net);
expr_->value_= IVL_VT_VOID;
expr_->u_.enumtype_.type = net->netenum();
}
@ -365,13 +368,13 @@ void dll_target::expr_select(const NetESelect*net)
ivl_expr_t rght = expr_;
expr_ = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
FILE_NAME(expr_, net);
expr_->type_ = IVL_EX_SELECT;
expr_->value_= IVL_VT_VECTOR;
expr_->width_= net->expr_width();
expr_->signed_ = net->has_sign()? 1 : 0;
expr_->sized_= 1;
FILE_NAME(expr_, net);
expr_->u_.binary_.lef_ = left;
expr_->u_.binary_.rig_ = rght;
@ -389,6 +392,7 @@ void dll_target::expr_sfunc(const NetESFunc*net)
expr->width_= net->expr_width();
expr->signed_ = net->has_sign()? 1 : 0;
expr->sized_= 1;
FILE_NAME(expr, net);
/* system function names are lex_strings strings. */
expr->u_.sfunc_.name_ = net->name();
@ -414,11 +418,11 @@ void dll_target::expr_ternary(const NetETernary*net)
ivl_expr_t expr = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
expr->type_ = IVL_EX_TERNARY;
FILE_NAME(expr, net);
expr->value_= net->expr_type();
expr->width_ = net->expr_width();
expr->signed_ = net->has_sign()? 1 : 0;
expr->sized_ = 1;
FILE_NAME(expr, net);
net->cond_expr()->expr_scan(this);
assert(expr_);
@ -456,11 +460,10 @@ void dll_target::expr_signal(const NetESignal*net)
expr_->type_ = IVL_EX_SIGNAL;
expr_->value_= net->expr_type();
expr_->file = net->get_file();
expr_->lineno= net->get_lineno();
expr_->width_= net->expr_width();
expr_->signed_ = net->has_sign()? 1 : 0;
expr_->sized_= 1;
FILE_NAME(expr_, net);
expr_->u_.signal_.word = word_expr;
expr_->u_.signal_.sig = sig;
@ -483,11 +486,11 @@ void dll_target::expr_ufunc(const NetEUFunc*net)
ivl_expr_t expr = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
expr->type_ = IVL_EX_UFUNC;
FILE_NAME(expr, net);
expr->value_= net->expr_type();
expr->width_= net->expr_width();
expr->signed_ = net->has_sign()? 1 : 0;
expr->sized_= 1;
FILE_NAME(expr, net);
expr->u_.ufunc_.def = lookup_scope_(net->func());
assert(expr->u_.ufunc_.def->type_ == IVL_SCT_FUNCTION);
@ -522,6 +525,7 @@ void dll_target::expr_unary(const NetEUnary*net)
expr_->width_ = net->expr_width();
expr_->signed_ = net->has_sign()? 1 : 0;
expr_->sized_ = 1;
FILE_NAME(expr_, net);
expr_->u_.unary_.op_ = net->op();
expr_->u_.unary_.sub_ = sub;
}

View File

@ -600,6 +600,7 @@ bool dll_target::proc_force(const NetForce*net)
assert(stmt_cur_);
assert(stmt_cur_->type_ == IVL_ST_NONE);
FILE_NAME(stmt_cur_, net);
stmt_cur_->type_ = IVL_ST_FORCE;

View File

@ -479,8 +479,7 @@ void dll_target::make_scope_parameters(ivl_scope_t scop, const NetScope*net)
ivl_parameter_t cur_par = scop->param_ + idx;
cur_par->basename = (*cur_pit).first;
cur_par->scope = scop;
cur_par->file = (*cur_pit).second.get_file();
cur_par->lineno = (*cur_pit).second.get_lineno();
FILE_NAME(cur_par, &((*cur_pit).second));
NetExpr*etmp = (*cur_pit).second.val;
make_scope_param_expr(cur_par, etmp);
@ -493,8 +492,7 @@ void dll_target::make_scope_parameters(ivl_scope_t scop, const NetScope*net)
ivl_parameter_t cur_par = scop->param_ + idx;
cur_par->basename = (*cur_pit).first;
cur_par->scope = scop;
cur_par->file = (*cur_pit).second.get_file();
cur_par->lineno = (*cur_pit).second.get_lineno();
FILE_NAME(cur_par, &((*cur_pit).second));
NetExpr*etmp = (*cur_pit).second.val;
make_scope_param_expr(cur_par, etmp);
@ -756,6 +754,7 @@ bool dll_target::bufz(const NetBUFZ*net)
obj->width_= net->width();
obj->npins_= 2;
obj->pins_ = new ivl_nexus_t[2];
FILE_NAME(obj, net);
/* Get the ivl_nexus_t objects connected to the two pins.
@ -844,6 +843,8 @@ void dll_target::logic(const NetLogic*net)
obj->width_ = net->width();
FILE_NAME(obj, net);
switch (net->type()) {
case NetLogic::AND:
obj->type_ = IVL_LO_AND;
@ -942,9 +943,6 @@ void dll_target::logic(const NetLogic*net)
make_logic_delays_(obj, net);
obj->file = net->get_file();
obj->lineno = net->get_lineno();
scope_add_logic(scop, obj);
}
@ -960,6 +958,7 @@ bool dll_target::tran(const NetTran*net)
obj->island = net->get_island();
assert(obj->scope);
assert(obj->island);
FILE_NAME(obj, net);
const Nexus*nex;
@ -989,9 +988,6 @@ bool dll_target::tran(const NetTran*net)
obj->offset= net->part_offset();
}
obj->file = net->get_file();
obj->lineno = net->get_lineno();
switch_attributes(obj, net);
make_switch_delays_(obj, net);
scope_add_switch(obj->scope, obj);
@ -1007,6 +1003,7 @@ bool dll_target::sign_extend(const NetSignExtend*net)
obj->name = net->name();
obj->scope = find_scope(des_, net->scope());
assert(obj->scope);
FILE_NAME(obj, net);
const Nexus*nex;
@ -1059,6 +1056,7 @@ bool dll_target::ureduce(const NetUReduce*net)
obj->name = net->name();
obj->scope = find_scope(des_, net->scope());
assert(obj->scope);
FILE_NAME(obj, net);
obj->width = net->width();
@ -1090,6 +1088,7 @@ void dll_target::net_case_cmp(const NetCaseCmp*net)
obj->name = net->name();
obj->scope = find_scope(des_, net->scope());
assert(obj->scope);
FILE_NAME(obj, net);
obj->width = net->width();
obj->u_.arith.signed_flag = 0;
@ -1160,10 +1159,10 @@ bool dll_target::net_sysfunction(const NetSysFunc*net)
struct ivl_lpm_s*obj = new struct ivl_lpm_s;
obj->type = IVL_LPM_SFUNC;
FILE_NAME(obj, net);
obj->name = net->name();
obj->scope = find_scope(des_, net->scope());
assert(obj->scope);
FILE_NAME(obj, net);
obj->u_.sfunc.ports = net->pin_count();
@ -1212,6 +1211,7 @@ bool dll_target::net_function(const NetUserFunc*net)
obj->name = net->name();
obj->scope = find_scope(des_, net->scope());
assert(obj->scope);
FILE_NAME(obj, net);
/* Get the definition of the function and save it. */
const NetScope*def = net->def();
@ -1259,6 +1259,7 @@ void dll_target::udp(const NetUDP*net)
struct ivl_net_logic_s *obj = new struct ivl_net_logic_s;
obj->type_ = IVL_LO_UDP;
FILE_NAME(obj, net);
/* The NetUDP class hasn't learned about width yet, so we
assume a width of 1. */
@ -1279,6 +1280,8 @@ void dll_target::udp(const NetUDP*net)
u->table[u->nrows] = 0x0;
u->nin = net->nin();
u->sequ = net->is_sequential();
u->file = net->udp_file();
u->lineno = net->udp_lineno();
if (u->sequ)
u->init = net->get_initial();
else
@ -1327,6 +1330,7 @@ void dll_target::udp(const NetUDP*net)
obj->scope_= scop;
obj->name_ = net->name();
FILE_NAME(obj, net);
make_logic_delays_(obj, net);
@ -1344,6 +1348,7 @@ void dll_target::lpm_abs(const NetAbs*net)
assert(net->scope());
obj->scope = find_scope(des_, net->scope());
assert(obj->scope);
FILE_NAME(obj, net);
obj->u_.arith.signed_flag = 0;
obj->width = net->width();
@ -1379,6 +1384,7 @@ void dll_target::lpm_add_sub(const NetAddSub*net)
assert(net->scope());
obj->scope = find_scope(des_, net->scope());
assert(obj->scope);
FILE_NAME(obj, net);
obj->u_.arith.signed_flag = 0;
@ -1431,6 +1437,7 @@ bool dll_target::lpm_array_dq(const NetArrayDq*net)
assert(obj->u_.array.sig);
obj->scope = find_scope(des_, net->scope());
assert(obj->scope);
FILE_NAME(obj, net);
obj->width = net->width();
obj->u_.array.swid = net->awidth();
@ -1466,6 +1473,7 @@ void dll_target::lpm_clshift(const NetCLShift*net)
assert(net->scope());
obj->scope = find_scope(des_, net->scope());
assert(obj->scope);
FILE_NAME(obj, net);
/* Look at the direction input of the device, and select the
shift direction accordingly. */
@ -1512,6 +1520,7 @@ bool dll_target::lpm_arith1_(ivl_lpm_type_t lpm_type, unsigned width, bool signe
assert(net->scope());
obj->scope = find_scope(des_, net->scope());
assert(obj->scope);
FILE_NAME(obj, net);
obj->width = width;
obj->u_.arith.signed_flag = signed_flag? 1 : 0;
@ -1564,6 +1573,7 @@ void dll_target::lpm_compare(const NetCompare*net)
assert(net->scope());
obj->scope = find_scope(des_, net->scope());
assert(obj->scope);
FILE_NAME(obj, net);
bool swap_operands = false;
@ -1667,6 +1677,7 @@ void dll_target::lpm_divide(const NetDivide*net)
assert(net->scope());
obj->scope = find_scope(des_, net->scope());
assert(obj->scope);
FILE_NAME(obj, net);
unsigned wid = net->width_r();
@ -1706,6 +1717,7 @@ void dll_target::lpm_modulo(const NetModulo*net)
assert(net->scope());
obj->scope = find_scope(des_, net->scope());
assert(obj->scope);
FILE_NAME(obj, net);
unsigned wid = net->width_r();
@ -1744,6 +1756,7 @@ void dll_target::lpm_ff(const NetFF*net)
obj->name = net->name();
obj->scope = find_scope(des_, net->scope());
assert(obj->scope);
FILE_NAME(obj, net);
obj->width = net->width();
@ -1831,7 +1844,6 @@ void dll_target::lpm_ff(const NetFF*net)
assert(nex->t_cookie());
obj->u_.ff.d.pin = nex->t_cookie();
nexus_lpm_add(obj->u_.ff.d.pin, obj, 0, IVL_DR_HiZ, IVL_DR_HiZ);
}
/*
@ -1845,6 +1857,7 @@ void dll_target::lpm_mult(const NetMult*net)
assert(net->scope());
obj->scope = find_scope(des_, net->scope());
assert(obj->scope);
FILE_NAME(obj, net);
unsigned wid = net->width_r();
@ -1887,6 +1900,7 @@ void dll_target::lpm_mux(const NetMux*net)
obj->name = net->name(); // The NetMux permallocates its name.
obj->scope = find_scope(des_, net->scope());
assert(obj->scope);
FILE_NAME(obj, net);
obj->width = net->width();
obj->u_.mux.size = net->size();
@ -1938,6 +1952,7 @@ void dll_target::lpm_pow(const NetPow*net)
assert(net->scope());
obj->scope = find_scope(des_, net->scope());
assert(obj->scope);
FILE_NAME(obj, net);
unsigned wid = net->width_r();
obj->u_.arith.signed_flag = net->get_signed()? 1 : 0;
@ -1977,6 +1992,7 @@ bool dll_target::concat(const NetConcat*net)
assert(net->scope());
obj->scope = find_scope(des_, net->scope());
assert(obj->scope);
FILE_NAME(obj, net);
obj->width = net->width();
@ -2010,11 +2026,11 @@ bool dll_target::part_select(const NetPartSelect*net)
obj->type = IVL_LPM_PART_PV;
break;
}
FILE_NAME(obj, net);
obj->name = net->name(); // NetPartSelect names are permallocated.
assert(net->scope());
obj->scope = find_scope(des_, net->scope());
assert(obj->scope);
FILE_NAME(obj, net);
/* Part selects are always unsigned, so we use this to indicate
* if the part select base signal is signed or not. */
@ -2093,6 +2109,7 @@ bool dll_target::replicate(const NetReplicate*net)
assert(net->scope());
obj->scope = find_scope(des_, net->scope());
assert(obj->scope);
FILE_NAME(obj, net);
obj->width = net->width();
obj->u_.repeat.count = net->repeat();
@ -2136,6 +2153,9 @@ bool dll_target::net_const(const NetConst*net)
struct ivl_net_const_s *obj = new struct ivl_net_const_s;
obj->type = IVL_VT_BOOL;
assert(net->scope());
obj->scope = find_scope(des_, net->scope());
FILE_NAME(obj, net);
/* constants have a single vector output. */
assert(net->pin_count() == 1);
@ -2192,9 +2212,6 @@ bool dll_target::net_const(const NetConst*net)
des_.consts.resize( des_.consts.size() + 1 );
des_.consts[des_.consts.size()-1] = obj;
obj->file = net->get_file();
obj->lineno = net->get_lineno();
make_const_delays_(obj, net);
return true;
@ -2206,6 +2223,9 @@ bool dll_target::net_literal(const NetLiteral*net)
struct ivl_net_const_s *obj = new struct ivl_net_const_s;
obj->type = IVL_VT_REAL;
assert(net->scope());
obj->scope = find_scope(des_, net->scope());
FILE_NAME(obj, net);
obj->width_ = 1;
obj->signed_ = 1;
obj->b.real_value = net->value_real().as_double();
@ -2322,8 +2342,8 @@ void dll_target::signal(const NetNet*net)
object, or creating the sigs_ array if this is the first
signal. */
obj->scope_ = find_scope(des_, net->scope());
FILE_NAME(obj, net);
assert(obj->scope_);
FILE_NAME(obj, net);
if (obj->scope_->nsigs_ == 0) {
assert(obj->scope_->sigs_ == 0);

41
t-dll.h
View File

@ -444,6 +444,7 @@ struct ivl_net_const_s {
unsigned signed_ : 1;
perm_string file;
unsigned lineno;
ivl_scope_t scope;
union {
double real_value;
@ -512,6 +513,8 @@ struct ivl_udp_s {
unsigned nrows;
typedef const char*ccharp_t;
ccharp_t*table; // zero terminated array of pointers
perm_string file;
unsigned lineno;
};
/*
@ -797,12 +800,6 @@ struct ivl_statement_s {
* 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();
@ -815,6 +812,30 @@ static inline void FILE_NAME(ivl_lpm_t lpm, const LineInfo*info)
lpm->lineno = info->get_lineno();
}
static inline void FILE_NAME(ivl_net_const_t net, const LineInfo*info)
{
net->file = info->get_file();
net->lineno = info->get_lineno();
}
static inline void FILE_NAME(ivl_net_logic_t net, const LineInfo*info)
{
net->file = info->get_file();
net->lineno = info->get_lineno();
}
static inline void FILE_NAME(ivl_parameter_t net, const LineInfo*info)
{
net->file = info->get_file();
net->lineno = info->get_lineno();
}
static inline void FILE_NAME(ivl_process_t net, const LineInfo*info)
{
net->file = info->get_file();
net->lineno = info->get_lineno();
}
static inline void FILE_NAME(ivl_scope_t scope, const NetScope*info)
{
scope->file = info->get_file();
@ -823,13 +844,13 @@ static inline void FILE_NAME(ivl_scope_t scope, const NetScope*info)
scope->def_lineno = info->get_def_lineno();
}
static inline void FILE_NAME(ivl_switch_t net, const LineInfo*info)
static inline void FILE_NAME(ivl_statement_t stmt, const LineInfo*info)
{
net->file = info->get_file();
net->lineno = info->get_lineno();
stmt->file = info->get_file();
stmt->lineno = info->get_lineno();
}
static inline void FILE_NAME(ivl_process_t net, const LineInfo*info)
static inline void FILE_NAME(ivl_switch_t net, const LineInfo*info)
{
net->file = info->get_file();
net->lineno = info->get_lineno();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2010 Stephen Williams (steve@icarus.com)
* Copyright (c) 2000-2011 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
@ -36,7 +36,7 @@
static const char*version_string =
"Icarus Verilog STUB Code Generator " VERSION " (" VERSION_TAG ")\n\n"
"Copyright (c) 2000-2009 Stephen Williams (steve@icarus.com)\n\n"
"Copyright (c) 2000-2011 Stephen Williams (steve@icarus.com)\n\n"
" This program is free software; you can redistribute it and/or modify\n"
" it under the terms of the GNU General Public License as published by\n"
" the Free Software Foundation; either version 2 of the License, or\n"
@ -1641,7 +1641,7 @@ static void show_primitive(ivl_udp_t net, unsigned ref_count)
ivl_udp_name(net), ref_count);
if (ivl_udp_sequ(net))
fprintf(out, " reg out = %u;\n", ivl_udp_init(net));
fprintf(out, " reg out = %c;\n", ivl_udp_init(net));
else
fprintf(out, " wire out;\n");
fprintf(out, " table\n");