Use perm_strings for named langiage items.
This commit is contained in:
parent
17c891bc9c
commit
27af95d402
13
Module.cc
13
Module.cc
|
|
@ -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.
|
||||
*
|
||||
|
|
|
|||
22
Module.h
22
Module.h
|
|
@ -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.
|
||||
|
|
|
|||
27
PGate.cc
27
PGate.cc
|
|
@ -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.
|
||||
*
|
||||
|
|
|
|||
33
PGate.h
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.
|
||||
*
|
||||
|
|
|
|||
9
PUdp.cc
9
PUdp.cc
|
|
@ -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.
|
||||
*
|
||||
|
|
|
|||
12
PUdp.h
12
PUdp.h
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef __PUdp_H
|
||||
#define __PUdp_H
|
||||
/*
|
||||
* Copyright (c) 1998-2000 Stephen Williams (steve@picturel.com)
|
||||
* Copyright (c) 1998-2004 Stephen Williams (steve@picturel.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: PUdp.h,v 1.10 2003/07/15 05:07:13 steve Exp $"
|
||||
#ident "$Id: PUdp.h,v 1.11 2004/02/18 17:11:54 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <map>
|
||||
# include "StringHeap.h"
|
||||
# include "svector.h"
|
||||
# include "verinum.h"
|
||||
|
||||
|
|
@ -52,7 +53,7 @@ class PExpr;
|
|||
class PUdp {
|
||||
|
||||
public:
|
||||
explicit PUdp(const string&n, unsigned nports);
|
||||
explicit PUdp(perm_string n, unsigned nports);
|
||||
|
||||
svector<string>ports;
|
||||
bool sequential;
|
||||
|
|
@ -67,7 +68,7 @@ class PUdp {
|
|||
|
||||
void dump(ostream&out) const;
|
||||
|
||||
const string name_;
|
||||
perm_string name_;
|
||||
private:
|
||||
|
||||
private: // Not implemented
|
||||
|
|
@ -77,6 +78,9 @@ class PUdp {
|
|||
|
||||
/*
|
||||
* $Log: PUdp.h,v $
|
||||
* Revision 1.11 2004/02/18 17:11:54 steve
|
||||
* Use perm_strings for named langiage items.
|
||||
*
|
||||
* Revision 1.10 2003/07/15 05:07:13 steve
|
||||
* Move PUdp constructor into compiled file.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: Statement.cc,v 1.28 2002/08/12 01:34:58 steve Exp $"
|
||||
#ident "$Id: Statement.cc,v 1.29 2004/02/18 17:11:54 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -86,7 +86,7 @@ PAssignNB::~PAssignNB()
|
|||
{
|
||||
}
|
||||
|
||||
PBlock::PBlock(const string&n, BL_TYPE t, const svector<Statement*>&st)
|
||||
PBlock::PBlock(perm_string n, BL_TYPE t, const svector<Statement*>&st)
|
||||
: name_(n), bl_type_(t), list_(st)
|
||||
{
|
||||
}
|
||||
|
|
@ -295,6 +295,9 @@ PWhile::~PWhile()
|
|||
|
||||
/*
|
||||
* $Log: Statement.cc,v $
|
||||
* Revision 1.29 2004/02/18 17:11:54 steve
|
||||
* Use perm_strings for named langiage items.
|
||||
*
|
||||
* Revision 1.28 2002/08/12 01:34:58 steve
|
||||
* conditional ident string using autoconfig.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: Statement.h,v 1.38 2003/05/19 02:50:58 steve Exp $"
|
||||
#ident "$Id: Statement.h,v 1.39 2004/02/18 17:11:54 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <string>
|
||||
|
|
@ -148,7 +148,7 @@ class PBlock : public Statement {
|
|||
public:
|
||||
enum BL_TYPE { BL_SEQ, BL_PAR };
|
||||
|
||||
explicit PBlock(const string&n, BL_TYPE t, const svector<Statement*>&st);
|
||||
explicit PBlock(perm_string n, BL_TYPE t, const svector<Statement*>&st);
|
||||
explicit PBlock(BL_TYPE t, const svector<Statement*>&st);
|
||||
explicit PBlock(BL_TYPE t);
|
||||
~PBlock();
|
||||
|
|
@ -161,7 +161,7 @@ class PBlock : public Statement {
|
|||
virtual void elaborate_scope(Design*des, NetScope*scope) const;
|
||||
|
||||
private:
|
||||
string name_;
|
||||
perm_string name_;
|
||||
const BL_TYPE bl_type_;
|
||||
svector<Statement*>list_;
|
||||
};
|
||||
|
|
@ -455,6 +455,9 @@ class PWhile : public Statement {
|
|||
|
||||
/*
|
||||
* $Log: Statement.h,v $
|
||||
* Revision 1.39 2004/02/18 17:11:54 steve
|
||||
* Use perm_strings for named langiage items.
|
||||
*
|
||||
* Revision 1.38 2003/05/19 02:50:58 steve
|
||||
* Implement the wait statement behaviorally instead of as nets.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2003 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2002-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: StringHeap.cc,v 1.5 2003/03/01 06:25:30 steve Exp $"
|
||||
#ident "$Id: StringHeap.cc,v 1.6 2004/02/18 17:11:54 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "StringHeap.h"
|
||||
|
|
@ -64,6 +64,11 @@ const char* StringHeap::add(const char*text)
|
|||
return res;
|
||||
}
|
||||
|
||||
perm_string StringHeap::make(const char*text)
|
||||
{
|
||||
return perm_string(add(text));
|
||||
}
|
||||
|
||||
|
||||
StringHeapLex::StringHeapLex()
|
||||
{
|
||||
|
|
@ -121,8 +126,64 @@ const char* StringHeapLex::add(const char*text)
|
|||
return res;
|
||||
}
|
||||
|
||||
perm_string StringHeapLex::make(const char*text)
|
||||
{
|
||||
return perm_string(add(text));
|
||||
}
|
||||
|
||||
perm_string StringHeapLex::make(const string&text)
|
||||
{
|
||||
return perm_string(add(text.c_str()));
|
||||
}
|
||||
|
||||
bool operator == (perm_string a, const char*b)
|
||||
{
|
||||
if (a.str() == b)
|
||||
return true;
|
||||
|
||||
if (! (a.str() && b))
|
||||
return false;
|
||||
|
||||
if (strcmp(a.str(), b) == 0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool operator == (perm_string a, perm_string b)
|
||||
{
|
||||
return a == b.str();
|
||||
}
|
||||
|
||||
bool operator != (perm_string a, const char*b)
|
||||
{
|
||||
return ! (a == b);
|
||||
}
|
||||
|
||||
bool operator != (perm_string a, perm_string b)
|
||||
{
|
||||
return ! (a == b);
|
||||
}
|
||||
|
||||
bool operator < (perm_string a, perm_string b)
|
||||
{
|
||||
if (b.str() && !a.str())
|
||||
return true;
|
||||
|
||||
if (b.str() == a.str())
|
||||
return false;
|
||||
|
||||
if (strcmp(a.str(), b.str()) < 0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* $Log: StringHeap.cc,v $
|
||||
* Revision 1.6 2004/02/18 17:11:54 steve
|
||||
* Use perm_strings for named langiage items.
|
||||
*
|
||||
* Revision 1.5 2003/03/01 06:25:30 steve
|
||||
* Add the lex_strings string handler, and put
|
||||
* scope names and system task/function names
|
||||
|
|
|
|||
49
StringHeap.h
49
StringHeap.h
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef __StringHeap_H
|
||||
#define __StringHeap_H
|
||||
/*
|
||||
* Copyright (c) 2002-2003 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2002-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,9 +19,48 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: StringHeap.h,v 1.4 2003/03/01 06:25:30 steve Exp $"
|
||||
#ident "$Id: StringHeap.h,v 1.5 2004/02/18 17:11:54 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
# include <string>
|
||||
|
||||
class perm_string {
|
||||
|
||||
public:
|
||||
perm_string() : text_(0) { }
|
||||
perm_string(const perm_string&that) : text_(that.text_) { }
|
||||
~perm_string() { }
|
||||
|
||||
perm_string& operator = (const perm_string&that)
|
||||
{ text_ = that.text_; return *this; }
|
||||
|
||||
const char*str() const { return text_; }
|
||||
operator const char* () const { return str(); }
|
||||
|
||||
// This is an escape for making perm_string objects out of
|
||||
// literals. For example, per_string::literal("Label"); Please
|
||||
// do *not* cheat and pass arbitrary const char* items here.
|
||||
static perm_string literal(const char*t) { return perm_string(t); }
|
||||
|
||||
private:
|
||||
friend class StringHeap;
|
||||
friend class StringHeapLex;
|
||||
perm_string(const char*t) : text_(t) { };
|
||||
|
||||
private:
|
||||
const char*text_;
|
||||
};
|
||||
|
||||
extern bool operator == (perm_string a, perm_string b);
|
||||
extern bool operator == (perm_string a, const char* b);
|
||||
extern bool operator != (perm_string a, perm_string b);
|
||||
extern bool operator != (perm_string a, const char* b);
|
||||
extern bool operator > (perm_string a, perm_string b);
|
||||
extern bool operator < (perm_string a, perm_string b);
|
||||
extern bool operator >= (perm_string a, perm_string b);
|
||||
extern bool operator <= (perm_string a, perm_string b);
|
||||
|
||||
/*
|
||||
* The string heap is a way to permanently allocate strings
|
||||
* efficiently. They only take up the space of the string characters
|
||||
|
|
@ -34,6 +73,7 @@ class StringHeap {
|
|||
~StringHeap();
|
||||
|
||||
const char*add(const char*);
|
||||
perm_string make(const char*);
|
||||
|
||||
private:
|
||||
enum { HEAPCELL = 0x10000 };
|
||||
|
|
@ -60,6 +100,8 @@ class StringHeapLex : private StringHeap {
|
|||
~StringHeapLex();
|
||||
|
||||
const char*add(const char*);
|
||||
perm_string make(const char*);
|
||||
perm_string make(const string&);
|
||||
|
||||
unsigned add_count() const;
|
||||
unsigned add_hit_count() const;
|
||||
|
|
@ -78,6 +120,9 @@ class StringHeapLex : private StringHeap {
|
|||
|
||||
/*
|
||||
* $Log: StringHeap.h,v $
|
||||
* Revision 1.5 2004/02/18 17:11:54 steve
|
||||
* Use perm_strings for named langiage items.
|
||||
*
|
||||
* Revision 1.4 2003/03/01 06:25:30 steve
|
||||
* Add the lex_strings string handler, and put
|
||||
* scope names and system task/function names
|
||||
|
|
|
|||
12
compiler.h
12
compiler.h
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: compiler.h,v 1.19 2003/11/13 05:55:33 steve Exp $"
|
||||
#ident "$Id: compiler.h,v 1.20 2004/02/18 17:11:54 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <list>
|
||||
|
|
@ -102,12 +102,20 @@ extern generation_t generation_flag;
|
|||
/* This is the string to use to invoke the preprocessor. */
|
||||
extern char*ivlpp_string;
|
||||
|
||||
extern map<string,unsigned> missing_modules;
|
||||
extern map<perm_string,unsigned> missing_modules;
|
||||
|
||||
/*
|
||||
* the lex_strings are perm_strings made up of tokens from the source
|
||||
* file. Identifiers are so likely to be used many times that it makes
|
||||
* much sense to use a StringHeapLex to hold them.
|
||||
*/
|
||||
extern StringHeapLex lex_strings;
|
||||
|
||||
/*
|
||||
* $Log: compiler.h,v $
|
||||
* Revision 1.20 2004/02/18 17:11:54 steve
|
||||
* Use perm_strings for named langiage items.
|
||||
*
|
||||
* Revision 1.19 2003/11/13 05:55:33 steve
|
||||
* Move the DLL= flag to target config files.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: design_dump.cc,v 1.145 2003/12/17 16:52:39 steve Exp $"
|
||||
#ident "$Id: design_dump.cc,v 1.146 2004/02/18 17:11:54 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -686,7 +686,9 @@ void NetRepeat::dump(ostream&o, unsigned ind) const
|
|||
|
||||
void NetScope::dump(ostream&o) const
|
||||
{
|
||||
/* This is a constructed hierarchical name. */
|
||||
o << name();
|
||||
|
||||
switch (type_) {
|
||||
case BEGIN_END:
|
||||
o << " sequential block";
|
||||
|
|
@ -698,7 +700,7 @@ void NetScope::dump(ostream&o) const
|
|||
o << " function";
|
||||
break;
|
||||
case MODULE:
|
||||
o << " module <" << (module_name_? module_name_ : "") << ">";
|
||||
o << " module <" << (module_name_? module_name_.str() : "") << ">";
|
||||
break;
|
||||
case TASK:
|
||||
o << " task";
|
||||
|
|
@ -1077,6 +1079,9 @@ void Design::dump(ostream&o) const
|
|||
|
||||
/*
|
||||
* $Log: design_dump.cc,v $
|
||||
* Revision 1.146 2004/02/18 17:11:54 steve
|
||||
* Use perm_strings for named langiage items.
|
||||
*
|
||||
* Revision 1.145 2003/12/17 16:52:39 steve
|
||||
* Debug dumps for synth2.
|
||||
*
|
||||
|
|
|
|||
13
elab_net.cc
13
elab_net.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: elab_net.cc,v 1.123 2004/02/15 04:23:48 steve Exp $"
|
||||
#ident "$Id: elab_net.cc,v 1.124 2004/02/18 17:11:54 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -1140,7 +1140,7 @@ NetNet* PECallFunction::elaborate_net(Design*des, NetScope*scope,
|
|||
|
||||
|
||||
NetUserFunc*net = new NetUserFunc(scope,
|
||||
scope->local_symbol().c_str(),
|
||||
scope->local_symbol(),
|
||||
dscope);
|
||||
des->add_node(net);
|
||||
|
||||
|
|
@ -1372,7 +1372,7 @@ NetNet* PEIdent::elaborate_net(Design*des, NetScope*scope,
|
|||
assert(pc);
|
||||
verinum pvalue = pc->value();
|
||||
|
||||
sig = new NetNet(scope, path_.peek_name(0),
|
||||
sig = new NetNet(scope, lex_strings.make(path_.peek_name(0)),
|
||||
NetNet::IMPLICIT, pc->expr_width());
|
||||
NetConst*cp = new NetConst(scope, scope->local_symbol(),
|
||||
pvalue);
|
||||
|
|
@ -1391,7 +1391,7 @@ NetNet* PEIdent::elaborate_net(Design*des, NetScope*scope,
|
|||
/* Fallback, this may be an implicitly declared net. */
|
||||
if (sig == 0) {
|
||||
|
||||
sig = new NetNet(scope, path_.peek_name(0),
|
||||
sig = new NetNet(scope, lex_strings.make(path_.peek_name(0)),
|
||||
NetNet::IMPLICIT, 1);
|
||||
|
||||
if (error_implicit) {
|
||||
|
|
@ -1653,7 +1653,7 @@ NetNet* PEIdent::elaborate_lnet(Design*des, NetScope*scope,
|
|||
|
||||
if (implicit_net_ok && !error_implicit) {
|
||||
|
||||
sig = new NetNet(scope, path_.peek_name(0),
|
||||
sig = new NetNet(scope, lex_strings.make(path_.peek_name(0)),
|
||||
NetNet::IMPLICIT, 1);
|
||||
|
||||
if (warn_implicit) {
|
||||
|
|
@ -2426,6 +2426,9 @@ NetNet* PEUnary::elaborate_net(Design*des, NetScope*scope,
|
|||
|
||||
/*
|
||||
* $Log: elab_net.cc,v $
|
||||
* Revision 1.124 2004/02/18 17:11:54 steve
|
||||
* Use perm_strings for named langiage items.
|
||||
*
|
||||
* Revision 1.123 2004/02/15 04:23:48 steve
|
||||
* Fix evaluation of compare to constant expression.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: elab_scope.cc,v 1.27 2003/09/13 01:01:51 steve Exp $"
|
||||
#ident "$Id: elab_scope.cc,v 1.28 2004/02/18 17:11:55 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -171,12 +171,12 @@ bool Module::elaborate_scope(Design*des, NetScope*scope) const
|
|||
// elaborate_scope method of the PTask for detailed
|
||||
// processing.
|
||||
|
||||
typedef map<string,PTask*>::const_iterator tasks_it_t;
|
||||
typedef map<perm_string,PTask*>::const_iterator tasks_it_t;
|
||||
|
||||
for (tasks_it_t cur = tasks_.begin()
|
||||
; cur != tasks_.end() ; cur ++ ) {
|
||||
|
||||
NetScope*task_scope = new NetScope(scope, (*cur).first.c_str(),
|
||||
NetScope*task_scope = new NetScope(scope, (*cur).first,
|
||||
NetScope::TASK);
|
||||
(*cur).second->elaborate_scope(des, task_scope);
|
||||
}
|
||||
|
|
@ -186,12 +186,12 @@ bool Module::elaborate_scope(Design*des, NetScope*scope) const
|
|||
// perspective of scopes. So handle them exactly the same
|
||||
// way.
|
||||
|
||||
typedef map<string,PFunction*>::const_iterator funcs_it_t;
|
||||
typedef map<perm_string,PFunction*>::const_iterator funcs_it_t;
|
||||
|
||||
for (funcs_it_t cur = funcs_.begin()
|
||||
; cur != funcs_.end() ; cur ++ ) {
|
||||
|
||||
NetScope*func_scope = new NetScope(scope, (*cur).first.c_str(),
|
||||
NetScope*func_scope = new NetScope(scope, (*cur).first,
|
||||
NetScope::FUNC);
|
||||
(*cur).second->elaborate_scope(des, func_scope);
|
||||
}
|
||||
|
|
@ -288,7 +288,7 @@ void PGModule::elaborate_scope_mod_(Design*des, Module*mod, NetScope*sc) const
|
|||
}
|
||||
|
||||
// Create the new scope as a MODULE with my name.
|
||||
NetScope*my_scope = new NetScope(sc, get_name().c_str(), NetScope::MODULE);
|
||||
NetScope*my_scope = new NetScope(sc, get_name(), NetScope::MODULE);
|
||||
my_scope->set_module_name(mod->mod_name());
|
||||
|
||||
// Set time units and precision.
|
||||
|
|
@ -439,8 +439,8 @@ void PBlock::elaborate_scope(Design*des, NetScope*scope) const
|
|||
{
|
||||
NetScope*my_scope = scope;
|
||||
|
||||
if (name_ != "") {
|
||||
my_scope = new NetScope(scope, name_.c_str(), bl_type_==BL_PAR
|
||||
if (name_ != 0) {
|
||||
my_scope = new NetScope(scope, name_, bl_type_==BL_PAR
|
||||
? NetScope::FORK_JOIN
|
||||
: NetScope::BEGIN_END);
|
||||
}
|
||||
|
|
@ -549,6 +549,9 @@ void PWhile::elaborate_scope(Design*des, NetScope*scope) const
|
|||
|
||||
/*
|
||||
* $Log: elab_scope.cc,v $
|
||||
* Revision 1.28 2004/02/18 17:11:55 steve
|
||||
* Use perm_strings for named langiage items.
|
||||
*
|
||||
* Revision 1.27 2003/09/13 01:01:51 steve
|
||||
* Spelling fixes.
|
||||
*
|
||||
|
|
|
|||
20
elab_sig.cc
20
elab_sig.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: elab_sig.cc,v 1.32 2003/09/20 05:24:00 steve Exp $"
|
||||
#ident "$Id: elab_sig.cc,v 1.33 2004/02/18 17:11:55 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -29,6 +29,7 @@
|
|||
# include "PGate.h"
|
||||
# include "PTask.h"
|
||||
# include "PWire.h"
|
||||
# include "compiler.h"
|
||||
# include "netlist.h"
|
||||
# include "netmisc.h"
|
||||
# include "util.h"
|
||||
|
|
@ -174,7 +175,7 @@ bool Module::elaborate_sig(Design*des, NetScope*scope) const
|
|||
}
|
||||
|
||||
|
||||
typedef map<string,PFunction*>::const_iterator mfunc_it_t;
|
||||
typedef map<perm_string,PFunction*>::const_iterator mfunc_it_t;
|
||||
|
||||
for (mfunc_it_t cur = funcs_.begin()
|
||||
; cur != funcs_.end() ; cur ++) {
|
||||
|
|
@ -195,7 +196,7 @@ bool Module::elaborate_sig(Design*des, NetScope*scope) const
|
|||
// elaborate the ports of the tasks defined within this
|
||||
// module. Run through them now.
|
||||
|
||||
typedef map<string,PTask*>::const_iterator mtask_it_t;
|
||||
typedef map<perm_string,PTask*>::const_iterator mtask_it_t;
|
||||
|
||||
for (mtask_it_t cur = tasks_.begin()
|
||||
; cur != tasks_.end() ; cur ++) {
|
||||
|
|
@ -234,7 +235,7 @@ bool PGModule::elaborate_sig_mod_(Design*des, NetScope*scope,
|
|||
*/
|
||||
void PFunction::elaborate_sig(Design*des, NetScope*scope) const
|
||||
{
|
||||
string fname = scope->basename();
|
||||
perm_string fname = scope->basename();
|
||||
assert(scope->type() == NetScope::FUNC);
|
||||
|
||||
/* Make sure the function has at least one input port. If it
|
||||
|
|
@ -271,8 +272,8 @@ void PFunction::elaborate_sig(Design*des, NetScope*scope) const
|
|||
as two components: <func>.<port>. */
|
||||
|
||||
hname_t path = (*ports_)[idx]->path();
|
||||
string pname = path.peek_name(1);
|
||||
string ppath = path.peek_name(0);
|
||||
perm_string pname = lex_strings.make(path.peek_name(1));
|
||||
perm_string ppath = lex_strings.make(path.peek_name(0));
|
||||
|
||||
if (ppath != scope->basename()) {
|
||||
cerr << get_line() << ": internal error: function "
|
||||
|
|
@ -514,7 +515,7 @@ void PWire::elaborate_sig(Design*des, NetScope*scope) const
|
|||
delete lexp;
|
||||
delete rexp;
|
||||
|
||||
string name = hname_.peek_tail_name();
|
||||
perm_string name = lex_strings.make(hname_.peek_tail_name());
|
||||
|
||||
long lnum = lval.as_long();
|
||||
long rnum = rval.as_long();
|
||||
|
|
@ -525,7 +526,7 @@ void PWire::elaborate_sig(Design*des, NetScope*scope) const
|
|||
|
||||
} else {
|
||||
|
||||
string name = hname_.peek_tail_name();
|
||||
perm_string name = lex_strings.make(hname_.peek_tail_name());
|
||||
NetNet*sig = new NetNet(scope, name, wtype, msb, lsb);
|
||||
sig->set_line(*this);
|
||||
sig->port_type(port_type_);
|
||||
|
|
@ -539,6 +540,9 @@ void PWire::elaborate_sig(Design*des, NetScope*scope) const
|
|||
|
||||
/*
|
||||
* $Log: elab_sig.cc,v $
|
||||
* Revision 1.33 2004/02/18 17:11:55 steve
|
||||
* Use perm_strings for named langiage items.
|
||||
*
|
||||
* Revision 1.32 2003/09/20 05:24:00 steve
|
||||
* Evaluate memory index constants using elab_and_eval.
|
||||
*
|
||||
|
|
|
|||
54
elaborate.cc
54
elaborate.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: elaborate.cc,v 1.295 2004/01/21 04:35:03 steve Exp $"
|
||||
#ident "$Id: elaborate.cc,v 1.296 2004/02/18 17:11:55 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -176,8 +176,8 @@ void PGAssign::elaborate(Design*des, NetScope*scope) const
|
|||
} else {
|
||||
verinum tmpv (0UL, lval->pin_count()-cnt);
|
||||
NetConst*tmp = new NetConst(scope,
|
||||
scope->local_symbol(),
|
||||
tmpv);
|
||||
scope->local_symbol(),
|
||||
tmpv);
|
||||
des->add_node(tmp);
|
||||
for (idx = cnt
|
||||
; idx < lval->pin_count()
|
||||
|
|
@ -191,8 +191,7 @@ void PGAssign::elaborate(Design*des, NetScope*scope) const
|
|||
strength and delays. */
|
||||
unsigned idx;
|
||||
for (idx = 0 ; idx < cnt ; idx += 1) {
|
||||
NetBUFZ*dev = new NetBUFZ(scope,
|
||||
scope->local_symbol());
|
||||
NetBUFZ*dev = new NetBUFZ(scope,scope->local_symbol());
|
||||
connect(lval->pin(idx), dev->pin(0));
|
||||
connect(rid->pin(idx), dev->pin(1));
|
||||
dev->rise_time(rise_time);
|
||||
|
|
@ -212,8 +211,8 @@ void PGAssign::elaborate(Design*des, NetScope*scope) const
|
|||
|
||||
} else {
|
||||
NetConst*dev = new NetConst(scope,
|
||||
scope->local_symbol(),
|
||||
verinum::V0);
|
||||
scope->local_symbol(),
|
||||
verinum::V0);
|
||||
|
||||
des->add_node(dev);
|
||||
dev->pin(0).drive0(drive0);
|
||||
|
|
@ -269,7 +268,7 @@ void PGBuiltin::elaborate(Design*des, NetScope*scope) const
|
|||
{
|
||||
unsigned count = 1;
|
||||
long low = 0, high = 0;
|
||||
string name = get_name();
|
||||
string name = string(get_name());
|
||||
|
||||
if (name == "")
|
||||
name = scope->local_symbol();
|
||||
|
|
@ -351,7 +350,7 @@ void PGBuiltin::elaborate(Design*des, NetScope*scope) const
|
|||
index = low - idx;
|
||||
|
||||
tmp << name << "<" << index << ">";
|
||||
const string inm = tmp.str();
|
||||
perm_string inm = lex_strings.make(tmp.str());
|
||||
|
||||
switch (type()) {
|
||||
case AND:
|
||||
|
|
@ -494,7 +493,7 @@ void PGBuiltin::elaborate(Design*des, NetScope*scope) const
|
|||
void PGModule::elaborate_mod_(Design*des, Module*rmod, NetScope*scope) const
|
||||
{
|
||||
// Missing module instance names have already been rejected.
|
||||
assert(get_name() != "");
|
||||
assert(get_name() != 0);
|
||||
|
||||
if (msb_) {
|
||||
cerr << get_line() << ": sorry: Module instantiation arrays "
|
||||
|
|
@ -778,8 +777,8 @@ void PGModule::elaborate_mod_(Design*des, Module*rmod, NetScope*scope) const
|
|||
void PGModule::elaborate_udp_(Design*des, PUdp*udp, NetScope*scope) const
|
||||
{
|
||||
|
||||
string my_name = get_name();
|
||||
if (my_name == "")
|
||||
perm_string my_name = get_name();
|
||||
if (my_name == 0)
|
||||
my_name = scope->local_symbol();
|
||||
|
||||
/* When the parser notices delay expressions in front of a
|
||||
|
|
@ -837,7 +836,7 @@ void PGModule::elaborate_udp_(Design*des, PUdp*udp, NetScope*scope) const
|
|||
bool PGModule::elaborate_sig(Design*des, NetScope*scope) const
|
||||
{
|
||||
// Look for the module type
|
||||
map<string,Module*>::const_iterator mod = pform_modules.find(type_);
|
||||
map<perm_string,Module*>::const_iterator mod = pform_modules.find(type_);
|
||||
if (mod != pform_modules.end())
|
||||
return elaborate_sig_mod_(des, scope, (*mod).second);
|
||||
|
||||
|
|
@ -848,14 +847,14 @@ bool PGModule::elaborate_sig(Design*des, NetScope*scope) const
|
|||
void PGModule::elaborate(Design*des, NetScope*scope) const
|
||||
{
|
||||
// Look for the module type
|
||||
map<string,Module*>::const_iterator mod = pform_modules.find(type_);
|
||||
map<perm_string,Module*>::const_iterator mod = pform_modules.find(type_);
|
||||
if (mod != pform_modules.end()) {
|
||||
elaborate_mod_(des, (*mod).second, scope);
|
||||
return;
|
||||
}
|
||||
|
||||
// Try a primitive type
|
||||
map<string,PUdp*>::const_iterator udp = pform_primitives.find(type_);
|
||||
map<perm_string,PUdp*>::const_iterator udp = pform_primitives.find(type_);
|
||||
if (udp != pform_primitives.end()) {
|
||||
elaborate_udp_(des, (*udp).second, scope);
|
||||
return;
|
||||
|
|
@ -868,14 +867,14 @@ void PGModule::elaborate(Design*des, NetScope*scope) const
|
|||
void PGModule::elaborate_scope(Design*des, NetScope*sc) const
|
||||
{
|
||||
// Look for the module type
|
||||
map<string,Module*>::const_iterator mod = pform_modules.find(type_);
|
||||
map<perm_string,Module*>::const_iterator mod = pform_modules.find(type_);
|
||||
if (mod != pform_modules.end()) {
|
||||
elaborate_scope_mod_(des, (*mod).second, sc);
|
||||
return;
|
||||
}
|
||||
|
||||
// Try a primitive type
|
||||
map<string,PUdp*>::const_iterator udp = pform_primitives.find(type_);
|
||||
map<perm_string,PUdp*>::const_iterator udp = pform_primitives.find(type_);
|
||||
if (udp != pform_primitives.end())
|
||||
return;
|
||||
|
||||
|
|
@ -1171,7 +1170,7 @@ NetProc* PBlock::elaborate(Design*des, NetScope*scope) const
|
|||
: NetBlock::SEQU;
|
||||
|
||||
NetScope*nscope = 0;
|
||||
if (name_.length()) {
|
||||
if (name_.str() != 0) {
|
||||
nscope = scope->child(name_);
|
||||
if (nscope == 0) {
|
||||
cerr << get_line() << ": internal error: "
|
||||
|
|
@ -1195,7 +1194,7 @@ NetProc* PBlock::elaborate(Design*des, NetScope*scope) const
|
|||
// statement. There is no need to keep the block node. Also,
|
||||
// don't elide named blocks, because they might be referenced
|
||||
// elsewhere.
|
||||
if ((list_.count() == 1) && (name_.length() == 0)) {
|
||||
if ((list_.count() == 1) && (name_.str() == 0)) {
|
||||
assert(list_[0]);
|
||||
NetProc*tmp = list_[0]->elaborate(des, nscope);
|
||||
return tmp;
|
||||
|
|
@ -1802,7 +1801,7 @@ NetProc* PEventStatement::elaborate_st(Design*des, NetScope*scope,
|
|||
list. The NetEvProbe objects all refer back to the NetEvent
|
||||
object. */
|
||||
|
||||
NetEvent*ev = new NetEvent(lex_strings.add(scope->local_symbol().c_str()));
|
||||
NetEvent*ev = new NetEvent(scope->local_symbol());
|
||||
ev->set_line(*this);
|
||||
unsigned expr_count = 0;
|
||||
|
||||
|
|
@ -2004,7 +2003,7 @@ NetProc* PEventStatement::elaborate_wait(Design*des, NetScope*scope,
|
|||
<< "block permanently." << endl;
|
||||
}
|
||||
|
||||
NetEvent*wait_event = new NetEvent(lex_strings.add(scope->local_symbol().c_str()));
|
||||
NetEvent*wait_event = new NetEvent(scope->local_symbol());
|
||||
scope->add_event(wait_event);
|
||||
|
||||
NetEvWait*wait = new NetEvWait(0 /* noop */);
|
||||
|
|
@ -2408,7 +2407,7 @@ bool Module::elaborate(Design*des, NetScope*scope) const
|
|||
|
||||
|
||||
// Elaborate functions.
|
||||
typedef map<string,PFunction*>::const_iterator mfunc_it_t;
|
||||
typedef map<perm_string,PFunction*>::const_iterator mfunc_it_t;
|
||||
for (mfunc_it_t cur = funcs_.begin()
|
||||
; cur != funcs_.end() ; cur ++) {
|
||||
|
||||
|
|
@ -2420,7 +2419,7 @@ bool Module::elaborate(Design*des, NetScope*scope) const
|
|||
// Elaborate the task definitions. This is done before the
|
||||
// behaviors so that task calls may reference these, and after
|
||||
// the signals so that the tasks can reference them.
|
||||
typedef map<string,PTask*>::const_iterator mtask_it_t;
|
||||
typedef map<perm_string,PTask*>::const_iterator mtask_it_t;
|
||||
for (mtask_it_t cur = tasks_.begin()
|
||||
; cur != tasks_.end() ; cur ++) {
|
||||
|
||||
|
|
@ -2530,7 +2529,7 @@ struct root_elem {
|
|||
NetScope *scope;
|
||||
};
|
||||
|
||||
Design* elaborate(list<const char*>roots)
|
||||
Design* elaborate(list<perm_string>roots)
|
||||
{
|
||||
svector<root_elem*> root_elems(roots.size());
|
||||
bool rc = true;
|
||||
|
|
@ -2540,12 +2539,12 @@ Design* elaborate(list<const char*>roots)
|
|||
// module and elaborate what I find.
|
||||
Design*des = new Design;
|
||||
|
||||
for (list<const char*>::const_iterator root = roots.begin()
|
||||
for (list<perm_string>::const_iterator root = roots.begin()
|
||||
; root != roots.end()
|
||||
; root++) {
|
||||
|
||||
// Look for the root module in the list.
|
||||
map<string,Module*>::const_iterator mod = pform_modules.find(*root);
|
||||
map<perm_string,Module*>::const_iterator mod = pform_modules.find(*root);
|
||||
if (mod == pform_modules.end()) {
|
||||
cerr << "error: Unable to find the root module \""
|
||||
<< (*root) << "\" in the Verilog source." << endl;
|
||||
|
|
@ -2627,6 +2626,9 @@ Design* elaborate(list<const char*>roots)
|
|||
|
||||
/*
|
||||
* $Log: elaborate.cc,v $
|
||||
* Revision 1.296 2004/02/18 17:11:55 steve
|
||||
* Use perm_strings for named langiage items.
|
||||
*
|
||||
* Revision 1.295 2004/01/21 04:35:03 steve
|
||||
* Get rid of useless warning.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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: expr_synth.cc,v 1.53 2004/02/15 04:23:48 steve Exp $"
|
||||
#ident "$Id: expr_synth.cc,v 1.54 2004/02/18 17:11:56 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -54,11 +54,11 @@ NetNet* NetEBAdd::synthesize(Design*des)
|
|||
assert(lsig->pin_count() == rsig->pin_count());
|
||||
unsigned width=lsig->pin_count();
|
||||
|
||||
string path = lsig->scope()->local_symbol();
|
||||
perm_string path = lsig->scope()->local_symbol();
|
||||
NetNet*osig = new NetNet(lsig->scope(), path, NetNet::IMPLICIT, width);
|
||||
osig->local_flag(true);
|
||||
|
||||
string oname = osig->scope()->local_symbol();
|
||||
perm_string oname = osig->scope()->local_symbol();
|
||||
NetAddSub *adder = new NetAddSub(lsig->scope(), oname, width);
|
||||
for (unsigned idx = 0 ; idx < width; idx += 1) {
|
||||
connect(lsig->pin(idx), adder->pin_DataA(idx));
|
||||
|
|
@ -111,7 +111,7 @@ NetNet* NetEBBits::synthesize(Design*des)
|
|||
osig->local_flag(true);
|
||||
|
||||
for (unsigned idx = 0 ; idx < osig->pin_count() ; idx += 1) {
|
||||
string oname = scope->local_hsymbol();
|
||||
perm_string oname = scope->local_symbol();
|
||||
NetLogic*gate;
|
||||
|
||||
/* If the rsig bit is constant, then look for special
|
||||
|
|
@ -190,12 +190,12 @@ NetNet* NetEBComp::synthesize(Design*des)
|
|||
switch (op_) {
|
||||
case 'e':
|
||||
case 'E':
|
||||
gate = new NetLogic(scope, scope->local_hsymbol(),
|
||||
gate = new NetLogic(scope, scope->local_symbol(),
|
||||
lsig->pin_count()+1, NetLogic::NOR);
|
||||
break;
|
||||
case 'n':
|
||||
case 'N':
|
||||
gate = new NetLogic(scope, scope->local_hsymbol(),
|
||||
gate = new NetLogic(scope, scope->local_symbol(),
|
||||
lsig->pin_count()+1, NetLogic::OR);
|
||||
break;
|
||||
|
||||
|
|
@ -204,11 +204,11 @@ NetNet* NetEBComp::synthesize(Design*des)
|
|||
is very much like sig != 0. (0 > sig) shouldn't
|
||||
happen. */
|
||||
if (rcon) {
|
||||
gate = new NetLogic(scope, scope->local_hsymbol(),
|
||||
gate = new NetLogic(scope, scope->local_symbol(),
|
||||
lsig->pin_count()+1, NetLogic::OR);
|
||||
} else {
|
||||
assert(0);
|
||||
gate = new NetLogic(scope, scope->local_hsymbol(),
|
||||
gate = new NetLogic(scope, scope->local_symbol(),
|
||||
lsig->pin_count()+1, NetLogic::NOR);
|
||||
}
|
||||
break;
|
||||
|
|
@ -216,11 +216,11 @@ NetNet* NetEBComp::synthesize(Design*des)
|
|||
case '<':
|
||||
/* 0 < sig is handled like sig > 0. */
|
||||
if (! rcon) {
|
||||
gate = new NetLogic(scope, scope->local_hsymbol(),
|
||||
gate = new NetLogic(scope, scope->local_symbol(),
|
||||
lsig->pin_count()+1, NetLogic::OR);
|
||||
} else {
|
||||
assert(0);
|
||||
gate = new NetLogic(scope, scope->local_hsymbol(),
|
||||
gate = new NetLogic(scope, scope->local_symbol(),
|
||||
lsig->pin_count()+1, NetLogic::NOR);
|
||||
}
|
||||
break;
|
||||
|
|
@ -257,7 +257,7 @@ NetNet* NetEBComp::synthesize(Design*des)
|
|||
/* Handle the special case of a single bit equality
|
||||
operation. Make an XNOR gate instead of a comparator. */
|
||||
if ((width == 1) && ((op_ == 'e') || (op_ == 'E'))) {
|
||||
NetLogic*gate = new NetLogic(scope, scope->local_hsymbol(),
|
||||
NetLogic*gate = new NetLogic(scope, scope->local_symbol(),
|
||||
3, NetLogic::XNOR);
|
||||
connect(gate->pin(0), osig->pin(0));
|
||||
connect(gate->pin(1), lsig->pin(0));
|
||||
|
|
@ -270,7 +270,7 @@ NetNet* NetEBComp::synthesize(Design*des)
|
|||
operation. This is similar to single bit equality, but uses
|
||||
an XOR instead of an XNOR gate. */
|
||||
if ((width == 1) && ((op_ == 'n') || (op_ == 'N'))) {
|
||||
NetLogic*gate = new NetLogic(scope, scope->local_hsymbol(),
|
||||
NetLogic*gate = new NetLogic(scope, scope->local_symbol(),
|
||||
3, NetLogic::XOR);
|
||||
connect(gate->pin(0), osig->pin(0));
|
||||
connect(gate->pin(1), lsig->pin(0));
|
||||
|
|
@ -394,7 +394,7 @@ NetNet* NetEBLogic::synthesize(Design*des)
|
|||
comparison with a single wide OR gate. So handle this
|
||||
magically. */
|
||||
|
||||
string oname = scope->local_hsymbol();
|
||||
perm_string oname = scope->local_symbol();
|
||||
|
||||
NetLogic*olog = new NetLogic(scope, oname,
|
||||
lsig->pin_count()+rsig->pin_count()+1,
|
||||
|
|
@ -418,7 +418,7 @@ NetNet* NetEBLogic::synthesize(Design*des)
|
|||
/* Create the logic AND gate. This is a single bit
|
||||
output, with inputs for each of the operands. */
|
||||
NetLogic*olog;
|
||||
string oname = scope->local_hsymbol();
|
||||
perm_string oname = scope->local_symbol();
|
||||
|
||||
olog = new NetLogic(scope, oname, 3, NetLogic::AND);
|
||||
|
||||
|
|
@ -551,7 +551,7 @@ NetNet* NetEConcat::synthesize(Design*des)
|
|||
assert(scope);
|
||||
|
||||
/* Make a NetNet object to carry the output vector. */
|
||||
string path = scope->local_symbol();
|
||||
perm_string path = scope->local_symbol();
|
||||
NetNet*osig = new NetNet(scope, path, NetNet::IMPLICIT, expr_width());
|
||||
osig->local_flag(true);
|
||||
|
||||
|
|
@ -579,7 +579,7 @@ NetNet* NetEConst::synthesize(Design*des)
|
|||
NetScope*scope = des->find_root_scope();
|
||||
assert(scope);
|
||||
|
||||
string path = scope->local_symbol();
|
||||
perm_string path = scope->local_symbol();
|
||||
unsigned width=expr_width();
|
||||
|
||||
NetNet*osig = new NetNet(scope, path, NetNet::IMPLICIT, width);
|
||||
|
|
@ -617,7 +617,7 @@ NetNet* NetEUBits::synthesize(Design*des)
|
|||
osig->local_flag(true);
|
||||
|
||||
for (unsigned idx = 0 ; idx < osig->pin_count() ; idx += 1) {
|
||||
string oname = scope->local_hsymbol();
|
||||
perm_string oname = scope->local_symbol();
|
||||
NetLogic*gate;
|
||||
|
||||
switch (op()) {
|
||||
|
|
@ -648,7 +648,7 @@ NetNet* NetEUReduce::synthesize(Design*des)
|
|||
NetNet::IMPLICIT, 1);
|
||||
osig->local_flag(true);
|
||||
|
||||
string oname = scope->local_hsymbol();
|
||||
perm_string oname = scope->local_symbol();
|
||||
NetLogic*gate;
|
||||
|
||||
switch (op()) {
|
||||
|
|
@ -747,7 +747,7 @@ NetNet* NetETernary::synthesize(Design *des)
|
|||
NetNet*tsig = true_val_->synthesize(des);
|
||||
NetNet*fsig = false_val_->synthesize(des);
|
||||
|
||||
string path = csig->scope()->local_symbol();
|
||||
perm_string path = csig->scope()->local_symbol();
|
||||
|
||||
assert(csig->pin_count() == 1);
|
||||
|
||||
|
|
@ -762,7 +762,7 @@ NetNet* NetETernary::synthesize(Design *des)
|
|||
assert(width <= tsig->pin_count());
|
||||
assert(width <= fsig->pin_count());
|
||||
|
||||
string oname = csig->scope()->local_symbol();
|
||||
perm_string oname = csig->scope()->local_symbol();
|
||||
NetMux *mux = new NetMux(csig->scope(), oname, width, 2, 1);
|
||||
for (unsigned idx = 0 ; idx < width; idx += 1) {
|
||||
connect(tsig->pin(idx), mux->pin_Data(idx, 1));
|
||||
|
|
@ -816,7 +816,7 @@ NetNet* NetESignal::synthesize(Design*des)
|
|||
NetScope*scope = net_->scope();
|
||||
assert(scope);
|
||||
|
||||
string name = scope->local_symbol();
|
||||
perm_string name = scope->local_symbol();
|
||||
NetNet*tmp = new NetNet(scope, name, NetNet::WIRE, wid);
|
||||
tmp->local_flag(true);
|
||||
|
||||
|
|
@ -828,6 +828,9 @@ NetNet* NetESignal::synthesize(Design*des)
|
|||
|
||||
/*
|
||||
* $Log: expr_synth.cc,v $
|
||||
* Revision 1.54 2004/02/18 17:11:56 steve
|
||||
* Use perm_strings for named langiage items.
|
||||
*
|
||||
* Revision 1.53 2004/02/15 04:23:48 steve
|
||||
* Fix evaluation of compare to constant expression.
|
||||
*
|
||||
|
|
|
|||
27
main.cc
27
main.cc
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
const char COPYRIGHT[] =
|
||||
"Copyright (c) 1998-2003 Stephen Williams (steve@icarus.com)";
|
||||
"Copyright (c) 1998-2004 Stephen Williams (steve@icarus.com)";
|
||||
|
||||
/*
|
||||
* This source code is free software; you can redistribute it
|
||||
|
|
@ -19,7 +19,7 @@ const char COPYRIGHT[] =
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: main.cc,v 1.80 2004/02/15 00:19:29 steve Exp $"
|
||||
#ident "$Id: main.cc,v 1.81 2004/02/18 17:11:56 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -86,11 +86,11 @@ generation_t generation_flag = GN_DEFAULT;
|
|||
map<string,const char*> flags;
|
||||
char*vpi_module_list = 0;
|
||||
|
||||
map<string,unsigned> missing_modules;
|
||||
map<perm_string,unsigned> missing_modules;
|
||||
|
||||
list<const char*> library_suff;
|
||||
|
||||
list<const char*> roots;
|
||||
list<perm_string> roots;
|
||||
|
||||
char*ivlpp_string = 0;
|
||||
|
||||
|
|
@ -334,7 +334,7 @@ static void read_iconfig_file(const char*ipath)
|
|||
flags["-o"] = strdup(cp);
|
||||
|
||||
} else if (strcmp(buf, "root") == 0) {
|
||||
roots.push_back(strdup(cp));
|
||||
roots.push_back(lex_strings.make(cp));
|
||||
|
||||
} else if (strcmp(buf,"warnings") == 0) {
|
||||
/* Scan the warnings enable string for warning flags. */
|
||||
|
|
@ -384,7 +384,7 @@ static void read_iconfig_file(const char*ipath)
|
|||
}
|
||||
}
|
||||
|
||||
extern Design* elaborate(list <const char*>root);
|
||||
extern Design* elaborate(list <perm_string> root);
|
||||
|
||||
#if defined(HAVE_TIMES)
|
||||
static double cycles_diff(struct tms *a, struct tms *b)
|
||||
|
|
@ -526,13 +526,13 @@ int main(int argc, char*argv[])
|
|||
if (pf_path) {
|
||||
ofstream out (pf_path);
|
||||
out << "PFORM DUMP MODULES:" << endl;
|
||||
for (map<string,Module*>::iterator mod = pform_modules.begin()
|
||||
for (map<perm_string,Module*>::iterator mod = pform_modules.begin()
|
||||
; mod != pform_modules.end()
|
||||
; mod ++ ) {
|
||||
pform_dump(out, (*mod).second);
|
||||
}
|
||||
out << "PFORM DUMP PRIMITIVES:" << endl;
|
||||
for (map<string,PUdp*>::iterator idx = pform_primitives.begin()
|
||||
for (map<perm_string,PUdp*>::iterator idx = pform_primitives.begin()
|
||||
; idx != pform_primitives.end()
|
||||
; idx ++ ) {
|
||||
(*idx).second->dump(out);
|
||||
|
|
@ -548,8 +548,8 @@ int main(int argc, char*argv[])
|
|||
then look for modules that are not instantiated anywhere. */
|
||||
|
||||
if (roots.empty()) {
|
||||
map<string,bool> mentioned_p;
|
||||
map<string,Module*>::iterator mod;
|
||||
map<perm_string,bool> mentioned_p;
|
||||
map<perm_string,Module*>::iterator mod;
|
||||
if (verbose_flag)
|
||||
cout << "LOCATING TOP-LEVEL MODULES" << endl << " ";
|
||||
for (mod = pform_modules.begin()
|
||||
|
|
@ -618,7 +618,7 @@ int main(int argc, char*argv[])
|
|||
des->set_flags(flags);
|
||||
|
||||
/* Done iwth all the pform data. Delete the modules. */
|
||||
for (map<string,Module*>::iterator idx = pform_modules.begin()
|
||||
for (map<perm_string,Module*>::iterator idx = pform_modules.begin()
|
||||
; idx != pform_modules.end() ; idx ++) {
|
||||
|
||||
delete (*idx).second;
|
||||
|
|
@ -700,7 +700,7 @@ int main(int argc, char*argv[])
|
|||
if (missing_modules.size() > 0) {
|
||||
cerr << "*** These modules were missing:" << endl;
|
||||
|
||||
map<string,unsigned>::const_iterator idx;
|
||||
map<perm_string,unsigned>::const_iterator idx;
|
||||
for (idx = missing_modules.begin()
|
||||
; idx != missing_modules.end()
|
||||
; idx ++)
|
||||
|
|
@ -716,6 +716,9 @@ int main(int argc, char*argv[])
|
|||
|
||||
/*
|
||||
* $Log: main.cc,v $
|
||||
* Revision 1.81 2004/02/18 17:11:56 steve
|
||||
* Use perm_strings for named langiage items.
|
||||
*
|
||||
* Revision 1.80 2004/02/15 00:19:29 steve
|
||||
* Report elaboration errors without crashing.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: net_assign.cc,v 1.16 2003/01/26 21:15:58 steve Exp $"
|
||||
#ident "$Id: net_assign.cc,v 1.17 2004/02/18 17:11:56 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -98,14 +98,14 @@ unsigned NetAssign_::lwidth() const
|
|||
else return lwid_;
|
||||
}
|
||||
|
||||
const char*NetAssign_::name() const
|
||||
perm_string NetAssign_::name() const
|
||||
{
|
||||
if (sig_) {
|
||||
return sig_->name();
|
||||
} else if (mem_) {
|
||||
return mem_->name();
|
||||
} else {
|
||||
return "";
|
||||
return perm_string::literal("");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -254,6 +254,9 @@ NetAssignNB::~NetAssignNB()
|
|||
|
||||
/*
|
||||
* $Log: net_assign.cc,v $
|
||||
* Revision 1.17 2004/02/18 17:11:56 steve
|
||||
* Use perm_strings for named langiage items.
|
||||
*
|
||||
* Revision 1.16 2003/01/26 21:15:58 steve
|
||||
* Rework expression parsing and elaboration to
|
||||
* accommodate real/realtime values and expressions.
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: net_design.cc,v 1.42 2003/11/10 20:59:03 steve Exp $"
|
||||
#ident "$Id: net_design.cc,v 1.43 2004/02/18 17:11:56 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -80,7 +80,7 @@ unsigned long Design::scale_to_precision(unsigned long val,
|
|||
return val;
|
||||
}
|
||||
|
||||
NetScope* Design::make_root_scope(const char*root)
|
||||
NetScope* Design::make_root_scope(perm_string root)
|
||||
{
|
||||
NetScope *root_scope_;
|
||||
root_scope_ = new NetScope(0, root, NetScope::MODULE);
|
||||
|
|
@ -617,6 +617,9 @@ void Design::delete_process(NetProcTop*top)
|
|||
|
||||
/*
|
||||
* $Log: net_design.cc,v $
|
||||
* Revision 1.43 2004/02/18 17:11:56 steve
|
||||
* Use perm_strings for named langiage items.
|
||||
*
|
||||
* Revision 1.42 2003/11/10 20:59:03 steve
|
||||
* Design::get_flag returns const char* instead of string.
|
||||
*
|
||||
|
|
|
|||
11
net_event.cc
11
net_event.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: net_event.cc,v 1.23 2003/04/22 04:48:29 steve Exp $"
|
||||
#ident "$Id: net_event.cc,v 1.24 2004/02/18 17:11:56 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -245,13 +245,13 @@ const NetEvent* NetEvTrig::event() const
|
|||
return event_;
|
||||
}
|
||||
|
||||
NetEvProbe::NetEvProbe(NetScope*s, const string&n, NetEvent*tgt,
|
||||
NetEvProbe::NetEvProbe(NetScope*s, perm_string n, NetEvent*tgt,
|
||||
edge_t t, unsigned p)
|
||||
: NetNode(s, lex_strings.add(n.c_str()), p), event_(tgt), edge_(t)
|
||||
: NetNode(s, n, p), event_(tgt), edge_(t)
|
||||
{
|
||||
for (unsigned idx = 0 ; idx < p ; idx += 1) {
|
||||
pin(idx).set_dir(Link::INPUT);
|
||||
pin(idx).set_name("P", idx);
|
||||
pin(idx).set_name(perm_string::literal("P"), idx);
|
||||
}
|
||||
|
||||
enext_ = event_->probes_;
|
||||
|
|
@ -449,6 +449,9 @@ NetProc* NetEvWait::statement()
|
|||
|
||||
/*
|
||||
* $Log: net_event.cc,v $
|
||||
* Revision 1.24 2004/02/18 17:11:56 steve
|
||||
* Use perm_strings for named langiage items.
|
||||
*
|
||||
* Revision 1.23 2003/04/22 04:48:29 steve
|
||||
* Support event names as expressions elements.
|
||||
*
|
||||
|
|
|
|||
19
net_force.cc
19
net_force.cc
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2000 Stephen Williams (steve@picturel.com)
|
||||
* Copyright (c) 2000-2004 Stephen Williams (steve@picturel.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: net_force.cc,v 1.11 2003/03/06 00:28:41 steve Exp $"
|
||||
#ident "$Id: net_force.cc,v 1.12 2004/02/18 17:11:56 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -45,13 +45,13 @@
|
|||
* output pins to connect to the netlist? But that would cause the
|
||||
* link ring to grow, and that is not quite correct either. Hmm...
|
||||
*/
|
||||
NetCAssign::NetCAssign(NetScope*s, const string&n, NetNet*l)
|
||||
: NetNode(s, lex_strings.add(n.c_str()), l->pin_count()), lval_(l)
|
||||
NetCAssign::NetCAssign(NetScope*s, perm_string n, NetNet*l)
|
||||
: NetNode(s, n, l->pin_count()), lval_(l)
|
||||
{
|
||||
lval_->incr_eref();
|
||||
for (unsigned idx = 0 ; idx < pin_count() ; idx += 1) {
|
||||
pin(idx).set_dir(Link::INPUT);
|
||||
pin(idx).set_name("I", idx);
|
||||
pin(idx).set_name(perm_string::literal("I"), idx);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -87,14 +87,14 @@ const NetNet*NetDeassign::lval() const
|
|||
return lval_;
|
||||
}
|
||||
|
||||
NetForce::NetForce(NetScope*s, const string&n, NetNet*l)
|
||||
: NetNode(s, lex_strings.add(n.c_str()), l->pin_count()), lval_(l)
|
||||
NetForce::NetForce(NetScope*s, perm_string n, NetNet*l)
|
||||
: NetNode(s, n, l->pin_count()), lval_(l)
|
||||
{
|
||||
lval_->incr_eref();
|
||||
|
||||
for (unsigned idx = 0 ; idx < pin_count() ; idx += 1) {
|
||||
pin(idx).set_dir(Link::INPUT);
|
||||
pin(idx).set_name("I", idx);
|
||||
pin(idx).set_name(perm_string::literal("I"), idx);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -137,6 +137,9 @@ const NetNet*NetRelease::lval() const
|
|||
|
||||
/*
|
||||
* $Log: net_force.cc,v $
|
||||
* Revision 1.12 2004/02/18 17:11:56 steve
|
||||
* Use perm_strings for named langiage items.
|
||||
*
|
||||
* Revision 1.11 2003/03/06 00:28:41 steve
|
||||
* All NetObj objects have lex_string base names.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: net_func.cc,v 1.4 2003/03/06 00:28:41 steve Exp $"
|
||||
#ident "$Id: net_func.cc,v 1.5 2004/02/18 17:11:56 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -35,8 +35,8 @@ static unsigned count_def_pins(const NetFuncDef*def)
|
|||
return sum;
|
||||
}
|
||||
|
||||
NetUserFunc::NetUserFunc(NetScope*s, const char*n, NetScope*d)
|
||||
: NetNode(s, lex_strings.add(n), count_def_pins(d->func_def())),
|
||||
NetUserFunc::NetUserFunc(NetScope*s, perm_string n, NetScope*d)
|
||||
: NetNode(s, n, count_def_pins(d->func_def())),
|
||||
def_(d)
|
||||
{
|
||||
NetFuncDef*def = def_->func_def();
|
||||
|
|
@ -147,6 +147,9 @@ bool PECallFunction::check_call_matches_definition_(Design*des, NetScope*dscope)
|
|||
|
||||
/*
|
||||
* $Log: net_func.cc,v $
|
||||
* Revision 1.5 2004/02/18 17:11:56 steve
|
||||
* Use perm_strings for named langiage items.
|
||||
*
|
||||
* Revision 1.4 2003/03/06 00:28:41 steve
|
||||
* All NetObj objects have lex_string base names.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: net_link.cc,v 1.13 2003/01/14 21:16:18 steve Exp $"
|
||||
#ident "$Id: net_link.cc,v 1.14 2004/02/18 17:11:56 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -195,13 +195,13 @@ unsigned Link::get_pin() const
|
|||
return pin_;
|
||||
}
|
||||
|
||||
void Link::set_name(const string&n, unsigned i)
|
||||
void Link::set_name(perm_string n, unsigned i)
|
||||
{
|
||||
name_ = n;
|
||||
inst_ = i;
|
||||
}
|
||||
|
||||
const string& Link::get_name() const
|
||||
perm_string Link::get_name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
|
@ -499,6 +499,9 @@ bool NexusSet::intersect(const NexusSet&that) const
|
|||
|
||||
/*
|
||||
* $Log: net_link.cc,v $
|
||||
* Revision 1.14 2004/02/18 17:11:56 steve
|
||||
* Use perm_strings for named langiage items.
|
||||
*
|
||||
* Revision 1.13 2003/01/14 21:16:18 steve
|
||||
* Move strstream to ostringstream for compatibility.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2000 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2000-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: net_modulo.cc,v 1.6 2003/03/06 00:28:41 steve Exp $"
|
||||
#ident "$Id: net_modulo.cc,v 1.7 2004/02/18 17:11:56 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -31,23 +31,23 @@
|
|||
# include "compiler.h"
|
||||
|
||||
|
||||
NetModulo::NetModulo(NetScope*s, const string&n, unsigned wr,
|
||||
NetModulo::NetModulo(NetScope*s, perm_string n, unsigned wr,
|
||||
unsigned wa, unsigned wb)
|
||||
: NetNode(s, lex_strings.add(n.c_str()), wr+wa+wb),
|
||||
: NetNode(s, n, wr+wa+wb),
|
||||
width_r_(wr), width_a_(wa), width_b_(wb)
|
||||
{
|
||||
unsigned p = 0;
|
||||
for (unsigned idx = 0 ; idx < width_r_ ; idx += 1, p += 1) {
|
||||
pin(p).set_dir(Link::OUTPUT);
|
||||
pin(p).set_name("Result", idx);
|
||||
pin(p).set_name(perm_string::literal("Result"), idx);
|
||||
}
|
||||
for (unsigned idx = 0 ; idx < width_a_ ; idx += 1, p += 1) {
|
||||
pin(p).set_dir(Link::INPUT);
|
||||
pin(p).set_name("DataA", idx);
|
||||
pin(p).set_name(perm_string::literal("DataA"), idx);
|
||||
}
|
||||
for (unsigned idx = 0 ; idx < width_b_ ; idx += 1, p += 1) {
|
||||
pin(p).set_dir(Link::INPUT);
|
||||
pin(p).set_name("DataB", idx);
|
||||
pin(p).set_name(perm_string::literal("DataB"), idx);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -108,6 +108,9 @@ const Link& NetModulo::pin_DataB(unsigned idx) const
|
|||
|
||||
/*
|
||||
* $Log: net_modulo.cc,v $
|
||||
* Revision 1.7 2004/02/18 17:11:56 steve
|
||||
* Use perm_strings for named langiage items.
|
||||
*
|
||||
* Revision 1.6 2003/03/06 00:28:41 steve
|
||||
* All NetObj objects have lex_string base names.
|
||||
*
|
||||
|
|
|
|||
39
net_scope.cc
39
net_scope.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: net_scope.cc,v 1.29 2003/09/13 01:30:07 steve Exp $"
|
||||
#ident "$Id: net_scope.cc,v 1.30 2004/02/18 17:11:56 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -35,7 +35,7 @@
|
|||
* in question.
|
||||
*/
|
||||
|
||||
NetScope::NetScope(NetScope*up, const char*n, NetScope::TYPE t)
|
||||
NetScope::NetScope(NetScope*up, perm_string n, NetScope::TYPE t)
|
||||
: type_(t), up_(up), sib_(0), sub_(0)
|
||||
{
|
||||
memories_ = 0;
|
||||
|
|
@ -63,12 +63,12 @@ NetScope::NetScope(NetScope*up, const char*n, NetScope::TYPE t)
|
|||
func_ = 0;
|
||||
break;
|
||||
case NetScope::MODULE:
|
||||
module_name_ = 0;
|
||||
module_name_ = perm_string();
|
||||
break;
|
||||
default: /* BEGIN_END and FORK_JOIN, do nothing */
|
||||
break;
|
||||
}
|
||||
name_ = lex_strings.add(n);
|
||||
name_ = n;
|
||||
}
|
||||
|
||||
NetScope::~NetScope()
|
||||
|
|
@ -184,13 +184,13 @@ const NetFuncDef* NetScope::func_def() const
|
|||
return func_;
|
||||
}
|
||||
|
||||
void NetScope::set_module_name(const char*n)
|
||||
void NetScope::set_module_name(perm_string n)
|
||||
{
|
||||
assert(type_ == MODULE);
|
||||
module_name_ = n; /* NOTE: n mus have been permallocated. */
|
||||
}
|
||||
|
||||
const char* NetScope::module_name() const
|
||||
perm_string NetScope::module_name() const
|
||||
{
|
||||
assert(type_ == MODULE);
|
||||
return module_name_;
|
||||
|
|
@ -216,7 +216,7 @@ int NetScope::time_precision() const
|
|||
return time_prec_;
|
||||
}
|
||||
|
||||
const char* NetScope::basename() const
|
||||
perm_string NetScope::basename() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
|
@ -224,9 +224,9 @@ const char* NetScope::basename() const
|
|||
string NetScope::name() const
|
||||
{
|
||||
if (up_)
|
||||
return up_->name() + "." + name_;
|
||||
return up_->name() + "." + string(name_);
|
||||
else
|
||||
return name_;
|
||||
return string(name_);
|
||||
}
|
||||
|
||||
void NetScope::add_event(NetEvent*ev)
|
||||
|
|
@ -308,7 +308,7 @@ void NetScope::rem_signal(NetNet*net)
|
|||
* is assumed to be the base name of the signal, so no sub-scopes are
|
||||
* searched.
|
||||
*/
|
||||
NetNet* NetScope::find_signal(const string&key)
|
||||
NetNet* NetScope::find_signal(const char*key)
|
||||
{
|
||||
if (signals_ == 0)
|
||||
return 0;
|
||||
|
|
@ -380,7 +380,7 @@ NetMemory* NetScope::find_memory(const string&key)
|
|||
|
||||
NetMemory*cur = memories_;
|
||||
do {
|
||||
if (cur->name() == key)
|
||||
if (cur->name() == key.c_str())
|
||||
return cur;
|
||||
cur = cur->sprev_;
|
||||
} while (cur != memories_);
|
||||
|
|
@ -399,12 +399,12 @@ void NetScope::add_variable(NetVariable*var)
|
|||
* This method locates a child scope by name. The name is the simple
|
||||
* name of the child, no hierarchy is searched.
|
||||
*/
|
||||
NetScope* NetScope::child(const string&name)
|
||||
NetScope* NetScope::child(const char*name)
|
||||
{
|
||||
if (sub_ == 0) return 0;
|
||||
|
||||
NetScope*cur = sub_;
|
||||
while (cur->name_ != name) {
|
||||
while (strcmp(cur->name_, name) != 0) {
|
||||
if (cur->sib_ == 0) return 0;
|
||||
cur = cur->sib_;
|
||||
}
|
||||
|
|
@ -412,12 +412,12 @@ NetScope* NetScope::child(const string&name)
|
|||
return cur;
|
||||
}
|
||||
|
||||
const NetScope* NetScope::child(const string&name) const
|
||||
const NetScope* NetScope::child(const char*name) const
|
||||
{
|
||||
if (sub_ == 0) return 0;
|
||||
|
||||
NetScope*cur = sub_;
|
||||
while (cur->name_ != name) {
|
||||
while (strcmp(cur->name_, name) != 0) {
|
||||
if (cur->sib_ == 0) return 0;
|
||||
cur = cur->sib_;
|
||||
}
|
||||
|
|
@ -435,21 +435,24 @@ const NetScope* NetScope::parent() const
|
|||
return up_;
|
||||
}
|
||||
|
||||
string NetScope::local_symbol()
|
||||
perm_string NetScope::local_symbol()
|
||||
{
|
||||
ostringstream res;
|
||||
res << "_s" << (lcounter_++);
|
||||
return res.str();
|
||||
return lex_strings.make(res.str());
|
||||
}
|
||||
|
||||
string NetScope::local_hsymbol()
|
||||
{
|
||||
return name() + "." + local_symbol();
|
||||
return string(name()) + "." + string(local_symbol());
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* $Log: net_scope.cc,v $
|
||||
* Revision 1.30 2004/02/18 17:11:56 steve
|
||||
* Use perm_strings for named langiage items.
|
||||
*
|
||||
* Revision 1.29 2003/09/13 01:30:07 steve
|
||||
* Missing case warnings.
|
||||
*
|
||||
|
|
|
|||
13
net_udp.cc
13
net_udp.cc
|
|
@ -18,7 +18,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: net_udp.cc,v 1.8 2003/03/06 00:28:42 steve Exp $"
|
||||
#ident "$Id: net_udp.cc,v 1.9 2004/02/18 17:11:56 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -26,14 +26,14 @@
|
|||
|
||||
# include "netlist.h"
|
||||
|
||||
NetUDP::NetUDP(NetScope*s, const string&n, unsigned pins, PUdp *u)
|
||||
: NetNode(s, lex_strings.add(n.c_str()), pins), udp(u)
|
||||
NetUDP::NetUDP(NetScope*s, perm_string n, unsigned pins, PUdp *u)
|
||||
: NetNode(s, n, pins), udp(u)
|
||||
{
|
||||
pin(0).set_dir(Link::OUTPUT);
|
||||
pin(0).set_name("O", 0);
|
||||
pin(0).set_name(perm_string::literal("O"), 0);
|
||||
for (unsigned idx = 1 ; idx < pins ; idx += 1) {
|
||||
pin(idx).set_dir(Link::INPUT);
|
||||
pin(idx).set_name("I", idx-1);
|
||||
pin(idx).set_name(perm_string::literal("I"), idx-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -92,6 +92,9 @@ char NetUDP::get_initial() const
|
|||
|
||||
/*
|
||||
* $Log: net_udp.cc,v $
|
||||
* Revision 1.9 2004/02/18 17:11:56 steve
|
||||
* Use perm_strings for named langiage items.
|
||||
*
|
||||
* Revision 1.8 2003/03/06 00:28:42 steve
|
||||
* All NetObj objects have lex_string base names.
|
||||
*
|
||||
|
|
|
|||
252
netlist.cc
252
netlist.cc
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1998-2002 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
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: netlist.cc,v 1.220 2003/11/10 19:44:30 steve Exp $"
|
||||
#ident "$Id: netlist.cc,v 1.221 2004/02/18 17:11:56 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -168,7 +168,7 @@ Link* find_next_output(Link*lnk)
|
|||
return 0;
|
||||
}
|
||||
|
||||
NetObj::NetObj(NetScope*s, const char*n, unsigned np)
|
||||
NetObj::NetObj(NetScope*s, perm_string n, unsigned np)
|
||||
: scope_(s), name_(n), npins_(np), delay1_(0), delay2_(0), delay3_(0)
|
||||
{
|
||||
pins_ = new Link[npins_];
|
||||
|
|
@ -212,7 +212,7 @@ const Link& NetObj::pin(unsigned idx) const
|
|||
return pins_[idx];
|
||||
}
|
||||
|
||||
NetNode::NetNode(NetScope*s, const char*n, unsigned npins)
|
||||
NetNode::NetNode(NetScope*s, perm_string n, unsigned npins)
|
||||
: NetObj(s, n, npins), node_next_(0), node_prev_(0), design_(0)
|
||||
{
|
||||
}
|
||||
|
|
@ -223,8 +223,8 @@ NetNode::~NetNode()
|
|||
design_->del_node(this);
|
||||
}
|
||||
|
||||
NetNet::NetNet(NetScope*s, const string&n, Type t, unsigned npins)
|
||||
: NetObj(s, lex_strings.add(n.c_str()), npins), sig_next_(0), sig_prev_(0),
|
||||
NetNet::NetNet(NetScope*s, perm_string n, Type t, unsigned npins)
|
||||
: NetObj(s, n, npins), sig_next_(0), sig_prev_(0),
|
||||
type_(t), port_type_(NOT_A_PORT), signed_(false), msb_(npins-1), lsb_(0),
|
||||
local_flag_(false), eref_count_(0), lref_count_(0)
|
||||
{
|
||||
|
|
@ -254,7 +254,7 @@ NetNet::NetNet(NetScope*s, const string&n, Type t, unsigned npins)
|
|||
}
|
||||
|
||||
for (unsigned idx = 0 ; idx < npins ; idx += 1) {
|
||||
pin(idx).set_name("P", idx);
|
||||
pin(idx).set_name(perm_string::literal("P"), idx);
|
||||
pin(idx).set_dir(dir);
|
||||
pin(idx).set_init(init_value);
|
||||
}
|
||||
|
|
@ -262,8 +262,8 @@ NetNet::NetNet(NetScope*s, const string&n, Type t, unsigned npins)
|
|||
scope()->add_signal(this);
|
||||
}
|
||||
|
||||
NetNet::NetNet(NetScope*s, const string&n, Type t, long ms, long ls)
|
||||
: NetObj(s, lex_strings.add(n.c_str()), ((ms>ls)?ms-ls:ls-ms) + 1),
|
||||
NetNet::NetNet(NetScope*s, perm_string n, Type t, long ms, long ls)
|
||||
: NetObj(s, n, ((ms>ls)?ms-ls:ls-ms) + 1),
|
||||
sig_next_(0), sig_prev_(0), type_(t),
|
||||
port_type_(NOT_A_PORT), signed_(false), msb_(ms), lsb_(ls),
|
||||
local_flag_(false), eref_count_(0), lref_count_(0)
|
||||
|
|
@ -294,7 +294,7 @@ NetNet::NetNet(NetScope*s, const string&n, Type t, long ms, long ls)
|
|||
}
|
||||
|
||||
for (unsigned idx = 0 ; idx < pin_count() ; idx += 1) {
|
||||
pin(idx).set_name("P", idx);
|
||||
pin(idx).set_name(perm_string::literal("P"), idx);
|
||||
pin(idx).set_dir(dir);
|
||||
pin(idx).set_init(init_value);
|
||||
}
|
||||
|
|
@ -526,30 +526,30 @@ const NetScope* NetProcTop::scope() const
|
|||
* ...
|
||||
*/
|
||||
|
||||
NetFF::NetFF(NetScope*s, const char*n, unsigned wid)
|
||||
: NetNode(s, lex_strings.add(n), 8 + 2*wid)
|
||||
NetFF::NetFF(NetScope*s, perm_string n, unsigned wid)
|
||||
: NetNode(s, n, 8 + 2*wid)
|
||||
{
|
||||
pin_Clock().set_dir(Link::INPUT);
|
||||
pin_Clock().set_name("Clock", 0);
|
||||
pin_Clock().set_name(perm_string::literal("Clock"), 0);
|
||||
pin_Enable().set_dir(Link::INPUT);
|
||||
pin_Enable().set_name("Enable", 0);
|
||||
pin_Enable().set_name(perm_string::literal("Enable"), 0);
|
||||
pin_Aload().set_dir(Link::INPUT);
|
||||
pin_Aload().set_name("Aload", 0);
|
||||
pin_Aload().set_name(perm_string::literal("Aload"), 0);
|
||||
pin_Aset().set_dir(Link::INPUT);
|
||||
pin_Aset().set_name("Aset", 0);
|
||||
pin_Aset().set_name(perm_string::literal("Aset"), 0);
|
||||
pin_Aclr().set_dir(Link::INPUT);
|
||||
pin_Aclr().set_name("Aclr", 0);
|
||||
pin_Aclr().set_name(perm_string::literal("Aclr"), 0);
|
||||
pin_Sload().set_dir(Link::INPUT);
|
||||
pin_Sload().set_name("Sload", 0);
|
||||
pin_Sload().set_name(perm_string::literal("Sload"), 0);
|
||||
pin_Sset().set_dir(Link::INPUT);
|
||||
pin_Sset().set_name("Sset", 0);
|
||||
pin_Sset().set_name(perm_string::literal("Sset"), 0);
|
||||
pin_Sclr().set_dir(Link::INPUT);
|
||||
pin_Sclr().set_name("Sclr", 0);
|
||||
pin_Sclr().set_name(perm_string::literal("Sclr"), 0);
|
||||
for (unsigned idx = 0 ; idx < wid ; idx += 1) {
|
||||
pin_Data(idx).set_dir(Link::INPUT);
|
||||
pin_Data(idx).set_name("Data", idx);
|
||||
pin_Data(idx).set_name(perm_string::literal("Data"), idx);
|
||||
pin_Q(idx).set_dir(Link::OUTPUT);
|
||||
pin_Q(idx).set_name("Q", idx);
|
||||
pin_Q(idx).set_name(perm_string::literal("Q"), idx);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -694,22 +694,28 @@ const verinum& NetFF::sset_value() const
|
|||
* 7 -- DataB[0]
|
||||
* 8 -- Result[0]
|
||||
*/
|
||||
NetAddSub::NetAddSub(NetScope*s, const string&n, unsigned w)
|
||||
: NetNode(s, lex_strings.add(n.c_str()), w*3+6)
|
||||
NetAddSub::NetAddSub(NetScope*s, perm_string n, unsigned w)
|
||||
: NetNode(s, n, w*3+6)
|
||||
{
|
||||
pin(0).set_dir(Link::INPUT); pin(0).set_name("Add_Sub", 0);
|
||||
pin(1).set_dir(Link::INPUT); pin(1).set_name("Aclr", 0);
|
||||
pin(2).set_dir(Link::INPUT); pin(2).set_name("Clock", 0);
|
||||
pin(3).set_dir(Link::INPUT); pin(3).set_name("Cin", 0);
|
||||
pin(4).set_dir(Link::OUTPUT); pin(4).set_name("Cout", 0);
|
||||
pin(5).set_dir(Link::OUTPUT); pin(5).set_name("Overflow", 0);
|
||||
pin(0).set_dir(Link::INPUT); pin(0).set_name(
|
||||
perm_string::literal("Add_Sub"), 0);
|
||||
pin(1).set_dir(Link::INPUT); pin(1).set_name(
|
||||
perm_string::literal("Aclr"), 0);
|
||||
pin(2).set_dir(Link::INPUT); pin(2).set_name(
|
||||
perm_string::literal("Clock"), 0);
|
||||
pin(3).set_dir(Link::INPUT); pin(3).set_name(
|
||||
perm_string::literal("Cin"), 0);
|
||||
pin(4).set_dir(Link::OUTPUT); pin(4).set_name(
|
||||
perm_string::literal("Cout"), 0);
|
||||
pin(5).set_dir(Link::OUTPUT); pin(5).set_name(
|
||||
perm_string::literal("Overflow"), 0);
|
||||
for (unsigned idx = 0 ; idx < w ; idx += 1) {
|
||||
pin_DataA(idx).set_dir(Link::INPUT);
|
||||
pin_DataB(idx).set_dir(Link::INPUT);
|
||||
pin_Result(idx).set_dir(Link::OUTPUT);
|
||||
pin_DataA(idx).set_name("DataA", idx);
|
||||
pin_DataB(idx).set_name("DataB", idx);
|
||||
pin_Result(idx).set_name("Result", idx);
|
||||
pin_DataA(idx).set_name(perm_string::literal("DataA"), idx);
|
||||
pin_DataB(idx).set_name(perm_string::literal("DataB"), idx);
|
||||
pin_Result(idx).set_name(perm_string::literal("Result"), idx);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -783,26 +789,29 @@ const Link& NetAddSub::pin_Result(unsigned idx) const
|
|||
* 3+W -- Result(0)
|
||||
* 3+2W -- Distance(0)
|
||||
*/
|
||||
NetCLShift::NetCLShift(NetScope*s, const string&n,
|
||||
NetCLShift::NetCLShift(NetScope*s, perm_string n,
|
||||
unsigned width, unsigned width_dist)
|
||||
: NetNode(s, lex_strings.add(n.c_str()), 3+2*width+width_dist),
|
||||
: NetNode(s, n, 3+2*width+width_dist),
|
||||
width_(width), width_dist_(width_dist)
|
||||
{
|
||||
pin(0).set_dir(Link::INPUT); pin(0).set_name("Direction", 0);
|
||||
pin(1).set_dir(Link::OUTPUT); pin(1).set_name("Underflow", 0);
|
||||
pin(2).set_dir(Link::OUTPUT); pin(2).set_name("Overflow", 0);
|
||||
pin(0).set_dir(Link::INPUT); pin(0).set_name(
|
||||
perm_string::literal("Direction"), 0);
|
||||
pin(1).set_dir(Link::OUTPUT); pin(1).set_name(
|
||||
perm_string::literal("Underflow"), 0);
|
||||
pin(2).set_dir(Link::OUTPUT); pin(2).set_name(
|
||||
perm_string::literal("Overflow"), 0);
|
||||
|
||||
for (unsigned idx = 0 ; idx < width_ ; idx += 1) {
|
||||
pin(3+idx).set_dir(Link::INPUT);
|
||||
pin(3+idx).set_name("Data", idx);
|
||||
pin(3+idx).set_name(perm_string::literal("Data"), idx);
|
||||
|
||||
pin(3+width_+idx).set_dir(Link::OUTPUT);
|
||||
pin(3+width_+idx).set_name("Result", idx);
|
||||
pin(3+width_+idx).set_name(perm_string::literal("Result"), idx);
|
||||
}
|
||||
|
||||
for (unsigned idx = 0 ; idx < width_dist_ ; idx += 1) {
|
||||
pin(3+2*width_+idx).set_dir(Link::INPUT);
|
||||
pin(3+2*width_+idx).set_name("Distance", idx);
|
||||
pin(3+2*width_+idx).set_name(perm_string::literal("Distance"), idx);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -886,23 +895,31 @@ const Link& NetCLShift::pin_Distance(unsigned idx) const
|
|||
return pin(3+2*width_+idx);
|
||||
}
|
||||
|
||||
NetCompare::NetCompare(NetScope*s, const string&n, unsigned wi)
|
||||
: NetNode(s, lex_strings.add(n.c_str()), 8+2*wi), width_(wi)
|
||||
NetCompare::NetCompare(NetScope*s, perm_string n, unsigned wi)
|
||||
: NetNode(s, n, 8+2*wi), width_(wi)
|
||||
{
|
||||
signed_flag_ = false;
|
||||
pin(0).set_dir(Link::INPUT); pin(0).set_name("Aclr");
|
||||
pin(1).set_dir(Link::INPUT); pin(1).set_name("Clock");
|
||||
pin(2).set_dir(Link::OUTPUT); pin(2).set_name("AGB");
|
||||
pin(3).set_dir(Link::OUTPUT); pin(3).set_name("AGEB");
|
||||
pin(4).set_dir(Link::OUTPUT); pin(4).set_name("AEB");
|
||||
pin(5).set_dir(Link::OUTPUT); pin(5).set_name("ANEB");
|
||||
pin(6).set_dir(Link::OUTPUT); pin(6).set_name("ALB");
|
||||
pin(7).set_dir(Link::OUTPUT); pin(7).set_name("ALEB");
|
||||
pin(0).set_dir(Link::INPUT); pin(0).set_name(
|
||||
perm_string::literal("Aclr"));
|
||||
pin(1).set_dir(Link::INPUT); pin(1).set_name(
|
||||
perm_string::literal("Clock"));
|
||||
pin(2).set_dir(Link::OUTPUT); pin(2).set_name(
|
||||
perm_string::literal("AGB"));
|
||||
pin(3).set_dir(Link::OUTPUT); pin(3).set_name(
|
||||
perm_string::literal("AGEB"));
|
||||
pin(4).set_dir(Link::OUTPUT); pin(4).set_name(
|
||||
perm_string::literal("AEB"));
|
||||
pin(5).set_dir(Link::OUTPUT); pin(5).set_name(
|
||||
perm_string::literal("ANEB"));
|
||||
pin(6).set_dir(Link::OUTPUT); pin(6).set_name(
|
||||
perm_string::literal("ALB"));
|
||||
pin(7).set_dir(Link::OUTPUT); pin(7).set_name(
|
||||
perm_string::literal("ALEB"));
|
||||
for (unsigned idx = 0 ; idx < width_ ; idx += 1) {
|
||||
pin(8+idx).set_dir(Link::INPUT);
|
||||
pin(8+idx).set_name("DataA", idx);
|
||||
pin(8+idx).set_name(perm_string::literal("DataA"), idx);
|
||||
pin(8+width_+idx).set_dir(Link::INPUT);
|
||||
pin(8+width_+idx).set_name("DataB", idx);
|
||||
pin(8+width_+idx).set_name(perm_string::literal("DataB"), idx);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1025,23 +1042,23 @@ const Link& NetCompare::pin_DataB(unsigned idx) const
|
|||
return pin(8+width_+idx);
|
||||
}
|
||||
|
||||
NetDivide::NetDivide(NetScope*sc, const string&n, unsigned wr,
|
||||
NetDivide::NetDivide(NetScope*sc, perm_string n, unsigned wr,
|
||||
unsigned wa, unsigned wb)
|
||||
: NetNode(sc, lex_strings.add(n.c_str()), wr+wa+wb),
|
||||
: NetNode(sc, n, wr+wa+wb),
|
||||
width_r_(wr), width_a_(wa), width_b_(wb)
|
||||
{
|
||||
unsigned p = 0;
|
||||
for (unsigned idx = 0 ; idx < width_r_ ; idx += 1, p += 1) {
|
||||
pin(p).set_dir(Link::OUTPUT);
|
||||
pin(p).set_name("Result", idx);
|
||||
pin(p).set_name(perm_string::literal("Result"), idx);
|
||||
}
|
||||
for (unsigned idx = 0 ; idx < width_a_ ; idx += 1, p += 1) {
|
||||
pin(p).set_dir(Link::INPUT);
|
||||
pin(p).set_name("DataA", idx);
|
||||
pin(p).set_name(perm_string::literal("DataA"), idx);
|
||||
}
|
||||
for (unsigned idx = 0 ; idx < width_b_ ; idx += 1, p += 1) {
|
||||
pin(p).set_dir(Link::INPUT);
|
||||
pin(p).set_name("DataB", idx);
|
||||
pin(p).set_name(perm_string::literal("DataB"), idx);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1100,31 +1117,31 @@ const Link& NetDivide::pin_DataB(unsigned idx) const
|
|||
return pin(idx+width_r_+width_a_);
|
||||
}
|
||||
|
||||
NetMult::NetMult(NetScope*sc, const string&n, unsigned wr,
|
||||
NetMult::NetMult(NetScope*sc, perm_string n, unsigned wr,
|
||||
unsigned wa, unsigned wb, unsigned ws)
|
||||
: NetNode(sc, lex_strings.add(n.c_str()), 2+wr+wa+wb+ws),
|
||||
: NetNode(sc, n, 2+wr+wa+wb+ws),
|
||||
signed_(false), width_r_(wr), width_a_(wa), width_b_(wb), width_s_(ws)
|
||||
{
|
||||
pin(0).set_dir(Link::INPUT); pin(0).set_name("Aclr", 0);
|
||||
pin(1).set_dir(Link::INPUT); pin(1).set_name("Clock", 0);
|
||||
pin(0).set_dir(Link::INPUT); pin(0).set_name(perm_string::literal("Aclr"), 0);
|
||||
pin(1).set_dir(Link::INPUT); pin(1).set_name(perm_string::literal("Clock"), 0);
|
||||
|
||||
|
||||
unsigned p = 2;
|
||||
for (unsigned idx = 0 ; idx < width_r_ ; idx += 1, p += 1) {
|
||||
pin(p).set_dir(Link::OUTPUT);
|
||||
pin(p).set_name("Result", idx);
|
||||
pin(p).set_name(perm_string::literal("Result"), idx);
|
||||
}
|
||||
for (unsigned idx = 0 ; idx < width_a_ ; idx += 1, p += 1) {
|
||||
pin(p).set_dir(Link::INPUT);
|
||||
pin(p).set_name("DataA", idx);
|
||||
pin(p).set_name(perm_string::literal("DataA"), idx);
|
||||
}
|
||||
for (unsigned idx = 0 ; idx < width_b_ ; idx += 1, p += 1) {
|
||||
pin(p).set_dir(Link::INPUT);
|
||||
pin(p).set_name("DataB", idx);
|
||||
pin(p).set_name(perm_string::literal("DataB"), idx);
|
||||
}
|
||||
for (unsigned idx = 0 ; idx < width_s_ ; idx += 1, p += 1) {
|
||||
pin(p).set_dir(Link::INPUT);
|
||||
pin(p).set_name("Sum", idx);
|
||||
pin(p).set_name(perm_string::literal("Sum"), idx);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1239,27 +1256,27 @@ const Link& NetMult::pin_Sum(unsigned idx) const
|
|||
* 2+N -- Result[N]
|
||||
*/
|
||||
|
||||
NetMux::NetMux(NetScope*s, const string&n,
|
||||
NetMux::NetMux(NetScope*s, perm_string n,
|
||||
unsigned wi, unsigned si, unsigned sw)
|
||||
: NetNode(s, lex_strings.add(n.c_str()), 2+wi+sw+wi*si),
|
||||
: NetNode(s, n, 2+wi+sw+wi*si),
|
||||
width_(wi), size_(si), swidth_(sw)
|
||||
{
|
||||
pin(0).set_dir(Link::INPUT); pin(0).set_name("Aclr", 0);
|
||||
pin(1).set_dir(Link::INPUT); pin(1).set_name("Clock", 0);
|
||||
pin(0).set_dir(Link::INPUT); pin(0).set_name(perm_string::literal("Aclr"), 0);
|
||||
pin(1).set_dir(Link::INPUT); pin(1).set_name(perm_string::literal("Clock"), 0);
|
||||
|
||||
for (unsigned idx = 0 ; idx < width_ ; idx += 1) {
|
||||
pin_Result(idx).set_dir(Link::OUTPUT);
|
||||
pin_Result(idx).set_name("Result", idx);
|
||||
pin_Result(idx).set_name(perm_string::literal("Result"), idx);
|
||||
|
||||
for (unsigned jdx = 0 ; jdx < size_ ; jdx += 1) {
|
||||
pin_Data(idx,jdx).set_dir(Link::INPUT);
|
||||
pin_Data(idx,jdx).set_name("Data", jdx*width_+idx);
|
||||
pin_Data(idx,jdx).set_name(perm_string::literal("Data"), jdx*width_+idx);
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned idx = 0 ; idx < swidth_ ; idx += 1) {
|
||||
pin_Sel(idx).set_dir(Link::INPUT);
|
||||
pin_Sel(idx).set_name("Sel", idx);
|
||||
pin_Sel(idx).set_name(perm_string::literal("Sel"), idx);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1341,27 +1358,27 @@ const Link& NetMux::pin_Data(unsigned w, unsigned s) const
|
|||
}
|
||||
|
||||
|
||||
NetRamDq::NetRamDq(NetScope*s, const string&n, NetMemory*mem, unsigned awid)
|
||||
: NetNode(s, lex_strings.add(n.c_str()), 3+2*mem->width()+awid),
|
||||
NetRamDq::NetRamDq(NetScope*s, perm_string n, NetMemory*mem, unsigned awid)
|
||||
: NetNode(s, n, 3+2*mem->width()+awid),
|
||||
mem_(mem), awidth_(awid)
|
||||
{
|
||||
pin(0).set_dir(Link::INPUT); pin(0).set_name("InClock", 0);
|
||||
pin(1).set_dir(Link::INPUT); pin(1).set_name("OutClock", 0);
|
||||
pin(2).set_dir(Link::INPUT); pin(2).set_name("WE", 0);
|
||||
pin(0).set_dir(Link::INPUT); pin(0).set_name(perm_string::literal("InClock"), 0);
|
||||
pin(1).set_dir(Link::INPUT); pin(1).set_name(perm_string::literal("OutClock"), 0);
|
||||
pin(2).set_dir(Link::INPUT); pin(2).set_name(perm_string::literal("WE"), 0);
|
||||
|
||||
for (unsigned idx = 0 ; idx < awidth_ ; idx += 1) {
|
||||
pin(3+idx).set_dir(Link::INPUT);
|
||||
pin(3+idx).set_name("Address", idx);
|
||||
pin(3+idx).set_name(perm_string::literal("Address"), idx);
|
||||
}
|
||||
|
||||
for (unsigned idx = 0 ; idx < width() ; idx += 1) {
|
||||
pin(3+awidth_+idx).set_dir(Link::INPUT);
|
||||
pin(3+awidth_+idx).set_name("Data", idx);
|
||||
pin(3+awidth_+idx).set_name(perm_string::literal("Data"), idx);
|
||||
}
|
||||
|
||||
for (unsigned idx = 0 ; idx < width() ; idx += 1) {
|
||||
pin(3+awidth_+width()+idx).set_dir(Link::OUTPUT);
|
||||
pin(3+awidth_+width()+idx).set_name("Q", idx);
|
||||
pin(3+awidth_+width()+idx).set_name(perm_string::literal("Q"), idx);
|
||||
}
|
||||
|
||||
next_ = mem_->ram_list_;
|
||||
|
|
@ -1546,13 +1563,13 @@ const Link& NetRamDq::pin_Q(unsigned idx) const
|
|||
return pin(3+awidth_+width()+idx);
|
||||
}
|
||||
|
||||
NetBUFZ::NetBUFZ(NetScope*s, const string&n)
|
||||
: NetNode(s, lex_strings.add(n.c_str()), 2)
|
||||
NetBUFZ::NetBUFZ(NetScope*s, perm_string n)
|
||||
: NetNode(s, n, 2)
|
||||
{
|
||||
pin(0).set_dir(Link::OUTPUT);
|
||||
pin(1).set_dir(Link::INPUT);
|
||||
pin(0).set_name("O", 0);
|
||||
pin(1).set_name("I", 0);
|
||||
pin(0).set_name(perm_string::literal("O"), 0);
|
||||
pin(1).set_name(perm_string::literal("I"), 0);
|
||||
}
|
||||
|
||||
NetBUFZ::~NetBUFZ()
|
||||
|
|
@ -1560,12 +1577,12 @@ NetBUFZ::~NetBUFZ()
|
|||
}
|
||||
|
||||
|
||||
NetCaseCmp::NetCaseCmp(NetScope*s, const string&n)
|
||||
: NetNode(s, lex_strings.add(n.c_str()), 3)
|
||||
NetCaseCmp::NetCaseCmp(NetScope*s, perm_string n)
|
||||
: NetNode(s, n, 3)
|
||||
{
|
||||
pin(0).set_dir(Link::OUTPUT); pin(0).set_name("O",0);
|
||||
pin(1).set_dir(Link::INPUT); pin(1).set_name("I",0);
|
||||
pin(2).set_dir(Link::INPUT); pin(2).set_name("I",1);
|
||||
pin(0).set_dir(Link::OUTPUT); pin(0).set_name(perm_string::literal("O"),0);
|
||||
pin(1).set_dir(Link::INPUT); pin(1).set_name(perm_string::literal("I"),0);
|
||||
pin(2).set_dir(Link::INPUT); pin(2).set_name(perm_string::literal("I"),1);
|
||||
}
|
||||
|
||||
NetCaseCmp::~NetCaseCmp()
|
||||
|
|
@ -1610,22 +1627,22 @@ NetProc* NetCondit::else_clause()
|
|||
return else_;
|
||||
}
|
||||
|
||||
NetConst::NetConst(NetScope*s, const string&n, verinum::V v)
|
||||
: NetNode(s, lex_strings.add(n.c_str()), 1)
|
||||
NetConst::NetConst(NetScope*s, perm_string n, verinum::V v)
|
||||
: NetNode(s, n, 1)
|
||||
{
|
||||
pin(0).set_dir(Link::OUTPUT);
|
||||
pin(0).set_name("O", 0);
|
||||
pin(0).set_name(perm_string::literal("O"), 0);
|
||||
value_ = new verinum::V[1];
|
||||
value_[0] = v;
|
||||
}
|
||||
|
||||
NetConst::NetConst(NetScope*s, const string&n, const verinum&val)
|
||||
: NetNode(s, lex_strings.add(n.c_str()), val.len())
|
||||
NetConst::NetConst(NetScope*s, perm_string n, const verinum&val)
|
||||
: NetNode(s, n, val.len())
|
||||
{
|
||||
value_ = new verinum::V[pin_count()];
|
||||
for (unsigned idx = 0 ; idx < pin_count() ; idx += 1) {
|
||||
pin(idx).set_dir(Link::OUTPUT);
|
||||
pin(idx).set_name("O", idx);
|
||||
pin(idx).set_name(perm_string::literal("O"), idx);
|
||||
value_[idx] = val.get(idx);
|
||||
}
|
||||
}
|
||||
|
|
@ -1909,7 +1926,7 @@ NetEMemory::~NetEMemory()
|
|||
{
|
||||
}
|
||||
|
||||
const string NetEMemory::name() const
|
||||
perm_string NetEMemory::name() const
|
||||
{
|
||||
return mem_->name();
|
||||
}
|
||||
|
|
@ -1919,10 +1936,10 @@ const NetExpr* NetEMemory::index() const
|
|||
return idx_;
|
||||
}
|
||||
|
||||
NetMemory::NetMemory(NetScope*sc, const string&n, long w, long s, long e)
|
||||
NetMemory::NetMemory(NetScope*sc, perm_string n, long w, long s, long e)
|
||||
: width_(w), idxh_(s), idxl_(e), ram_list_(0), scope_(sc)
|
||||
{
|
||||
name_ = strdup(n.c_str());
|
||||
name_ = n;
|
||||
scope_->add_memory(this);
|
||||
}
|
||||
|
||||
|
|
@ -1930,7 +1947,6 @@ NetMemory::~NetMemory()
|
|||
{
|
||||
assert(scope_);
|
||||
scope_->rem_memory(this);
|
||||
free(name_);
|
||||
}
|
||||
|
||||
unsigned NetMemory::count() const
|
||||
|
|
@ -1941,7 +1957,7 @@ unsigned NetMemory::count() const
|
|||
return idxh_ - idxl_ + 1;
|
||||
}
|
||||
|
||||
const char* NetMemory::name() const
|
||||
perm_string NetMemory::name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
|
@ -2017,7 +2033,7 @@ NetESignal::~NetESignal()
|
|||
net_->decr_eref();
|
||||
}
|
||||
|
||||
string NetESignal::name() const
|
||||
perm_string NetESignal::name() const
|
||||
{
|
||||
return net_->name();
|
||||
}
|
||||
|
|
@ -2061,7 +2077,7 @@ NetEBitSel::~NetEBitSel()
|
|||
delete idx_;
|
||||
}
|
||||
|
||||
string NetEBitSel::name() const
|
||||
perm_string NetEBitSel::name() const
|
||||
{
|
||||
return sig_->name();
|
||||
}
|
||||
|
|
@ -2152,14 +2168,14 @@ NetEUReduce::~NetEUReduce()
|
|||
{
|
||||
}
|
||||
|
||||
NetLogic::NetLogic(NetScope*s, const string&n, unsigned pins, TYPE t)
|
||||
: NetNode(s, lex_strings.add(n.c_str()), pins), type_(t)
|
||||
NetLogic::NetLogic(NetScope*s, perm_string n, unsigned pins, TYPE t)
|
||||
: NetNode(s, n, pins), type_(t)
|
||||
{
|
||||
pin(0).set_dir(Link::OUTPUT);
|
||||
pin(0).set_name("O", 0);
|
||||
pin(0).set_name(perm_string::literal("O"), 0);
|
||||
for (unsigned idx = 1 ; idx < pins ; idx += 1) {
|
||||
pin(idx).set_dir(Link::INPUT);
|
||||
pin(idx).set_name("I", idx-1);
|
||||
pin(idx).set_name(perm_string::literal("I"), idx-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2202,6 +2218,9 @@ const NetProc*NetTaskDef::proc() const
|
|||
|
||||
/*
|
||||
* $Log: netlist.cc,v $
|
||||
* Revision 1.221 2004/02/18 17:11:56 steve
|
||||
* Use perm_strings for named langiage items.
|
||||
*
|
||||
* Revision 1.220 2003/11/10 19:44:30 steve
|
||||
* Fix return value warnings.
|
||||
*
|
||||
|
|
@ -2221,24 +2240,5 @@ const NetProc*NetTaskDef::proc() const
|
|||
* More complete bit range internal error message,
|
||||
* Better test of part select ranges on non-zero
|
||||
* signal ranges.
|
||||
*
|
||||
* Revision 1.214 2003/04/27 16:33:16 steve
|
||||
* Better guess of defualt ternary width.
|
||||
*
|
||||
* Revision 1.213 2003/04/24 05:26:25 steve
|
||||
* NetSubsignal inherits port type from source.
|
||||
*
|
||||
* Revision 1.212 2003/04/22 04:48:29 steve
|
||||
* Support event names as expressions elements.
|
||||
*
|
||||
* Revision 1.211 2003/04/11 05:18:08 steve
|
||||
* Handle signed magnitude compare all the
|
||||
* way through to the vvp code generator.
|
||||
*
|
||||
* Revision 1.210 2003/03/29 05:51:25 steve
|
||||
* Sign extend NetMult inputs if result is signed.
|
||||
*
|
||||
* Revision 1.209 2003/03/15 18:08:43 steve
|
||||
* Comparison operators do have defined width.
|
||||
*/
|
||||
|
||||
|
|
|
|||
105
netlist.h
105
netlist.h
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: netlist.h,v 1.307 2003/12/17 16:52:39 steve Exp $"
|
||||
#ident "$Id: netlist.h,v 1.308 2004/02/18 17:11:57 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -33,6 +33,7 @@
|
|||
# include <list>
|
||||
# include "verinum.h"
|
||||
# include "verireal.h"
|
||||
# include "StringHeap.h"
|
||||
# include "HName.h"
|
||||
# include "LineInfo.h"
|
||||
# include "svector.h"
|
||||
|
|
@ -88,13 +89,13 @@ class NetObj : public Attrib, public virtual LineInfo {
|
|||
public:
|
||||
// The name of the object must be a permallocated string. A
|
||||
// lex_strings string, for example.
|
||||
explicit NetObj(NetScope*s, const char*n, unsigned npins);
|
||||
explicit NetObj(NetScope*s, perm_string n, unsigned npins);
|
||||
virtual ~NetObj();
|
||||
|
||||
NetScope* scope();
|
||||
const NetScope* scope() const;
|
||||
|
||||
const char* name() const { return name_; }
|
||||
perm_string name() const { return name_; }
|
||||
|
||||
unsigned pin_count() const { return npins_; }
|
||||
|
||||
|
|
@ -114,7 +115,7 @@ class NetObj : public Attrib, public virtual LineInfo {
|
|||
|
||||
private:
|
||||
NetScope*scope_;
|
||||
const char* name_;
|
||||
perm_string name_;
|
||||
Link*pins_;
|
||||
const unsigned npins_;
|
||||
unsigned delay1_;
|
||||
|
|
@ -192,8 +193,8 @@ class Link {
|
|||
// A link of an object (sometimes called a "pin") has a
|
||||
// name. It is convenient for the name to have a string and an
|
||||
// integer part.
|
||||
void set_name(const string&, unsigned inst =0);
|
||||
const string& get_name() const;
|
||||
void set_name(perm_string, unsigned inst =0);
|
||||
perm_string get_name() const;
|
||||
unsigned get_inst() const;
|
||||
|
||||
private:
|
||||
|
|
@ -209,8 +210,8 @@ class Link {
|
|||
// These members name the pin of the link. If the name
|
||||
// has width, then the inst_ member is the index of the
|
||||
// pin.
|
||||
string name_;
|
||||
unsigned inst_;
|
||||
perm_string name_;
|
||||
unsigned inst_;
|
||||
|
||||
private:
|
||||
Link *next_;
|
||||
|
|
@ -323,7 +324,7 @@ class NetNode : public NetObj {
|
|||
|
||||
public:
|
||||
// The name parameter must be a permallocated string.
|
||||
explicit NetNode(NetScope*s, const char*n, unsigned npins);
|
||||
explicit NetNode(NetScope*s, perm_string n, unsigned npins);
|
||||
|
||||
virtual ~NetNode();
|
||||
|
||||
|
|
@ -367,9 +368,9 @@ class NetNet : public NetObj {
|
|||
|
||||
enum PortType { NOT_A_PORT, PIMPLICIT, PINPUT, POUTPUT, PINOUT };
|
||||
|
||||
explicit NetNet(NetScope*s, const string&n, Type t, unsigned npins =1);
|
||||
explicit NetNet(NetScope*s, perm_string n, Type t, unsigned npins =1);
|
||||
|
||||
explicit NetNet(NetScope*s, const string&n, Type t, long ms, long ls);
|
||||
explicit NetNet(NetScope*s, perm_string n, Type t, long ms, long ls);
|
||||
|
||||
virtual ~NetNet();
|
||||
|
||||
|
|
@ -456,7 +457,7 @@ class NetNet : public NetObj {
|
|||
class NetAddSub : public NetNode {
|
||||
|
||||
public:
|
||||
NetAddSub(NetScope*s, const string&n, unsigned width);
|
||||
NetAddSub(NetScope*s, perm_string n, unsigned width);
|
||||
~NetAddSub();
|
||||
|
||||
// Get the width of the device (that is, the width of the
|
||||
|
|
@ -490,7 +491,7 @@ class NetAddSub : public NetNode {
|
|||
class NetCLShift : public NetNode {
|
||||
|
||||
public:
|
||||
NetCLShift(NetScope*s, const string&n, unsigned width,
|
||||
NetCLShift(NetScope*s, perm_string n, unsigned width,
|
||||
unsigned width_dist);
|
||||
~NetCLShift();
|
||||
|
||||
|
|
@ -533,7 +534,7 @@ class NetCLShift : public NetNode {
|
|||
class NetCompare : public NetNode {
|
||||
|
||||
public:
|
||||
NetCompare(NetScope*scope, const string&n, unsigned width);
|
||||
NetCompare(NetScope*scope, perm_string n, unsigned width);
|
||||
~NetCompare();
|
||||
|
||||
unsigned width() const;
|
||||
|
|
@ -587,7 +588,7 @@ class NetCompare : public NetNode {
|
|||
class NetDivide : public NetNode {
|
||||
|
||||
public:
|
||||
NetDivide(NetScope*scope, const string&n,
|
||||
NetDivide(NetScope*scope, perm_string n,
|
||||
unsigned width, unsigned wa, unsigned wb);
|
||||
~NetDivide();
|
||||
|
||||
|
|
@ -626,7 +627,7 @@ class NetDivide : public NetNode {
|
|||
class NetModulo : public NetNode {
|
||||
|
||||
public:
|
||||
NetModulo(NetScope*s, const string&n,
|
||||
NetModulo(NetScope*s, perm_string n,
|
||||
unsigned width, unsigned wa, unsigned wb);
|
||||
~NetModulo();
|
||||
|
||||
|
|
@ -659,7 +660,7 @@ class NetModulo : public NetNode {
|
|||
class NetFF : public NetNode {
|
||||
|
||||
public:
|
||||
NetFF(NetScope*s, const char*n, unsigned width);
|
||||
NetFF(NetScope*s, perm_string n, unsigned width);
|
||||
~NetFF();
|
||||
|
||||
unsigned width() const;
|
||||
|
|
@ -711,12 +712,12 @@ class NetFF : public NetNode {
|
|||
class NetMemory {
|
||||
|
||||
public:
|
||||
NetMemory(NetScope*sc, const string&n, long w, long s, long e);
|
||||
NetMemory(NetScope*sc, perm_string n, long w, long s, long e);
|
||||
~NetMemory();
|
||||
|
||||
// This is the BASE name of the memory object. It does not
|
||||
// include scope name, get that from the scope itself.
|
||||
const char*name() const;
|
||||
perm_string name() const;
|
||||
|
||||
// This is the width (in bits) of a single memory position.
|
||||
unsigned width() const { return width_; }
|
||||
|
|
@ -735,7 +736,7 @@ class NetMemory {
|
|||
void dump(ostream&o, unsigned lm) const;
|
||||
|
||||
private:
|
||||
char* name_;
|
||||
perm_string name_;
|
||||
unsigned width_;
|
||||
long idxh_;
|
||||
long idxl_;
|
||||
|
|
@ -763,7 +764,7 @@ class NetMemory {
|
|||
class NetMult : public NetNode {
|
||||
|
||||
public:
|
||||
NetMult(NetScope*sc, const string&n, unsigned width,
|
||||
NetMult(NetScope*sc, perm_string n, unsigned width,
|
||||
unsigned wa, unsigned wb, unsigned width_s =0);
|
||||
~NetMult();
|
||||
|
||||
|
|
@ -819,7 +820,7 @@ class NetMult : public NetNode {
|
|||
class NetMux : public NetNode {
|
||||
|
||||
public:
|
||||
NetMux(NetScope*scope, const string&n,
|
||||
NetMux(NetScope*scope, perm_string n,
|
||||
unsigned width, unsigned size, unsigned selw);
|
||||
~NetMux();
|
||||
|
||||
|
|
@ -860,7 +861,7 @@ class NetMux : public NetNode {
|
|||
class NetRamDq : public NetNode {
|
||||
|
||||
public:
|
||||
NetRamDq(NetScope*s, const string&name, NetMemory*mem, unsigned awid);
|
||||
NetRamDq(NetScope*s, perm_string name, NetMemory*mem, unsigned awid);
|
||||
~NetRamDq();
|
||||
|
||||
unsigned width() const;
|
||||
|
|
@ -910,7 +911,7 @@ class NetRamDq : public NetNode {
|
|||
class NetUserFunc : public NetNode {
|
||||
|
||||
public:
|
||||
NetUserFunc(NetScope*s, const char*n, NetScope*def);
|
||||
NetUserFunc(NetScope*s, perm_string n, NetScope*def);
|
||||
~NetUserFunc();
|
||||
|
||||
unsigned port_count() const;
|
||||
|
|
@ -1133,7 +1134,7 @@ class NetSubnet : public NetNet {
|
|||
class NetBUFZ : public NetNode {
|
||||
|
||||
public:
|
||||
explicit NetBUFZ(NetScope*s, const string&n);
|
||||
explicit NetBUFZ(NetScope*s, perm_string n);
|
||||
~NetBUFZ();
|
||||
|
||||
virtual void dump_node(ostream&, unsigned ind) const;
|
||||
|
|
@ -1154,7 +1155,7 @@ class NetBUFZ : public NetNode {
|
|||
class NetCaseCmp : public NetNode {
|
||||
|
||||
public:
|
||||
explicit NetCaseCmp(NetScope*s, const string&n);
|
||||
explicit NetCaseCmp(NetScope*s, perm_string n);
|
||||
~NetCaseCmp();
|
||||
|
||||
virtual void dump_node(ostream&, unsigned ind) const;
|
||||
|
|
@ -1172,8 +1173,8 @@ class NetCaseCmp : public NetNode {
|
|||
class NetConst : public NetNode {
|
||||
|
||||
public:
|
||||
explicit NetConst(NetScope*s, const string&n, verinum::V v);
|
||||
explicit NetConst(NetScope*s, const string&n, const verinum&val);
|
||||
explicit NetConst(NetScope*s, perm_string n, verinum::V v);
|
||||
explicit NetConst(NetScope*s, perm_string n, const verinum&val);
|
||||
~NetConst();
|
||||
|
||||
verinum::V value(unsigned idx) const;
|
||||
|
|
@ -1207,7 +1208,7 @@ class NetLogic : public NetNode {
|
|||
NOTIF0, NOTIF1, OR, PULLDOWN, PULLUP, RNMOS, RPMOS,
|
||||
PMOS, XNOR, XOR };
|
||||
|
||||
explicit NetLogic(NetScope*s, const string&n, unsigned pins, TYPE t);
|
||||
explicit NetLogic(NetScope*s, perm_string n, unsigned pins, TYPE t);
|
||||
|
||||
TYPE type() const { return type_; }
|
||||
|
||||
|
|
@ -1272,7 +1273,7 @@ class NetLogic : public NetNode {
|
|||
class NetUDP : public NetNode {
|
||||
|
||||
public:
|
||||
explicit NetUDP(NetScope*s, const string&n, unsigned pins, PUdp*u);
|
||||
explicit NetUDP(NetScope*s, perm_string n, unsigned pins, PUdp*u);
|
||||
|
||||
virtual bool emit_node(struct target_t*) const;
|
||||
virtual void dump_node(ostream&, unsigned ind) const;
|
||||
|
|
@ -1287,7 +1288,7 @@ class NetUDP : public NetNode {
|
|||
|
||||
unsigned nin() const { return pin_count()-1; }
|
||||
bool is_sequential() const { return udp->sequential; }
|
||||
string udp_name() const { return udp->name_; }
|
||||
perm_string udp_name() const { return udp->name_; }
|
||||
char get_initial() const;
|
||||
|
||||
private:
|
||||
|
|
@ -1409,7 +1410,7 @@ class NetAssign_ {
|
|||
unsigned lwidth() const;
|
||||
|
||||
// Get the name of the underlying object.
|
||||
const char*name() const;
|
||||
perm_string name() const;
|
||||
|
||||
NetNet* sig() const;
|
||||
NetMemory*mem() const;
|
||||
|
|
@ -1613,7 +1614,7 @@ class NetCase : public NetProc {
|
|||
class NetCAssign : public NetProc, public NetNode {
|
||||
|
||||
public:
|
||||
explicit NetCAssign(NetScope*s, const string&n, NetNet*l);
|
||||
explicit NetCAssign(NetScope*s, perm_string n, NetNet*l);
|
||||
~NetCAssign();
|
||||
|
||||
const Link& lval_pin(unsigned) const;
|
||||
|
|
@ -1910,7 +1911,7 @@ class NetEvProbe : public NetNode {
|
|||
public:
|
||||
enum edge_t { ANYEDGE, POSEDGE, NEGEDGE };
|
||||
|
||||
explicit NetEvProbe(NetScope*s, const string&n,
|
||||
explicit NetEvProbe(NetScope*s, perm_string n,
|
||||
NetEvent*tgt, edge_t t, unsigned p);
|
||||
~NetEvProbe();
|
||||
|
||||
|
|
@ -1943,7 +1944,7 @@ class NetEvProbe : public NetNode {
|
|||
class NetForce : public NetProc, public NetNode {
|
||||
|
||||
public:
|
||||
explicit NetForce(NetScope*s, const string&n, NetNet*l);
|
||||
explicit NetForce(NetScope*s, perm_string n, NetNet*l);
|
||||
~NetForce();
|
||||
|
||||
const Link& lval_pin(unsigned) const;
|
||||
|
|
@ -2886,7 +2887,7 @@ class NetEMemory : public NetExpr {
|
|||
NetEMemory(NetMemory*mem, NetExpr*idx =0);
|
||||
virtual ~NetEMemory();
|
||||
|
||||
const string name () const;
|
||||
perm_string name () const;
|
||||
const NetExpr* index() const;
|
||||
|
||||
virtual bool set_width(unsigned);
|
||||
|
|
@ -2923,7 +2924,7 @@ class NetESignal : public NetExpr {
|
|||
NetESignal(NetNet*n, unsigned msi, unsigned lsi);
|
||||
~NetESignal();
|
||||
|
||||
string name() const;
|
||||
perm_string name() const;
|
||||
virtual bool set_width(unsigned);
|
||||
|
||||
virtual NetESignal* dup_expr() const;
|
||||
|
|
@ -2962,7 +2963,7 @@ class NetEBitSel : public NetExpr {
|
|||
NetEBitSel(NetESignal*sig, NetExpr*ex);
|
||||
~NetEBitSel();
|
||||
|
||||
string name() const;
|
||||
perm_string name() const;
|
||||
const NetExpr*index() const { return idx_; }
|
||||
|
||||
virtual bool set_width(unsigned);
|
||||
|
|
@ -2994,7 +2995,7 @@ class NetScope : public Attrib {
|
|||
|
||||
/* Create a new scope, and attach it to the given parent. The
|
||||
name is expected to have been permallocated. */
|
||||
NetScope(NetScope*up, const char*name, TYPE t);
|
||||
NetScope(NetScope*up, perm_string name, TYPE t);
|
||||
~NetScope();
|
||||
|
||||
/* Parameters exist within a scope, and these methods allow
|
||||
|
|
@ -3034,7 +3035,7 @@ class NetScope : public Attrib {
|
|||
void add_signal(NetNet*);
|
||||
void rem_signal(NetNet*);
|
||||
|
||||
NetNet* find_signal(const string&name);
|
||||
NetNet* find_signal(const char*name);
|
||||
NetNet* find_signal_in_child(const hname_t&name);
|
||||
|
||||
|
||||
|
|
@ -3050,22 +3051,25 @@ class NetScope : public Attrib {
|
|||
/* The parent and child() methods allow users of NetScope
|
||||
objects to locate nearby scopes. */
|
||||
NetScope* parent();
|
||||
NetScope* child(const string&name);
|
||||
NetScope* child(const char*name);
|
||||
const NetScope* parent() const;
|
||||
const NetScope* child(const string&name) const;
|
||||
const NetScope* child(const char*name) const;
|
||||
|
||||
TYPE type() const;
|
||||
|
||||
void set_task_def(NetTaskDef*);
|
||||
void set_func_def(NetFuncDef*);
|
||||
void set_module_name(const char*);
|
||||
void set_module_name(perm_string);
|
||||
|
||||
NetTaskDef* task_def();
|
||||
NetFuncDef* func_def();
|
||||
|
||||
const NetTaskDef* task_def() const;
|
||||
const NetFuncDef* func_def() const;
|
||||
const char*module_name() const;
|
||||
|
||||
/* If the scope represents a module instance, the module_name
|
||||
is the name of the module itself. */
|
||||
perm_string module_name() const;
|
||||
|
||||
/* Scopes have their own time units and time precision. The
|
||||
unit and precision are given as power of 10, i.e., -3 is
|
||||
|
|
@ -3084,7 +3088,7 @@ class NetScope : public Attrib {
|
|||
/* The name of the scope is the fully qualified hierarchical
|
||||
name, whereas the basename is just my name within my parent
|
||||
scope. */
|
||||
const char* basename() const;
|
||||
perm_string basename() const;
|
||||
string name() const;
|
||||
|
||||
void run_defparams(class Design*);
|
||||
|
|
@ -3092,7 +3096,7 @@ class NetScope : public Attrib {
|
|||
|
||||
/* This method generates a non-hierarchical name that is
|
||||
guaranteed to be unique within this scope. */
|
||||
string local_symbol();
|
||||
perm_string local_symbol();
|
||||
/* This method generates a hierarchical name that is
|
||||
guaranteed to be unique globally. */
|
||||
string local_hsymbol();
|
||||
|
|
@ -3126,7 +3130,7 @@ class NetScope : public Attrib {
|
|||
|
||||
private:
|
||||
TYPE type_;
|
||||
const char* name_;
|
||||
perm_string name_;
|
||||
|
||||
signed char time_unit_, time_prec_;
|
||||
|
||||
|
|
@ -3135,10 +3139,10 @@ class NetScope : public Attrib {
|
|||
NetNet *signals_;
|
||||
NetMemory*memories_;
|
||||
|
||||
perm_string module_name_;
|
||||
union {
|
||||
NetTaskDef*task_;
|
||||
NetFuncDef*func_;
|
||||
const char*module_name_;
|
||||
};
|
||||
|
||||
NetScope*up_;
|
||||
|
|
@ -3170,7 +3174,7 @@ class Design {
|
|||
|
||||
const char* get_flag(const string&key) const;
|
||||
|
||||
NetScope* make_root_scope(const char*name);
|
||||
NetScope* make_root_scope(perm_string name);
|
||||
NetScope* find_root_scope();
|
||||
list<NetScope*> find_root_scopes();
|
||||
|
||||
|
|
@ -3311,6 +3315,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
|
|||
|
||||
/*
|
||||
* $Log: netlist.h,v $
|
||||
* Revision 1.308 2004/02/18 17:11:57 steve
|
||||
* Use perm_strings for named langiage items.
|
||||
*
|
||||
* Revision 1.307 2003/12/17 16:52:39 steve
|
||||
* Debug dumps for synth2.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: netmisc.cc,v 1.6 2003/03/06 00:28:42 steve Exp $"
|
||||
#ident "$Id: netmisc.cc,v 1.7 2004/02/18 17:11:57 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -37,7 +37,7 @@ NetNet* add_to_net(Design*des, NetNet*sig, long val)
|
|||
|
||||
verinum val_v (abs_val, width);
|
||||
|
||||
NetConst*val_c = new NetConst(scope, scope->local_hsymbol(), val_v);
|
||||
NetConst*val_c = new NetConst(scope, scope->local_symbol(), val_v);
|
||||
|
||||
NetNet*val_s = new NetNet(scope, scope->local_symbol(),
|
||||
NetNet::IMPLICIT, width);
|
||||
|
|
@ -90,6 +90,9 @@ NetExpr* elab_and_eval(Design*des, NetScope*scope, const PExpr*pe)
|
|||
|
||||
/*
|
||||
* $Log: netmisc.cc,v $
|
||||
* Revision 1.7 2004/02/18 17:11:57 steve
|
||||
* Use perm_strings for named langiage items.
|
||||
*
|
||||
* Revision 1.6 2003/03/06 00:28:42 steve
|
||||
* All NetObj objects have lex_string base names.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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: pad_to_width.cc,v 1.14 2003/03/06 00:28:42 steve Exp $"
|
||||
#ident "$Id: pad_to_width.cc,v 1.15 2004/02/18 17:11:57 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -80,9 +80,7 @@ NetNet*pad_to_width(Design*des, NetNet*net, unsigned wid)
|
|||
return net;
|
||||
|
||||
verinum pad(verinum::V0, wid - net->pin_count());
|
||||
NetConst*con = new NetConst(scope,
|
||||
path + "." + scope->local_symbol(),
|
||||
pad);
|
||||
NetConst*con = new NetConst(scope, scope->local_symbol(), pad);
|
||||
des->add_node(con);
|
||||
|
||||
NetNet*tmp = new NetNet(scope, scope->local_symbol(),
|
||||
|
|
@ -99,6 +97,9 @@ NetNet*pad_to_width(Design*des, NetNet*net, unsigned wid)
|
|||
|
||||
/*
|
||||
* $Log: pad_to_width.cc,v $
|
||||
* Revision 1.15 2004/02/18 17:11:57 steve
|
||||
* Use perm_strings for named langiage items.
|
||||
*
|
||||
* Revision 1.14 2003/03/06 00:28:42 steve
|
||||
* All NetObj objects have lex_string base names.
|
||||
*
|
||||
|
|
@ -121,27 +122,5 @@ NetNet*pad_to_width(Design*des, NetNet*net, unsigned wid)
|
|||
* Revision 1.8 2001/07/25 03:10:49 steve
|
||||
* Create a config.h.in file to hold all the config
|
||||
* junk, and support gcc 3.0. (Stephan Boettcher)
|
||||
*
|
||||
* Revision 1.7 2001/02/16 03:25:09 steve
|
||||
* Missing . in names generated from scope locals.
|
||||
*
|
||||
* Revision 1.6 2001/02/15 06:59:36 steve
|
||||
* FreeBSD port has a maintainer now.
|
||||
*
|
||||
* Revision 1.5 2000/05/02 00:58:12 steve
|
||||
* Move signal tables to the NetScope class.
|
||||
*
|
||||
* Revision 1.4 2000/02/23 02:56:55 steve
|
||||
* Macintosh compilers do not support ident.
|
||||
*
|
||||
* Revision 1.3 2000/02/16 03:58:27 steve
|
||||
* Fix up width matching in structural bitwise operators.
|
||||
*
|
||||
* Revision 1.2 2000/01/01 06:17:25 steve
|
||||
* Propogate line number information when expanding expressions.
|
||||
*
|
||||
* Revision 1.1 1999/09/29 00:42:51 steve
|
||||
* Allow expanding of additive operators.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
|||
24
parse.y
24
parse.y
|
|
@ -19,12 +19,13 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: parse.y,v 1.189 2004/02/15 17:48:16 steve Exp $"
|
||||
#ident "$Id: parse.y,v 1.190 2004/02/18 17:11:57 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
||||
# include "parse_misc.h"
|
||||
# include "compiler.h"
|
||||
# include "pform.h"
|
||||
# include <sstream>
|
||||
|
||||
|
|
@ -531,7 +532,8 @@ description
|
|||
: module
|
||||
| udp_primitive
|
||||
| KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')'
|
||||
{ pform_set_type_attrib($3, $5, $7);
|
||||
{ perm_string tmp3 = lex_strings.make($3);
|
||||
pform_set_type_attrib(tmp3, $5, $7);
|
||||
delete $3;
|
||||
delete $5;
|
||||
}
|
||||
|
|
@ -1609,7 +1611,8 @@ module_item
|
|||
but then can have parameter lists. */
|
||||
|
||||
| IDENTIFIER parameter_value_opt gate_instance_list ';'
|
||||
{ pform_make_modgates($1, $2, $3);
|
||||
{ perm_string tmp1 = lex_strings.make($1);
|
||||
pform_make_modgates(tmp1, $2, $3);
|
||||
delete $1;
|
||||
}
|
||||
|
||||
|
|
@ -1645,11 +1648,12 @@ module_item
|
|||
task_item_list_opt statement_opt
|
||||
K_endtask
|
||||
{ PTask*tmp = new PTask;
|
||||
perm_string tmp2 = lex_strings.make($2);
|
||||
tmp->set_file(@1.text);
|
||||
tmp->set_lineno(@1.first_line);
|
||||
tmp->set_ports($5);
|
||||
tmp->set_statement($6);
|
||||
pform_set_task($2, tmp);
|
||||
pform_set_task(tmp2, tmp);
|
||||
pform_pop_scope();
|
||||
delete $2;
|
||||
}
|
||||
|
|
@ -1719,7 +1723,8 @@ module_item
|
|||
extensions. Then catch the parameters of the $attribute keyword. */
|
||||
|
||||
| KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' ';'
|
||||
{ pform_set_attrib($3, $5, $7);
|
||||
{ perm_string tmp3 = lex_strings.make($3);
|
||||
pform_set_attrib(tmp3, $5, $7);
|
||||
delete $3;
|
||||
delete $5;
|
||||
}
|
||||
|
|
@ -2464,7 +2469,8 @@ statement
|
|||
block_item_decls_opt
|
||||
statement_list K_end
|
||||
{ pform_pop_scope();
|
||||
PBlock*tmp = new PBlock($3, PBlock::BL_SEQ, *$6);
|
||||
PBlock*tmp = new PBlock(lex_strings.make($3),
|
||||
PBlock::BL_SEQ, *$6);
|
||||
tmp->set_file(@1.text);
|
||||
tmp->set_lineno(@1.first_line);
|
||||
delete $3;
|
||||
|
|
@ -2496,7 +2502,8 @@ statement
|
|||
block_item_decls_opt
|
||||
statement_list K_join
|
||||
{ pform_pop_scope();
|
||||
PBlock*tmp = new PBlock($3, PBlock::BL_PAR, *$6);
|
||||
PBlock*tmp = new PBlock(lex_strings.make($3),
|
||||
PBlock::BL_PAR, *$6);
|
||||
tmp->set_file(@1.text);
|
||||
tmp->set_lineno(@1.first_line);
|
||||
delete $3;
|
||||
|
|
@ -3012,7 +3019,8 @@ udp_primitive
|
|||
udp_init_opt
|
||||
udp_body
|
||||
K_endprimitive
|
||||
{ pform_make_udp($2, $4, $7, $9, $8,
|
||||
{ perm_string tmp2 = lex_strings.make($2);
|
||||
pform_make_udp(tmp2, $4, $7, $9, $8,
|
||||
@2.text, @2.first_line);
|
||||
delete[]$2;
|
||||
}
|
||||
|
|
|
|||
10
parse_api.h
10
parse_api.h
|
|
@ -19,10 +19,11 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: parse_api.h,v 1.2 2002/08/12 01:35:00 steve Exp $"
|
||||
#ident "$Id: parse_api.h,v 1.3 2004/02/18 17:11:57 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <stdio.h>
|
||||
# include "StringHeap.h"
|
||||
# include <string>
|
||||
# include <map>
|
||||
|
||||
|
|
@ -34,8 +35,8 @@ class PUdp;
|
|||
* Verilog source into pform for elaboration. The parser adds modules
|
||||
* to these maps as it compiles modules in the verilog source.
|
||||
*/
|
||||
extern map<string,Module*> pform_modules;
|
||||
extern map<string,PUdp*> pform_primitives;
|
||||
extern map<perm_string,Module*> pform_modules;
|
||||
extern map<perm_string,PUdp*> pform_primitives;
|
||||
|
||||
/*
|
||||
* This code actually invokes the parser to make modules. The first
|
||||
|
|
@ -50,6 +51,9 @@ extern string vl_file;
|
|||
|
||||
/*
|
||||
* $Log: parse_api.h,v $
|
||||
* Revision 1.3 2004/02/18 17:11:57 steve
|
||||
* Use perm_strings for named langiage items.
|
||||
*
|
||||
* Revision 1.2 2002/08/12 01:35:00 steve
|
||||
* conditional ident string using autoconfig.
|
||||
*
|
||||
|
|
|
|||
56
pform.cc
56
pform.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: pform.cc,v 1.119 2004/02/15 17:48:28 steve Exp $"
|
||||
#ident "$Id: pform.cc,v 1.120 2004/02/18 17:11:57 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -35,8 +35,8 @@
|
|||
# include <typeinfo>
|
||||
# include <sstream>
|
||||
|
||||
map<string,Module*> pform_modules;
|
||||
map<string,PUdp*> pform_primitives;
|
||||
map<perm_string,Module*> pform_modules;
|
||||
map<perm_string,PUdp*> pform_primitives;
|
||||
|
||||
/*
|
||||
* The lexor accesses the vl_* variables.
|
||||
|
|
@ -120,7 +120,7 @@ void pform_set_timescale(int unit, int prec,
|
|||
<< "confusing timing results. Affected modules are:"
|
||||
<< endl;
|
||||
|
||||
map<string,Module*>::iterator mod;
|
||||
map<perm_string,Module*>::iterator mod;
|
||||
for (mod = pform_modules.begin()
|
||||
; mod != pform_modules.end() ; mod++) {
|
||||
const Module*mp = (*mod).second;
|
||||
|
|
@ -188,7 +188,7 @@ void pform_startmodule(const char*name, const char*file, unsigned lineno,
|
|||
{
|
||||
assert( pform_cur_module == 0 );
|
||||
|
||||
const char*lex_name = lex_strings.add(name);
|
||||
perm_string lex_name = lex_strings.make(name);
|
||||
pform_cur_module = new Module(lex_name);
|
||||
pform_cur_module->time_unit = pform_time_unit;
|
||||
pform_cur_module->time_precision = pform_time_prec;
|
||||
|
|
@ -254,9 +254,12 @@ void pform_module_set_ports(svector<Module::port_t*>*ports)
|
|||
void pform_endmodule(const char*name)
|
||||
{
|
||||
assert(pform_cur_module);
|
||||
assert(strcmp(name, pform_cur_module->mod_name()) == 0);
|
||||
perm_string mod_name = pform_cur_module->mod_name();
|
||||
assert(strcmp(name, mod_name) == 0);
|
||||
|
||||
map<perm_string,Module*>::const_iterator test =
|
||||
pform_modules.find(mod_name);
|
||||
|
||||
map<string,Module*>::const_iterator test = pform_modules.find(name);
|
||||
if (test != pform_modules.end()) {
|
||||
ostringstream msg;
|
||||
msg << "Module " << name << " was already declared here: "
|
||||
|
|
@ -265,7 +268,7 @@ void pform_endmodule(const char*name)
|
|||
pform_cur_module = 0;
|
||||
return;
|
||||
}
|
||||
pform_modules[name] = pform_cur_module;
|
||||
pform_modules[mod_name] = pform_cur_module;
|
||||
pform_cur_module = 0;
|
||||
}
|
||||
|
||||
|
|
@ -320,7 +323,7 @@ PExpr* pform_select_mtm_expr(PExpr*min, PExpr*typ, PExpr*max)
|
|||
return res;
|
||||
}
|
||||
|
||||
void pform_make_udp(const char*name, list<string>*parms,
|
||||
void pform_make_udp(perm_string name, list<string>*parms,
|
||||
svector<PWire*>*decl, list<string>*table,
|
||||
Statement*init_expr,
|
||||
const char*file, unsigned lineno)
|
||||
|
|
@ -686,7 +689,8 @@ void pform_makegate(PGBuiltin::Type type,
|
|||
return;
|
||||
}
|
||||
|
||||
PGBuiltin*cur = new PGBuiltin(type, info.name, info.parms, delay);
|
||||
perm_string dev_name = lex_strings.make(info.name);
|
||||
PGBuiltin*cur = new PGBuiltin(type, dev_name, info.parms, delay);
|
||||
if (info.range[0])
|
||||
cur->set_range(info.range[0], info.range[1]);
|
||||
|
||||
|
|
@ -732,8 +736,8 @@ void pform_makegates(PGBuiltin::Type type,
|
|||
* functions handle the instantiations of modules (and UDP objects) by
|
||||
* making PGModule objects.
|
||||
*/
|
||||
static void pform_make_modgate(const char*type,
|
||||
const string&name,
|
||||
static void pform_make_modgate(perm_string type,
|
||||
perm_string name,
|
||||
struct parmvalue_t*overrides,
|
||||
svector<PExpr*>*wires,
|
||||
PExpr*msb, PExpr*lsb,
|
||||
|
|
@ -763,8 +767,8 @@ static void pform_make_modgate(const char*type,
|
|||
pform_cur_module->add_gate(cur);
|
||||
}
|
||||
|
||||
static void pform_make_modgate(const char*type,
|
||||
const string&name,
|
||||
static void pform_make_modgate(perm_string type,
|
||||
perm_string name,
|
||||
struct parmvalue_t*overrides,
|
||||
svector<named_pexpr_t*>*bind,
|
||||
PExpr*msb, PExpr*lsb,
|
||||
|
|
@ -803,18 +807,17 @@ static void pform_make_modgate(const char*type,
|
|||
pform_cur_module->add_gate(cur);
|
||||
}
|
||||
|
||||
void pform_make_modgates(const char*type,
|
||||
void pform_make_modgates(perm_string type,
|
||||
struct parmvalue_t*overrides,
|
||||
svector<lgate>*gates)
|
||||
{
|
||||
// Get a permallocated version of the type string.
|
||||
type = lex_strings.add(type);
|
||||
|
||||
for (unsigned idx = 0 ; idx < gates->count() ; idx += 1) {
|
||||
lgate cur = (*gates)[idx];
|
||||
perm_string cur_name = lex_strings.make(cur.name);
|
||||
|
||||
if (cur.parms_by_name) {
|
||||
pform_make_modgate(type, cur.name, overrides,
|
||||
pform_make_modgate(type, cur_name, overrides,
|
||||
cur.parms_by_name,
|
||||
cur.range[0], cur.range[1],
|
||||
cur.file, cur.lineno);
|
||||
|
|
@ -828,14 +831,14 @@ void pform_make_modgates(const char*type,
|
|||
delete cur.parms;
|
||||
cur.parms = new svector<PExpr*>(0);
|
||||
}
|
||||
pform_make_modgate(type, cur.name, overrides,
|
||||
pform_make_modgate(type, cur_name, overrides,
|
||||
cur.parms,
|
||||
cur.range[0], cur.range[1],
|
||||
cur.file, cur.lineno);
|
||||
|
||||
} else {
|
||||
svector<PExpr*>*wires = new svector<PExpr*>(0);
|
||||
pform_make_modgate(type, cur.name, overrides,
|
||||
pform_make_modgate(type, cur_name, overrides,
|
||||
wires,
|
||||
cur.range[0], cur.range[1],
|
||||
cur.file, cur.lineno);
|
||||
|
|
@ -1213,7 +1216,7 @@ svector<PWire*>*pform_make_task_ports(NetNet::PortType pt,
|
|||
return res;
|
||||
}
|
||||
|
||||
void pform_set_task(const string&name, PTask*task)
|
||||
void pform_set_task(perm_string name, PTask*task)
|
||||
{
|
||||
pform_cur_module->add_task(name, task);
|
||||
}
|
||||
|
|
@ -1253,10 +1256,10 @@ void pform_set_function(const char*name, NetNet::Type ntype,
|
|||
|
||||
pform_cur_module->add_wire(out);
|
||||
func->set_output(out);
|
||||
pform_cur_module->add_function(name, func);
|
||||
pform_cur_module->add_function(lex_strings.make(name), func);
|
||||
}
|
||||
|
||||
void pform_set_attrib(const char*name, const string&key, char*value)
|
||||
void pform_set_attrib(perm_string name, const string&key, char*value)
|
||||
{
|
||||
hname_t path (name);
|
||||
|
||||
|
|
@ -1277,10 +1280,10 @@ void pform_set_attrib(const char*name, const string&key, char*value)
|
|||
* Set the attribute of a TYPE. This is different from an object in
|
||||
* that this applies to every instantiation of the given type.
|
||||
*/
|
||||
void pform_set_type_attrib(const string&name, const string&key,
|
||||
void pform_set_type_attrib(perm_string name, const string&key,
|
||||
char*value)
|
||||
{
|
||||
map<string,PUdp*>::const_iterator udp = pform_primitives.find(name);
|
||||
map<perm_string,PUdp*>::const_iterator udp = pform_primitives.find(name);
|
||||
if (udp == pform_primitives.end()) {
|
||||
VLerror("type name is not (yet) defined.");
|
||||
free(value);
|
||||
|
|
@ -1516,6 +1519,9 @@ int pform_parse(const char*path, FILE*file)
|
|||
|
||||
/*
|
||||
* $Log: pform.cc,v $
|
||||
* Revision 1.120 2004/02/18 17:11:57 steve
|
||||
* Use perm_strings for named langiage items.
|
||||
*
|
||||
* Revision 1.119 2004/02/15 17:48:28 steve
|
||||
* Better error checking of primitive tables.
|
||||
*
|
||||
|
|
|
|||
15
pform.h
15
pform.h
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: pform.h,v 1.73 2003/07/04 03:57:19 steve Exp $"
|
||||
#ident "$Id: pform.h,v 1.74 2004/02/18 17:11:57 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "netlist.h"
|
||||
|
|
@ -137,7 +137,7 @@ extern Module::port_t* pform_module_port_reference(char*name,
|
|||
unsigned lineno);
|
||||
extern void pform_endmodule(const char*);
|
||||
|
||||
extern void pform_make_udp(const char*name, list<string>*parms,
|
||||
extern void pform_make_udp(perm_string name, list<string>*parms,
|
||||
svector<PWire*>*decl, list<string>*table,
|
||||
Statement*init,
|
||||
const char*file, unsigned lineno);
|
||||
|
|
@ -194,7 +194,7 @@ extern void pform_set_net_range(list<char*>*names, svector<PExpr*>*, bool);
|
|||
extern void pform_set_reg_idx(const char*name, PExpr*l, PExpr*r);
|
||||
extern void pform_set_reg_integer(list<char*>*names);
|
||||
extern void pform_set_reg_time(list<char*>*names);
|
||||
extern void pform_set_task(const string&, PTask*);
|
||||
extern void pform_set_task(perm_string name, PTask*);
|
||||
extern void pform_set_function(const char*, NetNet::Type,
|
||||
svector<PExpr*>*, PFunction*);
|
||||
|
||||
|
|
@ -202,9 +202,9 @@ extern void pform_set_function(const char*, NetNet::Type,
|
|||
$attribute syntax, which can only set string values to
|
||||
attributes. The functions keep the value strings that are
|
||||
passed in. */
|
||||
extern void pform_set_attrib(const char*name, const string&key,
|
||||
extern void pform_set_attrib(perm_string name, const string&key,
|
||||
char*value);
|
||||
extern void pform_set_type_attrib(const string&name, const string&key,
|
||||
extern void pform_set_type_attrib(perm_string name, const string&key,
|
||||
char*value);
|
||||
|
||||
extern void pform_set_parameter(const string&name,
|
||||
|
|
@ -250,7 +250,7 @@ extern void pform_makegates(PGBuiltin::Type type,
|
|||
svector<lgate>*gates,
|
||||
svector<named_pexpr_t*>*attr);
|
||||
|
||||
extern void pform_make_modgates(const char*type,
|
||||
extern void pform_make_modgates(perm_string type,
|
||||
struct parmvalue_t*overrides,
|
||||
svector<lgate>*gates);
|
||||
|
||||
|
|
@ -283,6 +283,9 @@ extern void pform_dump(ostream&out, Module*mod);
|
|||
|
||||
/*
|
||||
* $Log: pform.h,v $
|
||||
* Revision 1.74 2004/02/18 17:11:57 steve
|
||||
* Use perm_strings for named langiage items.
|
||||
*
|
||||
* Revision 1.73 2003/07/04 03:57:19 steve
|
||||
* Allow attributes on Verilog 2001 port declarations.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: pform_dump.cc,v 1.82 2003/07/05 20:42:08 steve Exp $"
|
||||
#ident "$Id: pform_dump.cc,v 1.83 2004/02/18 17:11:57 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -437,7 +437,7 @@ void PAssignNB::dump(ostream&out, unsigned ind) const
|
|||
void PBlock::dump(ostream&out, unsigned ind) const
|
||||
{
|
||||
out << setw(ind) << "" << "begin";
|
||||
if (name_.length())
|
||||
if (name_ != 0)
|
||||
out << " : " << name_;
|
||||
out << endl;
|
||||
|
||||
|
|
@ -795,7 +795,7 @@ void Module::dump(ostream&out) const
|
|||
}
|
||||
|
||||
// Dump the task definitions.
|
||||
typedef map<string,PTask*>::const_iterator task_iter_t;
|
||||
typedef map<perm_string,PTask*>::const_iterator task_iter_t;
|
||||
for (task_iter_t cur = tasks_.begin()
|
||||
; cur != tasks_.end() ; cur ++) {
|
||||
out << " task " << (*cur).first << ";" << endl;
|
||||
|
|
@ -804,7 +804,7 @@ void Module::dump(ostream&out) const
|
|||
}
|
||||
|
||||
// Dump the function definitions.
|
||||
typedef map<string,PFunction*>::const_iterator func_iter_t;
|
||||
typedef map<perm_string,PFunction*>::const_iterator func_iter_t;
|
||||
for (func_iter_t cur = funcs_.begin()
|
||||
; cur != funcs_.end() ; cur ++) {
|
||||
out << " function " << (*cur).first << ";" << endl;
|
||||
|
|
@ -881,6 +881,9 @@ void PUdp::dump(ostream&out) const
|
|||
|
||||
/*
|
||||
* $Log: pform_dump.cc,v $
|
||||
* Revision 1.83 2004/02/18 17:11:57 steve
|
||||
* Use perm_strings for named langiage items.
|
||||
*
|
||||
* Revision 1.82 2003/07/05 20:42:08 steve
|
||||
* Fix some enumeration warnings.
|
||||
*
|
||||
|
|
|
|||
31
synth2.cc
31
synth2.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: synth2.cc,v 1.34 2003/12/20 00:59:31 steve Exp $"
|
||||
#ident "$Id: synth2.cc,v 1.35 2004/02/18 17:11:58 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -126,6 +126,9 @@ bool NetBlock::synth_async(Design*des, NetScope*scope,
|
|||
return true;
|
||||
}
|
||||
|
||||
const perm_string tmp1 = perm_string::literal("tmp1");
|
||||
const perm_string tmp2 = perm_string::literal("tmp2");
|
||||
|
||||
bool flag = true;
|
||||
NetProc*cur = last_;
|
||||
do {
|
||||
|
|
@ -134,14 +137,14 @@ bool NetBlock::synth_async(Design*des, NetScope*scope,
|
|||
/* Create a temporary nex_map for the substatement. */
|
||||
NexusSet tmp_set;
|
||||
cur->nex_output(tmp_set);
|
||||
NetNet*tmp_map = new NetNet(scope, "tmp1", NetNet::WIRE,
|
||||
NetNet*tmp_map = new NetNet(scope, tmp1, NetNet::WIRE,
|
||||
tmp_set.count());
|
||||
for (unsigned idx = 0 ; idx < tmp_map->pin_count() ; idx += 1)
|
||||
connect(tmp_set[idx], tmp_map->pin(idx));
|
||||
|
||||
/* Create also a temporary net_out to collect the
|
||||
output. */
|
||||
NetNet*tmp_out = new NetNet(scope, "tmp2", NetNet::WIRE,
|
||||
NetNet*tmp_out = new NetNet(scope, tmp2, NetNet::WIRE,
|
||||
tmp_set.count());
|
||||
|
||||
bool ok_flag = cur->synth_async(des, scope, tmp_map, tmp_out);
|
||||
|
|
@ -376,7 +379,8 @@ bool NetProcTop::synth_async(Design*des)
|
|||
NexusSet nex_set;
|
||||
statement_->nex_output(nex_set);
|
||||
|
||||
NetNet*nex_out = new NetNet(scope(), "tmp", NetNet::WIRE,
|
||||
const perm_string tmp1 = perm_string::literal("tmp");
|
||||
NetNet*nex_out = new NetNet(scope(), tmp1, NetNet::WIRE,
|
||||
nex_set.count());
|
||||
for (unsigned idx = 0 ; idx < nex_out->pin_count() ; idx += 1)
|
||||
connect(nex_set[idx], nex_out->pin(idx));
|
||||
|
|
@ -414,6 +418,9 @@ bool NetBlock::synth_sync(Design*des, NetScope*scope, NetFF*ff,
|
|||
|
||||
bool flag = true;
|
||||
|
||||
const perm_string tmp1 = perm_string::literal("tmp1");
|
||||
const perm_string tmp2 = perm_string::literal("tmp2");
|
||||
|
||||
/* Keep an accounting of which statement accounts for which
|
||||
bit slice of the FF bank. This is used for error checking. */
|
||||
NetProc**pin_accounting = new NetProc* [ff->pin_count()];
|
||||
|
|
@ -427,7 +434,7 @@ bool NetBlock::synth_sync(Design*des, NetScope*scope, NetFF*ff,
|
|||
/* Create a temporary nex_map for the substatement. */
|
||||
NexusSet tmp_set;
|
||||
cur->nex_output(tmp_set);
|
||||
NetNet*tmp_map = new NetNet(scope, "tmp1", NetNet::WIRE,
|
||||
NetNet*tmp_map = new NetNet(scope, tmp1, NetNet::WIRE,
|
||||
tmp_set.count());
|
||||
for (unsigned idx = 0 ; idx < tmp_map->pin_count() ; idx += 1)
|
||||
connect(tmp_set[idx], tmp_map->pin(idx));
|
||||
|
|
@ -441,7 +448,7 @@ bool NetBlock::synth_sync(Design*des, NetScope*scope, NetFF*ff,
|
|||
output. The tmp1 and tmp2 map and out sets together
|
||||
are used to collect the outputs from the substatement
|
||||
for the inputs of the FF bank. */
|
||||
NetNet*tmp_out = new NetNet(scope, "tmp2", NetNet::WIRE,
|
||||
NetNet*tmp_out = new NetNet(scope, tmp2, NetNet::WIRE,
|
||||
tmp_map->pin_count());
|
||||
|
||||
verinum tmp_aset = ff->aset_value();
|
||||
|
|
@ -451,7 +458,7 @@ bool NetBlock::synth_sync(Design*des, NetScope*scope, NetFF*ff,
|
|||
block. Connect this NetFF to the associated pins of
|
||||
the existing wide NetFF device. While I'm at it, also
|
||||
copy the aset_value bits for the new ff device. */
|
||||
NetFF*ff2 = new NetFF(scope, scope->local_symbol().c_str(),
|
||||
NetFF*ff2 = new NetFF(scope, scope->local_symbol(),
|
||||
tmp_out->pin_count());
|
||||
des->add_node(ff2);
|
||||
|
||||
|
|
@ -745,7 +752,7 @@ bool NetCondit::synth_sync(Design*des, NetScope*scope, NetFF*ff,
|
|||
|
||||
if (ff->pin_Enable().is_linked()) {
|
||||
NetLogic*ce_and = new NetLogic(scope,
|
||||
scope->local_hsymbol(), 3,
|
||||
scope->local_symbol(), 3,
|
||||
NetLogic::AND);
|
||||
des->add_node(ce_and);
|
||||
connect(ff->pin_Enable(), ce_and->pin(1));
|
||||
|
|
@ -848,7 +855,7 @@ bool NetProcTop::synth_sync(Design*des)
|
|||
NexusSet nex_set;
|
||||
statement_->nex_output(nex_set);
|
||||
|
||||
NetFF*ff = new NetFF(scope(), scope()->local_symbol().c_str(),
|
||||
NetFF*ff = new NetFF(scope(), scope()->local_symbol(),
|
||||
nex_set.count());
|
||||
des->add_node(ff);
|
||||
ff->attribute("LPM_FFType", verinum("DFF"));
|
||||
|
|
@ -865,7 +872,8 @@ bool NetProcTop::synth_sync(Design*des)
|
|||
/* The Q outputs of the DFF will connect to the actual outputs
|
||||
of the process. Thus, the DFF will be between the outputs
|
||||
of the process and the outputs of the substatement. */
|
||||
NetNet*nex_q = new NetNet(scope(), "tmpq", NetNet::WIRE,
|
||||
const perm_string tmpq = perm_string::literal("tmpq");
|
||||
NetNet*nex_q = new NetNet(scope(), tmpq, NetNet::WIRE,
|
||||
nex_set.count());
|
||||
for (unsigned idx = 0 ; idx < nex_set.count() ; idx += 1) {
|
||||
connect(nex_set[idx], nex_q->pin(idx));
|
||||
|
|
@ -962,6 +970,9 @@ void synth2(Design*des)
|
|||
|
||||
/*
|
||||
* $Log: synth2.cc,v $
|
||||
* Revision 1.35 2004/02/18 17:11:58 steve
|
||||
* Use perm_strings for named langiage items.
|
||||
*
|
||||
* Revision 1.34 2003/12/20 00:59:31 steve
|
||||
* Synthesis debug messages.
|
||||
*
|
||||
|
|
|
|||
17
t-dll.cc
17
t-dll.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: t-dll.cc,v 1.125 2003/12/12 05:43:08 steve Exp $"
|
||||
#ident "$Id: t-dll.cc,v 1.126 2004/02/18 17:11:58 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -534,7 +534,7 @@ void dll_target::make_scope_parameters(ivl_scope_t scope, const NetScope*net)
|
|||
void dll_target::add_root(ivl_design_s &des_, const NetScope *s)
|
||||
{
|
||||
ivl_scope_t root_ = new struct ivl_scope_s;
|
||||
const char *name = s->basename();
|
||||
perm_string name = s->basename();
|
||||
root_->name_ = name;
|
||||
root_->child_ = 0;
|
||||
root_->sibling_ = 0;
|
||||
|
|
@ -1012,7 +1012,7 @@ void dll_target::udp(const NetUDP*net)
|
|||
|
||||
obj->type_ = IVL_LO_UDP;
|
||||
|
||||
static map<string,ivl_udp_t> udps;
|
||||
static map<perm_string,ivl_udp_t> udps;
|
||||
ivl_udp_t u;
|
||||
|
||||
if (udps.find(net->udp_name()) != udps.end())
|
||||
|
|
@ -1030,7 +1030,7 @@ void dll_target::udp(const NetUDP*net)
|
|||
u->sequ = net->is_sequential();
|
||||
if (u->sequ)
|
||||
u->init = net->get_initial();
|
||||
u->name = strings_.add(net->udp_name().c_str());
|
||||
u->name = net->udp_name();
|
||||
string inp;
|
||||
char out;
|
||||
unsigned int i = 0;
|
||||
|
|
@ -1088,7 +1088,7 @@ void dll_target::memory(const NetMemory*net)
|
|||
ivl_memory_t obj = new struct ivl_memory_s;
|
||||
|
||||
obj->scope_ = find_scope(des_, net->scope());
|
||||
obj->basename_ = strings_.add(net->name());
|
||||
obj->basename_ = strings_.make(net->name());
|
||||
obj->width_ = net->width();
|
||||
obj->signed_ = 0;
|
||||
obj->size_ = net->count();
|
||||
|
|
@ -1997,12 +1997,12 @@ void dll_target::scope(const NetScope*net)
|
|||
}
|
||||
assert(def);
|
||||
scope->type_ = IVL_SCT_TASK;
|
||||
scope->tname_ = strings_.add(def->name().c_str());
|
||||
scope->tname_ = strings_.make(def->name().c_str());
|
||||
break;
|
||||
}
|
||||
case NetScope::FUNC:
|
||||
scope->type_ = IVL_SCT_FUNCTION;
|
||||
scope->tname_ = strings_.add(net->func_def()->name().c_str());
|
||||
scope->tname_ = strings_.make(net->func_def()->name().c_str());
|
||||
break;
|
||||
case NetScope::BEGIN_END:
|
||||
scope->type_ = IVL_SCT_BEGIN;
|
||||
|
|
@ -2176,6 +2176,9 @@ extern const struct target tgt_dll = { "dll", &dll_target_obj };
|
|||
|
||||
/*
|
||||
* $Log: t-dll.cc,v $
|
||||
* Revision 1.126 2004/02/18 17:11:58 steve
|
||||
* Use perm_strings for named langiage items.
|
||||
*
|
||||
* Revision 1.125 2003/12/12 05:43:08 steve
|
||||
* Some systems dlsym requires leading _ or not on whim.
|
||||
*
|
||||
|
|
|
|||
13
t-dll.h
13
t-dll.h
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: t-dll.h,v 1.108 2003/12/03 02:46:24 steve Exp $"
|
||||
#ident "$Id: t-dll.h,v 1.109 2004/02/18 17:11:58 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "target.h"
|
||||
|
|
@ -425,7 +425,7 @@ struct ivl_net_logic_s {
|
|||
* UDP definition.
|
||||
*/
|
||||
struct ivl_udp_s {
|
||||
const char* name;
|
||||
perm_string name;
|
||||
unsigned nin;
|
||||
unsigned sequ;
|
||||
char init;
|
||||
|
|
@ -475,7 +475,7 @@ struct ivl_nexus_s {
|
|||
* Memory.
|
||||
*/
|
||||
struct ivl_memory_s {
|
||||
const char*basename_;
|
||||
perm_string basename_;
|
||||
ivl_scope_t scope_;
|
||||
unsigned width_;
|
||||
unsigned signed_ : 1;
|
||||
|
|
@ -517,8 +517,8 @@ struct ivl_process_s {
|
|||
struct ivl_scope_s {
|
||||
ivl_scope_t child_, sibling_, parent;
|
||||
|
||||
const char* name_;
|
||||
const char* tname_;
|
||||
perm_string name_;
|
||||
perm_string tname_;
|
||||
ivl_scope_type_t type_;
|
||||
|
||||
unsigned nsigs_;
|
||||
|
|
@ -683,6 +683,9 @@ struct ivl_variable_s {
|
|||
|
||||
/*
|
||||
* $Log: t-dll.h,v $
|
||||
* Revision 1.109 2004/02/18 17:11:58 steve
|
||||
* Use perm_strings for named langiage items.
|
||||
*
|
||||
* Revision 1.108 2003/12/03 02:46:24 steve
|
||||
* Add support for wait on list of named events.
|
||||
*
|
||||
|
|
|
|||
13
t-xnf.cc
13
t-xnf.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: t-xnf.cc,v 1.50 2003/11/10 20:59:04 steve Exp $"
|
||||
#ident "$Id: t-xnf.cc,v 1.51 2004/02/18 17:11:58 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -119,6 +119,7 @@ class target_xnf : public target_t {
|
|||
|
||||
private:
|
||||
static string mangle(const string&);
|
||||
static string mangle(perm_string);
|
||||
static string choose_sig_name(const Link*lnk);
|
||||
static void draw_pin(ostream&os, const string&name,
|
||||
const Link&lnk);
|
||||
|
|
@ -153,6 +154,11 @@ string target_xnf::mangle(const string&name)
|
|||
return result;
|
||||
}
|
||||
|
||||
string target_xnf::mangle(perm_string name)
|
||||
{
|
||||
return mangle(string(name));
|
||||
}
|
||||
|
||||
/*
|
||||
* This method takes a signal and pin number as a nexus. Scan the
|
||||
* nexus to decide which name to use if there are lots of attached
|
||||
|
|
@ -160,7 +166,7 @@ string target_xnf::mangle(const string&name)
|
|||
*/
|
||||
string target_xnf::choose_sig_name(const Link*lnk)
|
||||
{
|
||||
return mangle( lnk->nexus()->name() );
|
||||
return mangle( string(lnk->nexus()->name()) );
|
||||
}
|
||||
|
||||
void target_xnf::draw_pin(ostream&os, const string&name,
|
||||
|
|
@ -932,6 +938,9 @@ extern const struct target tgt_xnf = { "xnf", &target_xnf_obj };
|
|||
|
||||
/*
|
||||
* $Log: t-xnf.cc,v $
|
||||
* Revision 1.51 2004/02/18 17:11:58 steve
|
||||
* Use perm_strings for named langiage items.
|
||||
*
|
||||
* Revision 1.50 2003/11/10 20:59:04 steve
|
||||
* Design::get_flag returns const char* instead of string.
|
||||
*
|
||||
|
|
|
|||
11
xnfio.cc
11
xnfio.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: xnfio.cc,v 1.27 2003/06/24 01:38:03 steve Exp $"
|
||||
#ident "$Id: xnfio.cc,v 1.28 2004/02/18 17:11:58 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -129,7 +129,7 @@ static NetLogic* make_obuf(Design*des, NetNet*net)
|
|||
|
||||
// Can't seem to find a way to rearrange the existing netlist,
|
||||
// so I am stuck creating a new buffer, the OBUF.
|
||||
NetLogic*buf = new NetLogic(scope, des->local_symbol(scope->name()),
|
||||
NetLogic*buf = new NetLogic(scope, scope->local_symbol(),
|
||||
2, NetLogic::BUF);
|
||||
des->add_node(buf);
|
||||
|
||||
|
|
@ -239,7 +239,7 @@ static void make_ibuf(Design*des, NetNet*net)
|
|||
}
|
||||
|
||||
// I give up, create an IBUF.
|
||||
NetLogic*buf = new NetLogic(scope, des->local_symbol(scope->name()),
|
||||
NetLogic*buf = new NetLogic(scope, scope->local_symbol(),
|
||||
2, NetLogic::BUF);
|
||||
des->add_node(buf);
|
||||
|
||||
|
|
@ -256,7 +256,7 @@ static void make_ibuf(Design*des, NetNet*net)
|
|||
// this case and create a new signal.
|
||||
if (count_signals(buf->pin(0)) == 0) {
|
||||
NetNet*tmp = new NetNet(scope,
|
||||
des->local_symbol(scope->name()),
|
||||
scope->local_symbol(),
|
||||
NetNet::WIRE);
|
||||
connect(buf->pin(0), tmp->pin(0));
|
||||
}
|
||||
|
|
@ -361,6 +361,9 @@ void xnfio(Design*des)
|
|||
|
||||
/*
|
||||
* $Log: xnfio.cc,v $
|
||||
* Revision 1.28 2004/02/18 17:11:58 steve
|
||||
* Use perm_strings for named langiage items.
|
||||
*
|
||||
* Revision 1.27 2003/06/24 01:38:03 steve
|
||||
* Various warnings fixed.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue