Add .repeat functor and BIFIF functors.
This commit is contained in:
parent
e74127e1fc
commit
ca1bbc79a3
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (c) 2001 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* $Id: README.txt,v 1.56 2005/02/03 04:55:13 steve Exp $
|
||||
* $Id: README.txt,v 1.57 2005/02/07 22:42:42 steve Exp $
|
||||
*/
|
||||
|
||||
VVP SIMULATION ENGINE
|
||||
|
|
@ -483,6 +483,19 @@ propagated, the bits are placed in the correct place in the output
|
|||
vector value, and a new output value is propagated.
|
||||
|
||||
|
||||
REPEAT VECTOR STATEMENTS:
|
||||
|
||||
The repeat vector statement is similar to the concatenation statement,
|
||||
expect that the input is repeated a constant number of times. The
|
||||
format of the repeat vector statement is:
|
||||
|
||||
<label> .repeat <wid>, <rept count>, <symbol> ;
|
||||
|
||||
In this statement, the <wid> is a decimal number that is the width of
|
||||
the *output* vector. The <rept count> is the number of time the input
|
||||
vector value is repeated to make the output width. The input width is
|
||||
implicit from these numbers. The <symbol> is then the input source.
|
||||
|
||||
REDUCTION LOGIC
|
||||
|
||||
The reduction logic statements take in a single vector, and propagate
|
||||
|
|
|
|||
143
vvp/bufif.cc
143
vvp/bufif.cc
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2001 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2001-2005 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,90 +17,79 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: bufif.cc,v 1.9 2002/09/06 04:56:28 steve Exp $"
|
||||
#ident "$Id: bufif.cc,v 1.10 2005/02/07 22:42:42 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "bufif.h"
|
||||
# include "functor.h"
|
||||
# include "schedule.h"
|
||||
# include "statistics.h"
|
||||
# include <stdio.h>
|
||||
# include <assert.h>
|
||||
|
||||
vvp_bufif_s::vvp_bufif_s(bool en_invert, bool out_invert,
|
||||
unsigned str0, unsigned str1)
|
||||
vvp_fun_bufif::vvp_fun_bufif(bool en_invert, bool out_invert,
|
||||
unsigned str0, unsigned str1)
|
||||
: pol_(en_invert? 1 : 0), inv_(out_invert? 1 : 0)
|
||||
{
|
||||
odrive0 = str0;
|
||||
odrive1 = str1;
|
||||
drive0_ = str0;
|
||||
drive1_ = str1;
|
||||
count_functors_bufif += 1;
|
||||
}
|
||||
|
||||
void vvp_bufif_s::set(vvp_ipoint_t ptr, bool push, unsigned v, unsigned)
|
||||
void vvp_fun_bufif::recv_vec4(vvp_net_ptr_t ptr, vvp_vector4_t bit)
|
||||
{
|
||||
put(ptr, v);
|
||||
|
||||
unsigned in0 = ival & 0x03;
|
||||
unsigned in1 = (ival >> 2) & 0x03;
|
||||
|
||||
unsigned char out0 = 0x00 | (odrive0<<0) | (odrive0<<4);
|
||||
unsigned char out1 = 0x88 | (odrive1<<0) | (odrive1<<4);
|
||||
unsigned char outX = 0x80 | (odrive0<<0) | (odrive1<<4);
|
||||
unsigned char outH = 0x80 | (0) | (odrive1<<4);
|
||||
unsigned char outL = 0x80 | (odrive0<<0) | (0);
|
||||
|
||||
unsigned val;
|
||||
unsigned str;
|
||||
|
||||
switch (in1 ^ pol_) {
|
||||
|
||||
case 1:
|
||||
switch (in0 ^ inv_) {
|
||||
case 0:
|
||||
val = 0;
|
||||
str = out0;
|
||||
break;
|
||||
case 1:
|
||||
val = 1;
|
||||
str = out1;
|
||||
break;
|
||||
default:
|
||||
val = 2;
|
||||
str = outX;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
switch (ptr.port()) {
|
||||
case 0:
|
||||
val = 3;
|
||||
str = HiZ;
|
||||
bit_ = bit;
|
||||
break;
|
||||
case 1:
|
||||
en_ = pol_? ~bit : bit;
|
||||
break;
|
||||
|
||||
/* The control input is x or z, so the output is H or
|
||||
L, depending on the (possibly inverted) input. This
|
||||
is not the same as X, as it is a combination of the
|
||||
drive strength of the output and HiZ. */
|
||||
default:
|
||||
switch (in0 ^ inv_) {
|
||||
case 0:
|
||||
val = 2;
|
||||
str = outL;
|
||||
break;
|
||||
case 1:
|
||||
val = 2;
|
||||
str = outH;
|
||||
break;
|
||||
default:
|
||||
val = 2;
|
||||
str = outX;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
put_ostr(val, str, push);
|
||||
vvp_vector8_t out (bit.size());
|
||||
|
||||
for (unsigned idx = 0 ; idx < bit.size() ; idx += 1) {
|
||||
vvp_bit4_t b_en = en_.value(idx);
|
||||
vvp_bit4_t b_bit = bit_.value(idx);
|
||||
|
||||
switch (b_en) {
|
||||
case BIT4_0:
|
||||
out.set_bit(idx, vvp_scaler_t(BIT4_Z,drive0_,drive1_));
|
||||
break;
|
||||
case BIT4_1:
|
||||
if (bit4_is_xz(b_bit))
|
||||
out.set_bit(idx, vvp_scaler_t(BIT4_X,drive0_,drive1_));
|
||||
else
|
||||
out.set_bit(idx, vvp_scaler_t(b_bit,drive0_,drive1_));
|
||||
break;
|
||||
|
||||
default:
|
||||
switch (b_bit) {
|
||||
case BIT4_0:
|
||||
out.set_bit(idx, vvp_scaler_t(BIT4_X,drive0_,0));
|
||||
break;
|
||||
case BIT4_1:
|
||||
out.set_bit(idx, vvp_scaler_t(BIT4_X,0,drive1_));
|
||||
break;
|
||||
default:
|
||||
out.set_bit(idx, vvp_scaler_t(BIT4_X,drive0_,drive1_));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
vvp_send_vec8(ptr.ptr()->out, out);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* $Log: bufif.cc,v $
|
||||
* Revision 1.10 2005/02/07 22:42:42 steve
|
||||
* Add .repeat functor and BIFIF functors.
|
||||
*
|
||||
* Revision 1.9 2002/09/06 04:56:28 steve
|
||||
* Add support for %v is the display system task.
|
||||
* Change the encoding of H and L outputs from
|
||||
|
|
@ -108,31 +97,5 @@ void vvp_bufif_s::set(vvp_ipoint_t ptr, bool push, unsigned v, unsigned)
|
|||
*
|
||||
* Revision 1.8 2002/08/12 01:35:07 steve
|
||||
* conditional ident string using autoconfig.
|
||||
*
|
||||
* Revision 1.7 2002/07/05 20:08:44 steve
|
||||
* Count different types of functors.
|
||||
*
|
||||
* Revision 1.6 2001/12/19 23:43:03 steve
|
||||
* clarify bufif output strenghts.
|
||||
*
|
||||
* Revision 1.5 2001/12/14 06:03:17 steve
|
||||
* Arrange bufif to support notif as well.
|
||||
*
|
||||
* Revision 1.4 2001/12/06 03:31:24 steve
|
||||
* Support functor delays for gates and UDP devices.
|
||||
* (Stephan Boettcher)
|
||||
*
|
||||
* Revision 1.3 2001/11/07 03:34:42 steve
|
||||
* Use functor pointers where vvp_ipoint_t is unneeded.
|
||||
*
|
||||
* Revision 1.2 2001/10/31 04:27:46 steve
|
||||
* Rewrite the functor type to have fewer functor modes,
|
||||
* and use objects to manage the different types.
|
||||
* (Stephan Boettcher)
|
||||
*
|
||||
* Revision 1.1 2001/05/31 04:12:43 steve
|
||||
* Make the bufif0 and bufif1 gates strength aware,
|
||||
* and accurately propagate strengths of outputs.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
|||
31
vvp/bufif.h
31
vvp/bufif.h
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef __bufif_H
|
||||
#define __bufif_H
|
||||
/*
|
||||
* Copyright (c) 2001 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2001-2005 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
|
||||
|
|
@ -19,26 +19,43 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: bufif.h,v 1.6 2002/09/06 04:56:29 steve Exp $"
|
||||
#ident "$Id: bufif.h,v 1.7 2005/02/07 22:42:42 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "functor.h"
|
||||
# include "vvp_net.h"
|
||||
|
||||
class vvp_bufif_s : public functor_s {
|
||||
/*
|
||||
* The vvp_fun_bufif functor implements the logic of bufif0/1 and
|
||||
* notif0/1 gates. Input 0 is the value to be buffered, and input 1 is
|
||||
* the enable. The gate processes vectors as bit slices handled by an
|
||||
* array of gates.
|
||||
*
|
||||
* The output from the gate is a vvp_vector8_t. The gate adds
|
||||
* strengths to the buffered value, and sends H/L in response to
|
||||
* unknown enable bits.
|
||||
*/
|
||||
class vvp_fun_bufif : public vvp_net_fun_t {
|
||||
|
||||
public:
|
||||
vvp_bufif_s(bool en_invert, bool out_invert,
|
||||
unsigned str0, unsigned str1);
|
||||
vvp_fun_bufif(bool en_invert, bool out_invert,
|
||||
unsigned str0, unsigned str1);
|
||||
|
||||
virtual void set(vvp_ipoint_t i, bool push, unsigned val, unsigned str);
|
||||
void recv_vec4(vvp_net_ptr_t port, vvp_vector4_t bit);
|
||||
|
||||
private:
|
||||
vvp_vector4_t bit_;
|
||||
vvp_vector4_t en_;
|
||||
unsigned pol_ : 1;
|
||||
unsigned inv_ : 1;
|
||||
unsigned drive0_ : 8;
|
||||
unsigned drive1_ : 8;
|
||||
};
|
||||
|
||||
/*
|
||||
* $Log: bufif.h,v $
|
||||
* Revision 1.7 2005/02/07 22:42:42 steve
|
||||
* Add .repeat functor and BIFIF functors.
|
||||
*
|
||||
* Revision 1.6 2002/09/06 04:56:29 steve
|
||||
* Add support for %v is the display system task.
|
||||
* Change the encoding of H and L outputs from
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: compile.h,v 1.61 2005/02/03 04:55:13 steve Exp $"
|
||||
#ident "$Id: compile.h,v 1.62 2005/02/07 22:42:42 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <stdio.h>
|
||||
|
|
@ -141,6 +141,9 @@ extern void compile_reduce_nand(char*label, struct symb_s arg);
|
|||
extern void compile_reduce_nor(char*label, struct symb_s arg);
|
||||
extern void compile_reduce_xnor(char*label, struct symb_s arg);
|
||||
|
||||
extern void compile_repeat(char*label, long width, long repeat,
|
||||
struct symb_s arg);
|
||||
|
||||
extern void compile_shiftl(char*label, long width,
|
||||
unsigned argc, struct symb_s*argv);
|
||||
extern void compile_shiftr(char*label, long width,
|
||||
|
|
@ -294,6 +297,9 @@ extern void compile_net(char*label, char*name,
|
|||
|
||||
/*
|
||||
* $Log: compile.h,v $
|
||||
* Revision 1.62 2005/02/07 22:42:42 steve
|
||||
* Add .repeat functor and BIFIF functors.
|
||||
*
|
||||
* Revision 1.61 2005/02/03 04:55:13 steve
|
||||
* Add support for reduction logic gates.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ident "$Id: concat.cc,v 1.1 2005/01/22 00:01:09 steve Exp $"
|
||||
#ident "$Id: concat.cc,v 1.2 2005/02/07 22:42:42 steve Exp $"
|
||||
|
||||
# include "compile.h"
|
||||
# include "vvp_net.h"
|
||||
|
|
@ -81,9 +81,51 @@ void compile_concat(char*label, unsigned w0, unsigned w1,
|
|||
inputs_connect(net, argc, argv);
|
||||
}
|
||||
|
||||
vvp_fun_repeat::vvp_fun_repeat(unsigned width, unsigned repeat)
|
||||
: wid_(width), rep_(repeat)
|
||||
{
|
||||
}
|
||||
|
||||
vvp_fun_repeat::~vvp_fun_repeat()
|
||||
{
|
||||
}
|
||||
|
||||
void vvp_fun_repeat::recv_vec4(vvp_net_ptr_t port, vvp_vector4_t bit)
|
||||
{
|
||||
assert(bit.size() == wid_/rep_);
|
||||
|
||||
vvp_vector4_t val (wid_);
|
||||
|
||||
for (unsigned rdx = 0 ; rdx < rep_ ; rdx += 1) {
|
||||
unsigned off = rdx * bit.size();
|
||||
|
||||
for (unsigned idx = 0 ; idx < bit.size() ; idx += 1)
|
||||
val.set_bit(off+idx, bit.value(idx));
|
||||
|
||||
}
|
||||
|
||||
vvp_send_vec4(port.ptr()->out, val);
|
||||
}
|
||||
|
||||
void compile_repeat(char*label, long width, long repeat, struct symb_s arg)
|
||||
{
|
||||
vvp_fun_repeat*fun = new vvp_fun_repeat(width, repeat);
|
||||
|
||||
vvp_net_t*net = new vvp_net_t;
|
||||
net->fun = fun;
|
||||
|
||||
define_functor_symbol(label, net);
|
||||
free(label);
|
||||
|
||||
input_connect(net, 0, arg.text);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* $Log: concat.cc,v $
|
||||
* Revision 1.2 2005/02/07 22:42:42 steve
|
||||
* Add .repeat functor and BIFIF functors.
|
||||
*
|
||||
* Revision 1.1 2005/01/22 00:01:09 steve
|
||||
* Add missing concat.cc to cvs
|
||||
*
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: lexor.lex,v 1.48 2005/02/03 04:55:13 steve Exp $"
|
||||
#ident "$Id: lexor.lex,v 1.49 2005/02/07 22:42:42 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "parse_misc.h"
|
||||
|
|
@ -111,6 +111,7 @@
|
|||
".reduce/nand" { return K_REDUCE_NAND; }
|
||||
".reduce/nor" { return K_REDUCE_NOR; }
|
||||
".reduce/xnor" { return K_REDUCE_XNOR; }
|
||||
".repeat" { return K_REPEAT; }
|
||||
".resolv" { return K_RESOLV; }
|
||||
".scope" { return K_SCOPE; }
|
||||
".shift/l" { return K_SHIFTL; }
|
||||
|
|
@ -192,6 +193,9 @@ int yywrap()
|
|||
|
||||
/*
|
||||
* $Log: lexor.lex,v $
|
||||
* Revision 1.49 2005/02/07 22:42:42 steve
|
||||
* Add .repeat functor and BIFIF functors.
|
||||
*
|
||||
* Revision 1.48 2005/02/03 04:55:13 steve
|
||||
* Add support for reduction logic gates.
|
||||
*
|
||||
|
|
|
|||
13
vvp/logic.cc
13
vvp/logic.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: logic.cc,v 1.17 2005/01/29 17:52:06 steve Exp $"
|
||||
#ident "$Id: logic.cc,v 1.18 2005/02/07 22:42:42 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "logic.h"
|
||||
|
|
@ -168,13 +168,13 @@ void compile_functor(char*label, char*type,
|
|||
|
||||
} else if (strcmp(type, "BUF") == 0) {
|
||||
obj = new vvp_fun_buf();
|
||||
#if 0
|
||||
|
||||
} else if (strcmp(type, "BUFIF0") == 0) {
|
||||
obj = new vvp_bufif_s(true,false, ostr0, ostr1);
|
||||
obj = new vvp_fun_bufif(true,false, ostr0, ostr1);
|
||||
|
||||
} else if (strcmp(type, "BUFIF1") == 0) {
|
||||
obj = new vvp_bufif_s(false,false, ostr0, ostr1);
|
||||
#endif
|
||||
obj = new vvp_fun_bufif(false,false, ostr0, ostr1);
|
||||
|
||||
} else if (strcmp(type, "BUFZ") == 0) {
|
||||
obj = new vvp_fun_bufz();
|
||||
#if 0
|
||||
|
|
@ -244,6 +244,9 @@ void compile_functor(char*label, char*type,
|
|||
|
||||
/*
|
||||
* $Log: logic.cc,v $
|
||||
* Revision 1.18 2005/02/07 22:42:42 steve
|
||||
* Add .repeat functor and BIFIF functors.
|
||||
*
|
||||
* Revision 1.17 2005/01/29 17:52:06 steve
|
||||
* move AND to buitin instead of table.
|
||||
*
|
||||
|
|
|
|||
10
vvp/parse.y
10
vvp/parse.y
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: parse.y,v 1.65 2005/02/03 04:55:13 steve Exp $"
|
||||
#ident "$Id: parse.y,v 1.66 2005/02/07 22:42:42 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "parse_misc.h"
|
||||
|
|
@ -63,7 +63,7 @@ extern FILE*yyin;
|
|||
%token K_CONCAT
|
||||
%token K_EVENT K_EVENT_OR K_FUNCTOR K_NET K_NET_S K_PARAM K_PART K_PART_PV
|
||||
%token K_REDUCE_AND K_REDUCE_OR K_REDUCE_XOR
|
||||
%token K_REDUCE_NAND K_REDUCE_NOR K_REDUCE_XNOR
|
||||
%token K_REDUCE_NAND K_REDUCE_NOR K_REDUCE_XNOR K_REPEAT
|
||||
%token K_RESOLV K_SCOPE K_SHIFTL K_SHIFTR K_THREAD K_TIMESCALE K_UFUNC
|
||||
%token K_UDP K_UDP_C K_UDP_S
|
||||
%token K_MEM K_MEM_P K_MEM_I
|
||||
|
|
@ -290,6 +290,9 @@ statement
|
|||
| T_LABEL K_REDUCE_XNOR symbol ';'
|
||||
{ compile_reduce_xnor($1, $3); }
|
||||
|
||||
| T_LABEL K_REPEAT T_NUMBER ',' T_NUMBER ',' symbol ';'
|
||||
{ compile_repeat($1, $3, $5, $7); }
|
||||
|
||||
| T_LABEL K_SHIFTL T_NUMBER ',' symbols ';'
|
||||
{ struct symbv_s obj = $5;
|
||||
compile_shiftl($1, $3, obj.cnt, obj.vect);
|
||||
|
|
@ -669,6 +672,9 @@ int compile_design(const char*path)
|
|||
|
||||
/*
|
||||
* $Log: parse.y,v $
|
||||
* Revision 1.66 2005/02/07 22:42:42 steve
|
||||
* Add .repeat functor and BIFIF functors.
|
||||
*
|
||||
* Revision 1.65 2005/02/03 04:55:13 steve
|
||||
* Add support for reduction logic gates.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ident "$Id: vvp_net.cc,v 1.13 2005/02/04 05:13:02 steve Exp $"
|
||||
#ident "$Id: vvp_net.cc,v 1.14 2005/02/07 22:42:42 steve Exp $"
|
||||
|
||||
# include "vvp_net.h"
|
||||
# include <stdio.h>
|
||||
|
|
@ -744,7 +744,7 @@ vvp_bit4_t vvp_fun_signal::value(unsigned idx) const
|
|||
* STRONG = 6,
|
||||
* SUPPLY = 7
|
||||
*
|
||||
* The vvp_signal_t value, however, is a combination of value and
|
||||
* The vvp_scaler_t value, however, is a combination of value and
|
||||
* strength, used in strength-aware contexts.
|
||||
*
|
||||
* OUTPUT STRENGTHS:
|
||||
|
|
@ -786,6 +786,27 @@ vvp_scaler_t::vvp_scaler_t(vvp_bit4_t val, unsigned str)
|
|||
}
|
||||
}
|
||||
|
||||
vvp_scaler_t::vvp_scaler_t(vvp_bit4_t val, unsigned str0, unsigned str1)
|
||||
{
|
||||
assert(str0 <= 7);
|
||||
assert(str1 <= 7);
|
||||
|
||||
switch (val) {
|
||||
case BIT4_0:
|
||||
value_ = str0 | (str0<<4);
|
||||
break;
|
||||
case BIT4_1:
|
||||
value_ = str1 | (str1<<4) | 0x88;
|
||||
break;
|
||||
case BIT4_X:
|
||||
value_ = str0 | (str1<<4) | 0x80;
|
||||
break;
|
||||
case BIT4_Z:
|
||||
value_ = 0x00;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
vvp_scaler_t::vvp_scaler_t()
|
||||
{
|
||||
value_ = 0;
|
||||
|
|
@ -988,6 +1009,15 @@ vvp_bit4_t compare_gtge(const vvp_vector4_t&lef, const vvp_vector4_t&rig,
|
|||
return out_if_equal;
|
||||
}
|
||||
|
||||
vvp_vector4_t operator ~ (const vvp_vector4_t&that)
|
||||
{
|
||||
vvp_vector4_t res (that.size());
|
||||
for (unsigned idx = 0 ; idx < res.size() ; idx += 1)
|
||||
res.set_bit(idx, ~ that.value(idx));
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
vvp_bit4_t compare_gtge_signed(const vvp_vector4_t&a,
|
||||
const vvp_vector4_t&b,
|
||||
vvp_bit4_t out_if_equal)
|
||||
|
|
@ -1032,6 +1062,9 @@ vvp_bit4_t compare_gtge_signed(const vvp_vector4_t&a,
|
|||
|
||||
/*
|
||||
* $Log: vvp_net.cc,v $
|
||||
* Revision 1.14 2005/02/07 22:42:42 steve
|
||||
* Add .repeat functor and BIFIF functors.
|
||||
*
|
||||
* Revision 1.13 2005/02/04 05:13:02 steve
|
||||
* Add wide .arith/mult, and vvp_vector2_t vectors.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ident "$Id: vvp_net.h,v 1.13 2005/02/04 05:13:02 steve Exp $"
|
||||
#ident "$Id: vvp_net.h,v 1.14 2005/02/07 22:42:42 steve Exp $"
|
||||
|
||||
# include <assert.h>
|
||||
|
||||
|
|
@ -93,6 +93,8 @@ class vvp_vector4_t {
|
|||
};
|
||||
};
|
||||
|
||||
extern vvp_vector4_t operator ~ (const vvp_vector4_t&that);
|
||||
|
||||
extern vvp_bit4_t compare_gtge(const vvp_vector4_t&a,
|
||||
const vvp_vector4_t&b,
|
||||
vvp_bit4_t val_if_equal);
|
||||
|
|
@ -164,6 +166,7 @@ class vvp_scaler_t {
|
|||
|
||||
// Make an unambiguous value.
|
||||
explicit vvp_scaler_t(vvp_bit4_t val, unsigned str);
|
||||
explicit vvp_scaler_t(vvp_bit4_t val, unsigned str0, unsigned str1);
|
||||
|
||||
// Get the vvp_bit4_t version of the value
|
||||
vvp_bit4_t value() const;
|
||||
|
|
@ -191,6 +194,9 @@ class vvp_vector8_t {
|
|||
explicit vvp_vector8_t(unsigned size =0);
|
||||
// Make a vvp_vector8_t from a vector4 and a specified strength.
|
||||
explicit vvp_vector8_t(const vvp_vector4_t&that, unsigned str);
|
||||
explicit vvp_vector8_t(const vvp_vector4_t&that,
|
||||
unsigned str0,
|
||||
unsigned str1);
|
||||
|
||||
~vvp_vector8_t();
|
||||
|
||||
|
|
@ -392,6 +398,25 @@ class vvp_fun_concat : public vvp_net_fun_t {
|
|||
vvp_vector4_t val_;
|
||||
};
|
||||
|
||||
/* vvp_fun_repeat
|
||||
* This node function create vectors by repeating the input. The width
|
||||
* is the width of the output vector, and the repeat is the number of
|
||||
* times to repeat the input. The width of the input vector is
|
||||
* implicit from these values.
|
||||
*/
|
||||
class vvp_fun_repeat : public vvp_net_fun_t {
|
||||
|
||||
public:
|
||||
vvp_fun_repeat(unsigned width, unsigned repeat);
|
||||
~vvp_fun_repeat();
|
||||
|
||||
void recv_vec4(vvp_net_ptr_t port, vvp_vector4_t bit);
|
||||
|
||||
private:
|
||||
unsigned wid_;
|
||||
unsigned rep_;
|
||||
};
|
||||
|
||||
/* vvp_fun_drive
|
||||
* This node function takes an input vvp_vector4_t as input, and
|
||||
* repeats that value as a vvp_vector8_t with all the bits given the
|
||||
|
|
@ -542,6 +567,9 @@ class vvp_fun_signal : public vvp_net_fun_t {
|
|||
|
||||
/*
|
||||
* $Log: vvp_net.h,v $
|
||||
* Revision 1.14 2005/02/07 22:42:42 steve
|
||||
* Add .repeat functor and BIFIF functors.
|
||||
*
|
||||
* Revision 1.13 2005/02/04 05:13:02 steve
|
||||
* Add wide .arith/mult, and vvp_vector2_t vectors.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue