Support multiple root modules (Philip Blundell)
This commit is contained in:
parent
6fc556cefc
commit
d350620315
|
|
@ -17,7 +17,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT) && !defined(macintosh)
|
#if !defined(WINNT) && !defined(macintosh)
|
||||||
#ident "$Id: design_dump.cc,v 1.117 2001/08/25 23:50:02 steve Exp $"
|
#ident "$Id: design_dump.cc,v 1.118 2001/10/19 21:53:24 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
|
|
@ -945,7 +945,9 @@ void Design::dump(ostream&o) const
|
||||||
{
|
{
|
||||||
o << "DESIGN TIME PRECISION: 10e" << get_precision() << endl;
|
o << "DESIGN TIME PRECISION: 10e" << get_precision() << endl;
|
||||||
o << "SCOPES:" << endl;
|
o << "SCOPES:" << endl;
|
||||||
root_scope_->dump(o);
|
for (list<NetScope*>::const_iterator scope = root_scopes_.begin();
|
||||||
|
scope != root_scopes_.end(); scope++)
|
||||||
|
(*scope)->dump(o);
|
||||||
|
|
||||||
o << "ELABORATED NODES:" << endl;
|
o << "ELABORATED NODES:" << endl;
|
||||||
|
|
||||||
|
|
@ -968,6 +970,9 @@ void Design::dump(ostream&o) const
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: design_dump.cc,v $
|
* $Log: design_dump.cc,v $
|
||||||
|
* Revision 1.118 2001/10/19 21:53:24 steve
|
||||||
|
* Support multiple root modules (Philip Blundell)
|
||||||
|
*
|
||||||
* Revision 1.117 2001/08/25 23:50:02 steve
|
* Revision 1.117 2001/08/25 23:50:02 steve
|
||||||
* Change the NetAssign_ class to refer to the signal
|
* Change the NetAssign_ class to refer to the signal
|
||||||
* instead of link into the netlist. This is faster
|
* instead of link into the netlist. This is faster
|
||||||
|
|
|
||||||
49
elaborate.cc
49
elaborate.cc
|
|
@ -17,7 +17,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT) && !defined(macintosh)
|
#if !defined(WINNT) && !defined(macintosh)
|
||||||
#ident "$Id: elaborate.cc,v 1.220 2001/08/25 23:50:02 steve Exp $"
|
#ident "$Id: elaborate.cc,v 1.221 2001/10/19 21:53:24 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
|
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
# include <typeinfo>
|
# include <typeinfo>
|
||||||
# include <strstream>
|
# include <strstream>
|
||||||
|
# include <list>
|
||||||
# include "pform.h"
|
# include "pform.h"
|
||||||
# include "PEvent.h"
|
# include "PEvent.h"
|
||||||
# include "netlist.h"
|
# include "netlist.h"
|
||||||
|
|
@ -2277,16 +2278,18 @@ bool Module::elaborate(Design*des, NetScope*scope) const
|
||||||
return result_flag;
|
return result_flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct root_elem {
|
||||||
|
Module *mod;
|
||||||
|
NetScope *scope;
|
||||||
|
};
|
||||||
|
|
||||||
Design* elaborate(const map<string,Module*>&modules,
|
Design* elaborate(const map<string,Module*>&modules,
|
||||||
const map<string,PUdp*>&primitives,
|
const map<string,PUdp*>&primitives,
|
||||||
const string&root)
|
list<string>roots)
|
||||||
{
|
{
|
||||||
// Look for the root module in the list.
|
svector<root_elem*> root_elems(roots.size());
|
||||||
map<string,Module*>::const_iterator mod = modules.find(root);
|
bool rc = true;
|
||||||
if (mod == modules.end())
|
unsigned i = 0;
|
||||||
return 0;
|
|
||||||
|
|
||||||
Module*rmod = (*mod).second;
|
|
||||||
|
|
||||||
// This is the output design. I fill it in as I scan the root
|
// This is the output design. I fill it in as I scan the root
|
||||||
// module and elaborate what I find.
|
// module and elaborate what I find.
|
||||||
|
|
@ -2295,9 +2298,21 @@ Design* elaborate(const map<string,Module*>&modules,
|
||||||
modlist = &modules;
|
modlist = &modules;
|
||||||
udplist = &primitives;
|
udplist = &primitives;
|
||||||
|
|
||||||
|
for (list<string>::const_iterator root = roots.begin();
|
||||||
|
root != roots.end(); root++) {
|
||||||
|
// Look for the root module in the list.
|
||||||
|
map<string,Module*>::const_iterator mod = modules.find(*root);
|
||||||
|
if (mod == modules.end()) {
|
||||||
|
cerr << "Unable to find root module \"" << (*root) << "\"." << endl;
|
||||||
|
des->errors++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Module *rmod = (*mod).second;
|
||||||
|
|
||||||
// Make the root scope, then scan the pform looking for scopes
|
// Make the root scope, then scan the pform looking for scopes
|
||||||
// and parameters.
|
// and parameters.
|
||||||
NetScope*scope = des->make_root_scope(root);
|
NetScope*scope = des->make_root_scope(*root);
|
||||||
scope->time_unit(rmod->time_unit);
|
scope->time_unit(rmod->time_unit);
|
||||||
scope->time_precision(rmod->time_precision);
|
scope->time_precision(rmod->time_precision);
|
||||||
des->set_precision(rmod->time_precision);
|
des->set_precision(rmod->time_precision);
|
||||||
|
|
@ -2306,6 +2321,12 @@ Design* elaborate(const map<string,Module*>&modules,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct root_elem *r = new struct root_elem;
|
||||||
|
r->mod = rmod;
|
||||||
|
r->scope = scope;
|
||||||
|
root_elems[i++] = r;
|
||||||
|
}
|
||||||
|
|
||||||
// This method recurses through the scopes, looking for
|
// This method recurses through the scopes, looking for
|
||||||
// defparam assignments to apply to the parameters in the
|
// defparam assignments to apply to the parameters in the
|
||||||
// various scopes. This needs to be done after all the scopes
|
// various scopes. This needs to be done after all the scopes
|
||||||
|
|
@ -2319,6 +2340,9 @@ Design* elaborate(const map<string,Module*>&modules,
|
||||||
// constants.
|
// constants.
|
||||||
des->evaluate_parameters();
|
des->evaluate_parameters();
|
||||||
|
|
||||||
|
for (i = 0; i < root_elems.count(); i++) {
|
||||||
|
Module *rmod = root_elems[i]->mod;
|
||||||
|
NetScope *scope = root_elems[i]->scope;
|
||||||
|
|
||||||
// With the parameters evaluated down to constants, we have
|
// With the parameters evaluated down to constants, we have
|
||||||
// what we need to elaborate signals and memories. This pass
|
// what we need to elaborate signals and memories. This pass
|
||||||
|
|
@ -2328,10 +2352,10 @@ Design* elaborate(const map<string,Module*>&modules,
|
||||||
delete des;
|
delete des;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now that the structure and parameters are taken care of,
|
// Now that the structure and parameters are taken care of,
|
||||||
// run through the pform again and generate the full netlist.
|
// run through the pform again and generate the full netlist.
|
||||||
bool rc = rmod->elaborate(des, scope);
|
rc &= rmod->elaborate(des, scope);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
modlist = 0;
|
modlist = 0;
|
||||||
|
|
@ -2348,6 +2372,9 @@ Design* elaborate(const map<string,Module*>&modules,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: elaborate.cc,v $
|
* $Log: elaborate.cc,v $
|
||||||
|
* Revision 1.221 2001/10/19 21:53:24 steve
|
||||||
|
* Support multiple root modules (Philip Blundell)
|
||||||
|
*
|
||||||
* Revision 1.220 2001/08/25 23:50:02 steve
|
* Revision 1.220 2001/08/25 23:50:02 steve
|
||||||
* Change the NetAssign_ class to refer to the signal
|
* Change the NetAssign_ class to refer to the signal
|
||||||
* instead of link into the netlist. This is faster
|
* instead of link into the netlist. This is faster
|
||||||
|
|
|
||||||
13
emit.cc
13
emit.cc
|
|
@ -17,7 +17,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT) && !defined(macintosh)
|
#if !defined(WINNT) && !defined(macintosh)
|
||||||
#ident "$Id: emit.cc,v 1.62 2001/08/25 23:50:02 steve Exp $"
|
#ident "$Id: emit.cc,v 1.63 2001/10/19 21:53:24 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
|
|
@ -369,7 +369,9 @@ bool Design::emit(struct target_t*tgt) const
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// enumerate the scopes
|
// enumerate the scopes
|
||||||
root_scope_->emit_scope(tgt);
|
for (list<NetScope*>::const_iterator scope = root_scopes_.begin();
|
||||||
|
scope != root_scopes_.end(); scope++)
|
||||||
|
(*scope)->emit_scope(tgt);
|
||||||
|
|
||||||
|
|
||||||
// emit nodes
|
// emit nodes
|
||||||
|
|
@ -383,7 +385,9 @@ bool Design::emit(struct target_t*tgt) const
|
||||||
|
|
||||||
|
|
||||||
// emit task and function definitions
|
// emit task and function definitions
|
||||||
root_scope_->emit_defs(tgt);
|
for (list<NetScope*>::const_iterator scope = root_scopes_.begin();
|
||||||
|
scope != root_scopes_.end(); scope++)
|
||||||
|
(*scope)->emit_defs(tgt);
|
||||||
|
|
||||||
|
|
||||||
// emit the processes
|
// emit the processes
|
||||||
|
|
@ -470,6 +474,9 @@ bool emit(const Design*des, const char*type)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: emit.cc,v $
|
* $Log: emit.cc,v $
|
||||||
|
* Revision 1.63 2001/10/19 21:53:24 steve
|
||||||
|
* Support multiple root modules (Philip Blundell)
|
||||||
|
*
|
||||||
* Revision 1.62 2001/08/25 23:50:02 steve
|
* Revision 1.62 2001/08/25 23:50:02 steve
|
||||||
* Change the NetAssign_ class to refer to the signal
|
* Change the NetAssign_ class to refer to the signal
|
||||||
* instead of link into the netlist. This is faster
|
* instead of link into the netlist. This is faster
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT) && !defined(macintosh)
|
#if !defined(WINNT) && !defined(macintosh)
|
||||||
#ident "$Id: functor.cc,v 1.25 2001/07/25 03:10:49 steve Exp $"
|
#ident "$Id: functor.cc,v 1.26 2001/10/19 21:53:24 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
|
|
@ -114,7 +114,9 @@ void NetScope::run_functor(Design*des, functor_t*fun)
|
||||||
void Design::functor(functor_t*fun)
|
void Design::functor(functor_t*fun)
|
||||||
{
|
{
|
||||||
// Scan the scopes
|
// Scan the scopes
|
||||||
root_scope_->run_functor(this, fun);
|
for (list<NetScope*>::const_iterator scope = root_scopes_.begin();
|
||||||
|
scope != root_scopes_.end(); scope++)
|
||||||
|
(*scope)->run_functor(this, fun);
|
||||||
|
|
||||||
// apply to processes
|
// apply to processes
|
||||||
procs_idx_ = procs_;
|
procs_idx_ = procs_;
|
||||||
|
|
@ -286,6 +288,9 @@ int proc_match_t::event_wait(NetEvWait*)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: functor.cc,v $
|
* $Log: functor.cc,v $
|
||||||
|
* Revision 1.26 2001/10/19 21:53:24 steve
|
||||||
|
* Support multiple root modules (Philip Blundell)
|
||||||
|
*
|
||||||
* Revision 1.25 2001/07/25 03:10:49 steve
|
* Revision 1.25 2001/07/25 03:10:49 steve
|
||||||
* Create a config.h.in file to hold all the config
|
* Create a config.h.in file to hold all the config
|
||||||
* junk, and support gcc 3.0. (Stephan Boettcher)
|
* junk, and support gcc 3.0. (Stephan Boettcher)
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT) && !defined(macintosh)
|
#if !defined(WINNT) && !defined(macintosh)
|
||||||
#ident "$Id: ivl_target.h,v 1.84 2001/10/16 02:19:27 steve Exp $"
|
#ident "$Id: ivl_target.h,v 1.85 2001/10/19 21:53:24 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
@ -332,6 +332,9 @@ extern const char* ivl_design_flag(ivl_design_t des, const char*key);
|
||||||
extern int ivl_design_process(ivl_design_t des,
|
extern int ivl_design_process(ivl_design_t des,
|
||||||
ivl_process_f fun, void*cd);
|
ivl_process_f fun, void*cd);
|
||||||
extern ivl_scope_t ivl_design_root(ivl_design_t des);
|
extern ivl_scope_t ivl_design_root(ivl_design_t des);
|
||||||
|
extern void ivl_design_roots(ivl_design_t des,
|
||||||
|
ivl_scope_t **scopes,
|
||||||
|
unsigned int *nscopes);
|
||||||
extern int ivl_design_time_precision(ivl_design_t des);
|
extern int ivl_design_time_precision(ivl_design_t des);
|
||||||
|
|
||||||
extern unsigned ivl_design_consts(ivl_design_t des);
|
extern unsigned ivl_design_consts(ivl_design_t des);
|
||||||
|
|
@ -964,6 +967,9 @@ _END_DECL
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: ivl_target.h,v $
|
* $Log: ivl_target.h,v $
|
||||||
|
* Revision 1.85 2001/10/19 21:53:24 steve
|
||||||
|
* Support multiple root modules (Philip Blundell)
|
||||||
|
*
|
||||||
* Revision 1.84 2001/10/16 02:19:27 steve
|
* Revision 1.84 2001/10/16 02:19:27 steve
|
||||||
* Support IVL_LPM_DIVIDE for structural divide.
|
* Support IVL_LPM_DIVIDE for structural divide.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
72
main.cc
72
main.cc
|
|
@ -19,7 +19,7 @@ const char COPYRIGHT[] =
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT) && !defined(macintosh)
|
#if !defined(WINNT) && !defined(macintosh)
|
||||||
#ident "$Id: main.cc,v 1.47 2001/07/30 02:44:05 steve Exp $"
|
#ident "$Id: main.cc,v 1.48 2001/10/19 21:53:24 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
|
|
@ -44,6 +44,7 @@ const char NOTICE[] =
|
||||||
# include <iostream.h>
|
# include <iostream.h>
|
||||||
# include <fstream>
|
# include <fstream>
|
||||||
# include <queue>
|
# include <queue>
|
||||||
|
# include <list>
|
||||||
# include <map>
|
# include <map>
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
|
|
@ -73,7 +74,6 @@ extern "C" const char*optarg;
|
||||||
const char VERSION[] = "$Name: $ $State: Exp $";
|
const char VERSION[] = "$Name: $ $State: Exp $";
|
||||||
|
|
||||||
const char*target = "null";
|
const char*target = "null";
|
||||||
string start_module = "";
|
|
||||||
|
|
||||||
map<string,string> flags;
|
map<string,string> flags;
|
||||||
|
|
||||||
|
|
@ -102,7 +102,7 @@ static void parm_to_flagmap(const string&flag)
|
||||||
|
|
||||||
extern Design* elaborate(const map<string,Module*>&modules,
|
extern Design* elaborate(const map<string,Module*>&modules,
|
||||||
const map<string,PUdp*>&primitives,
|
const map<string,PUdp*>&primitives,
|
||||||
const string&root);
|
list <string>root);
|
||||||
|
|
||||||
extern void cprop(Design*des);
|
extern void cprop(Design*des);
|
||||||
extern void synth(Design*des);
|
extern void synth(Design*des);
|
||||||
|
|
@ -175,6 +175,7 @@ int main(int argc, char*argv[])
|
||||||
int opt;
|
int opt;
|
||||||
unsigned flag_errors = 0;
|
unsigned flag_errors = 0;
|
||||||
queue<net_func> net_func_queue;
|
queue<net_func> net_func_queue;
|
||||||
|
list<string> roots;
|
||||||
|
|
||||||
struct tms cycles[5];
|
struct tms cycles[5];
|
||||||
|
|
||||||
|
|
@ -217,7 +218,7 @@ int main(int argc, char*argv[])
|
||||||
parm_to_flagmap(optarg);
|
parm_to_flagmap(optarg);
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
start_module = optarg;
|
roots.push_back(string(optarg));
|
||||||
break;
|
break;
|
||||||
case 'T':
|
case 'T':
|
||||||
if (strcmp(optarg,"min") == 0) {
|
if (strcmp(optarg,"min") == 0) {
|
||||||
|
|
@ -337,40 +338,41 @@ int main(int argc, char*argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* If the user did not give a specific module to start with,
|
/* If the user did not give specific module(s) to start with,
|
||||||
then look for the single module that has no ports. If there
|
then look for modules that are not instantiated anywhere. */
|
||||||
are multiple modules with no ports, then give up. */
|
|
||||||
|
|
||||||
if (start_module == "") {
|
if (roots.empty()) {
|
||||||
for (map<string,Module*>::iterator mod = modules.begin()
|
map<string,bool> mentioned_p;
|
||||||
; mod != modules.end()
|
map<string,Module*>::iterator mod;
|
||||||
; mod ++ ) {
|
if (verbose_flag)
|
||||||
Module*cur = (*mod).second;
|
cout << "LOCATING TOP-LEVEL MODULES..." << endl << " ";
|
||||||
if (cur->port_count() == 0)
|
for (mod = modules.begin(); mod != modules.end(); mod++) {
|
||||||
if (start_module == "") {
|
list<PGate*> gates = (*mod).second->get_gates();
|
||||||
start_module = cur->get_name();
|
list<PGate*>::const_iterator gate;
|
||||||
} else {
|
for (gate = gates.begin(); gate != gates.end(); gate++) {
|
||||||
cerr << "More then 1 top level module."
|
PGModule *mod = dynamic_cast<PGModule*>(*gate);
|
||||||
<< endl;
|
if (mod) {
|
||||||
return 1;
|
// Note that this module has been instantiated
|
||||||
|
mentioned_p[mod->get_type()] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the previous attempt to find a start module failed, but
|
for (mod = modules.begin(); mod != modules.end(); mod++) {
|
||||||
there is only one module, then just let the user get away
|
if (mentioned_p[(*mod).second->get_name()] == false) {
|
||||||
with it. */
|
if (verbose_flag)
|
||||||
|
cout << " " << (*mod).second->get_name();
|
||||||
if ((start_module == "") && (modules.size() == 1)) {
|
roots.push_back((*mod).second->get_name());
|
||||||
map<string,Module*>::iterator mod = modules.begin();
|
}
|
||||||
Module*cur = (*mod).second;
|
}
|
||||||
start_module = cur->get_name();
|
if (verbose_flag)
|
||||||
|
cout << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If there is *still* no guess for the root module, then give
|
/* If there is *still* no guess for the root module, then give
|
||||||
up completely, and complain. */
|
up completely, and complain. */
|
||||||
|
|
||||||
if (start_module == "") {
|
if (roots.empty()) {
|
||||||
cerr << "No top level modules, and no -s option." << endl;
|
cerr << "No top level modules, and no -s option." << endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
@ -382,20 +384,19 @@ int main(int argc, char*argv[])
|
||||||
cerr<<" ... done, "
|
cerr<<" ... done, "
|
||||||
<<cycles_diff(cycles+1, cycles+0)<<" seconds."<<endl;
|
<<cycles_diff(cycles+1, cycles+0)<<" seconds."<<endl;
|
||||||
}
|
}
|
||||||
cout << "ELABORATING DESIGN -s "<<start_module<<" ..." << endl;
|
cout << "ELABORATING DESIGN" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* On with the process of elaborating the module. */
|
/* On with the process of elaborating the module. */
|
||||||
Design*des = elaborate(modules, primitives, start_module);
|
Design*des = elaborate(modules, primitives, roots);
|
||||||
if (des == 0) {
|
if (des == 0) {
|
||||||
cerr << start_module << ": error: "
|
cerr << "Elaboration failed" << endl;
|
||||||
<< "Unable to elaborate module." << endl;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (des->errors) {
|
if (des->errors) {
|
||||||
cerr << start_module << ": error: " << des->errors
|
cerr << des->errors
|
||||||
<< " elaborating module." << endl;
|
<< " error(s) during elaboration." << endl;
|
||||||
return des->errors;
|
return des->errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -454,6 +455,9 @@ int main(int argc, char*argv[])
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: main.cc,v $
|
* $Log: main.cc,v $
|
||||||
|
* 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
|
* Revision 1.47 2001/07/30 02:44:05 steve
|
||||||
* Cleanup defines and types for mingw compile.
|
* Cleanup defines and types for mingw compile.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT) && !defined(macintosh)
|
#if !defined(WINNT) && !defined(macintosh)
|
||||||
#ident "$Id: net_design.cc,v 1.20 2001/07/25 03:10:49 steve Exp $"
|
#ident "$Id: net_design.cc,v 1.21 2001/10/19 21:53:24 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
# include <strstream>
|
# include <strstream>
|
||||||
|
|
||||||
Design:: Design()
|
Design:: Design()
|
||||||
: errors(0), root_scope_(0), nodes_(0), procs_(0), lcounter_(0)
|
: errors(0), nodes_(0), procs_(0), lcounter_(0)
|
||||||
{
|
{
|
||||||
procs_idx_ = 0;
|
procs_idx_ = 0;
|
||||||
des_precision_ = 0;
|
des_precision_ = 0;
|
||||||
|
|
@ -79,22 +79,33 @@ unsigned long Design::scale_to_precision(unsigned long val,
|
||||||
|
|
||||||
NetScope* Design::make_root_scope(const string&root)
|
NetScope* Design::make_root_scope(const string&root)
|
||||||
{
|
{
|
||||||
assert(root_scope_ == 0);
|
NetScope *root_scope_;
|
||||||
root_scope_ = new NetScope(0, root, NetScope::MODULE);
|
root_scope_ = new NetScope(0, root, NetScope::MODULE);
|
||||||
root_scope_->set_module_name(root.c_str());
|
root_scope_->set_module_name(root.c_str());
|
||||||
|
root_scopes_.push_back(root_scope_);
|
||||||
return root_scope_;
|
return root_scope_;
|
||||||
}
|
}
|
||||||
|
|
||||||
NetScope* Design::find_root_scope()
|
NetScope* Design::find_root_scope()
|
||||||
{
|
{
|
||||||
assert(root_scope_);
|
assert(root_scopes_.front());
|
||||||
return root_scope_;
|
return root_scopes_.front();
|
||||||
}
|
}
|
||||||
|
|
||||||
const NetScope* Design::find_root_scope() const
|
const NetScope* Design::find_root_scope() const
|
||||||
{
|
{
|
||||||
assert(root_scope_);
|
assert(root_scopes_.front());
|
||||||
return root_scope_;
|
return root_scopes_.front();
|
||||||
|
}
|
||||||
|
|
||||||
|
list<NetScope*> Design::find_root_scopes()
|
||||||
|
{
|
||||||
|
return root_scopes_;
|
||||||
|
}
|
||||||
|
|
||||||
|
const list<NetScope*> Design::find_root_scopes() const
|
||||||
|
{
|
||||||
|
return root_scopes_;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -105,23 +116,26 @@ const NetScope* Design::find_root_scope() const
|
||||||
*/
|
*/
|
||||||
NetScope* Design::find_scope(const string&key) const
|
NetScope* Design::find_scope(const string&key) const
|
||||||
{
|
{
|
||||||
if (key == root_scope_->name())
|
for (list<NetScope*>::const_iterator scope = root_scopes_.begin();
|
||||||
return root_scope_;
|
scope != root_scopes_.end(); scope++) {
|
||||||
|
if (key == (*scope)->name())
|
||||||
|
return *scope;
|
||||||
|
|
||||||
string path = key;
|
string path = key;
|
||||||
string root = parse_first_name(path);
|
string root = parse_first_name(path);
|
||||||
|
|
||||||
NetScope*cur = root_scope_;
|
NetScope*cur = *scope;
|
||||||
if (root != cur->name())
|
if (root != cur->name())
|
||||||
return 0;
|
continue;
|
||||||
|
|
||||||
while (cur) {
|
while (cur) {
|
||||||
string next = parse_first_name(path);
|
string next = parse_first_name(path);
|
||||||
cur = cur->child(next);
|
cur = cur->child(next);
|
||||||
if (path == "") return cur;
|
if (path == "") return cur;
|
||||||
}
|
}
|
||||||
|
|
||||||
return cur;
|
return cur;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -194,7 +208,9 @@ const NetExpr* Design::find_parameter(const NetScope*scope,
|
||||||
*/
|
*/
|
||||||
void Design::run_defparams()
|
void Design::run_defparams()
|
||||||
{
|
{
|
||||||
root_scope_->run_defparams(this);
|
for (list<NetScope*>::const_iterator scope = root_scopes_.begin();
|
||||||
|
scope != root_scopes_.end(); scope++)
|
||||||
|
(*scope)->run_defparams(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetScope::run_defparams(Design*des)
|
void NetScope::run_defparams(Design*des)
|
||||||
|
|
@ -231,7 +247,9 @@ void NetScope::run_defparams(Design*des)
|
||||||
|
|
||||||
void Design::evaluate_parameters()
|
void Design::evaluate_parameters()
|
||||||
{
|
{
|
||||||
root_scope_->evaluate_parameters(this);
|
for (list<NetScope*>::const_iterator scope = root_scopes_.begin();
|
||||||
|
scope != root_scopes_.end(); scope++)
|
||||||
|
(*scope)->evaluate_parameters(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetScope::evaluate_parameters(Design*des)
|
void NetScope::evaluate_parameters(Design*des)
|
||||||
|
|
@ -477,6 +495,9 @@ void Design::delete_process(NetProcTop*top)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: net_design.cc,v $
|
* $Log: net_design.cc,v $
|
||||||
|
* Revision 1.21 2001/10/19 21:53:24 steve
|
||||||
|
* Support multiple root modules (Philip Blundell)
|
||||||
|
*
|
||||||
* Revision 1.20 2001/07/25 03:10:49 steve
|
* Revision 1.20 2001/07/25 03:10:49 steve
|
||||||
* Create a config.h.in file to hold all the config
|
* Create a config.h.in file to hold all the config
|
||||||
* junk, and support gcc 3.0. (Stephan Boettcher)
|
* junk, and support gcc 3.0. (Stephan Boettcher)
|
||||||
|
|
|
||||||
11
netlist.h
11
netlist.h
|
|
@ -19,7 +19,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT) && !defined(macintosh)
|
#if !defined(WINNT) && !defined(macintosh)
|
||||||
#ident "$Id: netlist.h,v 1.216 2001/10/16 02:19:27 steve Exp $"
|
#ident "$Id: netlist.h,v 1.217 2001/10/19 21:53:24 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -30,6 +30,7 @@
|
||||||
*/
|
*/
|
||||||
# include <string>
|
# include <string>
|
||||||
# include <map>
|
# include <map>
|
||||||
|
# include <list>
|
||||||
# include "verinum.h"
|
# include "verinum.h"
|
||||||
# include "LineInfo.h"
|
# include "LineInfo.h"
|
||||||
# include "svector.h"
|
# include "svector.h"
|
||||||
|
|
@ -2710,9 +2711,10 @@ class Design {
|
||||||
|
|
||||||
NetScope* make_root_scope(const string&name);
|
NetScope* make_root_scope(const string&name);
|
||||||
NetScope* find_root_scope();
|
NetScope* find_root_scope();
|
||||||
|
list<NetScope*> find_root_scopes();
|
||||||
|
|
||||||
const NetScope* find_root_scope() const;
|
const NetScope* find_root_scope() const;
|
||||||
|
const list<NetScope*> find_root_scopes() const;
|
||||||
|
|
||||||
/* Attempt to set the precision to the specified value. If the
|
/* Attempt to set the precision to the specified value. If the
|
||||||
precision is already more precise, the keep the precise
|
precision is already more precise, the keep the precise
|
||||||
|
|
@ -2789,7 +2791,7 @@ class Design {
|
||||||
private:
|
private:
|
||||||
// Keep a tree of scopes. The NetScope class handles the wide
|
// Keep a tree of scopes. The NetScope class handles the wide
|
||||||
// tree and per-hop searches for me.
|
// tree and per-hop searches for me.
|
||||||
NetScope*root_scope_;
|
list<NetScope*>root_scopes_;
|
||||||
|
|
||||||
// List the nodes in the design
|
// List the nodes in the design
|
||||||
NetNode*nodes_;
|
NetNode*nodes_;
|
||||||
|
|
@ -2849,6 +2851,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: netlist.h,v $
|
* $Log: netlist.h,v $
|
||||||
|
* Revision 1.217 2001/10/19 21:53:24 steve
|
||||||
|
* Support multiple root modules (Philip Blundell)
|
||||||
|
*
|
||||||
* Revision 1.216 2001/10/16 02:19:27 steve
|
* Revision 1.216 2001/10/16 02:19:27 steve
|
||||||
* Support IVL_LPM_DIVIDE for structural divide.
|
* Support IVL_LPM_DIVIDE for structural divide.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
16
t-dll-api.cc
16
t-dll-api.cc
|
|
@ -17,7 +17,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT) && !defined(macintosh)
|
#if !defined(WINNT) && !defined(macintosh)
|
||||||
#ident "$Id: t-dll-api.cc,v 1.68 2001/10/16 02:19:27 steve Exp $"
|
#ident "$Id: t-dll-api.cc,v 1.69 2001/10/19 21:53:24 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
|
|
@ -46,7 +46,16 @@ extern "C" int ivl_design_process(ivl_design_t des,
|
||||||
|
|
||||||
extern "C" ivl_scope_t ivl_design_root(ivl_design_t des)
|
extern "C" ivl_scope_t ivl_design_root(ivl_design_t des)
|
||||||
{
|
{
|
||||||
return des->root_;
|
assert (des->nroots_);
|
||||||
|
return des->roots_[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" void ivl_design_roots(ivl_design_t des, ivl_scope_t **scopes,
|
||||||
|
unsigned int *nscopes)
|
||||||
|
{
|
||||||
|
assert (nscopes && scopes);
|
||||||
|
*scopes = &des->roots_[0];
|
||||||
|
*nscopes = des->nroots_;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" int ivl_design_time_precision(ivl_design_t des)
|
extern "C" int ivl_design_time_precision(ivl_design_t des)
|
||||||
|
|
@ -1389,6 +1398,9 @@ extern "C" ivl_statement_t ivl_stmt_sub_stmt(ivl_statement_t net)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: t-dll-api.cc,v $
|
* $Log: t-dll-api.cc,v $
|
||||||
|
* Revision 1.69 2001/10/19 21:53:24 steve
|
||||||
|
* Support multiple root modules (Philip Blundell)
|
||||||
|
*
|
||||||
* Revision 1.68 2001/10/16 02:19:27 steve
|
* Revision 1.68 2001/10/16 02:19:27 steve
|
||||||
* Support IVL_LPM_DIVIDE for structural divide.
|
* Support IVL_LPM_DIVIDE for structural divide.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT) & !defined(macintosh)
|
#if !defined(WINNT) & !defined(macintosh)
|
||||||
#ident "$Id: t-dll-expr.cc,v 1.18 2001/09/15 18:27:04 steve Exp $"
|
#ident "$Id: t-dll-expr.cc,v 1.19 2001/10/19 21:53:24 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
|
|
@ -225,7 +225,7 @@ void dll_target::expr_signal(const NetESignal*net)
|
||||||
expr_->type_ = IVL_EX_SIGNAL;
|
expr_->type_ = IVL_EX_SIGNAL;
|
||||||
expr_->width_= net->expr_width();
|
expr_->width_= net->expr_width();
|
||||||
expr_->signed_ = net->has_sign()? 1 : 0;
|
expr_->signed_ = net->has_sign()? 1 : 0;
|
||||||
expr_->u_.signal_.sig = find_signal(des_.root_, net->sig());
|
expr_->u_.signal_.sig = find_signal(des_, net->sig());
|
||||||
expr_->u_.signal_.lsi = net->lsi();
|
expr_->u_.signal_.lsi = net->lsi();
|
||||||
expr_->u_.signal_.msi = net->msi();
|
expr_->u_.signal_.msi = net->msi();
|
||||||
}
|
}
|
||||||
|
|
@ -237,7 +237,7 @@ void dll_target::expr_subsignal(const NetEBitSel*net)
|
||||||
ivl_expr_t expr = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
|
ivl_expr_t expr = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
|
||||||
assert(expr);
|
assert(expr);
|
||||||
|
|
||||||
if (net->sig()->lsb() != 0) {
|
if (0/*net->sig()->lsb() != 0*/) {
|
||||||
cerr << net->get_line() << ": sorry: LSB for signal "
|
cerr << net->get_line() << ": sorry: LSB for signal "
|
||||||
<< "is not zero." << endl;
|
<< "is not zero." << endl;
|
||||||
}
|
}
|
||||||
|
|
@ -245,7 +245,7 @@ void dll_target::expr_subsignal(const NetEBitSel*net)
|
||||||
expr->type_ = IVL_EX_BITSEL;
|
expr->type_ = IVL_EX_BITSEL;
|
||||||
expr->width_= net->expr_width();
|
expr->width_= net->expr_width();
|
||||||
expr->signed_ = net->has_sign()? 1 : 0;
|
expr->signed_ = net->has_sign()? 1 : 0;
|
||||||
expr->u_.bitsel_.sig = find_signal(des_.root_, net->sig());
|
expr->u_.bitsel_.sig = find_signal(des_, net->sig());
|
||||||
|
|
||||||
net->index()->expr_scan(this);
|
net->index()->expr_scan(this);
|
||||||
assert(expr_);
|
assert(expr_);
|
||||||
|
|
@ -301,6 +301,9 @@ void dll_target::expr_unary(const NetEUnary*net)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: t-dll-expr.cc,v $
|
* $Log: t-dll-expr.cc,v $
|
||||||
|
* Revision 1.19 2001/10/19 21:53:24 steve
|
||||||
|
* Support multiple root modules (Philip Blundell)
|
||||||
|
*
|
||||||
* Revision 1.18 2001/09/15 18:27:04 steve
|
* Revision 1.18 2001/09/15 18:27:04 steve
|
||||||
* Make configure detect malloc.h
|
* Make configure detect malloc.h
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT) && !defined(macintosh)
|
#if !defined(WINNT) && !defined(macintosh)
|
||||||
#ident "$Id: t-dll-proc.cc,v 1.35 2001/09/15 18:27:04 steve Exp $"
|
#ident "$Id: t-dll-proc.cc,v 1.36 2001/10/19 21:53:24 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
|
|
@ -115,7 +115,7 @@ void dll_target::func_def(const NetScope*net)
|
||||||
if (scope->ports > 0) {
|
if (scope->ports > 0) {
|
||||||
scope->port = new ivl_signal_t[scope->ports];
|
scope->port = new ivl_signal_t[scope->ports];
|
||||||
for (unsigned idx = 0 ; idx < scope->ports ; idx += 1)
|
for (unsigned idx = 0 ; idx < scope->ports ; idx += 1)
|
||||||
scope->port[idx] = find_signal(des_.root_, def->port(idx));
|
scope->port[idx] = find_signal(des_, def->port(idx));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -141,7 +141,7 @@ void dll_target::proc_assign(const NetAssign*net)
|
||||||
cur->width_ = asn->lwidth();
|
cur->width_ = asn->lwidth();
|
||||||
cur->loff_ = asn->get_loff();
|
cur->loff_ = asn->get_loff();
|
||||||
cur->type_ = IVL_LVAL_REG;
|
cur->type_ = IVL_LVAL_REG;
|
||||||
cur->n.sig = find_signal(des_.root_, asn->sig());
|
cur->n.sig = find_signal(des_, asn->sig());
|
||||||
|
|
||||||
cur->idx = 0;
|
cur->idx = 0;
|
||||||
if (asn->bmux()) {
|
if (asn->bmux()) {
|
||||||
|
|
@ -181,7 +181,7 @@ void dll_target::proc_assign_nb(const NetAssignNB*net)
|
||||||
cur->type_ = IVL_LVAL_REG;
|
cur->type_ = IVL_LVAL_REG;
|
||||||
cur->width_ = asn->lwidth();
|
cur->width_ = asn->lwidth();
|
||||||
cur->loff_ = asn->get_loff();
|
cur->loff_ = asn->get_loff();
|
||||||
cur->n.sig = find_signal(des_.root_, asn->sig());
|
cur->n.sig = find_signal(des_, asn->sig());
|
||||||
|
|
||||||
cur->idx = 0;
|
cur->idx = 0;
|
||||||
if (asn->bmux()) {
|
if (asn->bmux()) {
|
||||||
|
|
@ -669,6 +669,9 @@ void dll_target::proc_while(const NetWhile*net)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: t-dll-proc.cc,v $
|
* $Log: t-dll-proc.cc,v $
|
||||||
|
* Revision 1.36 2001/10/19 21:53:24 steve
|
||||||
|
* Support multiple root modules (Philip Blundell)
|
||||||
|
*
|
||||||
* Revision 1.35 2001/09/15 18:27:04 steve
|
* Revision 1.35 2001/09/15 18:27:04 steve
|
||||||
* Make configure detect malloc.h
|
* Make configure detect malloc.h
|
||||||
*
|
*
|
||||||
|
|
|
||||||
140
t-dll.cc
140
t-dll.cc
|
|
@ -17,7 +17,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT) && !defined(macintosh)
|
#if !defined(WINNT) && !defined(macintosh)
|
||||||
#ident "$Id: t-dll.cc,v 1.66 2001/10/16 02:19:27 steve Exp $"
|
#ident "$Id: t-dll.cc,v 1.67 2001/10/19 21:53:24 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
|
|
@ -101,37 +101,46 @@ static struct dll_target dll_target_obj;
|
||||||
* NetScope object. The search works by looking for the parent scope,
|
* NetScope object. The search works by looking for the parent scope,
|
||||||
* then scanning the parent scope for the NetScope object.
|
* then scanning the parent scope for the NetScope object.
|
||||||
*/
|
*/
|
||||||
ivl_scope_t dll_target::find_scope(ivl_scope_t root, const NetScope*cur)
|
static ivl_scope_t find_scope_from_root(ivl_scope_t root, const NetScope*cur)
|
||||||
{
|
{
|
||||||
ivl_scope_t parent, tmp;
|
ivl_scope_t parent, tmp;
|
||||||
|
|
||||||
if (const NetScope*par = cur->parent()) {
|
if (const NetScope*par = cur->parent()) {
|
||||||
parent = find_scope(root, par);
|
parent = find_scope_from_root(root, par);
|
||||||
|
|
||||||
} else {
|
|
||||||
assert(strcmp(root->name_, cur->name().c_str()) == 0);
|
|
||||||
return root;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (tmp = parent->child_ ; tmp ; tmp = tmp->sibling_)
|
for (tmp = parent->child_ ; tmp ; tmp = tmp->sibling_)
|
||||||
if (strcmp(tmp->name_, cur->name().c_str()) == 0)
|
if (strcmp(tmp->name_, cur->name().c_str()) == 0)
|
||||||
return tmp;
|
return tmp;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (strcmp(root->name_, cur->name().c_str()) == 0)
|
||||||
|
return root;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ivl_scope_t dll_target::find_scope(ivl_design_s &des, const NetScope*cur)
|
||||||
|
{
|
||||||
|
unsigned i;
|
||||||
|
ivl_scope_t scope = NULL;
|
||||||
|
for (i = 0; i < des.nroots_ && scope == NULL; i++)
|
||||||
|
scope = find_scope_from_root(des.roots_[i], cur);
|
||||||
|
return scope;
|
||||||
|
}
|
||||||
|
|
||||||
ivl_scope_t dll_target::lookup_scope_(const NetScope*cur)
|
ivl_scope_t dll_target::lookup_scope_(const NetScope*cur)
|
||||||
{
|
{
|
||||||
return find_scope(des_.root_, cur);
|
return find_scope(des_, cur);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is a convenience function to locate an ivl_signal_t object
|
* This is a convenience function to locate an ivl_signal_t object
|
||||||
* given the NetESignal that has the signal name.
|
* given the NetESignal that has the signal name.
|
||||||
*/
|
*/
|
||||||
ivl_signal_t dll_target::find_signal(ivl_scope_t root, const NetNet*net)
|
ivl_signal_t dll_target::find_signal(ivl_design_s &des, const NetNet*net)
|
||||||
{
|
{
|
||||||
ivl_scope_t scope = find_scope(root, net->scope());
|
ivl_scope_t scope = find_scope(des, net->scope());
|
||||||
assert(scope);
|
assert(scope);
|
||||||
|
|
||||||
const char*nname = net->name();
|
const char*nname = net->name();
|
||||||
|
|
@ -177,7 +186,11 @@ static ivl_memory_t find_memory(ivl_scope_t root, const NetMemory*cur)
|
||||||
|
|
||||||
ivl_memory_t dll_target::lookup_memory_(const NetMemory*cur)
|
ivl_memory_t dll_target::lookup_memory_(const NetMemory*cur)
|
||||||
{
|
{
|
||||||
return find_memory(des_.root_, cur);
|
unsigned i;
|
||||||
|
ivl_memory_t mem = NULL;
|
||||||
|
for (i = 0; i < des_.nroots_ && mem == NULL; i++)
|
||||||
|
mem = find_memory(des_.roots_[i], cur);
|
||||||
|
return mem;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ivl_nexus_t nexus_sig_make(ivl_signal_t net, unsigned pin)
|
static ivl_nexus_t nexus_sig_make(ivl_signal_t net, unsigned pin)
|
||||||
|
|
@ -334,8 +347,37 @@ static void scope_add_mem(ivl_scope_t scope, ivl_memory_t net)
|
||||||
scope->mem_[scope->nmem_-1] = net;
|
scope->mem_[scope->nmem_-1] = 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->name().c_str();
|
||||||
|
root_->name_ = strdup(name);
|
||||||
|
root_->child_ = 0;
|
||||||
|
root_->sibling_ = 0;
|
||||||
|
root_->parent = 0;
|
||||||
|
root_->nsigs_ = 0;
|
||||||
|
root_->sigs_ = 0;
|
||||||
|
root_->nlog_ = 0;
|
||||||
|
root_->log_ = 0;
|
||||||
|
root_->nevent_ = 0;
|
||||||
|
root_->event_ = 0;
|
||||||
|
root_->nlpm_ = 0;
|
||||||
|
root_->lpm_ = 0;
|
||||||
|
root_->nmem_ = 0;
|
||||||
|
root_->mem_ = 0;
|
||||||
|
root_->type_ = IVL_SCT_MODULE;
|
||||||
|
root_->tname_ = root_->name_;
|
||||||
|
des_.nroots_++;
|
||||||
|
if (des_.roots_)
|
||||||
|
des_.roots_ = (ivl_scope_t *)realloc(des_.roots_, des_.nroots_ * sizeof(ivl_scope_t));
|
||||||
|
else
|
||||||
|
des_.roots_ = (ivl_scope_t *)malloc(des_.nroots_ * sizeof(ivl_scope_t));
|
||||||
|
des_.roots_[des_.nroots_ - 1] = root_;
|
||||||
|
}
|
||||||
|
|
||||||
bool dll_target::start_design(const Design*des)
|
bool dll_target::start_design(const Design*des)
|
||||||
{
|
{
|
||||||
|
list<NetScope *> root_scopes;
|
||||||
dll_path_ = des->get_flag("DLL");
|
dll_path_ = des->get_flag("DLL");
|
||||||
dll_ = ivl_dlopen(dll_path_.c_str());
|
dll_ = ivl_dlopen(dll_path_.c_str());
|
||||||
if (dll_ == 0) {
|
if (dll_ == 0) {
|
||||||
|
|
@ -348,23 +390,13 @@ bool dll_target::start_design(const Design*des)
|
||||||
// Initialize the design object.
|
// Initialize the design object.
|
||||||
des_.self = des;
|
des_.self = des;
|
||||||
des_.time_precision = des->get_precision();
|
des_.time_precision = des->get_precision();
|
||||||
des_.root_ = new struct ivl_scope_s;
|
des_.nroots_ = 0;
|
||||||
des_.root_->name_ = strdup(des->find_root_scope()->name().c_str());
|
des_.roots_ = NULL;
|
||||||
des_.root_->child_ = 0;
|
|
||||||
des_.root_->sibling_ = 0;
|
root_scopes = des->find_root_scopes();
|
||||||
des_.root_->parent = 0;
|
for (list<NetScope*>::const_iterator scope = root_scopes.begin();
|
||||||
des_.root_->nsigs_ = 0;
|
scope != root_scopes.end(); scope++)
|
||||||
des_.root_->sigs_ = 0;
|
add_root(des_, *scope);
|
||||||
des_.root_->nlog_ = 0;
|
|
||||||
des_.root_->log_ = 0;
|
|
||||||
des_.root_->nevent_ = 0;
|
|
||||||
des_.root_->event_ = 0;
|
|
||||||
des_.root_->nlpm_ = 0;
|
|
||||||
des_.root_->lpm_ = 0;
|
|
||||||
des_.root_->nmem_ = 0;
|
|
||||||
des_.root_->mem_ = 0;
|
|
||||||
des_.root_->type_ = IVL_SCT_MODULE;
|
|
||||||
des_.root_->tname_ = des_.root_->name_;
|
|
||||||
|
|
||||||
des_.consts = (ivl_net_const_t*)
|
des_.consts = (ivl_net_const_t*)
|
||||||
malloc(sizeof(ivl_net_const_t));
|
malloc(sizeof(ivl_net_const_t));
|
||||||
|
|
@ -446,7 +478,7 @@ bool dll_target::bufz(const NetBUFZ*net)
|
||||||
/* Attach the logic device to the scope that contains it. */
|
/* Attach the logic device to the scope that contains it. */
|
||||||
|
|
||||||
assert(net->scope());
|
assert(net->scope());
|
||||||
ivl_scope_t scope = find_scope(des_.root_, net->scope());
|
ivl_scope_t scope = find_scope(des_, net->scope());
|
||||||
assert(scope);
|
assert(scope);
|
||||||
|
|
||||||
obj->scope_ = scope;
|
obj->scope_ = scope;
|
||||||
|
|
@ -463,7 +495,7 @@ void dll_target::event(const NetEvent*net)
|
||||||
{
|
{
|
||||||
struct ivl_event_s *obj = new struct ivl_event_s;
|
struct ivl_event_s *obj = new struct ivl_event_s;
|
||||||
|
|
||||||
ivl_scope_t scope = find_scope(des_.root_, net->scope());
|
ivl_scope_t scope = find_scope(des_, net->scope());
|
||||||
obj->name = strdup(net->full_name().c_str());
|
obj->name = strdup(net->full_name().c_str());
|
||||||
obj->scope = scope;
|
obj->scope = scope;
|
||||||
scope_add_event(scope, obj);
|
scope_add_event(scope, obj);
|
||||||
|
|
@ -576,7 +608,7 @@ void dll_target::logic(const NetLogic*net)
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(net->scope());
|
assert(net->scope());
|
||||||
ivl_scope_t scope = find_scope(des_.root_, net->scope());
|
ivl_scope_t scope = find_scope(des_, net->scope());
|
||||||
assert(scope);
|
assert(scope);
|
||||||
|
|
||||||
obj->scope_= scope;
|
obj->scope_= scope;
|
||||||
|
|
@ -605,10 +637,10 @@ void dll_target::net_case_cmp(const NetCaseCmp*net)
|
||||||
nexus_log_add(obj->pins_[idx], obj, idx);
|
nexus_log_add(obj->pins_[idx], obj, idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
// assert(net->scope());
|
//assert(net->scope());
|
||||||
// ivl_scope_t scope = find_scope(des_.root_, net->scope());
|
//ivl_scope_t scope = find_scope(des_, net->scope());
|
||||||
// assert(scope);
|
//assert(scope);
|
||||||
ivl_scope_t scope = des_.root_;
|
ivl_scope_t scope = des_.roots_[0];
|
||||||
|
|
||||||
obj->scope_= scope;
|
obj->scope_= scope;
|
||||||
obj->name_ = strdup(net->name());
|
obj->name_ = strdup(net->name());
|
||||||
|
|
@ -672,7 +704,7 @@ void dll_target::udp(const NetUDP*net)
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(net->scope());
|
assert(net->scope());
|
||||||
ivl_scope_t scope = find_scope(des_.root_, net->scope());
|
ivl_scope_t scope = find_scope(des_, net->scope());
|
||||||
assert(scope);
|
assert(scope);
|
||||||
|
|
||||||
obj->scope_= scope;
|
obj->scope_= scope;
|
||||||
|
|
@ -685,7 +717,7 @@ void dll_target::memory(const NetMemory*net)
|
||||||
{
|
{
|
||||||
ivl_memory_t obj = new struct ivl_memory_s;
|
ivl_memory_t obj = new struct ivl_memory_s;
|
||||||
obj->name_ = strdup(net->name().c_str());
|
obj->name_ = strdup(net->name().c_str());
|
||||||
obj->scope_ = find_scope(des_.root_, net->scope());
|
obj->scope_ = find_scope(des_, net->scope());
|
||||||
obj->width_ = net->width();
|
obj->width_ = net->width();
|
||||||
obj->signed_ = 0;
|
obj->signed_ = 0;
|
||||||
obj->size_ = net->count();
|
obj->size_ = net->count();
|
||||||
|
|
@ -703,7 +735,7 @@ void dll_target::lpm_add_sub(const NetAddSub*net)
|
||||||
obj->type = IVL_LPM_ADD;
|
obj->type = IVL_LPM_ADD;
|
||||||
obj->name = strdup(net->name());
|
obj->name = strdup(net->name());
|
||||||
assert(net->scope());
|
assert(net->scope());
|
||||||
obj->scope = find_scope(des_.root_, net->scope());
|
obj->scope = find_scope(des_, net->scope());
|
||||||
assert(obj->scope);
|
assert(obj->scope);
|
||||||
|
|
||||||
/* Choose the width of the adder. If the carry bit is
|
/* Choose the width of the adder. If the carry bit is
|
||||||
|
|
@ -772,7 +804,7 @@ void dll_target::lpm_clshift(const NetCLShift*net)
|
||||||
obj->type = IVL_LPM_SHIFTL;
|
obj->type = IVL_LPM_SHIFTL;
|
||||||
obj->name = strdup(net->name());
|
obj->name = strdup(net->name());
|
||||||
assert(net->scope());
|
assert(net->scope());
|
||||||
obj->scope = find_scope(des_.root_, net->scope());
|
obj->scope = find_scope(des_, net->scope());
|
||||||
assert(obj->scope);
|
assert(obj->scope);
|
||||||
|
|
||||||
/* Look at the direction input of the device, and select the
|
/* Look at the direction input of the device, and select the
|
||||||
|
|
@ -848,7 +880,7 @@ void dll_target::lpm_compare(const NetCompare*net)
|
||||||
ivl_lpm_t obj = new struct ivl_lpm_s;
|
ivl_lpm_t obj = new struct ivl_lpm_s;
|
||||||
obj->name = strdup(net->name());
|
obj->name = strdup(net->name());
|
||||||
assert(net->scope());
|
assert(net->scope());
|
||||||
obj->scope = find_scope(des_.root_, net->scope());
|
obj->scope = find_scope(des_, net->scope());
|
||||||
assert(obj->scope);
|
assert(obj->scope);
|
||||||
|
|
||||||
bool swap_operands = false;
|
bool swap_operands = false;
|
||||||
|
|
@ -960,7 +992,7 @@ void dll_target::lpm_divide(const NetDivide*net)
|
||||||
obj->type = IVL_LPM_DIVIDE;
|
obj->type = IVL_LPM_DIVIDE;
|
||||||
obj->name = strdup(net->name());
|
obj->name = strdup(net->name());
|
||||||
assert(net->scope());
|
assert(net->scope());
|
||||||
obj->scope = find_scope(des_.root_, net->scope());
|
obj->scope = find_scope(des_, net->scope());
|
||||||
assert(obj->scope);
|
assert(obj->scope);
|
||||||
|
|
||||||
unsigned wid = net->width_r();
|
unsigned wid = net->width_r();
|
||||||
|
|
@ -1017,7 +1049,7 @@ void dll_target::lpm_ff(const NetFF*net)
|
||||||
ivl_lpm_t obj = new struct ivl_lpm_s;
|
ivl_lpm_t obj = new struct ivl_lpm_s;
|
||||||
obj->type = IVL_LPM_FF;
|
obj->type = IVL_LPM_FF;
|
||||||
obj->name = strdup(net->name());
|
obj->name = strdup(net->name());
|
||||||
obj->scope = find_scope(des_.root_, net->scope());
|
obj->scope = find_scope(des_, net->scope());
|
||||||
assert(obj->scope);
|
assert(obj->scope);
|
||||||
|
|
||||||
obj->u_.ff.width = net->width();
|
obj->u_.ff.width = net->width();
|
||||||
|
|
@ -1085,7 +1117,7 @@ void dll_target::lpm_ram_dq(const NetRamDq*net)
|
||||||
obj->name = strdup(net->name());
|
obj->name = strdup(net->name());
|
||||||
obj->u_.ff.mem = lookup_memory_(net->mem());
|
obj->u_.ff.mem = lookup_memory_(net->mem());
|
||||||
assert(obj->u_.ff.mem);
|
assert(obj->u_.ff.mem);
|
||||||
obj->scope = find_scope(des_.root_, net->mem()->scope());
|
obj->scope = find_scope(des_, net->mem()->scope());
|
||||||
assert(obj->scope);
|
assert(obj->scope);
|
||||||
|
|
||||||
obj->u_.ff.width = net->width();
|
obj->u_.ff.width = net->width();
|
||||||
|
|
@ -1198,7 +1230,7 @@ void dll_target::lpm_mult(const NetMult*net)
|
||||||
obj->type = IVL_LPM_MULT;
|
obj->type = IVL_LPM_MULT;
|
||||||
obj->name = strdup(net->name());
|
obj->name = strdup(net->name());
|
||||||
assert(net->scope());
|
assert(net->scope());
|
||||||
obj->scope = find_scope(des_.root_, net->scope());
|
obj->scope = find_scope(des_, net->scope());
|
||||||
assert(obj->scope);
|
assert(obj->scope);
|
||||||
|
|
||||||
unsigned wid = net->width_r();
|
unsigned wid = net->width_r();
|
||||||
|
|
@ -1255,7 +1287,7 @@ void dll_target::lpm_mux(const NetMux*net)
|
||||||
ivl_lpm_t obj = new struct ivl_lpm_s;
|
ivl_lpm_t obj = new struct ivl_lpm_s;
|
||||||
obj->type = IVL_LPM_MUX;
|
obj->type = IVL_LPM_MUX;
|
||||||
obj->name = strdup(net->name());
|
obj->name = strdup(net->name());
|
||||||
obj->scope = find_scope(des_.root_, net->scope());
|
obj->scope = find_scope(des_, net->scope());
|
||||||
assert(obj->scope);
|
assert(obj->scope);
|
||||||
|
|
||||||
obj->u_.mux.width = net->width();
|
obj->u_.mux.width = net->width();
|
||||||
|
|
@ -1399,15 +1431,20 @@ void dll_target::scope(const NetScope*net)
|
||||||
ivl_scope_t scope;
|
ivl_scope_t scope;
|
||||||
|
|
||||||
if (net->parent() == 0) {
|
if (net->parent() == 0) {
|
||||||
assert(strcmp(des_.root_->name_, net->name().c_str()) == 0);
|
unsigned i;
|
||||||
scope = des_.root_;
|
scope = NULL;
|
||||||
|
for (i = 0; i < des_.nroots_ && scope == NULL; i++) {
|
||||||
|
if (strcmp(des_.roots_[i]->name_, net->name().c_str()) == 0)
|
||||||
|
scope = des_.roots_[i];
|
||||||
|
}
|
||||||
|
assert(scope);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
scope = new struct ivl_scope_s;
|
scope = new struct ivl_scope_s;
|
||||||
scope->name_ = strdup(net->name().c_str());
|
scope->name_ = strdup(net->name().c_str());
|
||||||
scope->child_ = 0;
|
scope->child_ = 0;
|
||||||
scope->sibling_ = 0;
|
scope->sibling_ = 0;
|
||||||
scope->parent = find_scope(des_.root_, net->parent());
|
scope->parent = find_scope(des_, net->parent());
|
||||||
scope->nsigs_ = 0;
|
scope->nsigs_ = 0;
|
||||||
scope->sigs_ = 0;
|
scope->sigs_ = 0;
|
||||||
scope->nlog_ = 0;
|
scope->nlog_ = 0;
|
||||||
|
|
@ -1459,7 +1496,7 @@ void dll_target::signal(const NetNet*net)
|
||||||
it. This involves growing the sigs_ array in the scope
|
it. This involves growing the sigs_ array in the scope
|
||||||
object, or creating the sigs_ array if this is the first
|
object, or creating the sigs_ array if this is the first
|
||||||
signal. */
|
signal. */
|
||||||
obj->scope_ = find_scope(des_.root_, net->scope());
|
obj->scope_ = find_scope(des_, net->scope());
|
||||||
assert(obj->scope_);
|
assert(obj->scope_);
|
||||||
|
|
||||||
if (obj->scope_->nsigs_ == 0) {
|
if (obj->scope_->nsigs_ == 0) {
|
||||||
|
|
@ -1617,6 +1654,9 @@ extern const struct target tgt_dll = { "dll", &dll_target_obj };
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: t-dll.cc,v $
|
* $Log: t-dll.cc,v $
|
||||||
|
* Revision 1.67 2001/10/19 21:53:24 steve
|
||||||
|
* Support multiple root modules (Philip Blundell)
|
||||||
|
*
|
||||||
* Revision 1.66 2001/10/16 02:19:27 steve
|
* Revision 1.66 2001/10/16 02:19:27 steve
|
||||||
* Support IVL_LPM_DIVIDE for structural divide.
|
* Support IVL_LPM_DIVIDE for structural divide.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
13
t-dll.h
13
t-dll.h
|
|
@ -19,7 +19,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT) && !defined(macintosh)
|
#if !defined(WINNT) && !defined(macintosh)
|
||||||
#ident "$Id: t-dll.h,v 1.65 2001/10/16 02:19:27 steve Exp $"
|
#ident "$Id: t-dll.h,v 1.66 2001/10/19 21:53:24 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "target.h"
|
# include "target.h"
|
||||||
|
|
@ -40,7 +40,8 @@ struct ivl_design_s {
|
||||||
|
|
||||||
int time_precision;
|
int time_precision;
|
||||||
|
|
||||||
ivl_scope_t root_;
|
ivl_scope_t *roots_;
|
||||||
|
unsigned nroots_;
|
||||||
|
|
||||||
ivl_process_t threads_;
|
ivl_process_t threads_;
|
||||||
|
|
||||||
|
|
@ -132,8 +133,9 @@ struct dll_target : public target_t, public expr_scan_t {
|
||||||
ivl_memory_t lookup_memory_(const NetMemory*mem);
|
ivl_memory_t lookup_memory_(const NetMemory*mem);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static ivl_scope_t find_scope(ivl_scope_t root, const NetScope*cur);
|
static ivl_scope_t find_scope(ivl_design_s &des, const NetScope*cur);
|
||||||
static ivl_signal_t find_signal(ivl_scope_t root, const NetNet*net);
|
static ivl_signal_t find_signal(ivl_design_s &des, const NetNet*net);
|
||||||
|
void add_root(ivl_design_s &des_, const NetScope *s);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -570,6 +572,9 @@ struct ivl_statement_s {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: t-dll.h,v $
|
* $Log: t-dll.h,v $
|
||||||
|
* Revision 1.66 2001/10/19 21:53:24 steve
|
||||||
|
* Support multiple root modules (Philip Blundell)
|
||||||
|
*
|
||||||
* Revision 1.65 2001/10/16 02:19:27 steve
|
* Revision 1.65 2001/10/16 02:19:27 steve
|
||||||
* Support IVL_LPM_DIVIDE for structural divide.
|
* Support IVL_LPM_DIVIDE for structural divide.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT) && !defined(macintosh)
|
#if !defined(WINNT) && !defined(macintosh)
|
||||||
#ident "$Id: vvp.c,v 1.12 2001/09/30 16:45:10 steve Exp $"
|
#ident "$Id: vvp.c,v 1.13 2001/10/19 21:53:24 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -67,7 +67,8 @@ int target_design(ivl_design_t des)
|
||||||
|
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
ivl_scope_t root;
|
ivl_scope_t *roots;
|
||||||
|
unsigned nroots, i;
|
||||||
const char*path = ivl_design_flag(des, "-o");
|
const char*path = ivl_design_flag(des, "-o");
|
||||||
assert(path);
|
assert(path);
|
||||||
|
|
||||||
|
|
@ -90,8 +91,9 @@ int target_design(ivl_design_t des)
|
||||||
|
|
||||||
draw_module_declarations(des);
|
draw_module_declarations(des);
|
||||||
|
|
||||||
root = ivl_design_root(des);
|
ivl_design_roots(des, &roots, &nroots);
|
||||||
draw_scope(root, 0);
|
for (i = 0; i < nroots; i++)
|
||||||
|
draw_scope(roots[i], 0);
|
||||||
|
|
||||||
rc = ivl_design_process(des, draw_process, 0);
|
rc = ivl_design_process(des, draw_process, 0);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue