Permalink
Browse files

Use perm_strings for named langiage items.

  • Loading branch information...
steve
steve committed Feb 18, 2004
1 parent 17c891b commit 27af95d402877593325e00fdb06e119b6d556de8
Showing with 706 additions and 474 deletions.
  1. +8 −5 Module.cc
  2. +13 −9 Module.h
  3. +15 −12 PGate.cc
  4. +18 −15 PGate.h
  5. +6 −3 PUdp.cc
  6. +8 −4 PUdp.h
  7. +5 −2 Statement.cc
  8. +6 −3 Statement.h
  9. +63 −2 StringHeap.cc
  10. +47 −2 StringHeap.h
  11. +10 −2 compiler.h
  12. +7 −2 design_dump.cc
  13. +8 −5 elab_net.cc
  14. +11 −8 elab_scope.cc
  15. +12 −8 elab_sig.cc
  16. +28 −26 elaborate.cc
  17. +25 −22 expr_synth.cc
  18. +15 −12 main.cc
  19. +6 −3 net_assign.cc
  20. +5 −2 net_design.cc
  21. +7 −4 net_event.cc
  22. +11 −8 net_force.cc
  23. +6 −3 net_func.cc
  24. +6 −3 net_link.cc
  25. +10 −7 net_modulo.cc
  26. +21 −18 net_scope.cc
  27. +8 −5 net_udp.cc
  28. +127 −127 netlist.cc
  29. +56 −49 netlist.h
  30. +5 −2 netmisc.cc
  31. +6 −27 pad_to_width.cc
  32. +16 −8 parse.y
  33. +7 −3 parse_api.h
  34. +31 −25 pform.cc
  35. +9 −6 pform.h
  36. +7 −4 pform_dump.cc
  37. +21 −10 synth2.cc
  38. +10 −7 t-dll.cc
  39. +8 −5 t-dll.h
  40. +11 −2 t-xnf.cc
  41. +7 −4 xnfio.cc
