Module types in pform are char* instead of string.

This commit is contained in:
steve 2001-10-21 00:42:47 +00:00
parent 56954356db
commit 9f3e64e11a
5 changed files with 43 additions and 19 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: PGate.cc,v 1.11 2001/10/19 01:55:32 steve Exp $"
#ident "$Id: PGate.cc,v 1.12 2001/10/21 00:42:47 steve Exp $"
#endif
# include "config.h"
@ -142,17 +142,24 @@ void PGBuiltin::set_range(PExpr*msb, PExpr*lsb)
lsb_ = lsb;
}
PGModule::PGModule(const string&type, const string&name, svector<PExpr*>*pins)
: PGate(name, pins), type_(type), overrides_(0), pins_(0),
PGModule::PGModule(const char*type, const string&name, svector<PExpr*>*pins)
: PGate(name, pins), overrides_(0), pins_(0),
npins_(0), parms_(0), nparms_(0), msb_(0), lsb_(0)
{
type_ = strdup(type);
}
PGModule::PGModule(const string&type, const string&name,
PGModule::PGModule(const char*type, const string&name,
named<PExpr*>*pins, unsigned npins)
: PGate(name, 0), type_(type), overrides_(0), pins_(pins),
: PGate(name, 0), overrides_(0), pins_(pins),
npins_(npins), parms_(0), nparms_(0), msb_(0), lsb_(0)
{
type_ = strdup(type);
}
PGModule::~PGModule()
{
free(type_);
}
void PGModule::set_parameters(svector<PExpr*>*o)
@ -178,13 +185,16 @@ void PGModule::set_range(PExpr*msb, PExpr*lsb)
lsb_ = lsb;
}
const string PGModule::get_type()
const char* PGModule::get_type()
{
return type_;
}
/*
* $Log: PGate.cc,v $
* Revision 1.12 2001/10/21 00:42:47 steve
* Module types in pform are char* instead of string.
*
* Revision 1.11 2001/10/19 01:55:32 steve
* Method to get the type_ member
*

15
PGate.h
View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: PGate.h,v 1.20 2001/10/19 01:55:32 steve Exp $"
#ident "$Id: PGate.h,v 1.21 2001/10/21 00:42:47 steve Exp $"
#endif
# include "svector.h"
@ -173,15 +173,17 @@ class PGModule : public PGate {
public:
// If the binding of ports is by position, this constructor
// builds everything all at once.
explicit PGModule(const string&type, const string&name,
explicit PGModule(const char*type, const 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 string&type, const string&name,
explicit PGModule(const char*type, const string&name,
named<PExpr*>*pins, unsigned npins);
~PGModule();
// Parameter overrides can come as an ordered list, or a set
// of named expressions.
void set_parameters(svector<PExpr*>*o);
@ -196,10 +198,10 @@ class PGModule : public PGate {
virtual void elaborate_scope(Design*des, NetScope*sc) const;
virtual bool elaborate_sig(Design*des, NetScope*scope) const;
const string get_type();
const char* get_type();
private:
string type_;
char* type_;
svector<PExpr*>*overrides_;
named<PExpr*>*pins_;
unsigned npins_;
@ -220,6 +222,9 @@ class PGModule : public PGate {
/*
* $Log: PGate.h,v $
* Revision 1.21 2001/10/21 00:42:47 steve
* Module types in pform are char* instead of string.
*
* Revision 1.20 2001/10/19 01:55:32 steve
* Method to get the type_ member
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: elaborate.cc,v 1.223 2001/10/20 23:02:40 steve Exp $"
#ident "$Id: elaborate.cc,v 1.224 2001/10/21 00:42:47 steve Exp $"
#endif
# include "config.h"
@ -745,7 +745,7 @@ void PGModule::elaborate_scope(Design*des, NetScope*sc) const
// Not a module or primitive that I know about yet, so try to
// load a library module file (which parses some new Verilog
// code) and try again.
if (load_module(type_.c_str())) {
if (load_module(type_)) {
// Try again to find the module type
mod = pform_modules.find(type_);
@ -2382,6 +2382,9 @@ Design* elaborate(list<const char*>roots)
/*
* $Log: elaborate.cc,v $
* Revision 1.224 2001/10/21 00:42:47 steve
* Module types in pform are char* instead of string.
*
* Revision 1.223 2001/10/20 23:02:40 steve
* Add automatic module libraries.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: pform.cc,v 1.80 2001/10/20 23:02:40 steve Exp $"
#ident "$Id: pform.cc,v 1.81 2001/10/21 00:42:48 steve Exp $"
#endif
# include "config.h"
@ -439,7 +439,7 @@ void pform_makegates(PGBuiltin::Type type,
* functions handle the instantaions of modules (and UDP objects) by
* making PGModule objects.
*/
static void pform_make_modgate(const string&type,
static void pform_make_modgate(const char*type,
const string&name,
struct parmvalue_t*overrides,
svector<PExpr*>*wires,
@ -470,7 +470,7 @@ static void pform_make_modgate(const string&type,
pform_cur_module->add_gate(cur);
}
static void pform_make_modgate(const string&type,
static void pform_make_modgate(const char*type,
const string&name,
struct parmvalue_t*overrides,
svector<portname_t*>*bind,
@ -510,7 +510,7 @@ static void pform_make_modgate(const string&type,
pform_cur_module->add_gate(cur);
}
void pform_make_modgates(const string&type,
void pform_make_modgates(const char*type,
struct parmvalue_t*overrides,
svector<lgate>*gates)
{
@ -1030,6 +1030,9 @@ int pform_parse(const char*path, FILE*file)
/*
* $Log: pform.cc,v $
* Revision 1.81 2001/10/21 00:42:48 steve
* Module types in pform are char* instead of string.
*
* Revision 1.80 2001/10/20 23:02:40 steve
* Add automatic module libraries.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: pform.h,v 1.47 2001/10/20 23:02:40 steve Exp $"
#ident "$Id: pform.h,v 1.48 2001/10/21 00:42:48 steve Exp $"
#endif
# include "netlist.h"
@ -168,7 +168,7 @@ extern void pform_makegates(PGBuiltin::Type type,
svector<PExpr*>*delay,
svector<lgate>*gates);
extern void pform_make_modgates(const string&type,
extern void pform_make_modgates(const char*type,
struct parmvalue_t*overrides,
svector<lgate>*gates);
@ -200,6 +200,9 @@ extern void pform_dump(ostream&out, Module*mod);
/*
* $Log: pform.h,v $
* Revision 1.48 2001/10/21 00:42:48 steve
* Module types in pform are char* instead of string.
*
* Revision 1.47 2001/10/20 23:02:40 steve
* Add automatic module libraries.
*