Handle unconnected module ports.

This commit is contained in:
steve 1999-09-17 02:06:25 +00:00
parent 4594ac1c2c
commit 424e6a750c
6 changed files with 49 additions and 11 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: Module.cc,v 1.6 1999/08/04 02:13:02 steve Exp $"
#ident "$Id: Module.cc,v 1.7 1999/09/17 02:06:25 steve Exp $"
#endif
# include "Module.h"
@ -30,6 +30,8 @@ Module::Module(const string&name, const svector<Module::port_t*>*pp)
ports_ = *pp;
for (unsigned idx = 0 ; idx < ports_.count() ; idx += 1) {
port_t*cur = ports_[idx];
if (cur == 0)
continue;
for (unsigned jdx = 0 ; jdx < cur->wires.count() ; jdx += 1)
add_wire(cur->wires[jdx]);
}
@ -99,6 +101,9 @@ PWire* Module::get_wire(const string&name)
/*
* $Log: Module.cc,v $
* Revision 1.7 1999/09/17 02:06:25 steve
* Handle unconnected module ports.
*
* Revision 1.6 1999/08/04 02:13:02 steve
* Elaborate module ports that are concatenations of
* module signals.

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: elaborate.cc,v 1.88 1999/09/16 04:18:15 steve Exp $"
#ident "$Id: elaborate.cc,v 1.89 1999/09/17 02:06:25 steve Exp $"
#endif
/*
@ -508,7 +508,7 @@ void PGModule::elaborate_mod_(Design*des, Module*rmod, const string&path) const
unsigned prts_pin_count = 0;
for (unsigned ldx = 0 ; ldx < mport.count() ; ldx += 1) {
PWire*pport = mport[0];
PWire*pport = mport[ldx];
prts[ldx] = des->find_signal(my_name, pport->name());
assert(prts[ldx]);
prts_pin_count += prts[ldx]->pin_count();
@ -2600,6 +2600,9 @@ Design* elaborate(const map<string,Module*>&modules,
/*
* $Log: elaborate.cc,v $
* Revision 1.89 1999/09/17 02:06:25 steve
* Handle unconnected module ports.
*
* Revision 1.88 1999/09/16 04:18:15 steve
* elaborate concatenation repeats.
*

14
parse.y
View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: parse.y,v 1.63 1999/09/10 05:02:09 steve Exp $"
#ident "$Id: parse.y,v 1.64 1999/09/17 02:06:26 steve Exp $"
#endif
# include "parse_misc.h"
@ -109,7 +109,7 @@ extern void lex_end_table();
%type <text> net_decl_assign
%type <strings> net_decl_assigns
%type <mport> port port_reference port_reference_list
%type <mport> port port_opt port_reference port_reference_list
%type <mports> list_of_ports list_of_ports_opt
%type <wires> task_item task_item_list task_item_list_opt
@ -816,13 +816,13 @@ identifier
;
list_of_ports
: port
: port_opt
{ svector<Module::port_t*>*tmp
= new svector<Module::port_t*>(1);
(*tmp)[0] = $1;
$$ = tmp;
}
| list_of_ports ',' port
| list_of_ports ',' port_opt
{ svector<Module::port_t*>*tmp
= new svector<Module::port_t*>(*$1, $3);
delete $1;
@ -832,7 +832,6 @@ list_of_ports
list_of_ports_opt
: '(' list_of_ports ')' { $$ = $2; }
| '(' ')' { $$ = 0; }
| { $$ = 0; }
;
@ -1174,6 +1173,11 @@ port
}
;
port_opt
: port { $$ = $1; }
| { $$ = 0; }
;
port_reference
: IDENTIFIER
{ Module::port_t*ptmp = new Module::port_t(1);

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: pform.cc,v 1.43 1999/09/15 01:55:06 steve Exp $"
#ident "$Id: pform.cc,v 1.44 1999/09/17 02:06:26 steve Exp $"
#endif
# include "compiler.h"
@ -97,6 +97,15 @@ static unsigned long evaluate_delay(PExpr*delay)
void pform_startmodule(const string&name, svector<Module::port_t*>*ports)
{
assert( pform_cur_module == 0 );
/* The parser parses ``module foo()'' as having one
unconnected port, but it is really a module with no
ports. Fix it up here. */
if (ports && (ports->count() == 1) && ((*ports)[0] == 0)) {
delete ports;
ports = 0;
}
pform_cur_module = new Module(name, ports);
delete ports;
}
@ -698,6 +707,9 @@ int pform_parse(const char*path, map<string,Module*>&modules,
/*
* $Log: pform.cc,v $
* Revision 1.44 1999/09/17 02:06:26 steve
* Handle unconnected module ports.
*
* Revision 1.43 1999/09/15 01:55:06 steve
* Elaborate non-blocking assignment to memories.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: pform_dump.cc,v 1.38 1999/09/08 02:24:39 steve Exp $"
#ident "$Id: pform_dump.cc,v 1.39 1999/09/17 02:06:26 steve Exp $"
#endif
/*
@ -516,6 +516,12 @@ void Module::dump(ostream&out) const
for (unsigned idx = 0 ; idx < ports_.count() ; idx += 1) {
port_t*cur = ports_[idx];
if (cur == 0) {
out << " unconnected" << endl;
continue;
}
switch (cur->wires[0]->get_port_type()) {
case NetNet::PINPUT:
out << " input ." << cur->name << "(";
@ -639,6 +645,9 @@ void PUdp::dump(ostream&out) const
/*
* $Log: pform_dump.cc,v $
* Revision 1.39 1999/09/17 02:06:26 steve
* Handle unconnected module ports.
*
* Revision 1.38 1999/09/08 02:24:39 steve
* Empty conditionals (pmonta@imedia.com)
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: t-null.cc,v 1.4 1999/07/03 02:12:52 steve Exp $"
#ident "$Id: t-null.cc,v 1.5 1999/09/17 02:06:26 steve Exp $"
#endif
# include "netlist.h"
@ -36,16 +36,21 @@ static class target_null_t : public target_t {
void net_esignal(ostream&, const NetESignal*) { }
void net_event(ostream&, const NetNEvent*) { }
void proc_block(ostream&, const NetBlock*) { }
void proc_condit(ostream&, const NetCondit*) { }
void proc_delay(ostream&, const NetPDelay*) { }
void proc_event(ostream&, const NetPEvent*) { }
void proc_forever(ostream&, const NetForever*) { }
void proc_repeat(ostream&, const NetRepeat*) { }
void proc_stask(ostream&, const NetSTask*) { }
} target_null_obj;
extern const struct target tgt_null = { "null", &target_null_obj };
/*
* $Log: t-null.cc,v $
* Revision 1.5 1999/09/17 02:06:26 steve
* Handle unconnected module ports.
*
* Revision 1.4 1999/07/03 02:12:52 steve
* Elaborate user defined tasks.
*