forked from steveicarus/iverilog
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Factor compile-time scopes into PScope class
Modules, functions and tasks are named scopes so derive them all from the PScope base class. These items all take scoped items, so the eventual plan is to move these items into PScope.
- Loading branch information
1 parent
331faa2
commit 3f2fa29
Showing
11 changed files
with
128 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (c) 1999 Stephen Williams ([email protected]) | ||
* Copyright (c) 1999-2008 Stephen Williams ([email protected]) | ||
* | ||
* This source code is free software; you can redistribute it | ||
* and/or modify it in source code form under the terms of the GNU | ||
|
@@ -16,16 +16,13 @@ | |
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA | ||
*/ | ||
#ifdef HAVE_CVS_IDENT | ||
#ident "$Id: PFunction.cc,v 1.7 2004/05/31 23:34:36 steve Exp $" | ||
#endif | ||
|
||
# include "config.h" | ||
|
||
#include "PTask.h" | ||
|
||
PFunction::PFunction(perm_string name) | ||
: name_(name), ports_(0), statement_(0) | ||
: PScope(name), ports_(0), statement_(0) | ||
{ | ||
return_type_.type = PTF_NONE; | ||
} | ||
|
@@ -51,28 +48,3 @@ void PFunction::set_return(PTaskFuncArg t) | |
{ | ||
return_type_ = t; | ||
} | ||
|
||
/* | ||
* $Log: PFunction.cc,v $ | ||
* Revision 1.7 2004/05/31 23:34:36 steve | ||
* Rewire/generalize parsing an elaboration of | ||
* function return values to allow for better | ||
* speed and more type support. | ||
* | ||
* Revision 1.6 2002/08/12 01:34:58 steve | ||
* conditional ident string using autoconfig. | ||
* | ||
* Revision 1.5 2001/07/25 03:10:48 steve | ||
* Create a config.h.in file to hold all the config | ||
* junk, and support gcc 3.0. (Stephan Boettcher) | ||
* | ||
* Revision 1.4 2001/01/13 22:20:08 steve | ||
* Parse parameters within nested scopes. | ||
* | ||
* Revision 1.3 2000/02/23 02:56:53 steve | ||
* Macintosh compilers do not support ident. | ||
* | ||
* Revision 1.2 1999/08/25 22:22:41 steve | ||
* elaborate some aspects of functions. | ||
* | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright (c) 2008 Stephen Williams ([email protected]) | ||
* | ||
* This source code is free software; you can redistribute it | ||
* and/or modify it in source code form under the terms of the GNU | ||
* General Public License as published by the Free Software | ||
* Foundation; either version 2 of the License, or (at your option) | ||
* any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA | ||
*/ | ||
|
||
# include "PScope.h" | ||
|
||
PScope::PScope(perm_string n) | ||
: name_(n) | ||
{ | ||
} | ||
|
||
PScope::~PScope() | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#ifndef __PScope_H | ||
#define __PScope_H | ||
/* | ||
* Copyright (c) 2008 Stephen Williams ([email protected]) | ||
* | ||
* This source code is free software; you can redistribute it | ||
* and/or modify it in source code form under the terms of the GNU | ||
* General Public License as published by the Free Software | ||
* Foundation; either version 2 of the License, or (at your option) | ||
* any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA | ||
*/ | ||
|
||
# include "StringHeap.h" | ||
# include <map> | ||
|
||
class PEvent; | ||
|
||
/* | ||
* The PScope class is a base representation of an object that | ||
* represents some sort of compile-time scope. For example, a module, | ||
* a function/task, a named block is derived from a PScope. | ||
* | ||
* NOTE: This is note the same concept as the "scope" of an elaborated | ||
* hierarchy. That is represented by NetScope objects after elaboration. | ||
*/ | ||
class PScope { | ||
|
||
public: | ||
PScope(perm_string name); | ||
~PScope(); | ||
|
||
perm_string pscope_name() const { return name_; } | ||
|
||
// Named events in the scope. | ||
map<perm_string,PEvent*>events; | ||
|
||
private: | ||
perm_string name_; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (c) 1999 Stephen Williams ([email protected]) | ||
* Copyright (c) 1999-2008 Stephen Williams ([email protected]) | ||
* | ||
* This source code is free software; you can redistribute it | ||
* and/or modify it in source code form under the terms of the GNU | ||
|
@@ -16,16 +16,13 @@ | |
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA | ||
*/ | ||
#ifdef HAVE_CVS_IDENT | ||
#ident "$Id: PTask.cc,v 1.7 2002/08/12 01:34:58 steve Exp $" | ||
#endif | ||
|
||
# include "config.h" | ||
|
||
# include "PTask.h" | ||
|
||
PTask::PTask() | ||
: ports_(0), statement_(0) | ||
PTask::PTask(perm_string name) | ||
: PScope(name), ports_(0), statement_(0) | ||
{ | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#ifndef __PTask_H | ||
#define __PTask_H | ||
/* | ||
* Copyright (c) 1999-2000 Stephen Williams ([email protected]) | ||
* Copyright (c) 1999-2008 Stephen Williams ([email protected]) | ||
* | ||
* This source code is free software; you can redistribute it | ||
* and/or modify it in source code form under the terms of the GNU | ||
|
@@ -18,11 +18,9 @@ | |
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA | ||
*/ | ||
#ifdef HAVE_CVS_IDENT | ||
#ident "$Id: PTask.h,v 1.14 2007/03/06 05:22:49 steve Exp $" | ||
#endif | ||
|
||
# include "LineInfo.h" | ||
# include "PScope.h" | ||
# include "svector.h" | ||
# include "StringHeap.h" | ||
# include <string> | ||
|
@@ -50,10 +48,10 @@ struct PTaskFuncArg { | |
/* | ||
* The PTask holds the parsed definitions of a task. | ||
*/ | ||
class PTask : public LineInfo { | ||
class PTask : public PScope, public LineInfo { | ||
|
||
public: | ||
explicit PTask(); | ||
explicit PTask(perm_string name); | ||
~PTask(); | ||
|
||
void set_ports(svector<PWire *>*p); | ||
|
@@ -89,7 +87,7 @@ class PTask : public LineInfo { | |
* | ||
* The output value is not elaborated until elaborate_sig. | ||
*/ | ||
class PFunction : public LineInfo { | ||
class PFunction : public PScope, public LineInfo { | ||
|
||
public: | ||
explicit PFunction(perm_string name); | ||
|
@@ -110,68 +108,9 @@ class PFunction : public LineInfo { | |
void dump(ostream&, unsigned) const; | ||
|
||
private: | ||
perm_string name_; | ||
PTaskFuncArg return_type_; | ||
svector<PWire *> *ports_; | ||
Statement *statement_; | ||
}; | ||
|
||
/* | ||
* $Log: PTask.h,v $ | ||
* Revision 1.14 2007/03/06 05:22:49 steve | ||
* Support signed function return values. | ||
* | ||
* Revision 1.13 2004/05/31 23:34:36 steve | ||
* Rewire/generalize parsing an elaboration of | ||
* function return values to allow for better | ||
* speed and more type support. | ||
* | ||
* Revision 1.12 2002/08/12 01:34:58 steve | ||
* conditional ident string using autoconfig. | ||
* | ||
* Revision 1.11 2001/11/22 06:20:59 steve | ||
* Use NetScope instead of string for scope path. | ||
* | ||
* Revision 1.10 2001/01/13 22:20:08 steve | ||
* Parse parameters within nested scopes. | ||
* | ||
* Revision 1.9 2000/07/30 18:25:43 steve | ||
* Rearrange task and function elaboration so that the | ||
* NetTaskDef and NetFuncDef functions are created during | ||
* signal enaboration, and carry these objects in the | ||
* NetScope class instead of the extra, useless map in | ||
* the Design class. | ||
* | ||
* Revision 1.8 2000/03/08 04:36:53 steve | ||
* Redesign the implementation of scopes and parameters. | ||
* I now generate the scopes and notice the parameters | ||
* in a separate pass over the pform. Once the scopes | ||
* are generated, I can process overrides and evalutate | ||
* paremeters before elaboration begins. | ||
* | ||
* Revision 1.7 2000/02/23 02:56:53 steve | ||
* Macintosh compilers do not support ident. | ||
* | ||
* Revision 1.6 1999/09/30 21:28:34 steve | ||
* Handle mutual reference of tasks by elaborating | ||
* task definitions in two passes, like functions. | ||
* | ||
* Revision 1.5 1999/09/01 20:46:19 steve | ||
* Handle recursive functions and arbitrary function | ||
* references to other functions, properly pass | ||
* function parameters and save function results. | ||
* | ||
* Revision 1.4 1999/08/25 22:22:41 steve | ||
* elaborate some aspects of functions. | ||
* | ||
* Revision 1.3 1999/07/31 19:14:47 steve | ||
* Add functions up to elaboration (Ed Carter) | ||
* | ||
* Revision 1.2 1999/07/24 02:11:19 steve | ||
* Elaborate task input ports. | ||
* | ||
* Revision 1.1 1999/07/03 02:12:51 steve | ||
* Elaborate user defined tasks. | ||
* | ||
*/ | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.