Elaborate and supprort to vvm the forever
and repeat statements.
This commit is contained in:
parent
04592d3c91
commit
853ad247a1
17
README.txt
17
README.txt
|
|
@ -149,6 +149,9 @@ Usage: ivl <options>... file
|
|||
Select the output format for the compiled result. Use the
|
||||
"ivl -h" command to get a list of configured targets.
|
||||
|
||||
-v
|
||||
Print version and copyright information for ivl.
|
||||
|
||||
ATTRIBUTES
|
||||
|
||||
The parser accepts as an extension to Verilog the $attribute module
|
||||
|
|
@ -245,9 +248,6 @@ verilog features.
|
|||
|
||||
- Min/Typ/Max expressions: Example: a = (1 : 6 : 14);
|
||||
|
||||
- Inversion of a vector with a bit operator:
|
||||
Example: reg [7:0] a; a = !(8'h01);
|
||||
|
||||
- The "!==" operator: Example: if( a !== b) do = 1;
|
||||
|
||||
- Expansion of a string into a larger variable:
|
||||
|
|
@ -262,10 +262,6 @@ verilog features.
|
|||
|
||||
- Bit ranges within IF. Example: if (a[2:3]) do = 1;
|
||||
|
||||
- Forever key word.
|
||||
|
||||
- Repeat key word.
|
||||
|
||||
- Assignment timing delay: Example: a = #1 0; #1 a = #2 ~a;
|
||||
|
||||
- Bit Ranges within $write, $display.
|
||||
|
|
@ -274,3 +270,10 @@ verilog features.
|
|||
|
||||
- Task declarations/calls.
|
||||
|
||||
- Specify blocks
|
||||
|
||||
- Named port parameters.
|
||||
Example: module foo(.x(r[0])) ; reg r[7:0]; endmodule
|
||||
|
||||
Note that binding to a port by name does work from the outside.
|
||||
i.e. ``foo foogate(.x(n[0]))'' is OK.
|
||||
|
|
|
|||
27
Statement.cc
27
Statement.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: Statement.cc,v 1.9 1999/06/15 05:38:39 steve Exp $"
|
||||
#ident "$Id: Statement.cc,v 1.10 1999/06/19 21:06:16 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "Statement.h"
|
||||
|
|
@ -102,11 +102,32 @@ PCondit::~PCondit()
|
|||
delete else_;
|
||||
}
|
||||
|
||||
PForever::PForever(Statement*s)
|
||||
: statement_(s)
|
||||
{
|
||||
}
|
||||
|
||||
PForever::~PForever()
|
||||
{
|
||||
delete statement_;
|
||||
}
|
||||
|
||||
PProcess::~PProcess()
|
||||
{
|
||||
delete statement_;
|
||||
}
|
||||
|
||||
PRepeat::PRepeat(PExpr*e, Statement*s)
|
||||
: expr_(e), statement_(s)
|
||||
{
|
||||
}
|
||||
|
||||
PRepeat::~PRepeat()
|
||||
{
|
||||
delete expr_;
|
||||
delete statement_;
|
||||
}
|
||||
|
||||
PWhile::~PWhile()
|
||||
{
|
||||
delete cond_;
|
||||
|
|
@ -115,6 +136,10 @@ PWhile::~PWhile()
|
|||
|
||||
/*
|
||||
* $Log: Statement.cc,v $
|
||||
* Revision 1.10 1999/06/19 21:06:16 steve
|
||||
* Elaborate and supprort to vvm the forever
|
||||
* and repeat statements.
|
||||
*
|
||||
* Revision 1.9 1999/06/15 05:38:39 steve
|
||||
* Support case expression lists.
|
||||
*
|
||||
|
|
|
|||
31
Statement.h
31
Statement.h
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: Statement.h,v 1.11 1999/06/15 05:38:39 steve Exp $"
|
||||
#ident "$Id: Statement.h,v 1.12 1999/06/19 21:06:16 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <string>
|
||||
|
|
@ -254,6 +254,18 @@ class PEventStatement : public Statement {
|
|||
Statement*statement_;
|
||||
};
|
||||
|
||||
class PForever : public Statement {
|
||||
public:
|
||||
explicit PForever(Statement*s);
|
||||
~PForever();
|
||||
|
||||
virtual NetProc* elaborate(Design*des, const string&path) const;
|
||||
virtual void dump(ostream&out, unsigned ind) const;
|
||||
|
||||
private:
|
||||
Statement*statement_;
|
||||
};
|
||||
|
||||
class PForStatement : public Statement {
|
||||
|
||||
public:
|
||||
|
|
@ -284,6 +296,19 @@ class PNoop : public Statement {
|
|||
PNoop() { }
|
||||
};
|
||||
|
||||
class PRepeat : public Statement {
|
||||
public:
|
||||
explicit PRepeat(PExpr*expr, Statement*s);
|
||||
~PRepeat();
|
||||
|
||||
virtual NetProc* elaborate(Design*des, const string&path) const;
|
||||
virtual void dump(ostream&out, unsigned ind) const;
|
||||
|
||||
private:
|
||||
PExpr*expr_;
|
||||
Statement*statement_;
|
||||
};
|
||||
|
||||
class PWhile : public Statement {
|
||||
|
||||
public:
|
||||
|
|
@ -301,6 +326,10 @@ class PWhile : public Statement {
|
|||
|
||||
/*
|
||||
* $Log: Statement.h,v $
|
||||
* Revision 1.12 1999/06/19 21:06:16 steve
|
||||
* Elaborate and supprort to vvm the forever
|
||||
* and repeat statements.
|
||||
*
|
||||
* Revision 1.11 1999/06/15 05:38:39 steve
|
||||
* Support case expression lists.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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.29 1999/06/15 05:38:15 steve Exp $"
|
||||
#ident "$Id: design_dump.cc,v 1.30 1999/06/19 21:06:16 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -389,6 +389,12 @@ void NetCondit::dump(ostream&o, unsigned ind) const
|
|||
}
|
||||
}
|
||||
|
||||
void NetForever::dump(ostream&o, unsigned ind) const
|
||||
{
|
||||
o << setw(ind) << "" << "forever" << endl;
|
||||
statement_->dump(o, ind+2);
|
||||
}
|
||||
|
||||
void NetPDelay::dump(ostream&o, unsigned ind) const
|
||||
{
|
||||
o << setw(ind) << "" << "#" << delay_;
|
||||
|
|
@ -459,6 +465,12 @@ void NetTask::dump(ostream&o, unsigned ind) const
|
|||
o << ";" << endl;
|
||||
}
|
||||
|
||||
void NetRepeat::dump(ostream&o, unsigned ind) const
|
||||
{
|
||||
o << setw(ind) << "" << "repeat (" << *expr_ << ")" << endl;
|
||||
statement_->dump(o, ind+2);
|
||||
}
|
||||
|
||||
void NetWhile::dump(ostream&o, unsigned ind) const
|
||||
{
|
||||
o << setw(ind) << "" << "while (" << *cond_ << ")" << endl;
|
||||
|
|
@ -630,6 +642,10 @@ void Design::dump(ostream&o) const
|
|||
|
||||
/*
|
||||
* $Log: design_dump.cc,v $
|
||||
* Revision 1.30 1999/06/19 21:06:16 steve
|
||||
* Elaborate and supprort to vvm the forever
|
||||
* and repeat statements.
|
||||
*
|
||||
* Revision 1.29 1999/06/15 05:38:15 steve
|
||||
* Handle total lack of signals or nodes.
|
||||
*
|
||||
|
|
|
|||
60
elaborate.cc
60
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.46 1999/06/17 05:34:42 steve Exp $"
|
||||
#ident "$Id: elaborate.cc,v 1.47 1999/06/19 21:06:16 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -1412,6 +1412,21 @@ NetProc* PEventStatement::elaborate(Design*des, const string&path) const
|
|||
return pe;
|
||||
}
|
||||
|
||||
/*
|
||||
* Forever statements are represented directly in the netlist. It is
|
||||
* theoretically possible to use a while structure with a constant
|
||||
* expression to represent the loop, but why complicate the code
|
||||
* generators so?
|
||||
*/
|
||||
NetProc* PForever::elaborate(Design*des, const string&path) const
|
||||
{
|
||||
NetProc*stat = statement_->elaborate(des, path);
|
||||
if (stat == 0) return 0;
|
||||
|
||||
NetForever*proc = new NetForever(stat);
|
||||
return proc;
|
||||
}
|
||||
|
||||
/*
|
||||
* elaborate the for loop as the equivilent while loop. This eases the
|
||||
* task for the target code generator. The structure is:
|
||||
|
|
@ -1465,6 +1480,45 @@ NetProc* PForStatement::elaborate(Design*des, const string&path) const
|
|||
return top;
|
||||
}
|
||||
|
||||
NetProc* PRepeat::elaborate(Design*des, const string&path) const
|
||||
{
|
||||
NetExpr*expr = expr_->elaborate_expr(des, path);
|
||||
if (expr == 0) {
|
||||
cerr << get_line() << ": Unable to elaborate"
|
||||
" repeat expression." << endl;
|
||||
des->errors += 1;
|
||||
return 0;
|
||||
}
|
||||
NetExpr*tmp = expr->eval_tree();
|
||||
if (tmp) {
|
||||
delete expr;
|
||||
expr = tmp;
|
||||
}
|
||||
|
||||
NetProc*stat = statement_->elaborate(des, path);
|
||||
if (stat == 0) return 0;
|
||||
|
||||
// If the expression is a constant, handle certain special
|
||||
// iteration counts.
|
||||
if (NetEConst*ce = dynamic_cast<NetEConst*>(expr)) {
|
||||
verinum val = ce->value();
|
||||
switch (val.as_ulong()) {
|
||||
case 0:
|
||||
delete expr;
|
||||
delete stat;
|
||||
return new NetBlock(NetBlock::SEQU);
|
||||
case 1:
|
||||
delete expr;
|
||||
return stat;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
NetRepeat*proc = new NetRepeat(expr, stat);
|
||||
return proc;
|
||||
}
|
||||
|
||||
/*
|
||||
* The while loop is fairly directly represented in the netlist.
|
||||
*/
|
||||
|
|
@ -1575,6 +1629,10 @@ Design* elaborate(const map<string,Module*>&modules,
|
|||
|
||||
/*
|
||||
* $Log: elaborate.cc,v $
|
||||
* Revision 1.47 1999/06/19 21:06:16 steve
|
||||
* Elaborate and supprort to vvm the forever
|
||||
* and repeat statements.
|
||||
*
|
||||
* Revision 1.46 1999/06/17 05:34:42 steve
|
||||
* Clean up interface of the PWire class,
|
||||
* Properly match wire ranges.
|
||||
|
|
|
|||
28
emit.cc
28
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.13 1999/06/09 03:00:06 steve Exp $"
|
||||
#ident "$Id: emit.cc,v 1.14 1999/06/19 21:06:16 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -115,6 +115,11 @@ void NetCondit::emit_proc(ostream&o, struct target_t*tgt) const
|
|||
tgt->proc_condit(o, this);
|
||||
}
|
||||
|
||||
void NetForever::emit_proc(ostream&o, struct target_t*tgt) const
|
||||
{
|
||||
tgt->proc_forever(o, this);
|
||||
}
|
||||
|
||||
void NetPDelay::emit_proc(ostream&o, struct target_t*tgt) const
|
||||
{
|
||||
tgt->proc_delay(o, this);
|
||||
|
|
@ -135,6 +140,11 @@ void NetPEvent::emit_proc_recurse(ostream&o, struct target_t*tgt) const
|
|||
if (statement_) statement_->emit_proc(o, tgt);
|
||||
}
|
||||
|
||||
void NetRepeat::emit_proc(ostream&o, struct target_t*tgt) const
|
||||
{
|
||||
tgt->proc_repeat(o, this);
|
||||
}
|
||||
|
||||
void NetTask::emit_proc(ostream&o, struct target_t*tgt) const
|
||||
{
|
||||
tgt->proc_task(o, this);
|
||||
|
|
@ -169,6 +179,18 @@ void NetCondit::emit_recurse_else(ostream&o, struct target_t*tgt) const
|
|||
else_->emit_proc(o, tgt);
|
||||
}
|
||||
|
||||
void NetForever::emit_recurse(ostream&o, struct target_t*tgt) const
|
||||
{
|
||||
if (statement_)
|
||||
statement_->emit_proc(o, tgt);
|
||||
}
|
||||
|
||||
void NetRepeat::emit_recurse(ostream&o, struct target_t*tgt) const
|
||||
{
|
||||
if (statement_)
|
||||
statement_->emit_proc(o, tgt);
|
||||
}
|
||||
|
||||
void NetWhile::emit_proc_recurse(ostream&o, struct target_t*tgt) const
|
||||
{
|
||||
proc_->emit_proc(o, tgt);
|
||||
|
|
@ -273,6 +295,10 @@ void emit(ostream&o, const Design*des, const char*type)
|
|||
|
||||
/*
|
||||
* $Log: emit.cc,v $
|
||||
* Revision 1.14 1999/06/19 21:06:16 steve
|
||||
* Elaborate and supprort to vvm the forever
|
||||
* and repeat statements.
|
||||
*
|
||||
* Revision 1.13 1999/06/09 03:00:06 steve
|
||||
* Add support for procedural concatenation expression.
|
||||
*
|
||||
|
|
|
|||
32
netlist.cc
32
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.37 1999/06/13 23:51:16 steve Exp $"
|
||||
#ident "$Id: netlist.cc,v 1.38 1999/06/19 21:06:16 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <cassert>
|
||||
|
|
@ -733,6 +733,16 @@ NetEUnary* NetEUnary::dup_expr() const
|
|||
assert(0);
|
||||
}
|
||||
|
||||
NetForever::NetForever(NetProc*p)
|
||||
: statement_(p)
|
||||
{
|
||||
}
|
||||
|
||||
NetForever::~NetForever()
|
||||
{
|
||||
delete statement_;
|
||||
}
|
||||
|
||||
NetLogic::NetLogic(const string&n, unsigned pins, TYPE t)
|
||||
: NetNode(n, pins), type_(t)
|
||||
{
|
||||
|
|
@ -741,6 +751,22 @@ NetLogic::NetLogic(const string&n, unsigned pins, TYPE t)
|
|||
pin(idx).set_dir(Link::INPUT);
|
||||
}
|
||||
|
||||
NetRepeat::NetRepeat(NetExpr*e, NetProc*p)
|
||||
: expr_(e), statement_(p)
|
||||
{
|
||||
}
|
||||
|
||||
NetRepeat::~NetRepeat()
|
||||
{
|
||||
delete expr_;
|
||||
delete statement_;
|
||||
}
|
||||
|
||||
const NetExpr* NetRepeat::expr() const
|
||||
{
|
||||
return expr_;
|
||||
}
|
||||
|
||||
NetUDP::NetUDP(const string&n, unsigned pins, bool sequ)
|
||||
: NetNode(n, pins), sequential_(sequ), init_('x')
|
||||
{
|
||||
|
|
@ -1202,6 +1228,10 @@ NetNet* Design::find_signal(bool (*func)(const NetNet*))
|
|||
|
||||
/*
|
||||
* $Log: netlist.cc,v $
|
||||
* Revision 1.38 1999/06/19 21:06:16 steve
|
||||
* Elaborate and supprort to vvm the forever
|
||||
* and repeat statements.
|
||||
*
|
||||
* Revision 1.37 1999/06/13 23:51:16 steve
|
||||
* l-value part select for procedural assignments.
|
||||
*
|
||||
|
|
|
|||
45
netlist.h
45
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.40 1999/06/13 23:51:16 steve Exp $"
|
||||
#ident "$Id: netlist.h,v 1.41 1999/06/19 21:06:16 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -728,6 +728,25 @@ class NetCondit : public NetProc {
|
|||
NetProc*else_;
|
||||
};
|
||||
|
||||
/*
|
||||
* A forever statement is executed over and over again forever. Or
|
||||
* until its block is disabled.
|
||||
*/
|
||||
class NetForever : public NetProc {
|
||||
|
||||
public:
|
||||
explicit NetForever(NetProc*s);
|
||||
~NetForever();
|
||||
|
||||
void emit_recurse(ostream&, struct target_t*) const;
|
||||
|
||||
virtual void emit_proc(ostream&, struct target_t*) const;
|
||||
virtual void dump(ostream&, unsigned ind) const;
|
||||
|
||||
private:
|
||||
NetProc*statement_;
|
||||
};
|
||||
|
||||
class NetPDelay : public NetProc {
|
||||
|
||||
public:
|
||||
|
|
@ -800,6 +819,26 @@ class NetNEvent : public NetNode, public sref<NetPEvent,NetNEvent> {
|
|||
};
|
||||
|
||||
|
||||
/*
|
||||
* A repeat statement is executed some fixed number of times.
|
||||
*/
|
||||
class NetRepeat : public NetProc {
|
||||
|
||||
public:
|
||||
explicit NetRepeat(NetExpr*e, NetProc*s);
|
||||
~NetRepeat();
|
||||
|
||||
const NetExpr*expr() const;
|
||||
void emit_recurse(ostream&, struct target_t*) const;
|
||||
|
||||
virtual void emit_proc(ostream&, struct target_t*) const;
|
||||
virtual void dump(ostream&, unsigned ind) const;
|
||||
|
||||
private:
|
||||
NetExpr*expr_;
|
||||
NetProc*statement_;
|
||||
};
|
||||
|
||||
/* The elaborator should expand all the user defined tasks in line, so
|
||||
this leaves the NetTask to represent activations of system tasks,
|
||||
or external tasks that are not known at compile time. */
|
||||
|
|
@ -1252,6 +1291,10 @@ extern ostream& operator << (ostream&, NetNet::Type);
|
|||
|
||||
/*
|
||||
* $Log: netlist.h,v $
|
||||
* Revision 1.41 1999/06/19 21:06:16 steve
|
||||
* Elaborate and supprort to vvm the forever
|
||||
* and repeat statements.
|
||||
*
|
||||
* Revision 1.40 1999/06/13 23:51:16 steve
|
||||
* l-value part select for procedural assignments.
|
||||
*
|
||||
|
|
|
|||
17
parse.y
17
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.45 1999/06/19 03:21:21 steve Exp $"
|
||||
#ident "$Id: parse.y,v 1.46 1999/06/19 21:06:16 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "parse_misc.h"
|
||||
|
|
@ -1268,9 +1268,10 @@ statement
|
|||
$$ = 0;
|
||||
}
|
||||
| K_forever statement
|
||||
{ yyerror(@1, "Sorry, forever statements not supported.");
|
||||
delete $2;
|
||||
$$ = 0;
|
||||
{ PForever*tmp = new PForever($2);
|
||||
tmp->set_file(@1.text);
|
||||
tmp->set_lineno(@1.first_line);
|
||||
$$ = tmp;
|
||||
}
|
||||
| K_fork statement_list K_join
|
||||
{ $$ = pform_make_block(PBlock::BL_PAR, $2); }
|
||||
|
|
@ -1279,10 +1280,10 @@ statement
|
|||
$$ = 0;
|
||||
}
|
||||
| K_repeat '(' expression ')' statement
|
||||
{ yyerror(@1, "Sorry, repeat statements not supported.");
|
||||
delete $3;
|
||||
delete $5;
|
||||
$$ = 0;
|
||||
{ PRepeat*tmp = new PRepeat($3, $5);
|
||||
tmp->set_file(@1.text);
|
||||
tmp->set_lineno(@1.first_line);
|
||||
$$ = tmp;
|
||||
}
|
||||
| K_begin K_end
|
||||
{ $$ = pform_make_block(PBlock::BL_SEQ, 0); }
|
||||
|
|
|
|||
|
|
@ -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.23 1999/06/17 05:34:42 steve Exp $"
|
||||
#ident "$Id: pform_dump.cc,v 1.24 1999/06/19 21:06:16 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -375,6 +375,12 @@ void PEventStatement::dump(ostream&out, unsigned ind) const
|
|||
}
|
||||
}
|
||||
|
||||
void PForever::dump(ostream&out, unsigned ind) const
|
||||
{
|
||||
out << setw(ind) << "" << "forever /* " << get_line() << " */" << endl;
|
||||
statement_->dump(out, ind+3);
|
||||
}
|
||||
|
||||
void PForStatement::dump(ostream&out, unsigned ind) const
|
||||
{
|
||||
out << setw(ind) << "" << "for (" << *name1_ << " = " << *expr1_
|
||||
|
|
@ -383,6 +389,12 @@ void PForStatement::dump(ostream&out, unsigned ind) const
|
|||
statement_->dump(out, ind+3);
|
||||
}
|
||||
|
||||
void PRepeat::dump(ostream&out, unsigned ind) const
|
||||
{
|
||||
out << setw(ind) << "" << "repeat (" << *expr_ << ")" << endl;
|
||||
statement_->dump(out, ind+3);
|
||||
}
|
||||
|
||||
void PWhile::dump(ostream&out, unsigned ind) const
|
||||
{
|
||||
out << setw(ind) << "" << "while (" << *cond_ << ")" << endl;
|
||||
|
|
@ -489,6 +501,10 @@ void PUdp::dump(ostream&out) const
|
|||
|
||||
/*
|
||||
* $Log: pform_dump.cc,v $
|
||||
* Revision 1.24 1999/06/19 21:06:16 steve
|
||||
* Elaborate and supprort to vvm the forever
|
||||
* and repeat statements.
|
||||
*
|
||||
* Revision 1.23 1999/06/17 05:34:42 steve
|
||||
* Clean up interface of the PWire class,
|
||||
* Properly match wire ranges.
|
||||
|
|
@ -553,46 +569,5 @@ void PUdp::dump(ostream&out) const
|
|||
* Elaborate prints errors about port vector
|
||||
* width mismatch
|
||||
* Emit better handles null statements.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Revision 1.5 1998/11/23 00:20:23 steve
|
||||
* NetAssign handles lvalues as pin links
|
||||
* instead of a signal pointer,
|
||||
* Wire attributes added,
|
||||
* Ability to parse UDP descriptions added,
|
||||
* XNF generates EXT records for signals with
|
||||
* the PAD attribute.
|
||||
*
|
||||
* Revision 1.4 1998/11/11 03:13:04 steve
|
||||
* Handle while loops.
|
||||
*
|
||||
* Revision 1.3 1998/11/09 18:55:34 steve
|
||||
* Add procedural while loops,
|
||||
* Parse procedural for loops,
|
||||
* Add procedural wait statements,
|
||||
* Add constant nodes,
|
||||
* Add XNOR logic gate,
|
||||
* Make vvm output look a bit prettier.
|
||||
*
|
||||
* Revision 1.2 1998/11/07 17:05:06 steve
|
||||
* Handle procedural conditional, and some
|
||||
* of the conditional expressions.
|
||||
*
|
||||
* Elaborate signals and identifiers differently,
|
||||
* allowing the netlist to hold signal information.
|
||||
*
|
||||
* Revision 1.1 1998/11/03 23:29:04 steve
|
||||
* Introduce verilog to CVS.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
|||
|
|
@ -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.2 1999/06/06 20:33:30 steve Exp $"
|
||||
#ident "$Id: t-null.cc,v 1.3 1999/06/19 21:06:16 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "netlist.h"
|
||||
|
|
@ -35,12 +35,18 @@ static class target_null_t : public target_t {
|
|||
void net_event(ostream&, const NetNEvent*) { }
|
||||
void proc_delay(ostream&, const NetPDelay*) { }
|
||||
void proc_event(ostream&, const NetPEvent*) { }
|
||||
void proc_forever(ostream&, const NetForever*) { }
|
||||
void proc_repeat(ostream&, const NetRepeat*) { }
|
||||
|
||||
} target_null_obj;
|
||||
|
||||
extern const struct target tgt_null = { "null", &target_null_obj };
|
||||
/*
|
||||
* $Log: t-null.cc,v $
|
||||
* Revision 1.3 1999/06/19 21:06:16 steve
|
||||
* Elaborate and supprort to vvm the forever
|
||||
* and repeat statements.
|
||||
*
|
||||
* Revision 1.2 1999/06/06 20:33:30 steve
|
||||
* implement some null-target code generation.
|
||||
*
|
||||
|
|
|
|||
63
t-vvm.cc
63
t-vvm.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: t-vvm.cc,v 1.24 1999/06/10 04:03:43 steve Exp $"
|
||||
#ident "$Id: t-vvm.cc,v 1.25 1999/06/19 21:06:16 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <iostream>
|
||||
|
|
@ -56,6 +56,8 @@ class target_vvm : public target_t {
|
|||
virtual void proc_block(ostream&os, const NetBlock*);
|
||||
virtual void proc_case(ostream&os, const NetCase*net);
|
||||
virtual void proc_condit(ostream&os, const NetCondit*);
|
||||
virtual void proc_forever(ostream&os, const NetForever*);
|
||||
virtual void proc_repeat(ostream&os, const NetRepeat*);
|
||||
virtual void proc_task(ostream&os, const NetTask*);
|
||||
virtual void proc_while(ostream&os, const NetWhile*);
|
||||
virtual void proc_event(ostream&os, const NetPEvent*);
|
||||
|
|
@ -973,6 +975,61 @@ void target_vvm::proc_condit(ostream&os, const NetCondit*net)
|
|||
os << " {" << endl;
|
||||
}
|
||||
|
||||
/*
|
||||
* The forever loop is implemented by starting a basic block, handing
|
||||
* the statement, and putting in a goto to the beginning of the block.
|
||||
*/
|
||||
void target_vvm::proc_forever(ostream&os, const NetForever*net)
|
||||
{
|
||||
unsigned top_step = ++thread_step_;
|
||||
unsigned out_step = ++thread_step_;
|
||||
|
||||
os << " step_ = &step_" << top_step << "_;" << endl;
|
||||
os << " return true;" << endl;
|
||||
os << " }" << endl;
|
||||
os << " bool step_" << top_step << "_()" << endl;
|
||||
os << " {" << endl;
|
||||
net->emit_recurse(os, this);
|
||||
os << " step_ = &step_" << top_step << "_;" << endl;
|
||||
os << " return true;" << endl;
|
||||
os << " }" << endl;
|
||||
|
||||
os << " bool step_" << out_step << "_()" << endl;
|
||||
os << " {" << endl;
|
||||
}
|
||||
|
||||
void target_vvm::proc_repeat(ostream&os, const NetRepeat*net)
|
||||
{
|
||||
string expr = emit_proc_rval(os, 8, net->expr());
|
||||
unsigned top_step = ++thread_step_;
|
||||
unsigned out_step = ++thread_step_;
|
||||
|
||||
os << " step_" << top_step << "_idx_ = " << expr <<
|
||||
".as_unsigned();" << endl;
|
||||
os << " step_ = &step_" << top_step << "_;" << endl;
|
||||
os << " return true;" << endl;
|
||||
os << " }" << endl;
|
||||
|
||||
os << " unsigned step_" << top_step << "_idx_;" << endl;
|
||||
|
||||
os << " bool step_" << top_step << "_()" << endl;
|
||||
os << " {" << endl;
|
||||
os << " if (step_" << top_step << "_idx_ == 0) {" << endl;
|
||||
os << " step_ = &step_" << out_step << "_;" << endl;
|
||||
os << " return true;" << endl;
|
||||
os << " }" << endl;
|
||||
os << " step_" << top_step << "_idx_ -= 1;" << endl;
|
||||
|
||||
net->emit_recurse(os,this);
|
||||
|
||||
os << " step_ = &step_" << top_step << "_;" << endl;
|
||||
os << " return true;" << endl;
|
||||
os << " }" << endl;
|
||||
|
||||
os << " bool step_" << out_step << "_()" << endl;
|
||||
os << " {" << endl;
|
||||
}
|
||||
|
||||
void target_vvm::proc_task(ostream&os, const NetTask*net)
|
||||
{
|
||||
if (net->name()[0] == '$') {
|
||||
|
|
@ -1136,6 +1193,10 @@ extern const struct target tgt_vvm = {
|
|||
};
|
||||
/*
|
||||
* $Log: t-vvm.cc,v $
|
||||
* Revision 1.25 1999/06/19 21:06:16 steve
|
||||
* Elaborate and supprort to vvm the forever
|
||||
* and repeat statements.
|
||||
*
|
||||
* Revision 1.24 1999/06/10 04:03:43 steve
|
||||
* Do not bother trying to print lvalue name in comment.
|
||||
*
|
||||
|
|
|
|||
18
target.cc
18
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.11 1999/06/09 03:00:06 steve Exp $"
|
||||
#ident "$Id: target.cc,v 1.12 1999/06/19 21:06:16 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "target.h"
|
||||
|
|
@ -135,6 +135,18 @@ void target_t::proc_event(ostream&os, const NetPEvent*)
|
|||
"Unhandled proc_event." << endl;
|
||||
}
|
||||
|
||||
void target_t::proc_forever(ostream&os, const NetForever*)
|
||||
{
|
||||
cerr << "target (" << typeid(*this).name() << "): "
|
||||
"Unhandled proc_forever." << endl;
|
||||
}
|
||||
|
||||
void target_t::proc_repeat(ostream&os, const NetRepeat*)
|
||||
{
|
||||
cerr << "target (" << typeid(*this).name() << "): "
|
||||
"Unhandled proc_repeat." << endl;
|
||||
}
|
||||
|
||||
void target_t::proc_task(ostream&os, const NetTask*)
|
||||
{
|
||||
}
|
||||
|
|
@ -208,6 +220,10 @@ void expr_scan_t::expr_binary(const NetEBinary*ex)
|
|||
|
||||
/*
|
||||
* $Log: target.cc,v $
|
||||
* Revision 1.12 1999/06/19 21:06:16 steve
|
||||
* Elaborate and supprort to vvm the forever
|
||||
* and repeat statements.
|
||||
*
|
||||
* Revision 1.11 1999/06/09 03:00:06 steve
|
||||
* Add support for procedural concatenation expression.
|
||||
*
|
||||
|
|
|
|||
8
target.h
8
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.11 1999/06/09 03:00:06 steve Exp $"
|
||||
#ident "$Id: target.h,v 1.12 1999/06/19 21:06:16 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "netlist.h"
|
||||
|
|
@ -81,6 +81,8 @@ struct target_t {
|
|||
virtual void proc_block(ostream&os, const NetBlock*);
|
||||
virtual void proc_case(ostream&os, const NetCase*);
|
||||
virtual void proc_condit(ostream&os, const NetCondit*);
|
||||
virtual void proc_forever(ostream&os, const NetForever*);
|
||||
virtual void proc_repeat(ostream&os, const NetRepeat*);
|
||||
virtual void proc_task(ostream&os, const NetTask*);
|
||||
virtual void proc_while(ostream&os, const NetWhile*);
|
||||
|
||||
|
|
@ -125,6 +127,10 @@ extern const struct target *target_table[];
|
|||
|
||||
/*
|
||||
* $Log: target.h,v $
|
||||
* Revision 1.12 1999/06/19 21:06:16 steve
|
||||
* Elaborate and supprort to vvm the forever
|
||||
* and repeat statements.
|
||||
*
|
||||
* Revision 1.11 1999/06/09 03:00:06 steve
|
||||
* Add support for procedural concatenation expression.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue