Mangle that handles device instance numbers.
This commit is contained in:
parent
3f4d5bf376
commit
9d0a266705
32
mangle.cc
32
mangle.cc
|
|
@ -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
|
||||
* 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
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: mangle.cc,v 1.1 1998/11/03 23:29:00 steve Exp $"
|
||||
#ident "$Id: mangle.cc,v 1.2 1999/02/15 05:52:50 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "target.h"
|
||||
|
|
@ -31,18 +31,31 @@ string mangle(const string&str)
|
|||
ostrstream res;
|
||||
string tmp = str;
|
||||
|
||||
res << "X";
|
||||
|
||||
for (;;) {
|
||||
size_t pos = tmp.find('.');
|
||||
while (tmp.length() > 0) {
|
||||
size_t pos = tmp.find_first_of(".<");
|
||||
if (pos > tmp.length())
|
||||
pos = tmp.length();
|
||||
|
||||
res << pos << tmp.substr(0, pos);
|
||||
res << "S" << pos << tmp.substr(0, pos);
|
||||
if (pos >= tmp.length())
|
||||
break;
|
||||
|
||||
tmp = tmp.substr(pos+1);
|
||||
tmp = tmp.substr(pos);
|
||||
switch (tmp[0]) {
|
||||
case '.':
|
||||
tmp = tmp.substr(1);
|
||||
break;
|
||||
case '<':
|
||||
tmp = tmp.substr(1);
|
||||
res << "_";
|
||||
while (tmp[0] != '>') {
|
||||
res << tmp[0];
|
||||
tmp = tmp.substr(1);
|
||||
}
|
||||
tmp = tmp.substr(1);
|
||||
res << "_";
|
||||
break;
|
||||
}
|
||||
}
|
||||
res << ends;
|
||||
return res.str();
|
||||
|
|
@ -50,6 +63,9 @@ string mangle(const string&str)
|
|||
|
||||
/*
|
||||
* $Log: mangle.cc,v $
|
||||
* Revision 1.2 1999/02/15 05:52:50 steve
|
||||
* Mangle that handles device instance numbers.
|
||||
*
|
||||
* Revision 1.1 1998/11/03 23:29:00 steve
|
||||
* Introduce verilog to CVS.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: vvm_gates.h,v 1.6 1999/01/31 18:15:55 steve Exp $"
|
||||
#ident "$Id: vvm_gates.h,v 1.7 1999/02/15 05:52:50 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "vvm.h"
|
||||
|
|
@ -90,6 +90,41 @@ template <unsigned WIDTH, unsigned long DELAY> class vvm_and {
|
|||
vvm_out_event::action_t output_;
|
||||
};
|
||||
|
||||
template <unsigned long DELAY> class vvm_bufif1 {
|
||||
|
||||
public:
|
||||
explicit vvm_bufif1(vvm_out_event::action_t o)
|
||||
: output_(o)
|
||||
{ input_[0] = Vx;
|
||||
input_[1] = Vx;
|
||||
}
|
||||
|
||||
void set(vvm_simulation*sim, unsigned idx, vvm_bit_t val)
|
||||
{ if (input_[idx-1] == val)
|
||||
return;
|
||||
input_[idx-1] = val;
|
||||
vvm_event*ev = new vvm_out_event(sim, compute_(), output_);
|
||||
if (DELAY > 0)
|
||||
sim->insert_event(DELAY, ev);
|
||||
else
|
||||
sim->active_event(ev);
|
||||
}
|
||||
|
||||
void start(vvm_simulation*sim)
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
vvm_bit_t input_[2];
|
||||
vvm_out_event::action_t output_;
|
||||
|
||||
vvm_bit_t compute_() const
|
||||
{ if (input_[1] != V1) return Vz;
|
||||
if (input_[0] == Vz) return Vx;
|
||||
return input_[0];
|
||||
}
|
||||
};
|
||||
|
||||
template <unsigned WIDTH, unsigned long DELAY> class vvm_nand {
|
||||
|
||||
public:
|
||||
|
|
@ -328,6 +363,9 @@ class vvm_pevent {
|
|||
|
||||
/*
|
||||
* $Log: vvm_gates.h,v $
|
||||
* Revision 1.7 1999/02/15 05:52:50 steve
|
||||
* Mangle that handles device instance numbers.
|
||||
*
|
||||
* Revision 1.6 1999/01/31 18:15:55 steve
|
||||
* Missing start methods.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue