Permalink
Browse files

Rework the heirarchical identifier parse syntax and pform

 to handle more general combinations of heirarch and bit selects.
  • Loading branch information...
steve
steve committed May 24, 2007
1 parent 67b1eee commit ddd36ecb6c71bdb26a49d4d56b16ea1e143d7922
Showing with 1,036 additions and 681 deletions.
  1. +2 −2 Makefile.in
  2. +7 −8 Module.cc
  3. +9 −5 Module.h
  4. +30 −14 PExpr.cc
  5. +24 −7 PExpr.h
  6. +3 −3 PGenerate.cc
  7. +4 −3 PGenerate.h
  8. +8 −19 PWire.cc
  9. +13 −12 PWire.h
  10. +15 −5 Statement.cc
  11. +13 −8 Statement.h
  12. +6 −2 design_dump.cc
  13. +144 −89 elab_expr.cc
  14. +51 −22 elab_lval.cc
  15. +98 −73 elab_net.cc
  16. +25 −14 elab_pexpr.cc
  17. +7 −3 elab_scope.cc
  18. +60 −51 elab_sig.cc
  19. +10 −5 elaborate.cc
  20. +10 −5 eval.cc
  21. +40 −29 net_design.cc
  22. +14 −9 netlist.h
  23. +8 −4 netmisc.h
  24. +214 −222 parse.y
  25. +42 −34 pform.cc
  26. +6 −2 pform.h
  27. +60 −27 pform_dump.cc
  28. +32 −0 pform_types.cc
  29. +72 −0 pform_types.h
  30. +9 −4 symbol_search.cc
View
@@ -16,7 +16,7 @@
# 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA
#
-#ident "$Id: Makefile.in,v 1.180 2007/02/06 05:07:31 steve Exp $"
+#ident "$Id: Makefile.in,v 1.181 2007/05/24 04:07:11 steve Exp $"
#
#
SHELL = /bin/sh
@@ -108,7 +108,7 @@ load_module.o netlist.o netmisc.o net_assign.o \
net_design.o net_event.o net_expr.o net_force.o net_func.o \
net_link.o net_modulo.o net_nex_input.o net_nex_output.o \
net_proc.o net_scope.o net_udp.o pad_to_width.o \
-parse.o parse_misc.o pform.o pform_dump.o \
+parse.o parse_misc.o pform.o pform_dump.o pform_types.o \
set_width.o symbol_search.o sync.o sys_funcs.o \
verinum.o verireal.o target.o targets.o \
Attrib.o HName.o LineInfo.o Module.o PDelays.o PEvent.o \
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.26 2007/04/19 02:52:53 steve Exp $"
+#ident "$Id: Module.cc,v 1.27 2007/05/24 04:07:11 steve Exp $"
#endif
# include "config.h"
@@ -111,9 +111,9 @@ unsigned Module::find_port(const char*name) const
}
-PWire* Module::get_wire(const hname_t&name) const
+PWire* Module::get_wire(const pform_name_t&name) const
{
- map<hname_t,PWire*>::const_iterator obj = wires_.find(name);
+ map<pform_name_t,PWire*>::const_iterator obj = wires_.find(name);
if (obj == wires_.end())
return 0;
else
@@ -133,11 +133,6 @@ PGate* Module::get_gate(perm_string name)
return 0;
}
-const map<hname_t,PWire*>& Module::get_wires() const
-{
- return wires_;
-}
-
const list<PGate*>& Module::get_gates() const
{
return gates_;
@@ -151,6 +146,10 @@ const list<PProcess*>& Module::get_behaviors() const
/*
* $Log: Module.cc,v $
+ * Revision 1.27 2007/05/24 04:07:11 steve
+ * Rework the heirarchical identifier parse syntax and pform
+ * to handle more general combinations of heirarch and bit selects.
+ *
* Revision 1.26 2007/04/19 02:52:53 steve
* Add support for -v flag in command file.
*
View
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
-#ident "$Id: Module.h,v 1.42 2007/04/19 02:52:53 steve Exp $"
+#ident "$Id: Module.h,v 1.43 2007/05/24 04:07:11 steve Exp $"
#endif
# include <list>
@@ -30,6 +30,7 @@
# include "named.h"
# include "LineInfo.h"
# include "netlist.h"
+# include "pform_types.h"
class PEvent;
class PExpr;
class PEIdent;
@@ -98,7 +99,7 @@ class Module : public LineInfo {
new parameters within the module, but may be used to set
values within this module (when instantiated) or in other
instantiated modules. */
- map<hname_t,PExpr*>defparms;
+ map<pform_name_t,PExpr*>defparms;
/* Parameters may be overridden at instantiation time;
the overrides do not contain explicit parameter names,
@@ -150,10 +151,9 @@ 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;
+ PWire* get_wire(const pform_name_t&name) const;
PGate* get_gate(perm_string name);
- const map<hname_t,PWire*>& get_wires() const;
const list<PGate*>& get_gates() const;
const list<PProcess*>& get_behaviors() const;
@@ -168,7 +168,7 @@ class Module : public LineInfo {
private:
perm_string name_;
- map<hname_t,PWire*> wires_;
+ map<pform_name_t,PWire*> wires_;
list<PGate*> gates_;
list<PProcess*> behaviors_;
map<perm_string,PTask*> tasks_;
@@ -182,6 +182,10 @@ class Module : public LineInfo {
/*
* $Log: Module.h,v $
+ * Revision 1.43 2007/05/24 04:07:11 steve
+ * Rework the heirarchical identifier parse syntax and pform
+ * to handle more general combinations of heirarch and bit selects.
+ *
* Revision 1.42 2007/04/19 02:52:53 steve
* Add support for -v flag in command file.
*
View
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
-#ident "$Id: PExpr.cc,v 1.38 2006/10/30 05:44:49 steve Exp $"
+#ident "$Id: PExpr.cc,v 1.39 2007/05/24 04:07:11 steve Exp $"
#endif
# include "config.h"
@@ -93,13 +93,26 @@ PEBShift::~PEBShift()
{
}
-PECallFunction::PECallFunction(const hname_t&n, const svector<PExpr *> &parms)
+PECallFunction::PECallFunction(const pform_name_t&n, const svector<PExpr *> &parms)
: path_(n), parms_(parms)
{
}
-PECallFunction::PECallFunction(const hname_t&n)
-: path_(n)
+static pform_name_t pn_from_ps(perm_string n)
+{
+ name_component_t tmp_name (n);
+ pform_name_t tmp;
+ tmp.push_back(tmp_name);
+ return tmp;
+}
+
+PECallFunction::PECallFunction(perm_string n, const svector<PExpr*>&parms)
+: path_(pn_from_ps(n)), parms_(parms)
+{
+}
+
+PECallFunction::PECallFunction(perm_string n)
+: path_(pn_from_ps(n))
{
}
@@ -165,33 +178,32 @@ bool PEFNumber::is_constant(Module*) const
return true;
}
-PEIdent::PEIdent(const hname_t&s)
-: path_(s), msb_(0), lsb_(0), sel_(SEL_NONE), idx_(0)
+PEIdent::PEIdent(const pform_name_t&that)
+: path_(that)
{
}
-PEIdent::~PEIdent()
+PEIdent::PEIdent(perm_string s)
{
+ path_.push_back(name_component_t(s));
}
-const hname_t& PEIdent::path() const
+PEIdent::~PEIdent()
{
- return path_;
}
/*
* An identifier can be in a constant expression if (and only if) it is
* a parameter.
+ *
+ * NOTE: This test does not work if the name is hierarchical!
*/
bool PEIdent::is_constant(Module*mod) const
{
if (mod == 0) return false;
- /* This is a work-around for map not matching < even when
- there is a perm_string operator that can do the comprare.
-
- The real fix is to make the path_ carry perm_strings. */
- perm_string tmp = perm_string::literal(path_.peek_name(0));
+ /* */
+ perm_string tmp = path_.back().name;
{ map<perm_string,Module::param_expr_t>::const_iterator cur;
cur = mod->parameters.find(tmp);
@@ -288,6 +300,10 @@ bool PEUnary::is_constant(Module*m) const
/*
* $Log: PExpr.cc,v $
+ * Revision 1.39 2007/05/24 04:07:11 steve
+ * Rework the heirarchical identifier parse syntax and pform
+ * to handle more general combinations of heirarch and bit selects.
+ *
* Revision 1.38 2006/10/30 05:44:49 steve
* Expression widths with unsized literals are pseudo-infinite width.
*
View
31 PExpr.h
@@ -19,14 +19,15 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
-#ident "$Id: PExpr.h,v 1.87 2007/01/16 05:44:14 steve Exp $"
+#ident "$Id: PExpr.h,v 1.88 2007/05/24 04:07:11 steve Exp $"
#endif
# include <string>
# include <vector>
# include "netlist.h"
# include "verinum.h"
# include "LineInfo.h"
+# include "pform_types.h"
class Design;
class Module;
@@ -247,9 +248,14 @@ class PEFNumber : public PExpr {
class PEIdent : public PExpr {
public:
- explicit PEIdent(const hname_t&s);
+ explicit PEIdent(perm_string);
+ explicit PEIdent(const pform_name_t&);
~PEIdent();
+ // Add another name to the string of heirarchy that is the
+ // current identifier.
+ void append_name(perm_string);
+
virtual void dump(ostream&) const;
virtual unsigned test_width(Design*des, NetScope*scope,
unsigned min, unsigned lval,
@@ -286,7 +292,10 @@ class PEIdent : public PExpr {
virtual bool is_constant(Module*) const;
verinum* eval_const(const Design*des, NetScope*sc) const;
- const hname_t& path() const;
+ const pform_name_t& path() const { return path_; }
+
+ private:
+ pform_name_t path_;
private:
// Common functions to calculate parts of part/bit selects.
@@ -332,9 +341,9 @@ class PEIdent : public PExpr {
NetScope*scope,
NetESignal*net,
NetScope*found) const;
- hname_t path_;
public:
+#if 0
// Use these to support part-select operators.
PExpr*msb_;
PExpr*lsb_;
@@ -345,6 +354,8 @@ class PEIdent : public PExpr {
// expression. If this is a reference to a vector, this is a
// bit select.
std::vector<PExpr*> idx_;
+#endif
+
NetNet* elaborate_net_array_(Design*des, NetScope*scope,
NetNet*sig, unsigned lwidth,
const NetExpr* rise,
@@ -621,8 +632,10 @@ class PETernary : public PExpr {
*/
class PECallFunction : public PExpr {
public:
- explicit PECallFunction(const hname_t&n, const svector<PExpr *> &parms);
- explicit PECallFunction(const hname_t&n);
+ explicit PECallFunction(const pform_name_t&n, const svector<PExpr *> &parms);
+ // Call of system function (name is not heirarchical)
+ explicit PECallFunction(perm_string n, const svector<PExpr *> &parms);
+ explicit PECallFunction(perm_string n);
~PECallFunction();
virtual void dump(ostream &) const;
@@ -638,7 +651,7 @@ class PECallFunction : public PExpr {
int expr_wid, bool sys_task_arg) const;
private:
- hname_t path_;
+ pform_name_t path_;
svector<PExpr *> parms_;
bool check_call_matches_definition_(Design*des, NetScope*dscope) const;
@@ -655,6 +668,10 @@ class PECallFunction : public PExpr {
/*
* $Log: PExpr.h,v $
+ * Revision 1.88 2007/05/24 04:07:11 steve
+ * Rework the heirarchical identifier parse syntax and pform
+ * to handle more general combinations of heirarch and bit selects.
+ *
* Revision 1.87 2007/01/16 05:44:14 steve
* Major rework of array handling. Memories are replaced with the
* more general concept of arrays. The NetMemory and NetEMemory
View
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
-#ident "$Id: PGenerate.cc,v 1.2 2007/03/05 05:59:10 steve Exp $"
+#ident "$Id: PGenerate.cc,v 1.3 2007/05/24 04:07:11 steve Exp $"
#endif
# include "PGenerate.h"
@@ -42,9 +42,9 @@ PWire* PGenerate::add_wire(PWire*wire)
return wire;
}
-PWire* PGenerate::get_wire(const hname_t&name) const
+PWire* PGenerate::get_wire(const pform_name_t&name) const
{
- map<hname_t,PWire*>::const_iterator obj = wires.find(name);
+ map<pform_name_t,PWire*>::const_iterator obj = wires.find(name);
if (obj == wires.end())
return 0;
else
View
@@ -19,14 +19,15 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
-#ident "$Id: PGenerate.h,v 1.2 2007/03/05 05:59:10 steve Exp $"
+#ident "$Id: PGenerate.h,v 1.3 2007/05/24 04:07:11 steve Exp $"
#endif
# include "LineInfo.h"
# include "StringHeap.h"
# include "HName.h"
# include <list>
# include <map>
+# include "pform_types.h"
class Design;
class NetScope;
@@ -59,9 +60,9 @@ class PGenerate : public LineInfo {
PExpr*loop_test;
PExpr*loop_step;
- map<hname_t,PWire*>wires;
+ map<pform_name_t,PWire*>wires;
PWire* add_wire(PWire*);
- PWire* get_wire(const hname_t&name) const;
+ PWire* get_wire(const pform_name_t&name) const;
list<PGate*> gates;
void add_gate(PGate*);
Oops, something went wrong.

0 comments on commit ddd36ec

Please sign in to comment.