Handle case inequality in netlists.

This commit is contained in:
steve 2005-03-09 05:52:03 +00:00
parent 53af2949b4
commit 1c5b4881d7
15 changed files with 152 additions and 28 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: design_dump.cc,v 1.156 2005/02/08 00:12:36 steve Exp $"
#ident "$Id: design_dump.cc,v 1.157 2005/03/09 05:52:03 steve Exp $"
#endif
# include "config.h"
@ -249,7 +249,11 @@ void NetBUFZ::dump_node(ostream&o, unsigned ind) const
void NetCaseCmp::dump_node(ostream&o, unsigned ind) const
{
o << setw(ind) << "" << "case compare === : " << name() << endl;
if (eeq_)
o << setw(ind) << "" << "case compare === : " << name() << endl;
else
o << setw(ind) << "" << "case compare !== : " << name() << endl;
dump_node_pins(o, ind+4);
}
@ -1139,6 +1143,9 @@ void Design::dump(ostream&o) const
/*
* $Log: design_dump.cc,v $
* Revision 1.157 2005/03/09 05:52:03 steve
* Handle case inequality in netlists.
*
* Revision 1.156 2005/02/08 00:12:36 steve
* Add the NetRepeat node, and code generator support.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: elab_net.cc,v 1.152 2005/02/19 02:43:38 steve Exp $"
#ident "$Id: elab_net.cc,v 1.153 2005/03/09 05:52:03 steve Exp $"
#endif
# include "config.h"
@ -627,17 +627,17 @@ NetNet* PEBinary::elaborate_net_cmp_(Design*des, NetScope*scope,
}
case 'E': // Case equals (===)
gate = new NetCaseCmp(scope, scope->local_symbol(), dwidth);
gate = new NetCaseCmp(scope, scope->local_symbol(), dwidth, true);
connect(gate->pin(0), osig->pin(0));
connect(gate->pin(1), lsig->pin(0));
connect(gate->pin(2), rsig->pin(0));
break;
case 'N': // Case equals (!==)
cerr << get_line() << ": internal error: "
<< "Forgot how to elaborate !==." << endl;
des->errors += 1;
gate = 0;
gate = new NetCaseCmp(scope, scope->local_symbol(), dwidth, false);
connect(gate->pin(0), osig->pin(0));
connect(gate->pin(1), lsig->pin(0));
connect(gate->pin(2), rsig->pin(0));
break;
case 'e': // ==
@ -2504,6 +2504,9 @@ NetNet* PEUnary::elaborate_net(Design*des, NetScope*scope,
/*
* $Log: elab_net.cc,v $
* Revision 1.153 2005/03/09 05:52:03 steve
* Handle case inequality in netlists.
*
* Revision 1.152 2005/02/19 02:43:38 steve
* Support shifts and divide.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: netlist.cc,v 1.238 2005/02/19 02:43:38 steve Exp $"
#ident "$Id: netlist.cc,v 1.239 2005/03/09 05:52:04 steve Exp $"
#endif
# include "config.h"
@ -1503,8 +1503,8 @@ unsigned NetBUFZ::width() const
return width_;
}
NetCaseCmp::NetCaseCmp(NetScope*s, perm_string n, unsigned wid)
: NetNode(s, n, 3), width_(wid)
NetCaseCmp::NetCaseCmp(NetScope*s, perm_string n, unsigned wid, bool eeq)
: NetNode(s, n, 3), width_(wid), eeq_(eeq)
{
pin(0).set_dir(Link::OUTPUT); pin(0).set_name(perm_string::literal("O"),0);
pin(1).set_dir(Link::INPUT); pin(1).set_name(perm_string::literal("I"),0);
@ -1520,6 +1520,11 @@ unsigned NetCaseCmp::width() const
return width_;
}
bool NetCaseCmp::eeq() const
{
return eeq_;
}
NetCondit::NetCondit(NetExpr*ex, NetProc*i, NetProc*e)
: expr_(ex), if_(i), else_(e)
{
@ -2191,6 +2196,9 @@ const NetProc*NetTaskDef::proc() const
/*
* $Log: netlist.cc,v $
* Revision 1.239 2005/03/09 05:52:04 steve
* Handle case inequality in netlists.
*
* Revision 1.238 2005/02/19 02:43:38 steve
* Support shifts and divide.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: netlist.h,v 1.335 2005/02/19 02:43:38 steve Exp $"
#ident "$Id: netlist.h,v 1.336 2005/03/09 05:52:04 steve Exp $"
#endif
/*
@ -1254,16 +1254,19 @@ class NetBUFZ : public NetNode {
class NetCaseCmp : public NetNode {
public:
explicit NetCaseCmp(NetScope*s, perm_string n, unsigned wid);
explicit NetCaseCmp(NetScope*s, perm_string n, unsigned wid, bool eeq);
~NetCaseCmp();
unsigned width() const;
// true if this is ===, false if this is !==
bool eeq() const;
virtual void dump_node(ostream&, unsigned ind) const;
virtual bool emit_node(struct target_t*) const;
private:
unsigned width_;
bool eeq_;
};
/*
@ -3414,6 +3417,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
/*
* $Log: netlist.h,v $
* Revision 1.336 2005/03/09 05:52:04 steve
* Handle case inequality in netlists.
*
* Revision 1.335 2005/02/19 02:43:38 steve
* Support shifts and divide.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: t-dll-api.cc,v 1.119 2005/02/19 02:43:38 steve Exp $"
#ident "$Id: t-dll-api.cc,v 1.120 2005/03/09 05:52:04 steve Exp $"
#endif
# include "config.h"
@ -745,6 +745,7 @@ extern "C" ivl_nexus_t ivl_lpm_data(ivl_lpm_t net, unsigned idx)
case IVL_LPM_CMP_GE:
case IVL_LPM_CMP_GT:
case IVL_LPM_CMP_NE:
case IVL_LPM_CMP_NEE:
case IVL_LPM_DIVIDE:
case IVL_LPM_MOD:
case IVL_LPM_MULT:
@ -910,6 +911,7 @@ extern "C" ivl_nexus_t ivl_lpm_q(ivl_lpm_t net, unsigned idx)
case IVL_LPM_CMP_EQ:
case IVL_LPM_CMP_NE:
case IVL_LPM_CMP_EEQ:
case IVL_LPM_CMP_NEE:
assert(idx == 0);
return net->u_.arith.q;
@ -1016,6 +1018,7 @@ extern "C" int ivl_lpm_signed(ivl_lpm_t net)
case IVL_LPM_CMP_GE:
case IVL_LPM_CMP_GT:
case IVL_LPM_CMP_NE:
case IVL_LPM_CMP_NEE:
case IVL_LPM_DIVIDE:
case IVL_LPM_MOD:
case IVL_LPM_MULT:
@ -1081,6 +1084,7 @@ extern "C" unsigned ivl_lpm_width(ivl_lpm_t net)
case IVL_LPM_CMP_GE:
case IVL_LPM_CMP_GT:
case IVL_LPM_CMP_NE:
case IVL_LPM_CMP_NEE:
case IVL_LPM_DIVIDE:
case IVL_LPM_MOD:
case IVL_LPM_MULT:
@ -1987,6 +1991,9 @@ extern "C" ivl_variable_type_t ivl_variable_type(ivl_variable_t net)
/*
* $Log: t-dll-api.cc,v $
* Revision 1.120 2005/03/09 05:52:04 steve
* Handle case inequality in netlists.
*
* Revision 1.119 2005/02/19 02:43:38 steve
* Support shifts and divide.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: t-dll.cc,v 1.142 2005/02/19 02:43:38 steve Exp $"
#ident "$Id: t-dll.cc,v 1.143 2005/03/09 05:52:04 steve Exp $"
#endif
# include "config.h"
@ -959,7 +959,7 @@ bool dll_target::ureduce(const NetUReduce*net)
void dll_target::net_case_cmp(const NetCaseCmp*net)
{
struct ivl_lpm_s*obj = new struct ivl_lpm_s;
obj->type = IVL_LPM_CMP_EEQ;
obj->type = net->eeq()? IVL_LPM_CMP_EEQ : IVL_LPM_CMP_NEE;
obj->name = net->name();
obj->scope = find_scope(des_, net->scope());
assert(obj->scope);
@ -2168,6 +2168,9 @@ extern const struct target tgt_dll = { "dll", &dll_target_obj };
/*
* $Log: t-dll.cc,v $
* Revision 1.143 2005/03/09 05:52:04 steve
* Handle case inequality in netlists.
*
* Revision 1.142 2005/02/19 02:43:38 steve
* Support shifts and divide.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: stub.c,v 1.114 2005/03/09 04:53:40 steve Exp $"
#ident "$Id: stub.c,v 1.115 2005/03/09 05:52:04 steve Exp $"
#endif
# include "config.h"
@ -292,15 +292,16 @@ static void show_lpm_divide(ivl_lpm_t net)
show_lpm_arithmetic_pins(net);
}
/* IVL_LPM_CMP_EEQ
/* IVL_LPM_CMP_EEQ/NEE
* This LPM node supports two-input compare. The output width is
* actually always 1, the lpm_width is the expected width of the inputs.
*/
static void show_lpm_cmp_eeq(ivl_lpm_t net)
{
const char*str = (ivl_lpm_type(net) == IVL_LPM_CMP_EEQ)? "EEQ" : "NEE";
unsigned width = ivl_lpm_width(net);
fprintf(out, " LPM_CMP_EEQ %s: <width=%u>\n",
fprintf(out, " LPM_CMP_%s %s: <width=%u>\n", str,
ivl_lpm_basename(net), width);
fprintf(out, " O: %s\n", ivl_nexus_name(ivl_lpm_q(net,0)));
@ -609,6 +610,7 @@ static void show_lpm(ivl_lpm_t net)
break;
case IVL_LPM_CMP_EEQ:
case IVL_LPM_CMP_NEE:
show_lpm_cmp_eeq(net);
break;
@ -1169,6 +1171,9 @@ int target_design(ivl_design_t des)
/*
* $Log: stub.c,v $
* Revision 1.115 2005/03/09 05:52:04 steve
* Handle case inequality in netlists.
*
* Revision 1.114 2005/03/09 04:53:40 steve
* Generate code for new form of memory ports.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: vvp_scope.c,v 1.120 2005/03/09 04:53:40 steve Exp $"
#ident "$Id: vvp_scope.c,v 1.121 2005/03/09 05:52:04 steve Exp $"
#endif
# include "vvp_priv.h"
@ -1399,6 +1399,10 @@ static void draw_lpm_cmp(ivl_lpm_t net)
type = "ne";
signed_string = "";
break;
case IVL_LPM_CMP_NEE:
type = "nee";
signed_string = "";
break;
default:
assert(0);
}
@ -1855,6 +1859,7 @@ static void draw_lpm_in_scope(ivl_lpm_t net)
case IVL_LPM_CMP_GE:
case IVL_LPM_CMP_GT:
case IVL_LPM_CMP_NE:
case IVL_LPM_CMP_NEE:
draw_lpm_cmp(net);
return;
@ -2017,6 +2022,9 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent)
/*
* $Log: vvp_scope.c,v $
* Revision 1.121 2005/03/09 05:52:04 steve
* Handle case inequality in netlists.
*
* Revision 1.120 2005/03/09 04:53:40 steve
* Generate code for new form of memory ports.
*

View File

@ -1,7 +1,7 @@
/*
* Copyright (c) 2001 Stephen Williams (steve@icarus.com)
*
* $Id: README.txt,v 1.59 2005/03/09 04:52:40 steve Exp $
* $Id: README.txt,v 1.60 2005/03/09 05:52:04 steve Exp $
*/
VVP SIMULATION ENGINE
@ -579,6 +579,7 @@ are implemented a bit differently. The syntax, however, is very
similar:
<label> .cmp/eeq <wid>, <A>, <B>;
<label> .cmp/nee <wid>, <A>, <B>;
<label> .cmp/eq <wid>, <A>, <B>;
<label> .cmp/ne <wid>, <A>, <B>;
<label> .cmp/ge <wid>, <A>, <B>;

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: arith.cc,v 1.40 2005/02/19 02:41:23 steve Exp $"
#ident "$Id: arith.cc,v 1.41 2005/03/09 05:52:04 steve Exp $"
#endif
# include "arith.h"
@ -497,6 +497,31 @@ void vvp_cmp_eeq::recv_vec4(vvp_net_ptr_t ptr, vvp_vector4_t bit)
break;
}
vvp_net_t*net = ptr.ptr();
vvp_send_vec4(net->out, eeq);
}
vvp_cmp_nee::vvp_cmp_nee(unsigned wid)
: vvp_arith_(wid)
{
}
void vvp_cmp_nee::recv_vec4(vvp_net_ptr_t ptr, vvp_vector4_t bit)
{
dispatch_operand_(ptr, bit);
vvp_vector4_t eeq (1);
eeq.set_bit(0, BIT4_0);
assert(op_a_.size() == op_b_.size());
for (unsigned idx = 0 ; idx < op_a_.size() ; idx += 1)
if (op_a_.value(idx) != op_b_.value(idx)) {
eeq.set_bit(0, BIT4_1);
break;
}
vvp_net_t*net = ptr.ptr();
vvp_send_vec4(net->out, eeq);
}
@ -735,6 +760,9 @@ void vvp_shiftr::set(vvp_ipoint_t i, bool push, unsigned val, unsigned)
/*
* $Log: arith.cc,v $
* Revision 1.41 2005/03/09 05:52:04 steve
* Handle case inequality in netlists.
*
* Revision 1.40 2005/02/19 02:41:23 steve
* Handle signed divide.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: arith.h,v 1.26 2005/02/19 01:32:52 steve Exp $"
#ident "$Id: arith.h,v 1.27 2005/03/09 05:52:04 steve Exp $"
#endif
# include "functor.h"
@ -87,6 +87,14 @@ class vvp_cmp_eeq : public vvp_arith_ {
};
class vvp_cmp_nee : public vvp_arith_ {
public:
explicit vvp_cmp_nee(unsigned wid);
void recv_vec4(vvp_net_ptr_t ptr, vvp_vector4_t bit);
};
class vvp_cmp_eq : public vvp_arith_ {
public:
@ -189,6 +197,9 @@ class vvp_shiftr : public vvp_arith_ {
/*
* $Log: arith.h,v $
* Revision 1.27 2005/03/09 05:52:04 steve
* Handle case inequality in netlists.
*
* Revision 1.26 2005/02/19 01:32:52 steve
* Implement .arith/div.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: compile.cc,v 1.190 2005/03/09 04:52:40 steve Exp $"
#ident "$Id: compile.cc,v 1.191 2005/03/09 05:52:04 steve Exp $"
#endif
# include "arith.h"
@ -967,6 +967,22 @@ void compile_cmp_eeq(char*label, long wid,
make_arith(arith, label, wid, argc, argv);
}
void compile_cmp_nee(char*label, long wid,
unsigned argc, struct symb_s*argv)
{
assert( wid > 0 );
if (argc != 2) {
fprintf(stderr, "%s .cmp/eeq has wrong number of symbols\n",label);
compile_errors += 1;
return;
}
vvp_arith_ *arith = new vvp_cmp_nee(wid);
make_arith(arith, label, wid, argc, argv);
}
void compile_cmp_eq(char*label, long wid, unsigned argc, struct symb_s*argv)
{
assert( wid > 0 );
@ -1645,6 +1661,9 @@ void compile_param_string(char*label, char*name, char*str, char*value)
/*
* $Log: compile.cc,v $
* Revision 1.191 2005/03/09 05:52:04 steve
* Handle case inequality in netlists.
*
* Revision 1.190 2005/03/09 04:52:40 steve
* reimplement memory ports.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: compile.h,v 1.64 2005/03/09 04:52:40 steve Exp $"
#ident "$Id: compile.h,v 1.65 2005/03/09 05:52:04 steve Exp $"
#endif
# include <stdio.h>
@ -126,6 +126,8 @@ extern void compile_arith_sub(char*label, long width,
unsigned argc, struct symb_s*argv);
extern void compile_cmp_eeq(char*label, long width,
unsigned argc, struct symb_s*argv);
extern void compile_cmp_nee(char*label, long width,
unsigned argc, struct symb_s*argv);
extern void compile_cmp_eq(char*label, long width,
unsigned argc, struct symb_s*argv);
extern void compile_cmp_ne(char*label, long width,
@ -295,6 +297,9 @@ extern void compile_net(char*label, char*name,
/*
* $Log: compile.h,v $
* Revision 1.65 2005/03/09 05:52:04 steve
* Handle case inequality in netlists.
*
* Revision 1.64 2005/03/09 04:52:40 steve
* reimplement memory ports.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: lexor.lex,v 1.49 2005/02/07 22:42:42 steve Exp $"
#ident "$Id: lexor.lex,v 1.50 2005/03/09 05:52:04 steve Exp $"
#endif
# include "parse_misc.h"
@ -91,6 +91,7 @@
".arith/sum" { return K_ARITH_SUM; }
".cmp/eeq" { return K_CMP_EEQ; }
".cmp/eq" { return K_CMP_EQ; }
".cmp/nee" { return K_CMP_NEE; }
".cmp/ne" { return K_CMP_NE; }
".cmp/ge" { return K_CMP_GE; }
".cmp/ge.s" { return K_CMP_GE_S; }
@ -193,6 +194,9 @@ int yywrap()
/*
* $Log: lexor.lex,v $
* Revision 1.50 2005/03/09 05:52:04 steve
* Handle case inequality in netlists.
*
* Revision 1.49 2005/02/07 22:42:42 steve
* Add .repeat functor and BIFIF functors.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: parse.y,v 1.68 2005/03/09 04:52:40 steve Exp $"
#ident "$Id: parse.y,v 1.69 2005/03/09 05:52:04 steve Exp $"
#endif
# include "parse_misc.h"
@ -59,7 +59,8 @@ extern FILE*yyin;
%token K_ARITH_DIV K_ARITH_DIV_S K_ARITH_MOD K_ARITH_MULT
%token K_ARITH_SUB K_ARITH_SUM
%token K_CMP_EEQ K_CMP_EQ K_CMP_NE K_CMP_GE K_CMP_GE_S K_CMP_GT K_CMP_GT_S
%token K_CMP_EEQ K_CMP_EQ K_CMP_NEE K_CMP_NE
%token K_CMP_GE K_CMP_GE_S K_CMP_GT K_CMP_GT_S
%token K_CONCAT
%token K_EVENT K_EVENT_OR K_FUNCTOR K_NET K_NET_S K_PARAM K_PART K_PART_PV
%token K_REDUCE_AND K_REDUCE_OR K_REDUCE_XOR
@ -243,6 +244,11 @@ statement
compile_cmp_eeq($1, $3, obj.cnt, obj.vect);
}
| T_LABEL K_CMP_NEE T_NUMBER ',' symbols ';'
{ struct symbv_s obj = $5;
compile_cmp_nee($1, $3, obj.cnt, obj.vect);
}
| T_LABEL K_CMP_EQ T_NUMBER ',' symbols ';'
{ struct symbv_s obj = $5;
compile_cmp_eq($1, $3, obj.cnt, obj.vect);
@ -673,6 +679,9 @@ int compile_design(const char*path)
/*
* $Log: parse.y,v $
* Revision 1.69 2005/03/09 05:52:04 steve
* Handle case inequality in netlists.
*
* Revision 1.68 2005/03/09 04:52:40 steve
* reimplement memory ports.
*