emit NetAssignMem objects in vvm target.

This commit is contained in:
steve 1999-05-12 04:03:19 +00:00
parent 0348394acc
commit 295306aad5
6 changed files with 57 additions and 9 deletions

10
emit.cc
View File

@ -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) #if !defined(WINNT)
#ident "$Id: emit.cc,v 1.10 1999/05/07 01:21:18 steve Exp $" #ident "$Id: emit.cc,v 1.11 1999/05/12 04:03:19 steve Exp $"
#endif #endif
/* /*
@ -85,6 +85,11 @@ void NetAssign::emit_proc(ostream&o, struct target_t*tgt) const
tgt->proc_assign(o, this); tgt->proc_assign(o, this);
} }
void NetAssignMem::emit_proc(ostream&o, struct target_t*tgt) const
{
tgt->proc_assign_mem(o, this);
}
void NetBlock::emit_proc(ostream&o, struct target_t*tgt) const void NetBlock::emit_proc(ostream&o, struct target_t*tgt) const
{ {
tgt->proc_block(o, this); tgt->proc_block(o, this);
@ -253,6 +258,9 @@ void emit(ostream&o, const Design*des, const char*type)
/* /*
* $Log: emit.cc,v $ * $Log: emit.cc,v $
* Revision 1.11 1999/05/12 04:03:19 steve
* emit NetAssignMem objects in vvm target.
*
* Revision 1.10 1999/05/07 01:21:18 steve * Revision 1.10 1999/05/07 01:21:18 steve
* Handle total lack of nodes and signals. * Handle total lack of nodes and signals.
* *

View File

@ -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) #if !defined(WINNT)
#ident "$Id: netlist.cc,v 1.23 1999/05/10 00:16:58 steve Exp $" #ident "$Id: netlist.cc,v 1.24 1999/05/12 04:03:19 steve Exp $"
#endif #endif
# include <cassert> # include <cassert>
@ -457,6 +457,7 @@ NetEBinary::NetEBinary(char op, NetExpr*l, NetExpr*r)
case 'e': case 'e':
case 'n': case 'n':
expr_width(1); expr_width(1);
right_->set_width(left_->expr_width());
break; break;
default: default:
expr_width(left_->expr_width() > right_->expr_width() expr_width(left_->expr_width() > right_->expr_width()
@ -469,8 +470,8 @@ void NetEBinary::set_width(unsigned w)
{ {
switch (op_) { switch (op_) {
/* Comparison operators allow the subexpressions to have /* Comparison operators allow the subexpressions to have
their own natural width. Do not recurse the their own natural width. However, I do need to make
set_width(). */ sure that the subexpressions have the same width. */
case 'e': case 'e':
assert(w == 1); assert(w == 1);
expr_width(w); expr_width(w);
@ -1050,6 +1051,9 @@ NetNet* Design::find_signal(bool (*func)(const NetNet*))
/* /*
* $Log: netlist.cc,v $ * $Log: netlist.cc,v $
* Revision 1.24 1999/05/12 04:03:19 steve
* emit NetAssignMem objects in vvm target.
*
* Revision 1.23 1999/05/10 00:16:58 steve * Revision 1.23 1999/05/10 00:16:58 steve
* Parse and elaborate the concatenate operator * Parse and elaborate the concatenate operator
* in structural contexts, Replace vector<PExpr*> * in structural contexts, Replace vector<PExpr*>

View File

@ -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) #if !defined(WINNT)
#ident "$Id: netlist.h,v 1.29 1999/05/10 00:16:58 steve Exp $" #ident "$Id: netlist.h,v 1.30 1999/05/12 04:03:19 steve Exp $"
#endif #endif
/* /*
@ -624,6 +624,11 @@ class NetAssignMem : public NetProc, public LineInfo {
explicit NetAssignMem(NetMemory*, NetExpr*idx, NetExpr*rv); explicit NetAssignMem(NetMemory*, NetExpr*idx, NetExpr*rv);
~NetAssignMem(); ~NetAssignMem();
const NetMemory*memory()const { return mem_; }
const NetExpr*index()const { return index_.ref(); }
const NetExpr*rval()const { return rval_.ref(); }
virtual void emit_proc(ostream&, struct target_t*) const;
virtual void dump(ostream&, unsigned ind) const; virtual void dump(ostream&, unsigned ind) const;
private: private:
@ -1173,6 +1178,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
/* /*
* $Log: netlist.h,v $ * $Log: netlist.h,v $
* Revision 1.30 1999/05/12 04:03:19 steve
* emit NetAssignMem objects in vvm target.
*
* Revision 1.29 1999/05/10 00:16:58 steve * Revision 1.29 1999/05/10 00:16:58 steve
* Parse and elaborate the concatenate operator * Parse and elaborate the concatenate operator
* in structural contexts, Replace vector<PExpr*> * in structural contexts, Replace vector<PExpr*>

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1998 Stephen Williams (steve@icarus.com) * Copyright (c) 1998-1999 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) #if !defined(WINNT)
#ident "$Id: t-vvm.cc,v 1.20 1999/05/03 01:51:29 steve Exp $" #ident "$Id: t-vvm.cc,v 1.21 1999/05/12 04:03:19 steve Exp $"
#endif #endif
# include <iostream> # include <iostream>
@ -50,6 +50,7 @@ class target_vvm : public target_t {
virtual void net_event(ostream&os, const NetNEvent*); virtual void net_event(ostream&os, const NetNEvent*);
virtual void start_process(ostream&os, const NetProcTop*); virtual void start_process(ostream&os, const NetProcTop*);
virtual void proc_assign(ostream&os, const NetAssign*); virtual void proc_assign(ostream&os, const NetAssign*);
virtual void proc_assign_mem(ostream&os, const NetAssignMem*);
virtual void proc_block(ostream&os, const NetBlock*); virtual void proc_block(ostream&os, const NetBlock*);
virtual void proc_case(ostream&os, const NetCase*net); virtual void proc_case(ostream&os, const NetCase*net);
virtual void proc_condit(ostream&os, const NetCondit*); virtual void proc_condit(ostream&os, const NetCondit*);
@ -700,6 +701,17 @@ void target_vvm::proc_assign(ostream&os, const NetAssign*net)
} }
} }
void target_vvm::proc_assign_mem(ostream&os, const NetAssignMem*amem)
{
string index = emit_proc_rval(os, 8, amem->index());
string rval = emit_proc_rval(os, 8, amem->rval());
const NetMemory*mem = amem->memory();
os << " /* " << amem->get_line() << " */" << endl;
os << " " << mangle(mem->name())
<< "[" << index << ".as_unsigned()] = " << rval << ";" << endl;
}
void target_vvm::proc_block(ostream&os, const NetBlock*net) void target_vvm::proc_block(ostream&os, const NetBlock*net)
{ {
net->emit_recurse(os, this); net->emit_recurse(os, this);
@ -946,6 +958,9 @@ extern const struct target tgt_vvm = {
}; };
/* /*
* $Log: t-vvm.cc,v $ * $Log: t-vvm.cc,v $
* Revision 1.21 1999/05/12 04:03:19 steve
* emit NetAssignMem objects in vvm target.
*
* Revision 1.20 1999/05/03 01:51:29 steve * Revision 1.20 1999/05/03 01:51:29 steve
* Restore support for wait event control. * Restore support for wait event control.
* *

View File

@ -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) #if !defined(WINNT)
#ident "$Id: target.cc,v 1.8 1999/05/01 02:57:53 steve Exp $" #ident "$Id: target.cc,v 1.9 1999/05/12 04:03:19 steve Exp $"
#endif #endif
# include "target.h" # include "target.h"
@ -87,6 +87,12 @@ void target_t::proc_assign(ostream&os, const NetAssign*)
{ {
} }
void target_t::proc_assign_mem(ostream&os, const NetAssignMem*)
{
cerr << "target (" << typeid(*this).name() << "): "
"Unhandled memory assignment." << endl;
}
void target_t::proc_block(ostream&os, const NetBlock*) void target_t::proc_block(ostream&os, const NetBlock*)
{ {
} }
@ -184,6 +190,9 @@ void expr_scan_t::expr_binary(const NetEBinary*ex)
/* /*
* $Log: target.cc,v $ * $Log: target.cc,v $
* Revision 1.9 1999/05/12 04:03:19 steve
* emit NetAssignMem objects in vvm target.
*
* Revision 1.8 1999/05/01 02:57:53 steve * Revision 1.8 1999/05/01 02:57:53 steve
* Handle much more complex event expressions. * Handle much more complex event expressions.
* *

View File

@ -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) #if !defined(WINNT)
#ident "$Id: target.h,v 1.8 1999/05/01 02:57:53 steve Exp $" #ident "$Id: target.h,v 1.9 1999/05/12 04:03:20 steve Exp $"
#endif #endif
# include "netlist.h" # include "netlist.h"
@ -75,6 +75,7 @@ struct target_t {
/* Various kinds of process nodes are dispatched through these. */ /* Various kinds of process nodes are dispatched through these. */
virtual void proc_assign(ostream&os, const NetAssign*); virtual void proc_assign(ostream&os, const NetAssign*);
virtual void proc_assign_mem(ostream&os, const NetAssignMem*);
virtual void proc_block(ostream&os, const NetBlock*); virtual void proc_block(ostream&os, const NetBlock*);
virtual void proc_case(ostream&os, const NetCase*); virtual void proc_case(ostream&os, const NetCase*);
virtual void proc_condit(ostream&os, const NetCondit*); virtual void proc_condit(ostream&os, const NetCondit*);
@ -121,6 +122,9 @@ extern const struct target *target_table[];
/* /*
* $Log: target.h,v $ * $Log: target.h,v $
* Revision 1.9 1999/05/12 04:03:20 steve
* emit NetAssignMem objects in vvm target.
*
* Revision 1.8 1999/05/01 02:57:53 steve * Revision 1.8 1999/05/01 02:57:53 steve
* Handle much more complex event expressions. * Handle much more complex event expressions.
* *