From 476a4c7bc496882393ed6f89251def21db17a68c Mon Sep 17 00:00:00 2001 From: Cary R Date: Wed, 18 Jun 2008 11:24:54 -0700 Subject: [PATCH 1/3] Add a script to manually build the version.h file. This script is used to manually build a version.h file. It is needed when building with MinGW using a cygwin hosted repository. --- scripts/CREATE_VERSION.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 scripts/CREATE_VERSION.sh diff --git a/scripts/CREATE_VERSION.sh b/scripts/CREATE_VERSION.sh new file mode 100644 index 000000000..2cbec4707 --- /dev/null +++ b/scripts/CREATE_VERSION.sh @@ -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 From 0153a25061e7196e0784cb361b1332e96883937d Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Thu, 19 Jun 2008 19:13:50 -0700 Subject: [PATCH 2/3] Elaborate nets with real-valued parameters. --- elab_net.cc | 26 +++++++++++++++++++++++++- netlist.cc | 5 +++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/elab_net.cc b/elab_net.cc index 4b5370e34..f00936882 100644 --- a/elab_net.cc +++ b/elab_net.cc @@ -1794,8 +1794,32 @@ NetNet* PEIdent::elaborate_net(Design*des, NetScope*scope, that connects to a signal with the correct name. */ 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(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(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(); /* If the parameter has declared dimensions, then apply diff --git a/netlist.cc b/netlist.cc index db630eb6b..d1565aab0 100644 --- a/netlist.cc +++ b/netlist.cc @@ -1505,6 +1505,11 @@ NetLiteral::~NetLiteral() { } +ivl_variable_type_t NetLiteral::data_type() const +{ + return IVL_VT_REAL; +} + const verireal& NetLiteral::value_real() const { return real_; From b9d6c816f170a40192961e8b23166780e594e787 Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Thu, 19 Jun 2008 19:14:19 -0700 Subject: [PATCH 3/3] Properly evaluate a unary ! with logic argument and real result. --- tgt-stub/expression.c | 5 +++++ tgt-vvp/eval_real.c | 19 +++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/tgt-stub/expression.c b/tgt-stub/expression.c index 500a82bab..823d359a6 100644 --- a/tgt-stub/expression.c +++ b/tgt-stub/expression.c @@ -178,6 +178,11 @@ void show_unary_expression(ivl_expr_t net, unsigned ind) 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\n", ind, "", name, width, sign, vt); show_expression(ivl_expr_oper1(net), ind+4); diff --git a/tgt-vvp/eval_real.c b/tgt-vvp/eval_real.c index dcc9aebe6..27e803d8d 100644 --- a/tgt-vvp/eval_real.c +++ b/tgt-vvp/eval_real.c @@ -441,7 +441,22 @@ static int draw_unary_real(ivl_expr_t exp) 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); + int sub = draw_eval_real(sube); if (ivl_expr_opcode(exp) == '+') @@ -461,8 +476,8 @@ static int draw_unary_real(ivl_expr_t exp) return sub; } - fprintf(vvp_out, "; XXXX unary (%c)\n", ivl_expr_opcode(exp)); - fprintf(stderr, "XXXX evaluate 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) on sube in %d\n", ivl_expr_opcode(exp), sub); return 0; }