Addtrbute keys are perm_strings.

This commit is contained in:
steve 2004-02-20 18:53:33 +00:00
parent 1295058e5d
commit 177b6ffb6a
23 changed files with 166 additions and 113 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: Attrib.cc,v 1.5 2002/08/12 01:34:58 steve Exp $"
#ident "$Id: Attrib.cc,v 1.6 2004/02/20 18:53:33 steve Exp $"
#endif
# include "config.h"
@ -36,25 +36,8 @@ Attrib::~Attrib()
delete[] list_;
}
#if 0
void Attrib::copy_attributes(const map<string,verinum>&attr)
{
assert(list_ == 0);
nlist_ = attr.size();
list_ = new cell_[nlist_];
map<string,verinum>::const_iterator idx;
unsigned jdx;
for (idx = attr.begin(), jdx = 0 ; idx != attr.end() ; idx ++, jdx++) {
struct cell_*tmp = list_ + jdx;
tmp->key = (*idx).first;
tmp->val = (*idx).second;
}
}
#endif
const verinum& Attrib::attribute(const string&key) const
const verinum& Attrib::attribute(perm_string key) const
{
for (unsigned idx = 0 ; idx < nlist_ ; idx += 1) {
@ -66,7 +49,7 @@ const verinum& Attrib::attribute(const string&key) const
return null;
}
void Attrib::attribute(const string&key, const verinum&value)
void Attrib::attribute(perm_string key, const verinum&value)
{
unsigned idx;
@ -108,10 +91,10 @@ unsigned Attrib::attr_cnt() const
return nlist_;
}
const char* Attrib::attr_key(unsigned idx) const
perm_string Attrib::attr_key(unsigned idx) const
{
assert(idx < nlist_);
return list_[idx].key.c_str();
return list_[idx].key;
}
const verinum& Attrib::attr_value(unsigned idx) const
@ -123,6 +106,9 @@ const verinum& Attrib::attr_value(unsigned idx) const
/*
* $Log: Attrib.cc,v $
* Revision 1.6 2004/02/20 18:53:33 steve
* Addtrbute keys are perm_strings.
*
* Revision 1.5 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*

View File

@ -19,10 +19,10 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: Attrib.h,v 1.4 2002/08/12 01:34:58 steve Exp $"
#ident "$Id: Attrib.h,v 1.5 2004/02/20 18:53:33 steve Exp $"
#endif
# include <string>
# include "StringHeap.h"
# include "verinum.h"
/*
@ -35,20 +35,20 @@ class Attrib {
Attrib();
~Attrib();
const verinum&attribute(const string&key) const;
void attribute(const string&key, const verinum&value);
const verinum&attribute(perm_string key) const;
void attribute(perm_string key, const verinum&value);
bool has_compat_attributes(const Attrib&that) const;
/* Provide a means of iterating over the entries in the map. */
unsigned attr_cnt() const;
const char* attr_key(unsigned idx) const;
perm_string attr_key(unsigned idx) const;
const verinum& attr_value(unsigned idx) const;
private:
struct cell_ {
string key;
perm_string key;
verinum val;
};
@ -62,6 +62,9 @@ class Attrib {
/*
* $Log: Attrib.h,v $
* Revision 1.5 2004/02/20 18:53:33 steve
* Addtrbute keys are perm_strings.
*
* Revision 1.4 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: Module.h,v 1.34 2004/02/20 06:22:56 steve Exp $"
#ident "$Id: Module.h,v 1.35 2004/02/20 18:53:33 steve Exp $"
#endif
# include <list>
@ -110,7 +110,7 @@ class Module : public LineInfo {
/* Keep a table of datum variables declared in the module. */
map<hname_t,PData*>datum;
map<string,PExpr*> attributes;
map<perm_string,PExpr*> attributes;
/* These are the timescale for this module. The default is
set by the `timescale directive. */
@ -166,6 +166,9 @@ class Module : public LineInfo {
/*
* $Log: Module.h,v $
* Revision 1.35 2004/02/20 18:53:33 steve
* Addtrbute keys are perm_strings.
*
* Revision 1.34 2004/02/20 06:22:56 steve
* parameter keys are per_strings.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: PGate.h,v 1.26 2004/02/18 17:11:54 steve Exp $"
#ident "$Id: PGate.h,v 1.27 2004/02/20 18:53:33 steve Exp $"
#endif
# include "svector.h"
@ -80,7 +80,7 @@ class PGate : public LineInfo {
void strength0(strength_t);
void strength1(strength_t);
map<string,PExpr*> attributes;
map<perm_string,PExpr*> attributes;
virtual void dump(ostream&out) const;
virtual void elaborate(Design*des, NetScope*scope) const;
@ -227,6 +227,9 @@ class PGModule : public PGate {
/*
* $Log: PGate.h,v $
* Revision 1.27 2004/02/20 18:53:33 steve
* Addtrbute keys are perm_strings.
*
* Revision 1.26 2004/02/18 17:11:54 steve
* Use perm_strings for named langiage items.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: PWire.h,v 1.16 2003/01/30 16:23:07 steve Exp $"
#ident "$Id: PWire.h,v 1.17 2004/02/20 18:53:33 steve Exp $"
#endif
# include "netlist.h"
@ -69,7 +69,7 @@ class PWire : public LineInfo {
void set_memory_idx(PExpr*ldx, PExpr*rdx);
map<string,PExpr*> attributes;
map<perm_string,PExpr*> attributes;
// Write myself to the specified stream.
void dump(ostream&out) const;
@ -100,6 +100,9 @@ class PWire : public LineInfo {
/*
* $Log: PWire.h,v $
* Revision 1.17 2004/02/20 18:53:33 steve
* Addtrbute keys are perm_strings.
*
* Revision 1.16 2003/01/30 16:23:07 steve
* Spelling fixes.
*

View File

@ -19,11 +19,12 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: Statement.h,v 1.39 2004/02/18 17:11:54 steve Exp $"
#ident "$Id: Statement.h,v 1.40 2004/02/20 18:53:33 steve Exp $"
#endif
# include <string>
# include "svector.h"
# include "StringHeap.h"
# include "PDelays.h"
# include "PExpr.h"
# include "HName.h"
@ -56,7 +57,7 @@ class PProcess : public LineInfo {
Type type() const { return type_; }
Statement*statement() { return statement_; }
map<string,PExpr*> attributes;
map<perm_string,PExpr*> attributes;
virtual void dump(ostream&out, unsigned ind) const;
@ -455,6 +456,9 @@ class PWhile : public Statement {
/*
* $Log: Statement.h,v $
* Revision 1.40 2004/02/20 18:53:33 steve
* Addtrbute keys are perm_strings.
*
* Revision 1.39 2004/02/18 17:11:54 steve
* Use perm_strings for named langiage items.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: cprop.cc,v 1.46 2003/11/08 17:53:34 steve Exp $"
#ident "$Id: cprop.cc,v 1.47 2004/02/20 18:53:34 steve Exp $"
#endif
# include "config.h"
@ -56,7 +56,7 @@ void cprop_functor::signal(Design*des, NetNet*obj)
void cprop_functor::lpm_add_sub(Design*des, NetAddSub*obj)
{
// For now, only additions are handled.
if (obj->attribute("LPM_Direction") != verinum("ADD"))
if (obj->attribute(perm_string::literal("LPM_Direction")) != verinum("ADD"))
return;
// If the low bit on the A side is 0, then eliminate it from
@ -1038,6 +1038,9 @@ void cprop(Design*des)
/*
* $Log: cprop.cc,v $
* Revision 1.47 2004/02/20 18:53:34 steve
* Addtrbute keys are perm_strings.
*
* Revision 1.46 2003/11/08 17:53:34 steve
* Do not remove constants accessible to VPI.
*

View File

@ -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.124 2004/02/18 17:11:54 steve Exp $"
#ident "$Id: elab_net.cc,v 1.125 2004/02/20 18:53:34 steve Exp $"
#endif
# include "config.h"
@ -246,10 +246,10 @@ NetNet* PEBinary::elaborate_net_add_(Design*des, NetScope*scope,
switch (op_) {
case '+':
gate->attribute("LPM_Direction", verinum("ADD"));
gate->attribute(perm_string::literal("LPM_Direction"), verinum("ADD"));
break;
case '-':
gate->attribute("LPM_Direction", verinum("SUB"));
gate->attribute(perm_string::literal("LPM_Direction"), verinum("SUB"));
break;
}
@ -2386,7 +2386,7 @@ NetNet* PEUnary::elaborate_net(Design*des, NetScope*scope,
default:
NetAddSub*sub = new NetAddSub(scope, scope->local_symbol(),
sig->pin_count());
sub->attribute("LPM_Direction", verinum("SUB"));
sub->attribute(perm_string::literal("LPM_Direction"), verinum("SUB"));
des->add_node(sub);
@ -2426,6 +2426,9 @@ NetNet* PEUnary::elaborate_net(Design*des, NetScope*scope,
/*
* $Log: elab_net.cc,v $
* Revision 1.125 2004/02/20 18:53:34 steve
* Addtrbute keys are perm_strings.
*
* Revision 1.124 2004/02/18 17:11:54 steve
* Use perm_strings for named langiage items.
*

View File

@ -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.296 2004/02/18 17:11:55 steve Exp $"
#ident "$Id: elaborate.cc,v 1.297 2004/02/20 18:53:34 steve Exp $"
#endif
# include "config.h"
@ -2516,7 +2516,8 @@ bool Module::elaborate(Design*des, NetScope*scope) const
if (! anyedge_test)
break;
top->attribute("_ivl_schedule_push", verinum(1));
top->attribute(perm_string::literal("_ivl_schedule_push"),
verinum(1));
} while (0);
}
@ -2626,6 +2627,9 @@ Design* elaborate(list<perm_string>roots)
/*
* $Log: elaborate.cc,v $
* Revision 1.297 2004/02/20 18:53:34 steve
* Addtrbute keys are perm_strings.
*
* Revision 1.296 2004/02/18 17:11:55 steve
* Use perm_strings for named langiage items.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002 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: eval_attrib.cc,v 1.6 2003/01/27 05:09:17 steve Exp $"
#ident "$Id: eval_attrib.cc,v 1.7 2004/02/20 18:53:35 steve Exp $"
#endif
# include "config.h"
@ -33,7 +33,7 @@
* for passing to netlist devices.
*/
attrib_list_t* evaluate_attributes(const map<string,PExpr*>&att,
attrib_list_t* evaluate_attributes(const map<perm_string,PExpr*>&att,
unsigned&natt,
const Design*des,
const NetScope*scope)
@ -46,7 +46,7 @@ attrib_list_t* evaluate_attributes(const map<string,PExpr*>&att,
unsigned idx = 0;
typedef map<string,PExpr*>::const_iterator iter_t;
typedef map<perm_string,PExpr*>::const_iterator iter_t;
for (iter_t cur = att.begin() ; cur != att.end() ; cur ++, idx++) {
table[idx].key = (*cur).first;
PExpr*exp = (*cur).second;
@ -74,6 +74,9 @@ attrib_list_t* evaluate_attributes(const map<string,PExpr*>&att,
/*
* $Log: eval_attrib.cc,v $
* Revision 1.7 2004/02/20 18:53:35 steve
* Addtrbute keys are perm_strings.
*
* Revision 1.6 2003/01/27 05:09:17 steve
* Spelling fixes.
*

View File

@ -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.54 2004/02/18 17:11:56 steve Exp $"
#ident "$Id: expr_synth.cc,v 1.55 2004/02/20 18:53:35 steve Exp $"
#endif
# include "config.h"
@ -69,10 +69,10 @@ NetNet* NetEBAdd::synthesize(Design*des)
switch (op()) {
case '+':
adder->attribute("LPM_Direction", verinum("ADD"));
adder->attribute(perm_string::literal("LPM_Direction"), verinum("ADD"));
break;
case '-':
adder->attribute("LPM_Direction", verinum("SUB"));
adder->attribute(perm_string::literal("LPM_Direction"), verinum("SUB"));
break;
}
@ -828,6 +828,9 @@ NetNet* NetESignal::synthesize(Design*des)
/*
* $Log: expr_synth.cc,v $
* Revision 1.55 2004/02/20 18:53:35 steve
* Addtrbute keys are perm_strings.
*
* Revision 1.54 2004/02/18 17:11:56 steve
* Use perm_strings for named langiage items.
*

View File

@ -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.7 2004/02/18 17:11:57 steve Exp $"
#ident "$Id: netmisc.cc,v 1.8 2004/02/20 18:53:35 steve Exp $"
#endif
# include "config.h"
@ -62,9 +62,9 @@ NetNet* add_to_net(Design*des, NetNet*sig, long val)
connect(res->pin(idx), add->pin_Result(idx));
if (val < 0)
add->attribute("LPM_Direction", verinum("SUB"));
add->attribute(perm_string::literal("LPM_Direction"), verinum("SUB"));
else
add->attribute("LPM_Direction", verinum("ADD"));
add->attribute(perm_string::literal("LPM_Direction"), verinum("ADD"));
des->add_node(add);
des->add_node(val_c);
@ -90,6 +90,9 @@ NetExpr* elab_and_eval(Design*des, NetScope*scope, const PExpr*pe)
/*
* $Log: netmisc.cc,v $
* Revision 1.8 2004/02/20 18:53:35 steve
* Addtrbute keys are perm_strings.
*
* Revision 1.7 2004/02/18 17:11:57 steve
* Use perm_strings for named langiage items.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: nodangle.cc,v 1.20 2004/01/15 06:04:19 steve Exp $"
#ident "$Id: nodangle.cc,v 1.21 2004/02/20 18:53:35 steve Exp $"
#endif
# include "config.h"
@ -121,7 +121,7 @@ void nodangle_f::signal(Design*des, NetNet*sig)
/* Can't delete ports of cells. */
if ((sig->port_type() != NetNet::NOT_A_PORT)
&& (sig->scope()->attribute("ivl_synthesis_cell") != verinum()))
&& (sig->scope()->attribute(perm_string::literal("ivl_synthesis_cell")) != verinum()))
return;
/* Check to see if the signal is completely unconnected. If
@ -205,6 +205,9 @@ void nodangle(Design*des)
/*
* $Log: nodangle.cc,v $
* Revision 1.21 2004/02/20 18:53:35 steve
* Addtrbute keys are perm_strings.
*
* Revision 1.20 2004/01/15 06:04:19 steve
* Remove duplicate NetEvProbe objects in nodangle.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: parse.y,v 1.191 2004/02/20 06:22:57 steve Exp $"
#ident "$Id: parse.y,v 1.192 2004/02/20 18:53:35 steve Exp $"
#endif
# include "config.h"
@ -1724,7 +1724,8 @@ module_item
| KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' ';'
{ perm_string tmp3 = lex_strings.make($3);
pform_set_attrib(tmp3, $5, $7);
perm_string tmp5 = lex_strings.make($5);
pform_set_attrib(tmp3, tmp5, $7);
delete $3;
delete $5;
}

View File

@ -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.122 2004/02/20 06:22:58 steve Exp $"
#ident "$Id: pform.cc,v 1.123 2004/02/20 18:53:35 steve Exp $"
#endif
# include "config.h"
@ -208,7 +208,7 @@ void pform_startmodule(const char*name, const char*file, unsigned lineno,
if (attr) {
for (unsigned idx = 0 ; idx < attr->count() ; idx += 1) {
named_pexpr_t*tmp = (*attr)[idx];
pform_cur_module->attributes[string(tmp->name)] = tmp->parm;
pform_cur_module->attributes[tmp->name] = tmp->parm;
}
}
}
@ -697,7 +697,7 @@ void pform_makegate(PGBuiltin::Type type,
if (attr) {
for (unsigned idx = 0 ; idx < attr->count() ; idx += 1) {
named_pexpr_t*tmp = (*attr)[idx];
cur->attributes[string(tmp->name)] = tmp->parm;
cur->attributes[tmp->name] = tmp->parm;
}
}
@ -975,7 +975,7 @@ void pform_module_define_port(const struct vlltype&li,
if (attr) {
for (unsigned idx = 0 ; idx < attr->count() ; idx += 1) {
named_pexpr_t*tmp = (*attr)[idx];
cur->attributes[string(tmp->name)] = tmp->parm;
cur->attributes[tmp->name] = tmp->parm;
}
}
pform_cur_module->add_wire(cur);
@ -1035,7 +1035,7 @@ void pform_makewire(const vlltype&li, const char*nm,
if (attr) {
for (unsigned idx = 0 ; idx < attr->count() ; idx += 1) {
named_pexpr_t*tmp = (*attr)[idx];
cur->attributes[string(tmp->name)] = tmp->parm;
cur->attributes[tmp->name] = tmp->parm;
}
}
@ -1259,7 +1259,7 @@ void pform_set_function(const char*name, NetNet::Type ntype,
pform_cur_module->add_function(lex_strings.make(name), func);
}
void pform_set_attrib(perm_string name, const string&key, char*value)
void pform_set_attrib(perm_string name, perm_string key, char*value)
{
hname_t path (name);
@ -1469,7 +1469,7 @@ PProcess* pform_make_behavior(PProcess::Type type, Statement*st,
if (attr) {
for (unsigned idx = 0 ; idx < attr->count() ; idx += 1) {
named_pexpr_t*tmp = (*attr)[idx];
pp->attributes[string(tmp->name)] = tmp->parm;
pp->attributes[tmp->name] = tmp->parm;
}
delete attr;
}
@ -1519,6 +1519,9 @@ int pform_parse(const char*path, FILE*file)
/*
* $Log: pform.cc,v $
* Revision 1.123 2004/02/20 18:53:35 steve
* Addtrbute keys are perm_strings.
*
* Revision 1.122 2004/02/20 06:22:58 steve
* parameter keys are per_strings.
*

View File

@ -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.75 2004/02/20 06:22:58 steve Exp $"
#ident "$Id: pform.h,v 1.76 2004/02/20 18:53:35 steve Exp $"
#endif
# include "netlist.h"
@ -202,7 +202,7 @@ 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(perm_string name, const string&key,
extern void pform_set_attrib(perm_string name, perm_string key,
char*value);
extern void pform_set_type_attrib(perm_string name, const string&key,
char*value);
@ -283,6 +283,9 @@ extern void pform_dump(ostream&out, Module*mod);
/*
* $Log: pform.h,v $
* Revision 1.76 2004/02/20 18:53:35 steve
* Addtrbute keys are perm_strings.
*
* Revision 1.75 2004/02/20 06:22:58 steve
* parameter keys are per_strings.
*

View File

@ -1,5 +1,5 @@
/*
* 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
@ -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.84 2004/02/20 06:22:58 steve Exp $"
#ident "$Id: pform_dump.cc,v 1.85 2004/02/20 18:53:35 steve Exp $"
#endif
# include "config.h"
@ -252,7 +252,7 @@ void PWire::dump(ostream&out) const
}
out << ";" << endl;
for (map<string,PExpr*>::const_iterator idx = attributes.begin()
for (map<perm_string,PExpr*>::const_iterator idx = attributes.begin()
; idx != attributes.end()
; idx ++) {
out << " " << (*idx).first;
@ -678,7 +678,7 @@ void PProcess::dump(ostream&out, unsigned ind) const
out << " /* " << get_line() << " */" << endl;
for (map<string,PExpr*>::const_iterator idx = attributes.begin()
for (map<perm_string,PExpr*>::const_iterator idx = attributes.begin()
; idx != attributes.end() ; idx++ ) {
out << setw(ind+2) << "" << "(* " << (*idx).first;
@ -695,7 +695,7 @@ void Module::dump(ostream&out) const
{
if (attributes.begin() != attributes.end()) {
out << "(* ";
for (map<string,PExpr*>::const_iterator idx = attributes.begin()
for (map<perm_string,PExpr*>::const_iterator idx = attributes.begin()
; idx != attributes.end() ; idx++ ) {
if (idx != attributes.begin()) {
out << " , ";
@ -881,6 +881,9 @@ void PUdp::dump(ostream&out) const
/*
* $Log: pform_dump.cc,v $
* Revision 1.85 2004/02/20 18:53:35 steve
* Addtrbute keys are perm_strings.
*
* Revision 1.84 2004/02/20 06:22:58 steve
* parameter keys are per_strings.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: syn-rules.y,v 1.28 2003/12/20 00:59:31 steve Exp $"
#ident "$Id: syn-rules.y,v 1.29 2004/02/20 18:53:35 steve Exp $"
#endif
# include "config.h"
@ -127,9 +127,9 @@ static void hookup_DFF_CE(NetFF*ff, NetESignal*d, NetEvProbe*pclk,
connect(ff->pin_Clock(), pclk->pin(0));
if (ce) connect(ff->pin_Enable(), ce->pin(0));
ff->attribute("LPM_FFType", verinum("DFF"));
ff->attribute(perm_string::literal("LPM_FFType"), verinum("DFF"));
if (pclk->edge() == NetEvProbe::NEGEDGE)
ff->attribute("Clock:LPM_Polarity", verinum("INVERT"));
ff->attribute(perm_string::literal("Clock:LPM_Polarity"), verinum("INVERT"));
}
@ -406,7 +406,7 @@ struct syn_rules_f : public functor_t {
{
/* If the scope that contains this process as a cell
attribute attached to it, then skip synthesis. */
if (top->scope()->attribute("ivl_synthesis_cell").len() > 0)
if (top->scope()->attribute(perm_string::literal("ivl_synthesis_cell")).len() > 0)
return;
syn_start_process(top);

View File

@ -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.35 2004/02/18 17:11:58 steve Exp $"
#ident "$Id: synth2.cc,v 1.36 2004/02/20 18:53:35 steve Exp $"
#endif
# include "config.h"
@ -839,7 +839,7 @@ bool NetEvWait::synth_sync(Design*des, NetScope*scope, NetFF*ff,
connect(ff->pin_Clock(), pclk->pin(0));
if (pclk->edge() == NetEvProbe::NEGEDGE)
ff->attribute("Clock:LPM_Polarity", verinum("INVERT"));
ff->attribute(perm_string::literal("Clock:LPM_Polarity"), verinum("INVERT"));
/* Synthesize the input to the DFF. */
bool flag = statement_->synth_sync(des, scope, ff,
@ -858,7 +858,7 @@ bool NetProcTop::synth_sync(Design*des)
NetFF*ff = new NetFF(scope(), scope()->local_symbol(),
nex_set.count());
des->add_node(ff);
ff->attribute("LPM_FFType", verinum("DFF"));
ff->attribute(perm_string::literal("LPM_FFType"), verinum("DFF"));
/* The D inputs to the DFF device will receive the output from
the statements of the process. */
@ -906,12 +906,12 @@ class synth2_f : public functor_t {
*/
void synth2_f::process(class Design*des, class NetProcTop*top)
{
if (top->attribute("ivl_synthesis_off").as_ulong() != 0)
if (top->attribute(perm_string::literal("ivl_synthesis_off")).as_ulong() != 0)
return;
/* If the scope that contains this process as a cell attribute
attached to it, then skip synthesis. */
if (top->scope()->attribute("ivl_synthesis_cell").len() > 0)
if (top->scope()->attribute(perm_string::literal("ivl_synthesis_cell")).len() > 0)
return;
if (top->is_synchronous()) do {
@ -928,7 +928,7 @@ void synth2_f::process(class Design*des, class NetProcTop*top)
if (! top->is_asynchronous()) {
bool synth_error_flag = false;
if (top->attribute("ivl_combinational").as_ulong() != 0) {
if (top->attribute(perm_string::literal("ivl_combinational")).as_ulong() != 0) {
cerr << top->get_line() << ": error: "
<< "Process is marked combinational,"
<< " but isn't really." << endl;
@ -936,7 +936,7 @@ void synth2_f::process(class Design*des, class NetProcTop*top)
synth_error_flag = true;
}
if (top->attribute("ivl_synthesis_on").as_ulong() != 0) {
if (top->attribute(perm_string::literal("ivl_synthesis_on")).as_ulong() != 0) {
cerr << top->get_line() << ": error: "
<< "Process is marked for synthesis,"
<< " but I can't do it." << endl;
@ -970,6 +970,9 @@ void synth2(Design*des)
/*
* $Log: synth2.cc,v $
* Revision 1.36 2004/02/20 18:53:35 steve
* Addtrbute keys are perm_strings.
*
* Revision 1.35 2004/02/18 17:11:58 steve
* Use perm_strings for named langiage items.
*

View File

@ -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.128 2004/02/20 06:22:58 steve Exp $"
#ident "$Id: t-dll.cc,v 1.129 2004/02/20 18:53:35 steve Exp $"
#endif
# include "config.h"
@ -162,7 +162,7 @@ ivl_attribute_s* dll_target::fill_in_attributes(const Attrib*net)
for (unsigned idx = 0 ; idx < nattr ; idx += 1) {
verinum tmp = net->attr_value(idx);
attr[idx].key = strings_.add(net->attr_key(idx));
attr[idx].key = net->attr_key(idx);
if (tmp.is_string()) {
attr[idx].type = IVL_ATT_STR;
attr[idx].val.str = strings_.add(tmp.as_string().c_str());
@ -1100,7 +1100,7 @@ void dll_target::memory(const NetMemory*net)
void dll_target::lpm_add_sub(const NetAddSub*net)
{
ivl_lpm_t obj = new struct ivl_lpm_s;
if (net->attribute("LPM_Direction") == verinum("SUB"))
if (net->attribute(perm_string::literal("LPM_Direction")) == verinum("SUB"))
obj->type = IVL_LPM_SUB;
else
obj->type = IVL_LPM_ADD;
@ -2176,6 +2176,9 @@ extern const struct target tgt_dll = { "dll", &dll_target_obj };
/*
* $Log: t-dll.cc,v $
* Revision 1.129 2004/02/20 18:53:35 steve
* Addtrbute keys are perm_strings.
*
* Revision 1.128 2004/02/20 06:22:58 steve
* parameter keys are per_strings.
*

View File

@ -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.51 2004/02/18 17:11:58 steve Exp $"
#ident "$Id: t-xnf.cc,v 1.52 2004/02/20 18:53:36 steve Exp $"
#endif
# include "config.h"
@ -347,7 +347,7 @@ void target_xnf::signal(const NetNet*net)
/* Now look to see if a PAD attribute is attached, and if so
write out PAD information to the XNF and the ncf files. */
string pad = net->attribute("PAD").as_string();
string pad = net->attribute(perm_string::literal("PAD")).as_string();
if (pad == "")
return;
@ -682,19 +682,19 @@ void target_xnf::lpm_compare_le_(ostream&os, const NetCompare*dev)
void target_xnf::lpm_ff(const NetFF*net)
{
string type = net->attribute("LPM_FFType").as_string();
string type = net->attribute(perm_string::literal("LPM_FFType")).as_string();
if (type == "") type = "DFF";
// XXXX For now, only support DFF
assert(type == "DFF");
string lcaname = net->attribute("XNF-LCA").as_string();
string lcaname = net->attribute(perm_string::literal("XNF-LCA")).as_string();
if (lcaname != "") {
draw_sym_with_lcaname(out_, lcaname, net);
return;
}
assert(net->attribute("XNF-LCA") == verinum(""));
assert(net->attribute(perm_string::literal("XNF-LCA")) == verinum(""));
/* Create a DFF object for each bit of width. The symbol name
has the index number appended so that read XNF may be able
@ -724,7 +724,7 @@ void target_xnf::lpm_ff(const NetFF*net)
draw_pin(out_, "Q", net->pin_Q(idx));
draw_pin(out_, "D", net->pin_Data(idx));
if (net->attribute("Clock:LPM_Polarity") == verinum("INVERT"))
if (net->attribute(perm_string::literal("Clock:LPM_Polarity")) == verinum("INVERT"))
draw_pin(out_, "~C", net->pin_Clock());
else
draw_pin(out_, "C", net->pin_Clock());
@ -822,7 +822,7 @@ void target_xnf::logic(const NetLogic*net)
{
// The XNF-LCA attribute overrides anything I might guess
// about this object.
string lca = net->attribute("XNF-LCA").as_string();
string lca = net->attribute(perm_string::literal("XNF-LCA")).as_string();
if (lca != "") {
draw_sym_with_lcaname(out_, lca, net);
return;
@ -920,7 +920,7 @@ bool target_xnf::bufz(const NetBUFZ*net)
void target_xnf::udp(const NetUDP*net)
{
string lca = net->attribute("XNF-LCA").as_string();
string lca = net->attribute(perm_string::literal("XNF-LCA")).as_string();
// I only know how to draw a UDP if it has the XNF-LCA
// attribute attached to it.
@ -938,6 +938,9 @@ extern const struct target tgt_xnf = { "xnf", &target_xnf_obj };
/*
* $Log: t-xnf.cc,v $
* Revision 1.52 2004/02/20 18:53:36 steve
* Addtrbute keys are perm_strings.
*
* Revision 1.51 2004/02/18 17:11:58 steve
* Use perm_strings for named langiage items.
*

13
util.h
View File

@ -1,7 +1,7 @@
#ifndef __util_H
#define __util_H
/*
* 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
@ -19,11 +19,11 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: util.h,v 1.6 2002/08/12 01:35:01 steve Exp $"
#ident "$Id: util.h,v 1.7 2004/02/20 18:53:36 steve Exp $"
#endif
# include <map>
# include <string>
# include "StringHeap.h"
# include "verinum.h"
class PExpr;
@ -40,17 +40,20 @@ extern bool load_module(const char*type);
struct attrib_list_t {
string key;
perm_string key;
verinum val;
};
extern attrib_list_t* evaluate_attributes(const map<string,PExpr*>&att,
extern attrib_list_t* evaluate_attributes(const map<perm_string,PExpr*>&att,
unsigned&natt,
const Design*des,
const NetScope*scope);
/*
* $Log: util.h,v $
* Revision 1.7 2004/02/20 18:53:36 steve
* Addtrbute keys are perm_strings.
*
* Revision 1.6 2002/08/12 01:35:01 steve
* conditional ident string using autoconfig.
*

View File

@ -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.28 2004/02/18 17:11:58 steve Exp $"
#ident "$Id: xnfio.cc,v 1.29 2004/02/20 18:53:36 steve Exp $"
#endif
# include "config.h"
@ -40,7 +40,7 @@ class xnfio_f : public functor_t {
static bool is_a_pad(const NetNet*net)
{
if (net->attribute("PAD") == verinum())
if (net->attribute(perm_string::literal("PAD")) == verinum())
return false;
return true;
@ -89,7 +89,8 @@ static NetLogic* make_obuf(Design*des, NetNet*net)
&& (count_inputs(tmp->pin(0)) == 0)
&& (count_outputs(tmp->pin(0)) == 1)
&& (idx->get_pin() == 0) ) {
tmp->attribute("XNF-LCA", verinum("OBUF:O,I"));
tmp->attribute(perm_string::literal("XNF-LCA"),
verinum("OBUF:O,I"));
return tmp;
}
@ -102,7 +103,8 @@ static NetLogic* make_obuf(Design*des, NetNet*net)
&& (count_inputs(tmp->pin(0)) == 0)
&& (count_outputs(tmp->pin(0)) == 1)
&& (idx->get_pin() == 0) ) {
tmp->attribute("XNF-LCA", verinum("OBUF:O,~I"));
tmp->attribute(perm_string::literal("XNF-LCA"),
verinum("OBUF:O,~I"));
return tmp;
}
@ -114,7 +116,8 @@ static NetLogic* make_obuf(Design*des, NetNet*net)
&& (count_inputs(tmp->pin(0)) == 0)
&& (count_outputs(tmp->pin(0)) == 1)
&& (idx->get_pin() == 0) ) {
tmp->attribute("XNF-LCA", verinum("OBUFT:O,I,~T"));
tmp->attribute(perm_string::literal("XNF-LCA"),
verinum("OBUFT:O,I,~T"));
return tmp;
}
@ -122,7 +125,8 @@ static NetLogic* make_obuf(Design*des, NetNet*net)
&& (count_inputs(tmp->pin(0)) == 0)
&& (count_outputs(tmp->pin(0)) == 1)
&& (idx->get_pin() == 0) ) {
tmp->attribute("XNF-LCA", verinum("OBUFT:O,I,T"));
tmp->attribute(perm_string::literal("XNF-LCA"),
verinum("OBUFT:O,I,T"));
return tmp;
}
}
@ -133,7 +137,7 @@ static NetLogic* make_obuf(Design*des, NetNet*net)
2, NetLogic::BUF);
des->add_node(buf);
buf->attribute("XNF-LCA", verinum("OBUF:O,I"));
buf->attribute(perm_string::literal("XNF-LCA"), verinum("OBUF:O,I"));
// Put the buffer between this signal and the rest of the
// netlist.
@ -175,7 +179,7 @@ static void absorb_OFF(Design*des, NetLogic*buf)
return;
if (ff->width() != 1)
return;
if (ff->attribute("LPM_FFType") != verinum("DFF"))
if (ff->attribute(perm_string::literal("LPM_FFType")) != verinum("DFF"))
return;
/* Connect the flip-flop output to the buffer output and
@ -189,7 +193,7 @@ static void absorb_OFF(Design*des, NetLogic*buf)
for (unsigned idx = 0 ; idx < ff->pin_count() ; idx += 1)
names[idx] = "";
if (ff->attribute("Clock:LPM_Polarity") == verinum("INVERT"))
if (ff->attribute(perm_string::literal("Clock:LPM_Polarity")) == verinum("INVERT"))
names[ff->pin_Clock().get_pin()] = "~C";
else
names[ff->pin_Clock().get_pin()] = "C";
@ -202,7 +206,7 @@ static void absorb_OFF(Design*des, NetLogic*buf)
lname = lname + "," + names[idx];
delete[]names;
ff->attribute("XNF-LCA", lname);
ff->attribute(perm_string::literal("XNF-LCA"), lname);
}
static void make_ibuf(Design*des, NetNet*net)
@ -224,7 +228,7 @@ static void make_ibuf(Design*des, NetNet*net)
if ((tmp = dynamic_cast<NetLogic*>(idx->get_obj())) == 0)
continue;
if (tmp->attribute("XNF-LCA") != verinum())
if (tmp->attribute(perm_string::literal("XNF-LCA")) != verinum())
continue;
// Found a BUF, it is only usable if the only input is
@ -232,7 +236,7 @@ static void make_ibuf(Design*des, NetNet*net)
if ((tmp->type() == NetLogic::BUF) &&
(count_inputs(tmp->pin(1)) == 1) &&
(count_outputs(tmp->pin(1)) == 0)) {
tmp->attribute("XNF-LCA", verinum("IBUF:O,I"));
tmp->attribute(perm_string::literal("XNF-LCA"), verinum("IBUF:O,I"));
return;
}
@ -243,7 +247,7 @@ static void make_ibuf(Design*des, NetNet*net)
2, NetLogic::BUF);
des->add_node(buf);
buf->attribute("XNF-LCA", verinum("IBUF:O,I"));
buf->attribute(perm_string::literal("XNF-LCA"), verinum("IBUF:O,I"));
// Put the buffer between this signal and the rest of the
// netlist.
@ -268,7 +272,7 @@ void xnfio_f::signal(Design*des, NetNet*net)
return;
assert(net->pin_count() == 1);
string pattr = net->attribute("PAD").as_string();
string pattr = net->attribute(perm_string::literal("PAD")).as_string();
switch (pattr[0]) {
case 'i':
@ -361,6 +365,9 @@ void xnfio(Design*des)
/*
* $Log: xnfio.cc,v $
* Revision 1.29 2004/02/20 18:53:36 steve
* Addtrbute keys are perm_strings.
*
* Revision 1.28 2004/02/18 17:11:58 steve
* Use perm_strings for named langiage items.
*