Support time variables.

This commit is contained in:
steve 2000-10-31 17:49:02 +00:00
parent 88c8547486
commit 3591e06c4e
9 changed files with 86 additions and 12 deletions

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #if !defined(WINNT) && !defined(macintosh)
#ident "$Id: compiler.h,v 1.4 2000/08/20 04:13:56 steve Exp $" #ident "$Id: compiler.h,v 1.5 2000/10/31 17:49:02 steve Exp $"
#endif #endif
/* /*
@ -33,6 +33,11 @@
# define INTEGER_WIDTH 32 # define INTEGER_WIDTH 32
#endif #endif
/* The TIME_WIDTH is the width of time variables. */
#ifndef TIME_WIDTH
# define TIME_WIDTH 64
#endif
/* /*
* When doing dynamic linking, we need a uniform way to identify the * When doing dynamic linking, we need a uniform way to identify the
* symbol. Some compilers put leading _, some trailing _. The * symbol. Some compilers put leading _, some trailing _. The
@ -63,6 +68,9 @@ extern bool warn_implicit;
/* /*
* $Log: compiler.h,v $ * $Log: compiler.h,v $
* Revision 1.5 2000/10/31 17:49:02 steve
* Support time variables.
*
* Revision 1.4 2000/08/20 04:13:56 steve * Revision 1.4 2000/08/20 04:13:56 steve
* Add ivl_target support for logic gates, and * Add ivl_target support for logic gates, and
* make the interface more accessible. * make the interface more accessible.

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #if !defined(WINNT) && !defined(macintosh)
#ident "$Id: elab_lval.cc,v 1.5 2000/10/26 17:09:46 steve Exp $" #ident "$Id: elab_lval.cc,v 1.6 2000/10/31 17:49:02 steve Exp $"
#endif #endif
# include "PExpr.h" # include "PExpr.h"
@ -171,9 +171,12 @@ NetAssign_* PEIdent::elaborate_lval(Design*des, NetScope*scope) const
} }
assert(reg); assert(reg);
if ((reg->type() != NetNet::REG) && (reg->type() != NetNet::INTEGER)) { if ((reg->type() != NetNet::REG)
&& (reg->type() != NetNet::INTEGER)
&& (reg->type() != NetNet::TIME)) {
cerr << get_line() << ": error: " << name() << cerr << get_line() << ": error: " << name() <<
" is not a reg in " << scope->name() << "." << endl; " is not a reg/integer/time in " << scope->name() <<
"." << endl;
des->errors += 1; des->errors += 1;
return 0; return 0;
} }
@ -281,6 +284,9 @@ NetAssign_* PEIdent::elaborate_lval(Design*des, NetScope*scope) const
/* /*
* $Log: elab_lval.cc,v $ * $Log: elab_lval.cc,v $
* Revision 1.6 2000/10/31 17:49:02 steve
* Support time variables.
*
* Revision 1.5 2000/10/26 17:09:46 steve * Revision 1.5 2000/10/26 17:09:46 steve
* Fix handling of errors in behavioral lvalues. (PR#28) * Fix handling of errors in behavioral lvalues. (PR#28)
* *

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #if !defined(WINNT) && !defined(macintosh)
#ident "$Id: ivl_target.h,v 1.25 2000/10/28 22:32:34 steve Exp $" #ident "$Id: ivl_target.h,v 1.26 2000/10/31 17:49:02 steve Exp $"
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
@ -185,6 +185,7 @@ typedef enum ivl_signal_type_e {
IVL_SIT_REG, IVL_SIT_REG,
IVL_SIT_SUPPLY0, IVL_SIT_SUPPLY0,
IVL_SIT_SUPPLY1, IVL_SIT_SUPPLY1,
IVL_SIT_TIME,
IVL_SIT_TRI, IVL_SIT_TRI,
IVL_SIT_TRI0, IVL_SIT_TRI0,
IVL_SIT_TRI1, IVL_SIT_TRI1,
@ -548,6 +549,9 @@ _END_DECL
/* /*
* $Log: ivl_target.h,v $ * $Log: ivl_target.h,v $
* Revision 1.26 2000/10/31 17:49:02 steve
* Support time variables.
*
* Revision 1.25 2000/10/28 22:32:34 steve * Revision 1.25 2000/10/28 22:32:34 steve
* API for concatenation expressions. * API for concatenation expressions.
* *

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #if !defined(WINNT) && !defined(macintosh)
#ident "$Id: netlist.cc,v 1.143 2000/10/28 00:51:42 steve Exp $" #ident "$Id: netlist.cc,v 1.144 2000/10/31 17:49:02 steve Exp $"
#endif #endif
# include <cassert> # include <cassert>
@ -46,6 +46,9 @@ ostream& operator<< (ostream&o, NetNet::Type t)
case NetNet::SUPPLY1: case NetNet::SUPPLY1:
o << "supply1"; o << "supply1";
break; break;
case NetNet::TIME:
o << "time";
break;
case NetNet::TRI: case NetNet::TRI:
o << "tri"; o << "tri";
break; break;
@ -2446,6 +2449,9 @@ bool NetUDP::sequ_glob_(string input, char output)
/* /*
* $Log: netlist.cc,v $ * $Log: netlist.cc,v $
* Revision 1.144 2000/10/31 17:49:02 steve
* Support time variables.
*
* Revision 1.143 2000/10/28 00:51:42 steve * Revision 1.143 2000/10/28 00:51:42 steve
* Add scope to threads in vvm, pass that scope * Add scope to threads in vvm, pass that scope
* to vpi sysTaskFunc objects, and add vpi calls * to vpi sysTaskFunc objects, and add vpi calls

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #if !defined(WINNT) && !defined(macintosh)
#ident "$Id: netlist.h,v 1.175 2000/10/28 00:51:42 steve Exp $" #ident "$Id: netlist.h,v 1.176 2000/10/31 17:49:02 steve Exp $"
#endif #endif
/* /*
@ -313,7 +313,8 @@ class NetNet : public NetObj, public LineInfo {
public: public:
enum Type { IMPLICIT, IMPLICIT_REG, WIRE, TRI, TRI1, SUPPLY0, enum Type { IMPLICIT, IMPLICIT_REG, WIRE, TRI, TRI1, SUPPLY0,
WAND, TRIAND, TRI0, SUPPLY1, WOR, TRIOR, REG, INTEGER }; WAND, TRIAND, TRI0, SUPPLY1, WOR, TRIOR, REG,
INTEGER, TIME };
enum PortType { NOT_A_PORT, PIMPLICIT, PINPUT, POUTPUT, PINOUT }; enum PortType { NOT_A_PORT, PIMPLICIT, PINPUT, POUTPUT, PINOUT };
@ -2810,6 +2811,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
/* /*
* $Log: netlist.h,v $ * $Log: netlist.h,v $
* Revision 1.176 2000/10/31 17:49:02 steve
* Support time variables.
*
* Revision 1.175 2000/10/28 00:51:42 steve * Revision 1.175 2000/10/28 00:51:42 steve
* Add scope to threads in vvm, pass that scope * Add scope to threads in vvm, pass that scope
* to vpi sysTaskFunc objects, and add vpi calls * to vpi sysTaskFunc objects, and add vpi calls

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #if !defined(WINNT) && !defined(macintosh)
#ident "$Id: parse.y,v 1.108 2000/10/31 17:00:04 steve Exp $" #ident "$Id: parse.y,v 1.109 2000/10/31 17:49:02 steve Exp $"
#endif #endif
# include "parse_misc.h" # include "parse_misc.h"
@ -210,6 +210,9 @@ block_item_decl
| K_integer list_of_variables ';' | K_integer list_of_variables ';'
{ pform_set_reg_integer($2); { pform_set_reg_integer($2);
} }
| K_time list_of_variables ';'
{ pform_set_reg_time($2);
}
; ;
block_item_decls block_item_decls

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #if !defined(WINNT) && !defined(macintosh)
#ident "$Id: pform.cc,v 1.65 2000/10/31 17:00:04 steve Exp $" #ident "$Id: pform.cc,v 1.66 2000/10/31 17:49:02 steve Exp $"
#endif #endif
# include "compiler.h" # include "compiler.h"
@ -916,6 +916,35 @@ void pform_set_reg_integer(list<char*>*names)
delete names; delete names;
} }
static void pform_set_reg_time(const char*nm)
{
string name = scoped_name(nm);
PWire*cur = pform_cur_module->get_wire(name);
if (cur == 0) {
cur = new PWire(name, NetNet::TIME, NetNet::NOT_A_PORT);
pform_cur_module->add_wire(cur);
} else {
bool rc = cur->set_wire_type(NetNet::TIME);
assert(rc);
}
assert(cur);
cur->set_range(new PENumber(new verinum(TIME_WIDTH-1, INTEGER_WIDTH)),
new PENumber(new verinum(0UL, INTEGER_WIDTH)));
}
void pform_set_reg_time(list<char*>*names)
{
for (list<char*>::iterator cur = names->begin()
; cur != names->end()
; cur ++ ) {
char*txt = *cur;
pform_set_reg_time(txt);
free(txt);
}
delete names;
}
svector<PWire*>* pform_make_udp_input_ports(list<char*>*names) svector<PWire*>* pform_make_udp_input_ports(list<char*>*names)
{ {
svector<PWire*>*out = new svector<PWire*>(names->size()); svector<PWire*>*out = new svector<PWire*>(names->size());
@ -973,6 +1002,9 @@ int pform_parse(const char*path, map<string,Module*>&modules,
/* /*
* $Log: pform.cc,v $ * $Log: pform.cc,v $
* Revision 1.66 2000/10/31 17:49:02 steve
* Support time variables.
*
* Revision 1.65 2000/10/31 17:00:04 steve * Revision 1.65 2000/10/31 17:00:04 steve
* Remove C++ string from variable lists. * Remove C++ string from variable lists.
* *

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #if !defined(WINNT) && !defined(macintosh)
#ident "$Id: pform.h,v 1.42 2000/10/31 17:00:05 steve Exp $" #ident "$Id: pform.h,v 1.43 2000/10/31 17:49:02 steve Exp $"
#endif #endif
# include "netlist.h" # include "netlist.h"
@ -140,6 +140,7 @@ extern void pform_set_port_type(list<char*>*names, svector<PExpr*>*,
extern void pform_set_net_range(list<char*>*names, svector<PExpr*>*); extern void pform_set_net_range(list<char*>*names, svector<PExpr*>*);
extern void pform_set_reg_idx(const string&name, PExpr*l, PExpr*r); extern void pform_set_reg_idx(const string&name, PExpr*l, PExpr*r);
extern void pform_set_reg_integer(list<char*>*names); extern void pform_set_reg_integer(list<char*>*names);
extern void pform_set_reg_time(list<char*>*names);
extern void pform_set_task(const string&, PTask*); extern void pform_set_task(const string&, PTask*);
extern void pform_set_function(const string&, svector<PExpr*>*, PFunction*); extern void pform_set_function(const string&, svector<PExpr*>*, PFunction*);
extern void pform_set_attrib(const string&name, const string&key, extern void pform_set_attrib(const string&name, const string&key,
@ -202,6 +203,9 @@ extern void pform_dump(ostream&out, Module*mod);
/* /*
* $Log: pform.h,v $ * $Log: pform.h,v $
* Revision 1.43 2000/10/31 17:49:02 steve
* Support time variables.
*
* Revision 1.42 2000/10/31 17:00:05 steve * Revision 1.42 2000/10/31 17:00:05 steve
* Remove C++ string from variable lists. * Remove C++ string from variable lists.
* *

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #if !defined(WINNT) && !defined(macintosh)
#ident "$Id: t-dll.cc,v 1.16 2000/10/21 16:49:45 steve Exp $" #ident "$Id: t-dll.cc,v 1.17 2000/10/31 17:49:02 steve Exp $"
#endif #endif
# include "compiler.h" # include "compiler.h"
@ -407,6 +407,10 @@ void dll_target::signal(const NetNet*net)
obj->type_ = IVL_SIT_SUPPLY1; obj->type_ = IVL_SIT_SUPPLY1;
break; break;
case NetNet::TIME:
obj->type_ = IVL_SIT_TIME;
break;
case NetNet::TRI: case NetNet::TRI:
obj->type_ = IVL_SIT_TRI; obj->type_ = IVL_SIT_TRI;
break; break;
@ -494,6 +498,9 @@ extern const struct target tgt_dll = { "dll", &dll_target_obj };
/* /*
* $Log: t-dll.cc,v $ * $Log: t-dll.cc,v $
* Revision 1.17 2000/10/31 17:49:02 steve
* Support time variables.
*
* Revision 1.16 2000/10/21 16:49:45 steve * Revision 1.16 2000/10/21 16:49:45 steve
* Reduce the target entry points to the target_design. * Reduce the target entry points to the target_design.
* *