View
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
-#ident "$Id: Module.cc,v 1.21 2003/04/02 03:00:14 steve Exp $"
+#ident "$Id: Module.cc,v 1.22 2004/02/18 17:11:54 steve Exp $"
#endif
# include "config.h"
@@ -28,7 +28,7 @@
# include <assert.h>
/* n is a permallocated string. */
-Module::Module(const char*n)
+Module::Module(perm_string n)
: name_(n)
{
}
@@ -42,12 +42,12 @@ void Module::add_gate(PGate*gate)
gates_.push_back(gate);
}
-void Module::add_task(const string&name, PTask*task)
+void Module::add_task(perm_string name, PTask*task)
{
tasks_[name] = task;
}
-void Module::add_function(const string &name, PFunction *func)
+void Module::add_function(perm_string name, PFunction *func)
{
funcs_[name] = func;
}
@@ -118,7 +118,7 @@ PWire* Module::get_wire(const hname_t&name) const
return (*obj).second;
}
-PGate* Module::get_gate(const string&name)
+PGate* Module::get_gate(perm_string name)
{
for (list<PGate*>::iterator cur = gates_.begin()
; cur != gates_.end()
@@ -149,6 +149,9 @@ const list<PProcess*>& Module::get_behaviors() const
/*
* $Log: Module.cc,v $
+ * Revision 1.22 2004/02/18 17:11:54 steve
+ * Use perm_strings for named langiage items.
+ *
* Revision 1.21 2003/04/02 03:00:14 steve
* Cope with empty module ports while binding by name.
*
View
@@ -19,12 +19,13 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
-#ident "$Id: Module.h,v 1.32 2003/06/20 00:53:19 steve Exp $"
+#ident "$Id: Module.h,v 1.33 2004/02/18 17:11:54 steve Exp $"
#endif
# include <list>
# include <map>
# include "svector.h"
+# include "StringHeap.h"
# include "HName.h"
# include "named.h"
# include "LineInfo.h"
@@ -63,7 +64,7 @@ class Module : public LineInfo {
public:
/* The name passed here is the module name, not the instance
name. This make must be a permallocated string. */
- explicit Module(const char*name);
+ explicit Module(perm_string name);
~Module();
@@ -115,7 +116,7 @@ class Module : public LineInfo {
set by the `timescale directive. */
int time_unit, time_precision;
- const char*mod_name() const { return name_; }
+ perm_string mod_name() const { return name_; }
void add_gate(PGate*gate);
@@ -125,8 +126,8 @@ class Module : public LineInfo {
PWire* add_wire(PWire*wire);
void add_behavior(PProcess*behave);
- void add_task(const string&name, PTask*def);
- void add_function(const string&name, PFunction*def);
+ void add_task(perm_string name, PTask*def);
+ void add_function(perm_string name, PFunction*def);
unsigned port_count() const;
const svector<PEIdent*>& get_port(unsigned idx) const;
@@ -135,7 +136,7 @@ class Module : public LineInfo {
// Find a wire by name. This is used for connecting gates to
// existing wires, etc.
PWire* get_wire(const hname_t&name) const;
- PGate* get_gate(const string&name);
+ PGate* get_gate(perm_string name);
const map<hname_t,PWire*>& get_wires() const;
const list<PGate*>& get_gates() const;
@@ -149,13 +150,13 @@ class Module : public LineInfo {
bool elaborate_sig(Design*, NetScope*scope) const;
private:
- const char* name_;
+ perm_string name_;
map<hname_t,PWire*> wires_;
list<PGate*> gates_;
list<PProcess*> behaviors_;
- map<string,PTask*> tasks_;
- map<string,PFunction*> funcs_;
+ map<perm_string,PTask*> tasks_;
+ map<perm_string,PFunction*> funcs_;
private: // Not implemented
Module(const Module&);
@@ -165,6 +166,9 @@ class Module : public LineInfo {
/*
* $Log: Module.h,v $
+ * Revision 1.33 2004/02/18 17:11:54 steve
+ * Use perm_strings for named langiage items.
+ *
* Revision 1.32 2003/06/20 00:53:19 steve
* Module attributes from the parser
* through to elaborated form.
View
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999-2000 Stephen Williams (steve@icarus.com)
+ * Copyright (c) 1999-2004 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
-#ident "$Id: PGate.cc,v 1.15 2003/03/06 04:37:12 steve Exp $"
+#ident "$Id: PGate.cc,v 1.16 2004/02/18 17:11:54 steve Exp $"
#endif
# include "config.h"
@@ -27,7 +27,7 @@
# include "verinum.h"
# include <assert.h>
-PGate::PGate(const string&name,
+PGate::PGate(perm_string name,
svector<PExpr*>*pins,
const svector<PExpr*>*del)
: name_(name), pins_(pins)
@@ -37,7 +37,7 @@ PGate::PGate(const string&name,
str1_ = STRONG;
}
-PGate::PGate(const string&name,
+PGate::PGate(perm_string name,
svector<PExpr*>*pins,
PExpr*del)
: name_(name), pins_(pins)
@@ -47,7 +47,7 @@ PGate::PGate(const string&name,
str1_ = STRONG;
}
-PGate::PGate(const string&name, svector<PExpr*>*pins)
+PGate::PGate(perm_string name, svector<PExpr*>*pins)
: name_(name), pins_(pins)
{
str0_ = STRONG;
@@ -99,13 +99,13 @@ void PGate::eval_delays(Design*des, NetScope*scope,
}
PGAssign::PGAssign(svector<PExpr*>*pins)
-: PGate("", pins)
+: PGate(perm_string(), pins)
{
assert(pins->count() == 2);
}
PGAssign::PGAssign(svector<PExpr*>*pins, svector<PExpr*>*dels)
-: PGate("", pins, dels)
+: PGate(perm_string(), pins, dels)
{
assert(pins->count() == 2);
}
@@ -114,14 +114,14 @@ PGAssign::~PGAssign()
{
}
-PGBuiltin::PGBuiltin(Type t, const string&name,
+PGBuiltin::PGBuiltin(Type t, perm_string name,
svector<PExpr*>*pins,
svector<PExpr*>*del)
: PGate(name, pins, del), type_(t), msb_(0), lsb_(0)
{
}
-PGBuiltin::PGBuiltin(Type t, const string&name,
+PGBuiltin::PGBuiltin(Type t, perm_string name,
svector<PExpr*>*pins,
PExpr*del)
: PGate(name, pins, del), type_(t), msb_(0), lsb_(0)
@@ -142,14 +142,14 @@ void PGBuiltin::set_range(PExpr*msb, PExpr*lsb)
lsb_ = lsb;
}
-PGModule::PGModule(const char*type, const string&name, svector<PExpr*>*pins)
+PGModule::PGModule(perm_string type, perm_string name, svector<PExpr*>*pins)
: PGate(name, pins), overrides_(0), pins_(0),
npins_(0), parms_(0), nparms_(0), msb_(0), lsb_(0)
{
type_ = type;
}
-PGModule::PGModule(const char*type, const string&name,
+PGModule::PGModule(perm_string type, perm_string name,
named<PExpr*>*pins, unsigned npins)
: PGate(name, 0), overrides_(0), pins_(pins),
npins_(npins), parms_(0), nparms_(0), msb_(0), lsb_(0)
@@ -184,13 +184,16 @@ void PGModule::set_range(PExpr*msb, PExpr*lsb)
lsb_ = lsb;
}
-const char* PGModule::get_type()
+perm_string PGModule::get_type()
{
return type_;
}
/*
* $Log: PGate.cc,v $
+ * Revision 1.16 2004/02/18 17:11:54 steve
+ * Use perm_strings for named langiage items.
+ *
* Revision 1.15 2003/03/06 04:37:12 steve
* lex_strings.add module names earlier.
*
View
33 PGate.h
@@ -1,7 +1,7 @@
#ifndef __PGate_H
#define __PGate_H
/*
- * Copyright (c) 1998-2000 Stephen Williams (steve@icarus.com)
+ * Copyright (c) 1998-2004 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@@ -19,10 +19,11 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
-#ident "$Id: PGate.h,v 1.25 2003/03/06 04:37:12 steve Exp $"
+#ident "$Id: PGate.h,v 1.26 2004/02/18 17:11:54 steve Exp $"
#endif
# include "svector.h"
+# include "StringHeap.h"
# include "named.h"
# include "LineInfo.h"
# include "PDelays.h"
@@ -53,17 +54,17 @@ class PGate : public LineInfo {
public:
enum strength_t { HIGHZ, WEAK, PULL, STRONG, SUPPLY };
- explicit PGate(const string&name, svector<PExpr*>*pins,
+ explicit PGate(perm_string name, svector<PExpr*>*pins,
const svector<PExpr*>*del);
- explicit PGate(const string&name, svector<PExpr*>*pins,
+ explicit PGate(perm_string name, svector<PExpr*>*pins,
PExpr*del);
- explicit PGate(const string&name, svector<PExpr*>*pins);
+ explicit PGate(perm_string name, svector<PExpr*>*pins);
virtual ~PGate();
- const string& get_name() const { return name_; }
+ perm_string get_name() const { return name_; }
void eval_delays(Design*des, NetScope*scope,
unsigned long&rise_time,
@@ -93,7 +94,7 @@ class PGate : public LineInfo {
void dump_delays(ostream&out) const;
private:
- const string name_;
+ perm_string name_;
PDelays delay_;
svector<PExpr*>*pins_;
@@ -141,10 +142,10 @@ class PGBuiltin : public PGate {
TRANIF1, RTRANIF0, RTRANIF1 };
public:
- explicit PGBuiltin(Type t, const string&name,
+ explicit PGBuiltin(Type t, perm_string name,
svector<PExpr*>*pins,
svector<PExpr*>*del);
- explicit PGBuiltin(Type t, const string&name,
+ explicit PGBuiltin(Type t, perm_string name,
svector<PExpr*>*pins,
PExpr*del);
~PGBuiltin();
@@ -171,17 +172,16 @@ class PGBuiltin : public PGate {
class PGModule : public PGate {
public:
- // NOTE: The type parameter to all the constructors is assumed
- // to have been permallocated.
+ // The name is the *instance* name of the gate.
// If the binding of ports is by position, this constructor
// builds everything all at once.
- explicit PGModule(const char*type, const string&name,
+ explicit PGModule(perm_string type, perm_string name,
svector<PExpr*>*pins);
// If the binding of ports is by name, this constructor takes
// the bindings and stores them for later elaboration.
- explicit PGModule(const char*type, const string&name,
+ explicit PGModule(perm_string type, perm_string name,
named<PExpr*>*pins, unsigned npins);
@@ -203,10 +203,10 @@ class PGModule : public PGate {
// This returns the module name of this module. It is a
// permallocated string.
- const char* get_type();
+ perm_string get_type();
private:
- const char* type_;
+ perm_string type_;
svector<PExpr*>*overrides_;
named<PExpr*>*pins_;
unsigned npins_;
@@ -227,6 +227,9 @@ class PGModule : public PGate {
/*
* $Log: PGate.h,v $
+ * Revision 1.26 2004/02/18 17:11:54 steve
+ * Use perm_strings for named langiage items.
+ *
* Revision 1.25 2003/03/06 04:37:12 steve
* lex_strings.add module names earlier.
*
View
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003 Stephen Williams (steve@icarus.com)
+ * Copyright (c) 2003-2004 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@@ -17,18 +17,21 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
-#ident "$Id: PUdp.cc,v 1.1 2003/07/15 05:07:13 steve Exp $"
+#ident "$Id: PUdp.cc,v 1.2 2004/02/18 17:11:54 steve Exp $"
#endif
# include "PUdp.h"
-PUdp::PUdp(const string&n, unsigned nports)
+PUdp::PUdp(perm_string n, unsigned nports)
: ports(nports), sequential(false), initial(verinum::Vx), name_(n)
{
}
/*
* $Log: PUdp.cc,v $
+ * Revision 1.2 2004/02/18 17:11:54 steve
+ * Use perm_strings for named langiage items.
+ *
* Revision 1.1 2003/07/15 05:07:13 steve
* Move PUdp constructor into compiled file.
*
Oops, something went wrong.

0 comments on commit 27af95d

Please sign in to comment.