Merge branch 'master' of ssh://steve-icarus@icarus.com/~steve-icarus/git/verilog

This commit is contained in:
Stephen Williams 2008-06-19 21:32:18 -07:00
commit fe555e4539
5 changed files with 65 additions and 3 deletions

View File

@ -1794,8 +1794,32 @@ NetNet* PEIdent::elaborate_net(Design*des, NetScope*scope,
that connects to a signal with the correct name. */ that connects to a signal with the correct name. */
if (par != 0) { if (par != 0) {
// Detect and handle the special case that we have a
// real valued parameter. Return a NetLiteral and a
// properly typed net.
if (const NetECReal*pc = dynamic_cast<const NetECReal*>(par)) {
NetLiteral*tmp = new NetLiteral(scope, scope->local_symbol(),
pc->value());
des->add_node(tmp);
tmp->set_line(*par);
sig = new NetNet(scope, scope->local_symbol(),
NetNet::IMPLICIT);
sig->set_line(*tmp);
sig->data_type(tmp->data_type());
sig->local_flag(true);
connect(tmp->pin(0), sig->pin(0));
return sig;
}
const NetEConst*pc = dynamic_cast<const NetEConst*>(par); const NetEConst*pc = dynamic_cast<const NetEConst*>(par);
assert(pc); if (pc == 0) {
cerr << get_fileline() << ": internal error: "
<< "Non-consant parameter value?: " << *par << endl;
cerr << get_fileline() << ": : "
<< "Expression type is " << par->expr_type() << endl;
}
ivl_assert(*this, pc);
verinum pvalue = pc->value(); verinum pvalue = pc->value();
/* If the parameter has declared dimensions, then apply /* If the parameter has declared dimensions, then apply

View File

@ -1505,6 +1505,11 @@ NetLiteral::~NetLiteral()
{ {
} }
ivl_variable_type_t NetLiteral::data_type() const
{
return IVL_VT_REAL;
}
const verireal& NetLiteral::value_real() const const verireal& NetLiteral::value_real() const
{ {
return real_; return real_;

13
scripts/CREATE_VERSION.sh Normal file
View File

@ -0,0 +1,13 @@
#!/bin/sh
# This script manually creates a version.h file.
#
# It is used when creating a MinGW executable from a Cygwin
# hosted git repository. It assumes that git is available.
#
# sh scripts/CREATE_VERSION.sh
#
echo "Building verion.h with git describe"
tmp=`git describe | sed -e 's;\(.*\);#define VERSION_TAG "\1";'`
echo "$tmp" > version.h

View File

@ -178,6 +178,11 @@ void show_unary_expression(ivl_expr_t net, unsigned ind)
break; break;
} }
if (ivl_expr_opcode(net) == '!' && ivl_expr_type(net)==IVL_VT_REAL) {
fprintf(out, "%*sERROR: Real argument to unary ! !?\n", ind,"");
stub_errors += 1;
}
fprintf(out, "%*s<unary \"%s\" width=%u, %s, type=%s>\n", ind, "", fprintf(out, "%*s<unary \"%s\" width=%u, %s, type=%s>\n", ind, "",
name, width, sign, vt); name, width, sign, vt);
show_expression(ivl_expr_oper1(net), ind+4); show_expression(ivl_expr_oper1(net), ind+4);

View File

@ -441,7 +441,22 @@ static int draw_unary_real(ivl_expr_t exp)
return res; return res;
} }
if (ivl_expr_opcode(exp) == '!') {
struct vector_info vi;
vi = draw_eval_expr(exp, STUFF_OK_XZ);
int res = allocate_word();
const char*sign_flag = ivl_expr_signed(exp)? "/s" : "";
fprintf(vvp_out, " %%ix/get%s %d, %u, %u;\n",
sign_flag, res, vi.base, vi.wid);
fprintf(vvp_out, " %%cvt/ri %d, %d;\n", res, res);
clr_vector(vi);
return res;
}
ivl_expr_t sube = ivl_expr_oper1(exp); ivl_expr_t sube = ivl_expr_oper1(exp);
int sub = draw_eval_real(sube); int sub = draw_eval_real(sube);
if (ivl_expr_opcode(exp) == '+') if (ivl_expr_opcode(exp) == '+')
@ -461,8 +476,8 @@ static int draw_unary_real(ivl_expr_t exp)
return sub; return sub;
} }
fprintf(vvp_out, "; XXXX unary (%c)\n", ivl_expr_opcode(exp)); fprintf(vvp_out, "; XXXX unary (%c) on sube in %d\n", ivl_expr_opcode(exp), sub);
fprintf(stderr, "XXXX evaluate unary (%c)\n", ivl_expr_opcode(exp)); fprintf(stderr, "XXXX evaluate unary (%c) on sube in %d\n", ivl_expr_opcode(exp), sub);
return 0; return 0;
} }