Core handles subsignal expressions.
This commit is contained in:
parent
32b52cbb97
commit
09cfbc6240
|
|
@ -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.17 1999/04/19 01:59:36 steve Exp $"
|
||||
#ident "$Id: design_dump.cc,v 1.18 1999/04/25 00:44:10 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -469,6 +469,14 @@ void NetESignal::dump(ostream&o) const
|
|||
o << name();
|
||||
}
|
||||
|
||||
void NetESubSignal::dump(ostream&o) const
|
||||
{
|
||||
sig_->dump(o);
|
||||
o << "[";
|
||||
idx_->dump(o);
|
||||
o << "]";
|
||||
}
|
||||
|
||||
void NetEMemory::dump(ostream&o) const
|
||||
{
|
||||
o << mem_->name() << "[";
|
||||
|
|
@ -543,6 +551,9 @@ void Design::dump(ostream&o) const
|
|||
|
||||
/*
|
||||
* $Log: design_dump.cc,v $
|
||||
* Revision 1.18 1999/04/25 00:44:10 steve
|
||||
* Core handles subsignal expressions.
|
||||
*
|
||||
* Revision 1.17 1999/04/19 01:59:36 steve
|
||||
* Add memories to the parse and elaboration phases.
|
||||
*
|
||||
|
|
|
|||
78
elaborate.cc
78
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.19 1999/04/19 01:59:36 steve Exp $"
|
||||
#ident "$Id: elaborate.cc,v 1.20 1999/04/25 00:44:10 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -680,41 +680,56 @@ NetExpr* PEString::elaborate_expr(Design*des, const string&path) const
|
|||
|
||||
NetExpr*PEIdent::elaborate_expr(Design*des, const string&path) const
|
||||
{
|
||||
if (text_[0] == '$') {
|
||||
// System identifiers show up in the netlist as identifiers.
|
||||
if (text_[0] == '$')
|
||||
return new NetEIdent(text_, 64);
|
||||
|
||||
} else {
|
||||
string name = path+"."+text_;
|
||||
string name = path+"."+text_;
|
||||
|
||||
if (NetExpr*ex = des->get_parameter(name))
|
||||
return ex;
|
||||
// If the identifier name a paramter name, then return
|
||||
// the expression that it represents.
|
||||
if (NetExpr*ex = des->get_parameter(name))
|
||||
return ex;
|
||||
|
||||
if (NetNet*net = des->find_signal(name)) {
|
||||
NetESignal*node = des->get_esignal(net);
|
||||
return node;
|
||||
// If the identifier names a signal (a register or wire)
|
||||
// then create a NetESignal node to handle it.
|
||||
if (NetNet*net = des->find_signal(name)) {
|
||||
NetESignal*node = des->get_esignal(net);
|
||||
assert(idx_ == 0);
|
||||
assert(lsb_ == 0);
|
||||
if (msb_) {
|
||||
NetExpr*ex = msb_->elaborate_expr(des, path);
|
||||
NetESubSignal*ss = new NetESubSignal(node, ex);
|
||||
return ss;
|
||||
}
|
||||
|
||||
if (NetMemory*mem = des->find_memory(name)) {
|
||||
assert(msb_ != 0);
|
||||
assert(lsb_ == 0);
|
||||
assert(idx_ == 0);
|
||||
NetExpr*i = msb_->elaborate_expr(des, path);
|
||||
if (i == 0) {
|
||||
cerr << get_line() << ": Unable to exaborate "
|
||||
"index expression `" << *msb_ << "'" << endl;
|
||||
des->errors += 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
NetEMemory*node = new NetEMemory(mem, i);
|
||||
return node;
|
||||
}
|
||||
|
||||
cerr << get_line() << ": Unable to bind wire/reg/memory "
|
||||
"`" << path << "." << text_ << "'" << endl;
|
||||
des->errors += 1;
|
||||
return 0;
|
||||
assert(msb_ == 0);
|
||||
return node;
|
||||
}
|
||||
|
||||
// If the identifier names a memory, then this is a
|
||||
// memory reference and I must generate a NetEMemory
|
||||
// object to handle it.
|
||||
if (NetMemory*mem = des->find_memory(name)) {
|
||||
assert(msb_ != 0);
|
||||
assert(lsb_ == 0);
|
||||
assert(idx_ == 0);
|
||||
NetExpr*i = msb_->elaborate_expr(des, path);
|
||||
if (i == 0) {
|
||||
cerr << get_line() << ": Unable to exaborate "
|
||||
"index expression `" << *msb_ << "'" << endl;
|
||||
des->errors += 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
NetEMemory*node = new NetEMemory(mem, i);
|
||||
return node;
|
||||
}
|
||||
|
||||
// I cannot interpret this identifier. Error message.
|
||||
cerr << get_line() << ": Unable to bind wire/reg/memory "
|
||||
"`" << path << "." << text_ << "'" << endl;
|
||||
des->errors += 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
NetExpr* PExpr::elaborate_expr(Design*des, const string&path) const
|
||||
|
|
@ -1028,6 +1043,9 @@ Design* elaborate(const map<string,Module*>&modules,
|
|||
|
||||
/*
|
||||
* $Log: elaborate.cc,v $
|
||||
* Revision 1.20 1999/04/25 00:44:10 steve
|
||||
* Core handles subsignal expressions.
|
||||
*
|
||||
* Revision 1.19 1999/04/19 01:59:36 steve
|
||||
* Add memories to the parse and elaboration phases.
|
||||
*
|
||||
|
|
|
|||
10
emit.cc
10
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.7 1999/04/19 01:59:36 steve Exp $"
|
||||
#ident "$Id: emit.cc,v 1.8 1999/04/25 00:44:10 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -229,6 +229,11 @@ void NetESignal::emit_node(ostream&o, struct target_t*tgt) const
|
|||
tgt->net_esignal(o, this);
|
||||
}
|
||||
|
||||
void NetESubSignal::expr_scan(struct expr_scan_t*tgt) const
|
||||
{
|
||||
tgt->expr_subsignal(this);
|
||||
}
|
||||
|
||||
void NetEUnary::expr_scan(struct expr_scan_t*tgt) const
|
||||
{
|
||||
tgt->expr_unary(this);
|
||||
|
|
@ -248,6 +253,9 @@ void emit(ostream&o, const Design*des, const char*type)
|
|||
|
||||
/*
|
||||
* $Log: emit.cc,v $
|
||||
* Revision 1.8 1999/04/25 00:44:10 steve
|
||||
* Core handles subsignal expressions.
|
||||
*
|
||||
* Revision 1.7 1999/04/19 01:59:36 steve
|
||||
* Add memories to the parse and elaboration phases.
|
||||
*
|
||||
|
|
|
|||
15
netlist.cc
15
netlist.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: netlist.cc,v 1.20 1999/04/19 01:59:36 steve Exp $"
|
||||
#ident "$Id: netlist.cc,v 1.21 1999/04/25 00:44:10 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <cassert>
|
||||
|
|
@ -536,6 +536,16 @@ void NetESignal::set_width(unsigned w)
|
|||
expr_width(w);
|
||||
}
|
||||
|
||||
NetESubSignal::NetESubSignal(NetESignal*sig, NetExpr*ex)
|
||||
: sig_(sig), idx_(ex)
|
||||
{
|
||||
}
|
||||
|
||||
NetESubSignal::~NetESubSignal()
|
||||
{
|
||||
idx_.clr_and_delete();
|
||||
}
|
||||
|
||||
NetEUnary::~NetEUnary()
|
||||
{
|
||||
expr_.clr_and_delete();
|
||||
|
|
@ -1016,6 +1026,9 @@ NetNet* Design::find_signal(bool (*func)(const NetNet*))
|
|||
|
||||
/*
|
||||
* $Log: netlist.cc,v $
|
||||
* Revision 1.21 1999/04/25 00:44:10 steve
|
||||
* Core handles subsignal expressions.
|
||||
*
|
||||
* Revision 1.20 1999/04/19 01:59:36 steve
|
||||
* Add memories to the parse and elaboration phases.
|
||||
*
|
||||
|
|
|
|||
28
netlist.h
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.24 1999/04/22 04:56:58 steve Exp $"
|
||||
#ident "$Id: netlist.h,v 1.25 1999/04/25 00:44:10 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -972,6 +972,29 @@ class NetESignal : public NetExpr, public NetNode {
|
|||
private:
|
||||
};
|
||||
|
||||
/*
|
||||
* An expression that takes a portion of a signal is represented as
|
||||
* one of these. For example, ``foo[x+5]'' is a signal and x+5 is an
|
||||
* expression to select a single bit from that signal. I can't just
|
||||
* make a new NetESignal node connected to the single net because the
|
||||
* expression may vary during execution, so the structure is not known
|
||||
* at compile (elaboration) time.
|
||||
*/
|
||||
class NetESubSignal : public NetExpr {
|
||||
|
||||
public:
|
||||
NetESubSignal(NetESignal*sig, NetExpr*ex);
|
||||
~NetESubSignal();
|
||||
|
||||
virtual void expr_scan(struct expr_scan_t*) const;
|
||||
virtual void dump(ostream&) const;
|
||||
|
||||
private:
|
||||
// For now, only support single-bit selects of a signal.
|
||||
NetESignal*sig_;
|
||||
NetExpr::REF idx_;
|
||||
};
|
||||
|
||||
/*
|
||||
* This class contains an entire design. It includes processes and a
|
||||
* netlist, and can be passed around from function to function.
|
||||
|
|
@ -1103,6 +1126,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
|
|||
|
||||
/*
|
||||
* $Log: netlist.h,v $
|
||||
* Revision 1.25 1999/04/25 00:44:10 steve
|
||||
* Core handles subsignal expressions.
|
||||
*
|
||||
* Revision 1.24 1999/04/22 04:56:58 steve
|
||||
* Add to vvm proceedural memory references.
|
||||
*
|
||||
|
|
|
|||
11
target.cc
11
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.6 1999/04/19 01:59:37 steve Exp $"
|
||||
#ident "$Id: target.cc,v 1.7 1999/04/25 00:44:10 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "target.h"
|
||||
|
|
@ -164,6 +164,12 @@ void expr_scan_t::expr_signal(const NetESignal*)
|
|||
"unhandled expr_signal." << endl;
|
||||
}
|
||||
|
||||
void expr_scan_t::expr_subsignal(const NetESubSignal*)
|
||||
{
|
||||
cerr << "expr_scan_t (" << typeid(*this).name() << "): "
|
||||
"unhandled expr_subsignal." << endl;
|
||||
}
|
||||
|
||||
void expr_scan_t::expr_unary(const NetEUnary*)
|
||||
{
|
||||
cerr << "expr_scan_t (" << typeid(*this).name() << "): "
|
||||
|
|
@ -178,6 +184,9 @@ void expr_scan_t::expr_binary(const NetEBinary*ex)
|
|||
|
||||
/*
|
||||
* $Log: target.cc,v $
|
||||
* Revision 1.7 1999/04/25 00:44:10 steve
|
||||
* Core handles subsignal expressions.
|
||||
*
|
||||
* Revision 1.6 1999/04/19 01:59:37 steve
|
||||
* Add memories to the parse and elaboration phases.
|
||||
*
|
||||
|
|
|
|||
6
target.h
6
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.6 1999/04/19 01:59:37 steve Exp $"
|
||||
#ident "$Id: target.h,v 1.7 1999/04/25 00:44:10 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "netlist.h"
|
||||
|
|
@ -99,6 +99,7 @@ struct expr_scan_t {
|
|||
virtual void expr_ident(const NetEIdent*);
|
||||
virtual void expr_memory(const NetEMemory*);
|
||||
virtual void expr_signal(const NetESignal*);
|
||||
virtual void expr_subsignal(const NetESubSignal*);
|
||||
virtual void expr_unary(const NetEUnary*);
|
||||
virtual void expr_binary(const NetEBinary*);
|
||||
};
|
||||
|
|
@ -120,6 +121,9 @@ extern const struct target *target_table[];
|
|||
|
||||
/*
|
||||
* $Log: target.h,v $
|
||||
* Revision 1.7 1999/04/25 00:44:10 steve
|
||||
* Core handles subsignal expressions.
|
||||
*
|
||||
* Revision 1.6 1999/04/19 01:59:37 steve
|
||||
* Add memories to the parse and elaboration phases.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue