Add the lex_strings string handler, and put
scope names and system task/function names into this table. Also, permallocate event names from the beginning.
This commit is contained in:
parent
411098117a
commit
4c67de5ca7
14
PEvent.cc
14
PEvent.cc
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 200Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2003 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,14 +17,14 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: PEvent.cc,v 1.3 2002/08/12 01:34:58 steve Exp $"
|
||||
#ident "$Id: PEvent.cc,v 1.4 2003/03/01 06:25:30 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
||||
# include "PEvent.h"
|
||||
|
||||
PEvent::PEvent(const string&n)
|
||||
PEvent::PEvent(const char*n)
|
||||
: name_(n)
|
||||
{
|
||||
}
|
||||
|
|
@ -33,13 +33,19 @@ PEvent::~PEvent()
|
|||
{
|
||||
}
|
||||
|
||||
string PEvent::name() const
|
||||
const char* PEvent::name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
/*
|
||||
* $Log: PEvent.cc,v $
|
||||
* 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
|
||||
* into this table. Also, permallocate event
|
||||
* names from the beginning.
|
||||
*
|
||||
* Revision 1.3 2002/08/12 01:34:58 steve
|
||||
* conditional ident string using autoconfig.
|
||||
*
|
||||
|
|
|
|||
15
PEvent.h
15
PEvent.h
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: PEvent.h,v 1.7 2003/01/30 16:23:07 steve Exp $"
|
||||
#ident "$Id: PEvent.h,v 1.8 2003/03/01 06:25:30 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "LineInfo.h"
|
||||
|
|
@ -36,15 +36,16 @@ class NetScope;
|
|||
class PEvent : public LineInfo {
|
||||
|
||||
public:
|
||||
explicit PEvent(const string&name);
|
||||
// The name is a perm-allocated string.
|
||||
explicit PEvent(const char*name);
|
||||
~PEvent();
|
||||
|
||||
string name() const;
|
||||
const char* name() const;
|
||||
|
||||
void elaborate_scope(Design*des, NetScope*scope) const;
|
||||
|
||||
private:
|
||||
string name_;
|
||||
const char* name_;
|
||||
|
||||
private: // not implemented
|
||||
PEvent(const PEvent&);
|
||||
|
|
@ -53,6 +54,12 @@ class PEvent : public LineInfo {
|
|||
|
||||
/*
|
||||
* $Log: PEvent.h,v $
|
||||
* Revision 1.8 2003/03/01 06:25:30 steve
|
||||
* Add the lex_strings string handler, and put
|
||||
* scope names and system task/function names
|
||||
* into this table. Also, permallocate event
|
||||
* names from the beginning.
|
||||
*
|
||||
* Revision 1.7 2003/01/30 16:23:07 steve
|
||||
* Spelling fixes.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2002 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2002-2003 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.4 2003/01/27 05:09:17 steve Exp $"
|
||||
#ident "$Id: StringHeap.cc,v 1.5 2003/03/01 06:25:30 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "StringHeap.h"
|
||||
|
|
@ -64,8 +64,71 @@ const char* StringHeap::add(const char*text)
|
|||
return res;
|
||||
}
|
||||
|
||||
|
||||
StringHeapLex::StringHeapLex()
|
||||
{
|
||||
hit_count_ = 0;
|
||||
add_count_ = 0;
|
||||
|
||||
for (unsigned idx = 0 ; idx < HASH_SIZE ; idx += 1)
|
||||
hash_table_[idx] = 0;
|
||||
}
|
||||
|
||||
StringHeapLex::~StringHeapLex()
|
||||
{
|
||||
}
|
||||
|
||||
unsigned StringHeapLex::add_hit_count() const
|
||||
{
|
||||
return hit_count_;
|
||||
}
|
||||
|
||||
unsigned StringHeapLex::add_count() const
|
||||
{
|
||||
return add_count_;
|
||||
}
|
||||
|
||||
static unsigned hash_string(const char*text)
|
||||
{
|
||||
unsigned h = 0;
|
||||
|
||||
while (*text) {
|
||||
h = (h << 4) ^ (h >> 28) ^ *text;
|
||||
text += 1;
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
const char* StringHeapLex::add(const char*text)
|
||||
{
|
||||
unsigned hash_value = hash_string(text) % HASH_SIZE;
|
||||
|
||||
/* If we easily find the string in the hash table, then return
|
||||
that and be done. */
|
||||
if (hash_table_[hash_value]
|
||||
&& (strcmp(hash_table_[hash_value], text) == 0)) {
|
||||
hit_count_ += 1;
|
||||
return hash_table_[hash_value];
|
||||
}
|
||||
|
||||
/* The existing hash entry is not a match. Replace it with the
|
||||
newly allocated value, and return the new pointer as the
|
||||
result to the add. */
|
||||
const char*res = StringHeap::add(text);
|
||||
hash_table_[hash_value] = res;
|
||||
add_count_ += 1;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* $Log: StringHeap.cc,v $
|
||||
* 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
|
||||
* into this table. Also, permallocate event
|
||||
* names from the beginning.
|
||||
*
|
||||
* Revision 1.4 2003/01/27 05:09:17 steve
|
||||
* Spelling fixes.
|
||||
*
|
||||
|
|
|
|||
44
StringHeap.h
44
StringHeap.h
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef __StringHeap_H
|
||||
#define __StringHeap_H
|
||||
/*
|
||||
* Copyright (c) 2002 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2002-2003 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,14 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: StringHeap.h,v 1.3 2003/01/16 21:44:46 steve Exp $"
|
||||
#ident "$Id: StringHeap.h,v 1.4 2003/03/01 06:25:30 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The string heap is a way to permanently allocate strings
|
||||
* efficiently. They only take up the space of the string characters
|
||||
* and the terminating nul, there is no malloc overhead.
|
||||
*/
|
||||
class StringHeap {
|
||||
|
||||
public:
|
||||
|
|
@ -42,8 +47,43 @@ class StringHeap {
|
|||
StringHeap& operator= (const StringHeap&);
|
||||
};
|
||||
|
||||
/*
|
||||
* A lexical string heap is a string heap that makes an effort to
|
||||
* return the same pointer for identical strings. This saves further
|
||||
* space by not allocating duplicate strings, so in a system with lots
|
||||
* of identifiers, this can theoretically save more space.
|
||||
*/
|
||||
class StringHeapLex : private StringHeap {
|
||||
|
||||
public:
|
||||
StringHeapLex();
|
||||
~StringHeapLex();
|
||||
|
||||
const char*add(const char*);
|
||||
|
||||
unsigned add_count() const;
|
||||
unsigned add_hit_count() const;
|
||||
|
||||
private:
|
||||
enum { HASH_SIZE = 4096 };
|
||||
const char*hash_table_[HASH_SIZE];
|
||||
|
||||
unsigned add_count_;
|
||||
unsigned hit_count_;
|
||||
|
||||
private: // not implemented
|
||||
StringHeapLex(const StringHeapLex&);
|
||||
StringHeapLex& operator= (const StringHeapLex&);
|
||||
};
|
||||
|
||||
/*
|
||||
* $Log: StringHeap.h,v $
|
||||
* 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
|
||||
* into this table. Also, permallocate event
|
||||
* names from the beginning.
|
||||
*
|
||||
* Revision 1.3 2003/01/16 21:44:46 steve
|
||||
* Keep some debugging status.
|
||||
*
|
||||
|
|
|
|||
12
compiler.h
12
compiler.h
|
|
@ -19,10 +19,11 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: compiler.h,v 1.15 2003/02/22 04:12:49 steve Exp $"
|
||||
#ident "$Id: compiler.h,v 1.16 2003/03/01 06:25:30 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <list>
|
||||
# include "StringHeap.h"
|
||||
|
||||
/*
|
||||
* This defines constants and defaults for the compiler in general.
|
||||
|
|
@ -96,8 +97,17 @@ extern generation_t generation_flag;
|
|||
/* This is the string to use to invoke the preprocessor. */
|
||||
extern char*ivlpp_string;
|
||||
|
||||
|
||||
extern StringHeapLex lex_strings;
|
||||
|
||||
/*
|
||||
* $Log: compiler.h,v $
|
||||
* Revision 1.16 2003/03/01 06:25:30 steve
|
||||
* Add the lex_strings string handler, and put
|
||||
* scope names and system task/function names
|
||||
* into this table. Also, permallocate event
|
||||
* names from the beginning.
|
||||
*
|
||||
* Revision 1.15 2003/02/22 04:12:49 steve
|
||||
* Add the portbind warning.
|
||||
*
|
||||
|
|
|
|||
12
elaborate.cc
12
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.274 2003/02/22 04:12:49 steve Exp $"
|
||||
#ident "$Id: elaborate.cc,v 1.275 2003/03/01 06:25:30 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -1806,7 +1806,7 @@ NetProc* PEventStatement::elaborate_st(Design*des, NetScope*scope,
|
|||
|
||||
/* Create a NetEvent object to manage this event. Note
|
||||
that the NetEvent object's name has no hierarchy. */
|
||||
NetEvent*ev = new NetEvent(scope->local_symbol());
|
||||
NetEvent*ev = new NetEvent(lex_strings.add(scope->local_symbol().c_str()));
|
||||
scope->add_event(ev);
|
||||
|
||||
NetEvWait*we = new NetEvWait(0);
|
||||
|
|
@ -1866,7 +1866,7 @@ NetProc* PEventStatement::elaborate_st(Design*des, NetScope*scope,
|
|||
list. The NetEvProbe objects all refer back to the NetEvent
|
||||
object. */
|
||||
|
||||
NetEvent*ev = new NetEvent(scope->local_symbol());
|
||||
NetEvent*ev = new NetEvent(lex_strings.add(scope->local_symbol().c_str()));
|
||||
ev->set_line(*this);
|
||||
unsigned expr_count = 0;
|
||||
|
||||
|
|
@ -2502,6 +2502,12 @@ Design* elaborate(list<const char*>roots)
|
|||
|
||||
/*
|
||||
* $Log: elaborate.cc,v $
|
||||
* Revision 1.275 2003/03/01 06:25:30 steve
|
||||
* Add the lex_strings string handler, and put
|
||||
* scope names and system task/function names
|
||||
* into this table. Also, permallocate event
|
||||
* names from the beginning.
|
||||
*
|
||||
* Revision 1.274 2003/02/22 04:12:49 steve
|
||||
* Add the portbind warning.
|
||||
*
|
||||
|
|
|
|||
106
main.cc
106
main.cc
|
|
@ -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.65 2003/02/22 04:12:49 steve Exp $"
|
||||
#ident "$Id: main.cc,v 1.66 2003/03/01 06:25:30 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -99,6 +99,12 @@ bool error_implicit = false;
|
|||
*/
|
||||
bool verbose_flag = false;
|
||||
|
||||
/*
|
||||
* Keep a heap of identifier strings that I encounter. This is a more
|
||||
* efficient way to allocate those strings.
|
||||
*/
|
||||
StringHeapLex lex_strings;
|
||||
|
||||
/*
|
||||
* In library searches, Windows file names are never case sensitive.
|
||||
*/
|
||||
|
|
@ -600,8 +606,17 @@ int main(int argc, char*argv[])
|
|||
times(cycles+4);
|
||||
cerr<<" ... done, "
|
||||
<<cycles_diff(cycles+4, cycles+3)<<" seconds."<<endl;
|
||||
} else
|
||||
} else {
|
||||
cout << "DONE." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (verbose_flag) {
|
||||
cout << "STATISTICS" << endl;
|
||||
cout << "lex_string:"
|
||||
<< " add_count=" << lex_strings.add_count()
|
||||
<< " hit_count=" << lex_strings.add_hit_count()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
@ -609,6 +624,12 @@ int main(int argc, char*argv[])
|
|||
|
||||
/*
|
||||
* $Log: main.cc,v $
|
||||
* Revision 1.66 2003/03/01 06:25:30 steve
|
||||
* Add the lex_strings string handler, and put
|
||||
* scope names and system task/function names
|
||||
* into this table. Also, permallocate event
|
||||
* names from the beginning.
|
||||
*
|
||||
* Revision 1.65 2003/02/22 04:12:49 steve
|
||||
* Add the portbind warning.
|
||||
*
|
||||
|
|
@ -645,86 +666,5 @@ int main(int argc, char*argv[])
|
|||
*
|
||||
* Revision 1.55 2002/05/24 01:13:00 steve
|
||||
* Support language generation flag -g.
|
||||
*
|
||||
* Revision 1.54 2002/04/22 00:53:39 steve
|
||||
* Do not allow implicit wires in sensitivity lists.
|
||||
*
|
||||
* Revision 1.53 2002/04/15 00:04:22 steve
|
||||
* Timescale warnings.
|
||||
*
|
||||
* Revision 1.52 2002/04/04 05:26:13 steve
|
||||
* Add dependency generation.
|
||||
*
|
||||
* Revision 1.51 2001/11/16 05:07:19 steve
|
||||
* Add support for +libext+ in command files.
|
||||
*
|
||||
* Revision 1.50 2001/10/20 23:02:40 steve
|
||||
* Add automatic module libraries.
|
||||
*
|
||||
* Revision 1.49 2001/10/20 05:21:51 steve
|
||||
* Scope/module names are char* instead of string.
|
||||
*
|
||||
* Revision 1.48 2001/10/19 21:53:24 steve
|
||||
* Support multiple root modules (Philip Blundell)
|
||||
*
|
||||
* Revision 1.47 2001/07/30 02:44:05 steve
|
||||
* Cleanup defines and types for mingw compile.
|
||||
*
|
||||
* Revision 1.46 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.45 2001/07/16 18:14:56 steve
|
||||
* Reshuffle -v and -V flags of ivl. (Stephan Boettcher)
|
||||
*
|
||||
* Revision 1.44 2001/07/03 04:09:24 steve
|
||||
* Generate verbuse status messages (Stephan Boettcher)
|
||||
*
|
||||
* Revision 1.43 2001/07/02 01:57:27 steve
|
||||
* Add the -V flag, and some verbose messages.
|
||||
*
|
||||
* Revision 1.42 2001/06/23 18:41:02 steve
|
||||
* Include stdlib.h
|
||||
*
|
||||
* Revision 1.41 2001/05/20 17:35:05 steve
|
||||
* declare getopt by hand in mingw32 compile.
|
||||
*
|
||||
* Revision 1.40 2001/01/20 19:02:05 steve
|
||||
* Switch hte -f flag to the -p flag.
|
||||
*
|
||||
* Revision 1.39 2000/11/22 20:48:32 steve
|
||||
* Allow sole module to be a root.
|
||||
*
|
||||
* Revision 1.38 2000/09/12 01:17:40 steve
|
||||
* Version information for vlog_vpi_info.
|
||||
*
|
||||
* Revision 1.37 2000/08/09 03:43:45 steve
|
||||
* Move all file manipulation out of target class.
|
||||
*
|
||||
* Revision 1.36 2000/07/29 17:58:21 steve
|
||||
* Introduce min:typ:max support.
|
||||
*
|
||||
* Revision 1.35 2000/07/14 06:12:57 steve
|
||||
* Move inital value handling from NetNet to Nexus
|
||||
* objects. This allows better propogation of inital
|
||||
* values.
|
||||
*
|
||||
* Clean up constant propagation a bit to account
|
||||
* for regs that are not really values.
|
||||
*
|
||||
* Revision 1.34 2000/05/13 20:55:47 steve
|
||||
* Use yacc based synthesizer.
|
||||
*
|
||||
* Revision 1.33 2000/05/08 05:29:43 steve
|
||||
* no need for nobufz functor.
|
||||
*
|
||||
* Revision 1.32 2000/05/03 22:14:31 steve
|
||||
* More features of ivl available through iverilog.
|
||||
*
|
||||
* Revision 1.31 2000/04/12 20:02:53 steve
|
||||
* Finally remove the NetNEvent and NetPEvent classes,
|
||||
* Get synthesis working with the NetEvWait class,
|
||||
* and get started supporting multiple events in a
|
||||
* wait in vvm.
|
||||
*/
|
||||
|
||||
|
|
|
|||
20
net_event.cc
20
net_event.cc
|
|
@ -17,15 +17,19 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: net_event.cc,v 1.20 2002/08/12 01:34:59 steve Exp $"
|
||||
#ident "$Id: net_event.cc,v 1.21 2003/03/01 06:25:30 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
# include "compiler.h"
|
||||
|
||||
# include "netlist.h"
|
||||
|
||||
NetEvent::NetEvent(const string&n)
|
||||
: name_(0)
|
||||
/*
|
||||
* NOTE: The name_ is perm-allocated by the caller.
|
||||
*/
|
||||
NetEvent::NetEvent(const char*n)
|
||||
: name_(n)
|
||||
{
|
||||
scope_ = 0;
|
||||
snext_ = 0;
|
||||
|
|
@ -33,8 +37,6 @@ NetEvent::NetEvent(const string&n)
|
|||
trig_ = 0;
|
||||
waitref_ = 0;
|
||||
wlist_ = 0;
|
||||
name_ = new char[n.length()+1];
|
||||
strcpy(name_, n.c_str());
|
||||
}
|
||||
|
||||
NetEvent::~NetEvent()
|
||||
|
|
@ -46,7 +48,7 @@ NetEvent::~NetEvent()
|
|||
delete probes_;
|
||||
probes_ = tmp;
|
||||
}
|
||||
delete[]name_;
|
||||
/* name_ is lex_strings. */
|
||||
}
|
||||
|
||||
const char* NetEvent::name() const
|
||||
|
|
@ -442,6 +444,12 @@ NetProc* NetEvWait::statement()
|
|||
|
||||
/*
|
||||
* $Log: net_event.cc,v $
|
||||
* Revision 1.21 2003/03/01 06:25:30 steve
|
||||
* Add the lex_strings string handler, and put
|
||||
* scope names and system task/function names
|
||||
* into this table. Also, permallocate event
|
||||
* names from the beginning.
|
||||
*
|
||||
* Revision 1.20 2002/08/12 01:34:59 steve
|
||||
* conditional ident string using autoconfig.
|
||||
*
|
||||
|
|
|
|||
16
net_expr.cc
16
net_expr.cc
|
|
@ -17,11 +17,12 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: net_expr.cc,v 1.13 2003/02/06 17:50:23 steve Exp $"
|
||||
#ident "$Id: net_expr.cc,v 1.14 2003/03/01 06:25:30 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
# include "netlist.h"
|
||||
# include "compiler.h"
|
||||
# include <iostream>
|
||||
|
||||
NetExpr::TYPE NetExpr::expr_type() const
|
||||
|
|
@ -349,11 +350,10 @@ bool NetESelect::set_width(unsigned w)
|
|||
return false;
|
||||
}
|
||||
|
||||
NetESFunc::NetESFunc(const string&n, unsigned width, unsigned np)
|
||||
NetESFunc::NetESFunc(const char*n, unsigned width, unsigned np)
|
||||
: name_(0)
|
||||
{
|
||||
name_ = new char [n.length()+1];
|
||||
strcpy(name_, n.c_str());
|
||||
name_ = lex_strings.add(n);
|
||||
expr_width(width);
|
||||
nparms_ = np;
|
||||
parms_ = new NetExpr*[np];
|
||||
|
|
@ -367,7 +367,7 @@ NetESFunc::~NetESFunc()
|
|||
if (parms_[idx]) delete parms_[idx];
|
||||
|
||||
delete[]parms_;
|
||||
delete[]name_;
|
||||
/* name_ string ls lex_strings allocated. */
|
||||
}
|
||||
|
||||
const char* NetESFunc::name() const
|
||||
|
|
@ -410,6 +410,12 @@ NetExpr::TYPE NetESFunc::expr_type() const
|
|||
|
||||
/*
|
||||
* $Log: net_expr.cc,v $
|
||||
* Revision 1.14 2003/03/01 06:25:30 steve
|
||||
* Add the lex_strings string handler, and put
|
||||
* scope names and system task/function names
|
||||
* into this table. Also, permallocate event
|
||||
* names from the beginning.
|
||||
*
|
||||
* Revision 1.13 2003/02/06 17:50:23 steve
|
||||
* Real constants have no defined vector width
|
||||
*
|
||||
|
|
|
|||
19
net_scope.cc
19
net_scope.cc
|
|
@ -17,10 +17,11 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: net_scope.cc,v 1.24 2003/01/27 05:09:17 steve Exp $"
|
||||
#ident "$Id: net_scope.cc,v 1.25 2003/03/01 06:25:30 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
# include "compiler.h"
|
||||
|
||||
# include "netlist.h"
|
||||
# include <sstream>
|
||||
|
|
@ -65,8 +66,7 @@ NetScope::NetScope(NetScope*up, const char*n, NetScope::TYPE t)
|
|||
module_name_ = 0;
|
||||
break;
|
||||
}
|
||||
name_ = new char[strlen(n)+1];
|
||||
strcpy(name_, n);
|
||||
name_ = lex_strings.add(n);
|
||||
}
|
||||
|
||||
NetScope::~NetScope()
|
||||
|
|
@ -74,9 +74,8 @@ NetScope::~NetScope()
|
|||
assert(sib_ == 0);
|
||||
assert(sub_ == 0);
|
||||
lcounter_ = 0;
|
||||
delete[]name_;
|
||||
if ((type_ == MODULE) && module_name_)
|
||||
free(module_name_);
|
||||
|
||||
/* name_ and module_name_ are perm-allocated. */
|
||||
}
|
||||
|
||||
NetExpr* NetScope::set_parameter(const string&key, NetExpr*expr,
|
||||
|
|
@ -186,7 +185,7 @@ const NetFuncDef* NetScope::func_def() const
|
|||
void NetScope::set_module_name(const char*n)
|
||||
{
|
||||
assert(type_ == MODULE);
|
||||
module_name_ = strdup(n);
|
||||
module_name_ = lex_strings.add(n);
|
||||
}
|
||||
|
||||
const char* NetScope::module_name() const
|
||||
|
|
@ -450,6 +449,12 @@ string NetScope::local_hsymbol()
|
|||
|
||||
/*
|
||||
* $Log: net_scope.cc,v $
|
||||
* Revision 1.25 2003/03/01 06:25:30 steve
|
||||
* Add the lex_strings string handler, and put
|
||||
* scope names and system task/function names
|
||||
* into this table. Also, permallocate event
|
||||
* names from the beginning.
|
||||
*
|
||||
* Revision 1.24 2003/01/27 05:09:17 steve
|
||||
* Spelling fixes.
|
||||
*
|
||||
|
|
|
|||
17
netlist.cc
17
netlist.cc
|
|
@ -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.205 2003/01/27 00:14:37 steve Exp $"
|
||||
#ident "$Id: netlist.cc,v 1.206 2003/03/01 06:25:30 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -26,9 +26,11 @@
|
|||
|
||||
# include <cassert>
|
||||
# include <typeinfo>
|
||||
# include "compiler.h"
|
||||
# include "netlist.h"
|
||||
# include "netmisc.h"
|
||||
|
||||
|
||||
ostream& operator<< (ostream&o, NetNet::Type t)
|
||||
{
|
||||
switch (t) {
|
||||
|
|
@ -1638,11 +1640,10 @@ const NetNet* NetFuncDef::port(unsigned idx) const
|
|||
return ports_[idx];
|
||||
}
|
||||
|
||||
NetSTask::NetSTask(const string&na, const svector<NetExpr*>&pa)
|
||||
NetSTask::NetSTask(const char*na, const svector<NetExpr*>&pa)
|
||||
: name_(0), parms_(pa)
|
||||
{
|
||||
name_ = new char[na.length() + 1];
|
||||
strcpy(name_, na.c_str());
|
||||
name_ = lex_strings.add(na);
|
||||
assert(name_[0] == '$');
|
||||
}
|
||||
|
||||
|
|
@ -1651,7 +1652,7 @@ NetSTask::~NetSTask()
|
|||
for (unsigned idx = 0 ; idx < parms_.count() ; idx += 1)
|
||||
delete parms_[idx];
|
||||
|
||||
delete[]name_;
|
||||
/* The name_ string is perm-allocated in lex_strings. */
|
||||
}
|
||||
|
||||
const char*NetSTask::name() const
|
||||
|
|
@ -2195,6 +2196,12 @@ const NetProc*NetTaskDef::proc() const
|
|||
|
||||
/*
|
||||
* $Log: netlist.cc,v $
|
||||
* Revision 1.206 2003/03/01 06:25:30 steve
|
||||
* Add the lex_strings string handler, and put
|
||||
* scope names and system task/function names
|
||||
* into this table. Also, permallocate event
|
||||
* names from the beginning.
|
||||
*
|
||||
* Revision 1.205 2003/01/27 00:14:37 steve
|
||||
* Support in various contexts the $realtime
|
||||
* system task.
|
||||
|
|
|
|||
27
netlist.h
27
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.276 2003/02/07 02:47:57 steve Exp $"
|
||||
#ident "$Id: netlist.h,v 1.277 2003/03/01 06:25:30 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -1707,7 +1707,10 @@ class NetEvent : public LineInfo {
|
|||
friend class NetEvWait;
|
||||
|
||||
public:
|
||||
explicit NetEvent (const string&n);
|
||||
// The name of the event is the basename, and should not
|
||||
// include the scope. Also, the name passed here should be
|
||||
// perm-allocated.
|
||||
explicit NetEvent (const char*n);
|
||||
~NetEvent();
|
||||
|
||||
const char* name() const;
|
||||
|
|
@ -1743,7 +1746,7 @@ class NetEvent : public LineInfo {
|
|||
NexusSet*nex_async_();
|
||||
|
||||
private:
|
||||
char* name_;
|
||||
const char* name_;
|
||||
|
||||
// The NetScope class uses these to list the events.
|
||||
NetScope*scope_;
|
||||
|
|
@ -2035,7 +2038,7 @@ class NetRelease : public NetProc {
|
|||
class NetSTask : public NetProc {
|
||||
|
||||
public:
|
||||
NetSTask(const string&na, const svector<NetExpr*>&);
|
||||
NetSTask(const char*na, const svector<NetExpr*>&);
|
||||
~NetSTask();
|
||||
|
||||
const char* name() const;
|
||||
|
|
@ -2049,7 +2052,7 @@ class NetSTask : public NetProc {
|
|||
virtual void dump(ostream&, unsigned ind) const;
|
||||
|
||||
private:
|
||||
char* name_;
|
||||
const char* name_;
|
||||
svector<NetExpr*>parms_;
|
||||
};
|
||||
|
||||
|
|
@ -2637,7 +2640,7 @@ class NetEScope : public NetExpr {
|
|||
class NetESFunc : public NetExpr {
|
||||
|
||||
public:
|
||||
NetESFunc(const string&name, unsigned width, unsigned nprms);
|
||||
NetESFunc(const char*name, unsigned width, unsigned nprms);
|
||||
~NetESFunc();
|
||||
|
||||
const char* name() const;
|
||||
|
|
@ -2656,7 +2659,7 @@ class NetESFunc : public NetExpr {
|
|||
virtual NetESFunc*dup_expr() const;
|
||||
|
||||
private:
|
||||
char* name_;
|
||||
const char* name_;
|
||||
unsigned nparms_;
|
||||
NetExpr**parms_;
|
||||
|
||||
|
|
@ -2995,7 +2998,7 @@ class NetScope {
|
|||
|
||||
private:
|
||||
TYPE type_;
|
||||
char* name_;
|
||||
const char* name_;
|
||||
|
||||
signed char time_unit_, time_prec_;
|
||||
|
||||
|
|
@ -3016,7 +3019,7 @@ class NetScope {
|
|||
union {
|
||||
NetTaskDef*task_;
|
||||
NetFuncDef*func_;
|
||||
char*module_name_;
|
||||
const char*module_name_;
|
||||
};
|
||||
|
||||
NetScope*up_;
|
||||
|
|
@ -3198,6 +3201,12 @@ extern ostream& operator << (ostream&, NetNet::Type);
|
|||
|
||||
/*
|
||||
* $Log: netlist.h,v $
|
||||
* Revision 1.277 2003/03/01 06:25:30 steve
|
||||
* Add the lex_strings string handler, and put
|
||||
* scope names and system task/function names
|
||||
* into this table. Also, permallocate event
|
||||
* names from the beginning.
|
||||
*
|
||||
* Revision 1.276 2003/02/07 02:47:57 steve
|
||||
* NetEBDiv handles real value constant expressions.
|
||||
*
|
||||
|
|
|
|||
10
pform.cc
10
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.109 2003/02/27 06:45:11 steve Exp $"
|
||||
#ident "$Id: pform.cc,v 1.110 2003/03/01 06:25:30 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -540,7 +540,7 @@ void pform_set_net_range(list<char*>*names,
|
|||
*/
|
||||
static void pform_make_event(const char*name, const char*fn, unsigned ln)
|
||||
{
|
||||
PEvent*event = new PEvent(name);
|
||||
PEvent*event = new PEvent(lex_strings.add(name));
|
||||
event->set_file(fn);
|
||||
event->set_lineno(ln);
|
||||
pform_cur_module->events[name] = event;
|
||||
|
|
@ -1412,6 +1412,12 @@ int pform_parse(const char*path, FILE*file)
|
|||
|
||||
/*
|
||||
* $Log: pform.cc,v $
|
||||
* Revision 1.110 2003/03/01 06:25:30 steve
|
||||
* Add the lex_strings string handler, and put
|
||||
* scope names and system task/function names
|
||||
* into this table. Also, permallocate event
|
||||
* names from the beginning.
|
||||
*
|
||||
* Revision 1.109 2003/02/27 06:45:11 steve
|
||||
* specparams as far as pform.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: t-dll-expr.cc,v 1.33 2003/02/02 00:19:27 steve Exp $"
|
||||
#ident "$Id: t-dll-expr.cc,v 1.34 2003/03/01 06:25:30 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -343,7 +343,8 @@ void dll_target::expr_sfunc(const NetESFunc*net)
|
|||
break;
|
||||
}
|
||||
expr->width_= net->expr_width();
|
||||
expr->u_.sfunc_.name_ = strdup(net->name());
|
||||
/* system function names are lex_strings strings. */
|
||||
expr->u_.sfunc_.name_ = net->name();
|
||||
|
||||
unsigned cnt = net->nparms();
|
||||
expr->u_.sfunc_.parms = cnt;
|
||||
|
|
@ -563,6 +564,12 @@ void dll_target::expr_variable(const NetEVariable*net)
|
|||
|
||||
/*
|
||||
* $Log: t-dll-expr.cc,v $
|
||||
* Revision 1.34 2003/03/01 06:25:30 steve
|
||||
* Add the lex_strings string handler, and put
|
||||
* scope names and system task/function names
|
||||
* into this table. Also, permallocate event
|
||||
* names from the beginning.
|
||||
*
|
||||
* Revision 1.33 2003/02/02 00:19:27 steve
|
||||
* Terminate bits string from ivl_expr_bits.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: t-dll-proc.cc,v 1.56 2003/01/30 16:23:08 steve Exp $"
|
||||
#ident "$Id: t-dll-proc.cc,v 1.57 2003/03/01 06:25:30 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -672,7 +672,8 @@ void dll_target::proc_stask(const NetSTask*net)
|
|||
assert(stmt_cur_->type_ == IVL_ST_NONE);
|
||||
|
||||
stmt_cur_->type_ = IVL_ST_STASK;
|
||||
stmt_cur_->u_.stask_.name_ = strdup(net->name());
|
||||
/* System task names are lex_strings strings. */
|
||||
stmt_cur_->u_.stask_.name_ = net->name();
|
||||
stmt_cur_->u_.stask_.nparm_= nparms;
|
||||
stmt_cur_->u_.stask_.parms_= (ivl_expr_t*)
|
||||
calloc(nparms, sizeof(ivl_expr_t));
|
||||
|
|
@ -827,6 +828,12 @@ void dll_target::proc_while(const NetWhile*net)
|
|||
|
||||
/*
|
||||
* $Log: t-dll-proc.cc,v $
|
||||
* Revision 1.57 2003/03/01 06:25:30 steve
|
||||
* Add the lex_strings string handler, and put
|
||||
* scope names and system task/function names
|
||||
* into this table. Also, permallocate event
|
||||
* names from the beginning.
|
||||
*
|
||||
* Revision 1.56 2003/01/30 16:23:08 steve
|
||||
* Spelling fixes.
|
||||
*
|
||||
|
|
|
|||
14
t-dll.h
14
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.98 2003/02/06 16:43:20 steve Exp $"
|
||||
#ident "$Id: t-dll.h,v 1.99 2003/03/01 06:25:30 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "target.h"
|
||||
|
|
@ -219,7 +219,7 @@ struct ivl_expr_s {
|
|||
} signal_;
|
||||
|
||||
struct {
|
||||
char*name_;
|
||||
const char *name_;
|
||||
ivl_expr_t *parm;
|
||||
unsigned short parms;
|
||||
} sfunc_;
|
||||
|
|
@ -615,8 +615,8 @@ struct ivl_statement_s {
|
|||
} forever_;
|
||||
|
||||
struct { /* IVL_ST_STASK */
|
||||
char* name_;
|
||||
unsigned nparm_;
|
||||
const char*name_;
|
||||
unsigned nparm_;
|
||||
ivl_expr_t*parms_;
|
||||
} stask_;
|
||||
|
||||
|
|
@ -651,6 +651,12 @@ struct ivl_variable_s {
|
|||
|
||||
/*
|
||||
* $Log: t-dll.h,v $
|
||||
* Revision 1.99 2003/03/01 06:25:30 steve
|
||||
* Add the lex_strings string handler, and put
|
||||
* scope names and system task/function names
|
||||
* into this table. Also, permallocate event
|
||||
* names from the beginning.
|
||||
*
|
||||
* Revision 1.98 2003/02/06 16:43:20 steve
|
||||
* Satisfy declaration requirements of some picky compilers.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue