Skip to content

Commit

Permalink
Use perm_strings for named langiage items.
Browse files Browse the repository at this point in the history
  • Loading branch information
steve committed Feb 18, 2004
1 parent 17c891b commit 27af95d
Show file tree
Hide file tree
Showing 41 changed files with 706 additions and 474 deletions.
13 changes: 8 additions & 5 deletions Module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -28,7 +28,7 @@
# include <assert.h>

/* n is a permallocated string. */
Module::Module(const char*n)
Module::Module(perm_string n)
: name_(n)
{
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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.
*
Expand Down
22 changes: 13 additions & 9 deletions Module.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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();


Expand Down Expand Up @@ -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);

Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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&);
Expand All @@ -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.
Expand Down
27 changes: 15 additions & 12 deletions PGate.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999-2000 Stephen Williams ([email protected])
* Copyright (c) 1999-2004 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
Expand All @@ -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"
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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;
Expand Down Expand Up @@ -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);
}
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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.
*
Expand Down
33 changes: 18 additions & 15 deletions PGate.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef __PGate_H
#define __PGate_H
/*
* Copyright (c) 1998-2000 Stephen Williams ([email protected])
* Copyright (c) 1998-2004 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
Expand All @@ -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"
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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_;

Expand Down Expand Up @@ -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();
Expand All @@ -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);


Expand All @@ -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_;
Expand All @@ -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.
*
Expand Down
9 changes: 6 additions & 3 deletions PUdp.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003 Stephen Williams ([email protected])
* Copyright (c) 2003-2004 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
Expand All @@ -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.
*
Expand Down
Loading

0 comments on commit 27af95d

Please sign in to comment.