diff --git a/Makefile.in b/Makefile.in index 8ae66c817..12e2faec3 100644 --- a/Makefile.in +++ b/Makefile.in @@ -18,7 +18,7 @@ # 59 Temple Place - Suite 330 # Boston, MA 02111-1307, USA # -#ident "$Id: Makefile.in,v 1.71 2000/10/04 17:08:31 steve Exp $" +#ident "$Id: Makefile.in,v 1.72 2000/10/05 05:03:01 steve Exp $" # # SHELL = /bin/sh @@ -55,12 +55,16 @@ all: ivl@EXEEXT@ iverilog@EXEEXT@ cd vvm ; $(MAKE) all cd vpi ; $(MAKE) all cd ivlpp ; $(MAKE) all + cd tgt-verilog ; $(MAKE) all + cd tgt-stub ; $(MAKE) all clean: rm -f *.o parse.cc parse.cc.output parse.h dep/*.d lexor.cc lexor_keyword.cc verilog iverilog@EXEEXT@ cd vvm ; $(MAKE) clean cd vpi ; $(MAKE) clean cd ivlpp ; $(MAKE) clean + cd tgt-verilog ; $(MAKE) clean + cd tgt-stub ; $(MAKE) clean distclean: clean rm -f vvm/Makefile diff --git a/ivl_target.h b/ivl_target.h index 79503397a..38852288d 100644 --- a/ivl_target.h +++ b/ivl_target.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: ivl_target.h,v 1.14 2000/09/30 02:18:15 steve Exp $" +#ident "$Id: ivl_target.h,v 1.15 2000/10/05 05:03:01 steve Exp $" #endif #ifdef __cplusplus @@ -56,8 +56,43 @@ _BEGIN_DECL * * The following typedefs list the various cookies that may be passed * around. + * + * ivl_design_t + * This object represents the entire elaborated design. Various + * global properties and methods are available from this. + * + * ivl_expr_t + * This object represents a node of an expression. If the + * expression has sub-expressions, they can be accessed from + * various method described below. The ivl_expr_type method in + * particular gets the type of the node in the form of an + * ivl_expr_type_t enumeration value. + * + * Objects of this type represent expressions in + * processes. Structural expressions are instead treated as logic + * gates. + * + * ivl_process_t + * A Verilog process is represented by one of these. A process may + * be an "initial" or an "always" process. These come from initial + * or always statements from the verilog source. + * + * ivl_scope_t + * Elaborated scopes within a design are represented by this type. + * + * ivl_statement_t + * Statements within processes are represented by one of these. The + * ivl_process_t object holds one of these, but a statement may in + * turn contain other statements. + * + * -- A Note About Bit Sets -- + * Some objects hold a value as an array of bits. In these cases there + * is some method that retrieves the width of the value and another + * that returns a "char*". The latter is a pointer to the least + * significant bit value. Bit values are represented by the characters + * '0', '1', 'x' and 'z'. Strengths are stored elsewhere. */ -typedef struct ivl_design_s *ivl_design_t; +typedef struct ivl_design_s *ivl_design_t; typedef struct ivl_expr_s *ivl_expr_t; typedef struct ivl_net_bufz_s *ivl_net_bufz_t; typedef struct ivl_net_const_s*ivl_net_const_t; @@ -81,6 +116,7 @@ typedef enum ivl_expr_type_e { IVL_EX_NONE = 0, IVL_EX_BINARY, IVL_EX_NUMBER, + IVL_EX_SFUNC, IVL_EX_SIGNAL, IVL_EX_STRING, IVL_EX_SUBSIG, @@ -168,6 +204,14 @@ extern const char* ivl_get_flag(ivl_design_t, const char*key); /* Get the name of the root module. This can be used as the design name. */ extern const char* ivl_get_root_name(ivl_design_t net); +/* + * These methods apply to ivl_net_const_t objects. + */ +extern const char* ivl_const_bits(ivl_net_const_t net); +extern ivl_nexus_t ivl_const_pin(ivl_net_const_t net, unsigned idx); +extern unsigned ivl_const_pins(ivl_net_const_t net); +extern int ivl_const_signed(ivl_net_const_t net); + /* EXPRESSION * These methods operate on expression objects from the * design. Expressions mainly exist in behavioral code. The @@ -176,14 +220,23 @@ extern const char* ivl_get_root_name(ivl_design_t net); */ extern ivl_expr_type_t ivl_expr_type(ivl_expr_t net); + /* IVL_EX_NUMBER */ extern const char* ivl_expr_bits(ivl_expr_t net); + /* IVL_EX_SIGNAL, IVL_EX_SFUNC */ extern const char* ivl_expr_name(ivl_expr_t net); + /* IVL_EX_BINARY */ extern char ivl_expr_opcode(ivl_expr_t net); + /* IVL_EX_BINARY */ extern ivl_expr_t ivl_expr_oper1(ivl_expr_t net); + /* IVL_EX_BINARY */ extern ivl_expr_t ivl_expr_oper2(ivl_expr_t net); + /* */ extern ivl_expr_t ivl_expr_oper3(ivl_expr_t net); + /* any expression */ extern int ivl_expr_signed(ivl_expr_t net); + /* */ extern const char* ivl_expr_string(ivl_expr_t net); + /* any expression */ extern unsigned ivl_expr_width(ivl_expr_t net); /* LOGIC @@ -193,16 +246,16 @@ extern unsigned ivl_expr_width(ivl_expr_t net); * provide access to the bits of information for a given logic device. */ -extern ivl_logic_t ivl_get_logic_type(ivl_net_logic_t net); -extern ivl_nexus_t ivl_get_logic_pin(ivl_net_logic_t net, unsigned pin); -extern unsigned ivl_get_logic_pins(ivl_net_logic_t net); +extern ivl_logic_t ivl_logic_type(ivl_net_logic_t net); +extern ivl_nexus_t ivl_logic_pin(ivl_net_logic_t net, unsigned pin); +extern unsigned ivl_logic_pins(ivl_net_logic_t net); /* NEXUS * connections of signals and nodes is handled by single-bit * nexus. These functions manage the ivl_nexus_t object. */ -extern const char* ivl_get_nexus_name(ivl_nexus_t net); +extern const char* ivl_nexus_name(ivl_nexus_t net); /* SIGNALS * Signals are named things in the Verilog source, like wires and @@ -223,16 +276,16 @@ extern ivl_signal_type_t ivl_signal_type(ivl_signal_t net); * is translated into a type and a single statement. (The statement * may be a compound statement.) * - * The ivl_get_process_type function gets the type of the process, + * The ivl_process_type function gets the type of the process, * an "inital" or "always" statement. * - * The ivl_get_process_stmt function gets the statement that forms the + * The ivl_process_stmt function gets the statement that forms the * process. See the statement related functions for how to manipulate * statements. */ -extern ivl_process_type_t ivl_get_process_type(ivl_process_t net); +extern ivl_process_type_t ivl_process_type(ivl_process_t net); -extern ivl_statement_t ivl_get_process_stmt(ivl_process_t net); +extern ivl_statement_t ivl_process_stmt(ivl_process_t net); /* * These functions manage statements of various type. This includes @@ -259,7 +312,9 @@ extern unsigned ivl_stmt_block_count(ivl_statement_t net); extern ivl_statement_t ivl_stmt_block_stmt(ivl_statement_t net, unsigned i); /* IVL_ST_CONDIT */ extern ivl_expr_t ivl_stmt_cond_expr(ivl_statement_t net); + /* IVL_ST_CONDIT */ extern ivl_statement_t ivl_stmt_cond_false(ivl_statement_t net); + /* IVL_ST_CONDIT */ extern ivl_statement_t ivl_stmt_cond_true(ivl_statement_t net); /* IVL_ST_DELAY */ extern unsigned long ivl_stmt_delay_val(ivl_statement_t net); @@ -378,6 +433,9 @@ _END_DECL /* * $Log: ivl_target.h,v $ + * Revision 1.15 2000/10/05 05:03:01 steve + * xor and constant devices. + * * Revision 1.14 2000/09/30 02:18:15 steve * ivl_expr_t support for binary operators, * Create a proper ivl_scope_t object. diff --git a/netlist.cc b/netlist.cc index fddf7f759..cf9ec7f65 100644 --- a/netlist.cc +++ b/netlist.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: netlist.cc,v 1.139 2000/09/26 05:05:58 steve Exp $" +#ident "$Id: netlist.cc,v 1.140 2000/10/05 05:03:01 steve Exp $" #endif # include @@ -2053,8 +2053,10 @@ const NetScope* NetEScope::scope() const } NetESFunc::NetESFunc(const string&n, unsigned width, unsigned np) -: name_(n) +: name_(0) { + name_ = new char [n.length()+1]; + strcpy(name_, n.c_str()); expr_width(width); nparms_ = np; parms_ = new NetExpr*[np]; @@ -2068,9 +2070,10 @@ NetESFunc::~NetESFunc() if (parms_[idx]) delete parms_[idx]; delete[]parms_; + delete[]name_; } -const string& NetESFunc::name() const +const char* NetESFunc::name() const { return name_; } @@ -2420,6 +2423,9 @@ bool NetUDP::sequ_glob_(string input, char output) /* * $Log: netlist.cc,v $ + * Revision 1.140 2000/10/05 05:03:01 steve + * xor and constant devices. + * * Revision 1.139 2000/09/26 05:05:58 steve * Detect indefinite widths where definite widths are required. * diff --git a/netlist.h b/netlist.h index 182ccf282..13cd5ee00 100644 --- a/netlist.h +++ b/netlist.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: netlist.h,v 1.170 2000/10/04 16:30:39 steve Exp $" +#ident "$Id: netlist.h,v 1.171 2000/10/05 05:03:01 steve Exp $" #endif /* @@ -2309,7 +2309,7 @@ class NetESFunc : public NetExpr { NetESFunc(const string&name, unsigned width, unsigned nprms); ~NetESFunc(); - const string& name() const; + const char* name() const; unsigned nparms() const; void parm(unsigned idx, NetExpr*expr); @@ -2323,7 +2323,7 @@ class NetESFunc : public NetExpr { virtual NetESFunc*dup_expr() const; private: - string name_; + char* name_; unsigned nparms_; NetExpr**parms_; @@ -2796,6 +2796,9 @@ extern ostream& operator << (ostream&, NetNet::Type); /* * $Log: netlist.h,v $ + * Revision 1.171 2000/10/05 05:03:01 steve + * xor and constant devices. + * * Revision 1.170 2000/10/04 16:30:39 steve * Use char8 instead of string to store name. * diff --git a/t-dll-api.cc b/t-dll-api.cc index 6aa406901..ba9753c8a 100644 --- a/t-dll-api.cc +++ b/t-dll-api.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: t-dll-api.cc,v 1.8 2000/09/30 02:18:15 steve Exp $" +#ident "$Id: t-dll-api.cc,v 1.9 2000/10/05 05:03:01 steve Exp $" #endif # include "t-dll.h" @@ -41,6 +41,24 @@ extern "C" const char*ivl_get_root_name(ivl_design_t des) return des->root_->self->basename(); } +extern "C" const char*ivl_const_bits(ivl_net_const_t net) +{ + assert(net); + return net->bits_; +} + +extern "C" unsigned ivl_const_pins(ivl_net_const_t net) +{ + assert(net); + return net->width_; +} + +extern "C" int ivl_const_signed(ivl_net_const_t net) +{ + assert(net); + return net->signed_ == 1; +} + extern "C" const char* ivl_expr_bits(ivl_expr_t net) { assert(net && (net->type_ == IVL_EX_NUMBER)); @@ -49,8 +67,18 @@ extern "C" const char* ivl_expr_bits(ivl_expr_t net) extern "C" const char* ivl_expr_name(ivl_expr_t net) { - assert(net->type_ == IVL_EX_SIGNAL); - return net->u_.subsig_.name_; + switch (net->type_) { + + case IVL_EX_SFUNC: + return net->u_.sfunc_.name_; + + case IVL_EX_SIGNAL: + return net->u_.subsig_.name_; + + default: + assert(0); + } + return 0; } extern "C" char ivl_expr_opcode(ivl_expr_t net) @@ -112,40 +140,42 @@ extern "C" unsigned ivl_expr_width(ivl_expr_t net) return net->width_; } -extern "C" ivl_logic_t ivl_get_logic_type(ivl_net_logic_t net) +extern "C" ivl_logic_t ivl_logic_type(ivl_net_logic_t net) { switch (net->dev_->type()) { case NetLogic::AND: return IVL_LO_AND; case NetLogic::OR: return IVL_LO_OR; + case NetLogic::XOR: + return IVL_LO_XOR; } assert(0); return IVL_LO_NONE; } -extern "C" unsigned ivl_get_logic_pins(ivl_net_logic_t net) +extern "C" unsigned ivl_logic_pins(ivl_net_logic_t net) { return net->dev_->pin_count(); } -extern "C" ivl_nexus_t ivl_get_logic_pin(ivl_net_logic_t net, unsigned pin) +extern "C" ivl_nexus_t ivl_logic_pin(ivl_net_logic_t net, unsigned pin) { return (ivl_nexus_t) (net->dev_->pin(pin).nexus()); } -extern "C" const char* ivl_get_nexus_name(ivl_nexus_t net) +extern "C" const char* ivl_nexus_name(ivl_nexus_t net) { const Nexus*nex = (const Nexus*)net; return nex->name(); } -extern "C" ivl_process_type_t ivl_get_process_type(ivl_process_t net) +extern "C" ivl_process_type_t ivl_process_type(ivl_process_t net) { return net->type_; } -extern "C" ivl_statement_t ivl_get_process_stmt(ivl_process_t net) +extern "C" ivl_statement_t ivl_process_stmt(ivl_process_t net) { return net->stmt_; } @@ -322,6 +352,9 @@ extern "C" ivl_statement_t ivl_stmt_sub_stmt(ivl_statement_t net) /* * $Log: t-dll-api.cc,v $ + * Revision 1.9 2000/10/05 05:03:01 steve + * xor and constant devices. + * * Revision 1.8 2000/09/30 02:18:15 steve * ivl_expr_t support for binary operators, * Create a proper ivl_scope_t object. diff --git a/t-dll-expr.cc b/t-dll-expr.cc index 8f65d2f64..4b0489c32 100644 --- a/t-dll-expr.cc +++ b/t-dll-expr.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) & !defined(macintosh) -#ident "$Id: t-dll-expr.cc,v 1.4 2000/09/30 02:18:15 steve Exp $" +#ident "$Id: t-dll-expr.cc,v 1.5 2000/10/05 05:03:01 steve Exp $" #endif # include "t-dll.h" @@ -96,6 +96,18 @@ void dll_target::expr_const(const NetEConst*net) } } +void dll_target::expr_sfunc(const NetESFunc*net) +{ + assert(expr_ == 0); + + expr_ = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s)); + assert(expr_); + + expr_->type_ = IVL_EX_SFUNC; + expr_->width_= net->expr_width(); + expr_->u_.sfunc_.name_ = strdup(net->name()); +} + void dll_target::expr_signal(const NetESignal*net) { assert(expr_ == 0); @@ -110,6 +122,9 @@ void dll_target::expr_signal(const NetESignal*net) /* * $Log: t-dll-expr.cc,v $ + * Revision 1.5 2000/10/05 05:03:01 steve + * xor and constant devices. + * * Revision 1.4 2000/09/30 02:18:15 steve * ivl_expr_t support for binary operators, * Create a proper ivl_scope_t object. diff --git a/t-dll-proc.cc b/t-dll-proc.cc index 4d24c44d4..4a859fa9e 100644 --- a/t-dll-proc.cc +++ b/t-dll-proc.cc @@ -18,7 +18,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: t-dll-proc.cc,v 1.6 2000/09/30 02:18:15 steve Exp $" +#ident "$Id: t-dll-proc.cc,v 1.7 2000/10/05 05:03:01 steve Exp $" #endif # include "target.h" @@ -213,7 +213,8 @@ void dll_target::proc_stask(const NetSTask*net) for (unsigned idx = 0 ; idx < nparms ; idx += 1) { expr_ = 0; - net->parm(idx)->expr_scan(this); + if (net->parm(idx)) + net->parm(idx)->expr_scan(this); stmt_cur_->u_.stask_.parms_[idx] = expr_; } @@ -268,6 +269,9 @@ void dll_target::proc_while(const NetWhile*net) /* * $Log: t-dll-proc.cc,v $ + * Revision 1.7 2000/10/05 05:03:01 steve + * xor and constant devices. + * * Revision 1.6 2000/09/30 02:18:15 steve * ivl_expr_t support for binary operators, * Create a proper ivl_scope_t object. diff --git a/t-dll.cc b/t-dll.cc index b2553467b..0dbc55f70 100644 --- a/t-dll.cc +++ b/t-dll.cc @@ -17,12 +17,13 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: t-dll.cc,v 1.9 2000/09/30 02:18:15 steve Exp $" +#ident "$Id: t-dll.cc,v 1.10 2000/10/05 05:03:01 steve Exp $" #endif # include "compiler.h" # include "t-dll.h" # include +# include static struct dll_target dll_target_obj; @@ -110,12 +111,30 @@ void dll_target::logic(const NetLogic*net) bool dll_target::net_const(const NetConst*net) { - struct ivl_net_const_s obj; + unsigned idx; + ivl_net_const_t obj = (ivl_net_const_t) + calloc(1, sizeof(struct ivl_net_const_s)); - obj.con_ = net; + obj->width_ = net->pin_count(); + obj->bits_ = (char*)malloc(obj->width_); + for (idx = 0 ; idx < obj->width_ ; idx += 1) + switch (net->value(idx)) { + case verinum::V0: + obj->bits_[idx] = '0'; + break; + case verinum::V1: + obj->bits_[idx] = '1'; + break; + case verinum::Vx: + obj->bits_[idx] = 'x'; + break; + case verinum::Vz: + obj->bits_[idx] = 'z'; + break; + } if (net_const_) { - int rc = (net_const_)(net->name(), &obj); + int rc = (net_const_)(net->name(), obj); return rc == 0; } else { @@ -202,6 +221,9 @@ extern const struct target tgt_dll = { "dll", &dll_target_obj }; /* * $Log: t-dll.cc,v $ + * Revision 1.10 2000/10/05 05:03:01 steve + * xor and constant devices. + * * Revision 1.9 2000/09/30 02:18:15 steve * ivl_expr_t support for binary operators, * Create a proper ivl_scope_t object. diff --git a/t-dll.h b/t-dll.h index 36119db98..d98aa86d8 100644 --- a/t-dll.h +++ b/t-dll.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: t-dll.h,v 1.7 2000/09/30 02:18:15 steve Exp $" +#ident "$Id: t-dll.h,v 1.8 2000/10/05 05:03:01 steve Exp $" #endif # include "target.h" @@ -85,6 +85,7 @@ struct dll_target : public target_t, public expr_scan_t { struct ivl_expr_s*expr_; void expr_binary(const NetEBinary*); void expr_const(const NetEConst*); + void expr_sfunc(const NetESFunc*); void expr_signal(const NetESignal*); }; @@ -115,6 +116,10 @@ struct ivl_expr_s { char*bits_; } number_; + struct { + char*name_; + } sfunc_; + struct { char*value_; } string_; @@ -128,7 +133,9 @@ struct ivl_expr_s { }; struct ivl_net_const_s { - const NetConst*con_; + unsigned width_ :24; + unsigned signed_ : 1; + char *bits_; }; struct ivl_net_logic_s { @@ -200,6 +207,9 @@ struct ivl_statement_s { /* * $Log: t-dll.h,v $ + * Revision 1.8 2000/10/05 05:03:01 steve + * xor and constant devices. + * * Revision 1.7 2000/09/30 02:18:15 steve * ivl_expr_t support for binary operators, * Create a proper ivl_scope_t object. diff --git a/tgt-stub/stub.c b/tgt-stub/stub.c index e8f71eb98..50ebf7de0 100644 --- a/tgt-stub/stub.c +++ b/tgt-stub/stub.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: stub.c,v 1.12 2000/09/26 00:30:07 steve Exp $" +#ident "$Id: stub.c,v 1.13 2000/10/05 05:03:01 steve Exp $" #endif /* @@ -45,7 +45,7 @@ int target_start_design(ivl_design_t des) return -2; } - fprintf(out, "STUB: root module = %s;\n", ivl_get_root_name(des)); + fprintf(out, "root module = %s;\n", ivl_get_root_name(des)); return 0; } @@ -62,7 +62,18 @@ int target_net_bufz(const char*name, ivl_net_bufz_t net) int target_net_const(const char*name, ivl_net_const_t net) { - fprintf(out, "STUB: %s: constant\n", name); + unsigned idx; + unsigned wid = ivl_const_pins(net); + const char*bits = ivl_const_bits(net); + + fprintf(out, "LPM_CONSTANT %s: %s%u'b", name, + ivl_const_signed(net)? "+- ":"", + wid); + + for (idx = 0 ; idx < wid ; idx += 1) + fprintf(out, "%c", bits[wid-1-idx]); + + fprintf(out, "\n"); return 0; } @@ -76,24 +87,27 @@ int target_net_logic(const char*name, ivl_net_logic_t net) { unsigned npins, idx; - switch (ivl_get_logic_type(net)) { + switch (ivl_logic_type(net)) { case IVL_LO_AND: - fprintf(out, " and %s (%s", name, - ivl_get_nexus_name(ivl_get_logic_pin(net, 0))); + fprintf(out, "and %s (%s", name, + ivl_nexus_name(ivl_logic_pin(net, 0))); break; case IVL_LO_OR: - fprintf(out, " or %s (%s", name, - ivl_get_nexus_name(ivl_get_logic_pin(net, 0))); + fprintf(out, "or %s (%s", name, + ivl_nexus_name(ivl_logic_pin(net, 0))); + break; + case IVL_LO_XOR: + fprintf(out, "xor %s (%s", name, + ivl_nexus_name(ivl_logic_pin(net, 0))); break; default: - fprintf(out, "STUB: %s: unsupported gate\n", name); + fprintf(out, "unsupported gate %s: \n", name); return -1; } - npins = ivl_get_logic_pins(net); + npins = ivl_logic_pins(net); for (idx = 1 ; idx < npins ; idx += 1) - fprintf(out, ", %s", - ivl_get_nexus_name(ivl_get_logic_pin(net,idx))); + fprintf(out, ", %s", ivl_nexus_name(ivl_logic_pin(net,idx))); fprintf(out, ");\n"); @@ -135,7 +149,7 @@ int target_net_signal(const char*name, ivl_signal_t net) break; } - fprintf(out, "STUB: %s %s[%u] %s\n", type, port, + fprintf(out, "%s %s[%u] %s\n", type, port, ivl_signal_pins(net), name); return 0; @@ -166,6 +180,11 @@ static void show_expression(ivl_expr_t net, unsigned ind) ivl_expr_string(net), ivl_expr_width(net)); break; + case IVL_EX_SFUNC: + fprintf(out, "%*s\n", ind, "", + ivl_expr_name(net), ivl_expr_width(net)); + break; + case IVL_EX_SIGNAL: fprintf(out, "%*s\n", ind, "", ivl_expr_name(net), ivl_expr_width(net)); @@ -256,7 +275,7 @@ static void show_statement(ivl_statement_t net, unsigned ind) int target_process(ivl_process_t net) { - switch (ivl_get_process_type(net)) { + switch (ivl_process_type(net)) { case IVL_PR_INITIAL: fprintf(out, "initial\n"); break; @@ -265,13 +284,16 @@ int target_process(ivl_process_t net) break; } - show_statement(ivl_get_process_stmt(net), 4); + show_statement(ivl_process_stmt(net), 4); return 0; } /* * $Log: stub.c,v $ + * Revision 1.13 2000/10/05 05:03:01 steve + * xor and constant devices. + * * Revision 1.12 2000/09/26 00:30:07 steve * Add EX_NUMBER and ST_TRIGGER to dll-api. * diff --git a/tgt-verilog/verilog.c b/tgt-verilog/verilog.c index ae389dad4..b1f77b7d7 100644 --- a/tgt-verilog/verilog.c +++ b/tgt-verilog/verilog.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: verilog.c,v 1.6 2000/10/04 02:24:20 steve Exp $" +#ident "$Id: verilog.c,v 1.7 2000/10/05 05:03:02 steve Exp $" #endif /* @@ -77,24 +77,27 @@ int target_net_logic(const char*name, ivl_net_logic_t net) { unsigned npins, idx; - switch (ivl_get_logic_type(net)) { + switch (ivl_logic_type(net)) { case IVL_LO_AND: fprintf(out, " and %s (%s", name, - ivl_get_nexus_name(ivl_get_logic_pin(net, 0))); + ivl_nexus_name(ivl_logic_pin(net, 0))); break; case IVL_LO_OR: fprintf(out, " or %s (%s", name, - ivl_get_nexus_name(ivl_get_logic_pin(net, 0))); + ivl_nexus_name(ivl_logic_pin(net, 0))); + break; + case IVL_LO_XOR: + fprintf(out, " xor %s (%s", name, + ivl_nexus_name(ivl_logic_pin(net, 0))); break; default: fprintf(out, "STUB: %s: unsupported gate\n", name); return -1; } - npins = ivl_get_logic_pins(net); + npins = ivl_logic_pins(net); for (idx = 1 ; idx < npins ; idx += 1) - fprintf(out, ", %s", - ivl_get_nexus_name(ivl_get_logic_pin(net,idx))); + fprintf(out, ", %s", ivl_nexus_name(ivl_logic_pin(net,idx))); fprintf(out, ");\n"); @@ -154,6 +157,10 @@ static void show_expression(ivl_expr_t net) break; } + case IVL_EX_SFUNC: + fprintf(out, "%s", ivl_expr_name(net)); + break; + case IVL_EX_STRING: fprintf(out, "\"%s\"", ivl_expr_string(net)); break; @@ -251,7 +258,7 @@ static void show_statement(ivl_statement_t net, unsigned ind) int target_process(ivl_process_t net) { - switch (ivl_get_process_type(net)) { + switch (ivl_process_type(net)) { case IVL_PR_INITIAL: fprintf(out, " initial\n"); break; @@ -260,13 +267,16 @@ int target_process(ivl_process_t net) break; } - show_statement(ivl_get_process_stmt(net), 8); + show_statement(ivl_process_stmt(net), 8); return 0; } /* * $Log: verilog.c,v $ + * Revision 1.7 2000/10/05 05:03:02 steve + * xor and constant devices. + * * Revision 1.6 2000/10/04 02:24:20 steve * print reg signals. *