Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Elaborate UDP devices,

 Support UDP type attributes, and
 pass those attributes to nodes that
 are instantiated by elaboration,
 Put modules into a map instead of
 a simple list.
  • Loading branch information...
commit e097c999d5354328385607a8b0c0d4dfff705058 1 parent 91aad30
steve authored
View
18 PGate.h
@@ -19,11 +19,12 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
-#ident "$Id: PGate.h,v 1.1 1998/11/03 23:28:54 steve Exp $"
+#ident "$Id: PGate.h,v 1.2 1998/12/01 00:42:13 steve Exp $"
#endif
# include <vector>
class PExpr;
+class PUdp;
class Design;
/*
@@ -111,7 +112,9 @@ class PGBuiltin : public PGate {
/*
* This kind of gate is an instantiation of a module. The stored type
- * is the name of a module definition somewhere in the pform.
+ * is the name of a module definition somewhere in the pform. This
+ * type als handles UDP devices, because it is generally not known at
+ * parse time whether a name belongs to a module or a UDP.
*/
class PGModule : public PGate {
@@ -125,10 +128,21 @@ class PGModule : public PGate {
private:
string type_;
+
+ void elaborate_mod_(Design*, Module*mod, const string&path) const;
+ void elaborate_udp_(Design*, PUdp *udp, const string&path) const;
};
/*
* $Log: PGate.h,v $
+ * Revision 1.2 1998/12/01 00:42:13 steve
+ * Elaborate UDP devices,
+ * Support UDP type attributes, and
+ * pass those attributes to nodes that
+ * are instantiated by elaboration,
+ * Put modules into a map instead of
+ * a simple list.
+ *
* Revision 1.1 1998/11/03 23:28:54 steve
* Introduce verilog to CVS.
*
View
14 PUdp.h
@@ -19,10 +19,12 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
-#ident "$Id: PUdp.h,v 1.1 1998/11/25 02:35:53 steve Exp $"
+#ident "$Id: PUdp.h,v 1.2 1998/12/01 00:42:13 steve Exp $"
#endif
+# include <map>
# include <vector>
+# include <string>
# include "verinum.h"
/*
@@ -61,6 +63,8 @@ class PUdp {
verinum::V initial;
+ map<string,string> attributes;
+
void dump(ostream&out) const;
private:
@@ -73,6 +77,14 @@ class PUdp {
/*
* $Log: PUdp.h,v $
+ * Revision 1.2 1998/12/01 00:42:13 steve
+ * Elaborate UDP devices,
+ * Support UDP type attributes, and
+ * pass those attributes to nodes that
+ * are instantiated by elaboration,
+ * Put modules into a map instead of
+ * a simple list.
+ *
* Revision 1.1 1998/11/25 02:35:53 steve
* Parse UDP primitives all the way to pform.
*
View
10 README.txt
@@ -69,6 +69,16 @@ Attributes are [<key> <value>] pairs and are used to communicate with
the various processing steps. See the documentation for the processing
step for a list of the pertinent attributes.
+Attributes can also be applied to gate types. When this is done, the
+attribute is given to every instantiation of the primitive. The syntax
+for the attribute statement is the same, except that the <identifier>
+names a primitive earlier in the compilation unit and the statement is
+placed in global scope, instead of within a module. The semicolon is
+not part of a type attribute.
+
+Currently, type attributes are only supported for UDP types.
+
+
HOW IT WORKS -- STAGES OF PROCESSING
* Parse
View
36 design_dump.cc
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
-#ident "$Id: design_dump.cc,v 1.4 1998/11/23 00:20:22 steve Exp $"
+#ident "$Id: design_dump.cc,v 1.5 1998/12/01 00:42:13 steve Exp $"
#endif
/*
@@ -28,21 +28,6 @@
# include <iomanip>
# include "netlist.h"
-static ostream& operator<< (ostream&o, NetNet::Type t)
-{
- switch (t) {
- case NetNet::IMPLICIT:
- o << "implicit wire";
- break;
- case NetNet::WIRE:
- o << "wire";
- break;
- case NetNet::REG:
- o << "reg";
- break;
- }
- return o;
-}
static ostream& operator<< (ostream&o, NetBlock::Type t)
{
@@ -164,6 +149,17 @@ void NetLogic::dump_node(ostream&o, unsigned ind) const
<< endl;
dump_node_pins(o, ind+4);
+ dump_obj_attr(o, ind+4);
+}
+
+void NetUDP::dump_node(ostream&o, unsigned ind) const
+{
+ o << setw(ind) << "" << "UDP: ";
+ o << " #(" << delay1() << "," << delay2() << "," << delay3() <<
+ ") " << name() << endl;
+
+ dump_node_pins(o, ind+4);
+ dump_obj_attr(o, ind+4);
}
void NetPEvent::dump_node(ostream&o, unsigned ind) const
@@ -396,6 +392,14 @@ void Design::dump(ostream&o) const
/*
* $Log: design_dump.cc,v $
+ * Revision 1.5 1998/12/01 00:42:13 steve
+ * Elaborate UDP devices,
+ * Support UDP type attributes, and
+ * pass those attributes to nodes that
+ * are instantiated by elaboration,
+ * Put modules into a map instead of
+ * a simple list.
+ *
* Revision 1.4 1998/11/23 00:20:22 steve
* NetAssign handles lvalues as pin links
* instead of a signal pointer,
View
96 elaborate.cc
@@ -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.6 1998/11/23 00:20:22 steve Exp $"
+#ident "$Id: elaborate.cc,v 1.7 1998/12/01 00:42:14 steve Exp $"
#endif
/*
@@ -89,7 +89,8 @@ static void do_assign(Design*des, const string&path,
// Urff, I don't like this global variable. I *will* figure out a
// way to get rid of it. But, for now the PGModule::elaborate method
// needs it to find the module definition.
-static const list<Module*>* modlist = 0;
+static const map<string,Module*>* modlist = 0;
+static const map<string,PUdp*>* udplist = 0;
/* Elaborate a source wire. Generally pretty easy. */
void PWire::elaborate(Design*des, const string&path) const
@@ -201,25 +202,8 @@ void PGBuiltin::elaborate(Design*des, const string&path) const
* the parameters. This is done with BUFZ gates so that they look just
* like continuous assignment connections.
*/
-void PGModule::elaborate(Design*des, const string&path) const
+void PGModule::elaborate_mod_(Design*des, Module*rmod, const string&path) const
{
- // Look for the module type
- Module*rmod = 0;
- for (list<Module*>::const_iterator mod = modlist->begin()
- ; mod != modlist->end()
- ; mod ++ ) {
-
- if ((*mod)->get_name() == type_) {
- rmod = *mod;
- break;
- }
- }
-
- if (rmod == 0) {
- cerr << "Unknown module: " << type_ << endl;
- return;
- }
-
string my_name;
if (get_name() == "")
my_name = local_symbol(path);
@@ -269,6 +253,48 @@ void PGModule::elaborate(Design*des, const string&path) const
}
}
+void PGModule::elaborate_udp_(Design*des, PUdp*udp, const string&path) const
+{
+ const string my_name = path+"."+get_name();
+ NetUDP*net = new NetUDP(my_name, udp->ports.size());
+ net->set_attributes(udp->attributes);
+
+ for (unsigned idx = 0 ; idx < net->pin_count() ; idx += 1) {
+ NetNet*sig = pin(idx)->elaborate_net(des, path);
+ if (sig == 0) {
+ cerr << "Expression too complicated for elaboration:"
+ << *pin(idx) << endl;
+ continue;
+ }
+
+ connect(sig->pin(0), net->pin(idx));
+
+ if (NetTmp*tmp = dynamic_cast<NetTmp*>(sig))
+ delete tmp;
+ }
+
+ des->add_node(net);
+}
+
+void PGModule::elaborate(Design*des, const string&path) const
+{
+ // Look for the module type
+ map<string,Module*>::const_iterator mod = modlist->find(type_);
+ if (mod != modlist->end()) {
+ elaborate_mod_(des, (*mod).second, path);
+ return;
+ }
+
+ // Try a primitive type
+ map<string,PUdp*>::const_iterator udp = udplist->find(type_);
+ if (udp != udplist->end()) {
+ elaborate_udp_(des, (*udp).second, path);
+ return;
+ }
+
+ cerr << "Unknown module: " << type_ << endl;
+}
+
NetNet* PExpr::elaborate_net(Design*des, const string&path) const
{
cerr << "Don't know how to elaborate `" << *this << "' as gates." << endl;
@@ -676,30 +702,26 @@ void Module::elaborate(Design*des, const string&path) const
}
}
-Design* elaborate(const list<Module*>&modules, const string&root)
+Design* elaborate(const map<string,Module*>&modules,
+ const map<string,PUdp*>&primitives,
+ const string&root)
{
// Look for the root module in the list.
- Module*rmod = 0;
- for (list<Module*>::const_iterator mod = modules.begin()
- ; mod != modules.end()
- ; mod ++ ) {
-
- if ((*mod)->get_name() == root) {
- rmod = *mod;
- break;
- }
- }
-
- if (rmod == 0)
+ map<string,Module*>::const_iterator mod = modules.find(root);
+ if (mod == modules.end())
return 0;
+ Module*rmod = (*mod).second;
+
// This is the output design. I fill it in as I scan the root
// module and elaborate what I find.
Design*des = new Design;
modlist = &modules;
+ udplist = &primitives;
rmod->elaborate(des, root);
modlist = 0;
+ udplist = 0;
return des;
}
@@ -707,6 +729,14 @@ Design* elaborate(const list<Module*>&modules, const string&root)
/*
* $Log: elaborate.cc,v $
+ * Revision 1.7 1998/12/01 00:42:14 steve
+ * Elaborate UDP devices,
+ * Support UDP type attributes, and
+ * pass those attributes to nodes that
+ * are instantiated by elaboration,
+ * Put modules into a map instead of
+ * a simple list.
+ *
* Revision 1.6 1998/11/23 00:20:22 steve
* NetAssign handles lvalues as pin links
* instead of a signal pointer,
View
15 emit.cc
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
-#ident "$Id: emit.cc,v 1.3 1998/11/09 18:55:34 steve Exp $"
+#ident "$Id: emit.cc,v 1.4 1998/12/01 00:42:14 steve Exp $"
#endif
/*
@@ -40,6 +40,11 @@ void NetLogic::emit_node(ostream&o, struct target_t*tgt) const
tgt->logic(o, this);
}
+void NetUDP::emit_node(ostream&o, struct target_t*tgt) const
+{
+ tgt->udp(o, this);
+}
+
void NetAssign::emit_node(ostream&o, struct target_t*tgt) const
{
tgt->net_assign(o, this);
@@ -218,6 +223,14 @@ void emit(ostream&o, const Design*des, const char*type)
/*
* $Log: emit.cc,v $
+ * Revision 1.4 1998/12/01 00:42:14 steve
+ * Elaborate UDP devices,
+ * Support UDP type attributes, and
+ * pass those attributes to nodes that
+ * are instantiated by elaboration,
+ * Put modules into a map instead of
+ * a simple list.
+ *
* Revision 1.3 1998/11/09 18:55:34 steve
* Add procedural while loops,
* Parse procedural for loops,
View
29 main.cc
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
-#ident "$Id: main.cc,v 1.6 1998/11/25 02:35:53 steve Exp $"
+#ident "$Id: main.cc,v 1.7 1998/12/01 00:42:14 steve Exp $"
#endif
# include <stdio.h>
@@ -55,7 +55,9 @@ static void parm_to_flagmap(const string&flag)
}
-extern Design* elaborate(const list<Module*>&modules, const string&root);
+extern Design* elaborate(const map<string,Module*>&modules,
+ const map<string,PUdp*>&primitives,
+ const string&root);
extern void emit(ostream&o, const Design*, const char*);
extern void cprop(Design*des);
@@ -154,8 +156,8 @@ int main(int argc, char*argv[])
}
/* Parse the input. Make the pform. */
- list<Module*>modules;
- map<string,PUdp*>primitives;
+ map<string,Module*> modules;
+ map<string,PUdp*> primitives;
int rc = pform_parse(input, modules, primitives);
if (rc) {
@@ -165,10 +167,10 @@ int main(int argc, char*argv[])
if (dump_flag) {
ofstream out ("a.pf");
out << "PFORM DUMP MODULES:" << endl;
- for (list<Module*>::iterator mod = modules.begin()
+ for (map<string,Module*>::iterator mod = modules.begin()
; mod != modules.end()
; mod ++ ) {
- pform_dump(out, *mod);
+ pform_dump(out, (*mod).second);
}
out << "PFORM DUMP PRIMITIVES:" << endl;
for (map<string,PUdp*>::iterator idx = primitives.begin()
@@ -180,12 +182,11 @@ int main(int argc, char*argv[])
/* Select a root module, and elaborate the design. */
- if ((start_module == "") && (modules.size() == 1)) {
- Module*mod = modules.front();
- start_module = mod->get_name();
+ if (start_module == "") {
+ start_module = "main";
}
- Design*des = elaborate(modules, start_module);
+ Design*des = elaborate(modules, primitives, start_module);
if (des == 0) {
cerr << "Unable to elaborate design." << endl;
return 1;
@@ -226,6 +227,14 @@ int main(int argc, char*argv[])
/*
* $Log: main.cc,v $
+ * Revision 1.7 1998/12/01 00:42:14 steve
+ * Elaborate UDP devices,
+ * Support UDP type attributes, and
+ * pass those attributes to nodes that
+ * are instantiated by elaboration,
+ * Put modules into a map instead of
+ * a simple list.
+ *
* Revision 1.6 1998/11/25 02:35:53 steve
* Parse UDP primitives all the way to pform.
*
View
54 netlist.cc
@@ -17,13 +17,57 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
-#ident "$Id: netlist.cc,v 1.8 1998/11/23 00:20:23 steve Exp $"
+#ident "$Id: netlist.cc,v 1.9 1998/12/01 00:42:14 steve Exp $"
#endif
# include <cassert>
# include <typeinfo>
# include "netlist.h"
+ostream& operator<< (ostream&o, NetNet::Type t)
+{
+ switch (t) {
+ case NetNet::IMPLICIT:
+ o << "wire /*implicit*/";
+ break;
+ case NetNet::REG:
+ o << "reg";
+ break;
+ case NetNet::SUPPLY0:
+ o << "supply0";
+ break;
+ case NetNet::SUPPLY1:
+ o << "supply1";
+ break;
+ case NetNet::TRI:
+ o << "tri";
+ break;
+ case NetNet::TRI0:
+ o << "tri0";
+ break;
+ case NetNet::TRI1:
+ o << "tri1";
+ break;
+ case NetNet::TRIAND:
+ o << "triand";
+ break;
+ case NetNet::TRIOR:
+ o << "trior";
+ break;
+ case NetNet::WAND:
+ o << "wand";
+ break;
+ case NetNet::WOR:
+ o << "wor";
+ break;
+ case NetNet::WIRE:
+ o << "wire";
+ break;
+ }
+ return o;
+}
+
+
void connect(NetObj::Link&l, NetObj::Link&r)
{
NetObj::Link* cur = &l;
@@ -452,6 +496,14 @@ NetNet* Design::find_signal(bool (*func)(const NetNet*))
/*
* $Log: netlist.cc,v $
+ * Revision 1.9 1998/12/01 00:42:14 steve
+ * Elaborate UDP devices,
+ * Support UDP type attributes, and
+ * pass those attributes to nodes that
+ * are instantiated by elaboration,
+ * Put modules into a map instead of
+ * a simple list.
+ *
* Revision 1.8 1998/11/23 00:20:23 steve
* NetAssign handles lvalues as pin links
* instead of a signal pointer,
View
28 netlist.h
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
-#ident "$Id: netlist.h,v 1.8 1998/11/23 00:20:23 steve Exp $"
+#ident "$Id: netlist.h,v 1.9 1998/12/01 00:42:14 steve Exp $"
#endif
/*
@@ -307,6 +307,22 @@ class NetLogic : public NetNode {
const TYPE type_;
};
+/*
+ * The UDP is a User Defined Primitive from the Verilog source. Do not
+ * expand it out any further then this in the netlist, as this can be
+ * used to represent target device primitives.
+ */
+class NetUDP : public NetNode {
+
+ public:
+ explicit NetUDP(const string&n, unsigned pins)
+ : NetNode(n, pins) { }
+
+
+ virtual void emit_node(ostream&, struct target_t*) const;
+ virtual void dump_node(ostream&, unsigned ind) const;
+};
+
/* =========
* A process is a behavioral-model description. A process is a
* statement that may be compound. the various statement types may
@@ -753,8 +769,18 @@ const NetNet* find_link_signal(const NetObj*net, unsigned pin,
inline ostream& operator << (ostream&o, const NetExpr&exp)
{ exp.dump(o); return o; }
+extern ostream& operator << (ostream&, NetNet::Type);
+
/*
* $Log: netlist.h,v $
+ * Revision 1.9 1998/12/01 00:42:14 steve
+ * Elaborate UDP devices,
+ * Support UDP type attributes, and
+ * pass those attributes to nodes that
+ * are instantiated by elaboration,
+ * Put modules into a map instead of
+ * a simple list.
+ *
* Revision 1.8 1998/11/23 00:20:23 steve
* NetAssign handles lvalues as pin links
* instead of a signal pointer,
View
8 parse.y
@@ -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.7 1998/11/25 02:35:53 steve Exp $"
+#ident "$Id: parse.y,v 1.8 1998/12/01 00:42:14 steve Exp $"
#endif
# include "parse_misc.h"
@@ -151,6 +151,12 @@ delay_opt
description
: module
| udp_primitive
+ | KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')'
+ { pform_set_type_attrib(*$3, *$5, *$7);
+ delete $3;
+ delete $5;
+ delete $7;
+ }
;
event_control
View
38 pform.cc
@@ -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.5 1998/11/25 02:35:53 steve Exp $"
+#ident "$Id: pform.cc,v 1.6 1998/12/01 00:42:14 steve Exp $"
#endif
# include "pform.h"
@@ -32,8 +32,8 @@ extern int VLparse();
static Module*cur_module = 0;
-static list<Module*>*vl_modules = 0;
-static map<string,PUdp*> vl_primitives;
+static map<string,Module*> vl_modules;
+static map<string,PUdp*> vl_primitives;
/*
* This function evaluates delay expressions. The result should be a
@@ -55,8 +55,6 @@ void pform_startmodule(const string&name, list<PWire*>*ports)
assert( cur_module == 0 );
cur_module = new Module(name, ports? ports->size() : 0);
- vl_modules->push_back(cur_module);
-
if (ports) {
unsigned idx = 0;
for (list<PWire*>::iterator cur = ports->begin()
@@ -74,6 +72,7 @@ void pform_endmodule(const string&name)
{
assert(cur_module);
assert(name == cur_module->get_name());
+ vl_modules[name] = cur_module;
cur_module = 0;
}
@@ -350,6 +349,22 @@ void pform_set_attrib(const string&name, const string&key, const string&value)
cur->attributes[key] = value;
}
+/*
+ * Set the attribute of a TYPE. This is different from an object in
+ * that this applies to every instantiation of the given type.
+ */
+void pform_set_type_attrib(const string&name, const string&key,
+ const string&value)
+{
+ map<string,PUdp*>::const_iterator udp = vl_primitives.find(name);
+ if (udp == vl_primitives.end()) {
+ VLerror("type name is not (yet) defined.");
+ return;
+ }
+
+ (*udp).second ->attributes[key] = value;
+}
+
static void pform_set_net_range(const string&name, list<PExpr*>*range)
{
assert(range->size() == 2);
@@ -448,10 +463,10 @@ Statement* pform_make_calltask(string*name, list<PExpr*>*parms)
}
FILE*vl_input = 0;
-int pform_parse(FILE*input, list<Module*>&modules, map<string,PUdp*>&prim)
+int pform_parse(FILE*input, map<string,Module*>&modules,
+ map<string,PUdp*>&prim)
{
vl_input = input;
- vl_modules = &modules;
error_count = 0;
warn_count = 0;
int rc = VLparse();
@@ -459,6 +474,7 @@ int pform_parse(FILE*input, list<Module*>&modules, map<string,PUdp*>&prim)
cerr << "I give up." << endl;
}
+ modules = vl_modules;
prim = vl_primitives;
return error_count;
}
@@ -466,6 +482,14 @@ int pform_parse(FILE*input, list<Module*>&modules, map<string,PUdp*>&prim)
/*
* $Log: pform.cc,v $
+ * Revision 1.6 1998/12/01 00:42:14 steve
+ * Elaborate UDP devices,
+ * Support UDP type attributes, and
+ * pass those attributes to nodes that
+ * are instantiated by elaboration,
+ * Put modules into a map instead of
+ * a simple list.
+ *
* Revision 1.5 1998/11/25 02:35:53 steve
* Parse UDP primitives all the way to pform.
*
View
15 pform.h
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
-#ident "$Id: pform.h,v 1.3 1998/11/25 02:35:53 steve Exp $"
+#ident "$Id: pform.h,v 1.4 1998/12/01 00:42:14 steve Exp $"
#endif
# include "netlist.h"
@@ -92,6 +92,8 @@ extern void pform_set_port_type(list<string>*names, NetNet::PortType);
extern void pform_set_net_range(list<string>*names, list<PExpr*>*);
extern void pform_set_attrib(const string&name, const string&key,
const string&value);
+extern void pform_set_type_attrib(const string&name, const string&key,
+ const string&value);
extern void pform_make_behavior(PProcess::Type, Statement*);
extern Statement* pform_make_block(PBlock::BL_TYPE, list<Statement*>*);
extern Statement* pform_make_assignment(string*t, PExpr*e);
@@ -124,11 +126,20 @@ extern void pform_make_pgassign(const string&lval, PExpr*sel, PExpr*rval);
* parses the source file and places all the modules it finds into the
* mod list. The dump function dumps a module to the output stream.
*/
-extern int pform_parse(FILE*, list<Module*>&mod, map<string,PUdp*>&prim);
+extern int pform_parse(FILE*, map<string,Module*>&mod,
+ map<string,PUdp*>&prim);
extern void pform_dump(ostream&out, Module*mod);
/*
* $Log: pform.h,v $
+ * Revision 1.4 1998/12/01 00:42:14 steve
+ * Elaborate UDP devices,
+ * Support UDP type attributes, and
+ * pass those attributes to nodes that
+ * are instantiated by elaboration,
+ * Put modules into a map instead of
+ * a simple list.
+ *
* Revision 1.3 1998/11/25 02:35:53 steve
* Parse UDP primitives all the way to pform.
*
View
31 pform_dump.cc
@@ -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.6 1998/11/25 02:35:54 steve Exp $"
+#ident "$Id: pform_dump.cc,v 1.7 1998/12/01 00:42:14 steve Exp $"
#endif
/*
@@ -95,17 +95,7 @@ void PEBinary::dump(ostream&out) const
void PWire::dump(ostream&out) const
{
- switch (type) {
- case NetNet::IMPLICIT:
- out << " implicit wire ";
- break;
- case NetNet::WIRE:
- out << " wire ";
- break;
- case NetNet::REG:
- out << " reg ";
- break;
- }
+ out << " " << type;
switch (port_type) {
case NetNet::PIMPLICIT:
@@ -360,11 +350,28 @@ void PUdp::dump(ostream&out) const
<< ";" << endl;
out << "endprimitive" << endl;
+
+ // Dump the attributes for the primitive as attribute
+ // statements.
+ for (map<string,string>::const_iterator idx = attributes.begin()
+ ; idx != attributes.end()
+ ; idx ++) {
+ out << "$attribute(" << name_ << ", \"" << (*idx).first <<
+ "\", \"" << (*idx).second << "\")" << endl;
+ }
}
/*
* $Log: pform_dump.cc,v $
+ * Revision 1.7 1998/12/01 00:42:14 steve
+ * Elaborate UDP devices,
+ * Support UDP type attributes, and
+ * pass those attributes to nodes that
+ * are instantiated by elaboration,
+ * Put modules into a map instead of
+ * a simple list.
+ *
* Revision 1.6 1998/11/25 02:35:54 steve
* Parse UDP primitives all the way to pform.
*
View
23 t-verilog.cc
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
-#ident "$Id: t-verilog.cc,v 1.2 1998/11/23 00:20:23 steve Exp $"
+#ident "$Id: t-verilog.cc,v 1.3 1998/12/01 00:42:15 steve Exp $"
#endif
/*
@@ -56,19 +56,6 @@ class target_verilog : public target_t {
};
-static ostream& operator<< (ostream&o, NetNet::Type t)
-{
- switch (t) {
- case NetNet::WIRE:
- o << "wire";
- break;
- case NetNet::REG:
- o << "reg";
- break;
- }
- return o;
-}
-
/*
* The output of the design starts here. The emit operation calls the
* design_start and design_end target methods around the scan of the
@@ -307,6 +294,14 @@ const struct target tgt_verilog = {
/*
* $Log: t-verilog.cc,v $
+ * Revision 1.3 1998/12/01 00:42:15 steve
+ * Elaborate UDP devices,
+ * Support UDP type attributes, and
+ * pass those attributes to nodes that
+ * are instantiated by elaboration,
+ * Put modules into a map instead of
+ * a simple list.
+ *
* Revision 1.2 1998/11/23 00:20:23 steve
* NetAssign handles lvalues as pin links
* instead of a signal pointer,
View
16 target.cc
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
-#ident "$Id: target.cc,v 1.3 1998/11/09 18:55:34 steve Exp $"
+#ident "$Id: target.cc,v 1.4 1998/12/01 00:42:15 steve Exp $"
#endif
# include "target.h"
@@ -45,6 +45,12 @@ void target_t::bufz(ostream&os, const NetBUFZ*)
"Unhandled continuous assign (BUFZ)." << endl;
}
+void target_t::udp(ostream&os, const NetUDP*)
+{
+ cerr << "target (" << typeid(*this).name() << "): "
+ "Unhandled UDP." << endl;
+}
+
void target_t::net_assign(ostream&os, const NetAssign*)
{
}
@@ -147,6 +153,14 @@ void expr_scan_t::expr_binary(const NetEBinary*ex)
/*
* $Log: target.cc,v $
+ * Revision 1.4 1998/12/01 00:42:15 steve
+ * Elaborate UDP devices,
+ * Support UDP type attributes, and
+ * pass those attributes to nodes that
+ * are instantiated by elaboration,
+ * Put modules into a map instead of
+ * a simple list.
+ *
* Revision 1.3 1998/11/09 18:55:34 steve
* Add procedural while loops,
* Parse procedural for loops,
View
11 target.h
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
-#ident "$Id: target.h,v 1.3 1998/11/09 18:55:35 steve Exp $"
+#ident "$Id: target.h,v 1.4 1998/12/01 00:42:15 steve Exp $"
#endif
# include "netlist.h"
@@ -61,6 +61,7 @@ struct target_t {
/* Output a gate (called for each gate) */
virtual void logic(ostream&os, const NetLogic*);
virtual void bufz(ostream&os, const NetBUFZ*);
+ virtual void udp(ostream&os, const NetUDP*);
virtual void net_assign(ostream&os, const NetAssign*);
virtual void net_const(ostream&os, const NetConst*);
virtual void net_pevent(ostream&os, const NetPEvent*);
@@ -113,6 +114,14 @@ extern const struct target *target_table[];
/*
* $Log: target.h,v $
+ * Revision 1.4 1998/12/01 00:42:15 steve
+ * Elaborate UDP devices,
+ * Support UDP type attributes, and
+ * pass those attributes to nodes that
+ * are instantiated by elaboration,
+ * Put modules into a map instead of
+ * a simple list.
+ *
* Revision 1.3 1998/11/09 18:55:35 steve
* Add procedural while loops,
* Parse procedural for loops,
Please sign in to comment.
Something went wrong with that request. Please try again.