Use new vvp_fun_XXX in place of old functor table for NAND/NOR/XNOR/EEQ.
This commit is contained in:
parent
a3da90aa4a
commit
4f8a7ea84a
|
|
@ -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
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_CVS_IDENT
|
#ifdef HAVE_CVS_IDENT
|
||||||
#ident "$Id: draw_tt.c,v 1.22 2005/09/19 21:45:09 steve Exp $"
|
#ident "$Id: draw_tt.c,v 1.23 2006/11/28 05:57:20 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
|
|
@ -57,7 +57,7 @@ static void draw_AND(void)
|
||||||
printf("};\n");
|
printf("};\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#if 0
|
||||||
static void draw_NAND(void)
|
static void draw_NAND(void)
|
||||||
{
|
{
|
||||||
unsigned i0, i1, i2, i3;
|
unsigned i0, i1, i2, i3;
|
||||||
|
|
@ -91,7 +91,7 @@ static void draw_NAND(void)
|
||||||
|
|
||||||
printf("};\n");
|
printf("};\n");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#if 0
|
#if 0
|
||||||
static void draw_BUF(void)
|
static void draw_BUF(void)
|
||||||
{
|
{
|
||||||
|
|
@ -373,7 +373,7 @@ static void draw_MUXZ(void)
|
||||||
printf("};\n");
|
printf("};\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#if 0
|
||||||
static void draw_EEQ(void)
|
static void draw_EEQ(void)
|
||||||
{
|
{
|
||||||
unsigned i0, i1, i2, i3;
|
unsigned i0, i1, i2, i3;
|
||||||
|
|
@ -405,7 +405,8 @@ static void draw_EEQ(void)
|
||||||
|
|
||||||
printf("};\n");
|
printf("};\n");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#if 0
|
||||||
static void draw_NOR(void)
|
static void draw_NOR(void)
|
||||||
{
|
{
|
||||||
unsigned i0, i1, i2, i3;
|
unsigned i0, i1, i2, i3;
|
||||||
|
|
@ -439,7 +440,7 @@ static void draw_NOR(void)
|
||||||
|
|
||||||
printf("};\n");
|
printf("};\n");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#if 0
|
#if 0
|
||||||
static void draw_NOT(void)
|
static void draw_NOT(void)
|
||||||
{
|
{
|
||||||
|
|
@ -508,7 +509,7 @@ static void draw_OR(void)
|
||||||
printf("};\n");
|
printf("};\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#if 0
|
||||||
static void draw_XNOR(void)
|
static void draw_XNOR(void)
|
||||||
{
|
{
|
||||||
unsigned i0, i1, i2, i3;
|
unsigned i0, i1, i2, i3;
|
||||||
|
|
@ -540,7 +541,7 @@ static void draw_XNOR(void)
|
||||||
|
|
||||||
printf("};\n");
|
printf("};\n");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#if 0
|
#if 0
|
||||||
static void draw_XOR(void)
|
static void draw_XOR(void)
|
||||||
{
|
{
|
||||||
|
|
@ -750,12 +751,8 @@ main()
|
||||||
{
|
{
|
||||||
printf("# include \"logic.h\"\n");
|
printf("# include \"logic.h\"\n");
|
||||||
draw_MUXX();
|
draw_MUXX();
|
||||||
draw_EEQ();
|
|
||||||
draw_NAND();
|
|
||||||
draw_NOR();
|
|
||||||
draw_TRIAND();
|
draw_TRIAND();
|
||||||
draw_TRIOR();
|
draw_TRIOR();
|
||||||
draw_XNOR();
|
|
||||||
draw_hex_table();
|
draw_hex_table();
|
||||||
draw_oct_table();
|
draw_oct_table();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -763,6 +760,9 @@ main()
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: draw_tt.c,v $
|
* $Log: draw_tt.c,v $
|
||||||
|
* Revision 1.23 2006/11/28 05:57:20 steve
|
||||||
|
* Use new vvp_fun_XXX in place of old functor table for NAND/NOR/XNOR/EEQ.
|
||||||
|
*
|
||||||
* Revision 1.22 2005/09/19 21:45:09 steve
|
* Revision 1.22 2005/09/19 21:45:09 steve
|
||||||
* Use lazy eval of BUF/NOT/OR/XOR gates.
|
* Use lazy eval of BUF/NOT/OR/XOR gates.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
73
vvp/logic.cc
73
vvp/logic.cc
|
|
@ -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
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_CVS_IDENT
|
#ifdef HAVE_CVS_IDENT
|
||||||
#ident "$Id: logic.cc,v 1.36 2006/01/02 05:32:07 steve Exp $"
|
#ident "$Id: logic.cc,v 1.37 2006/11/28 05:57:20 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "logic.h"
|
# include "logic.h"
|
||||||
|
|
@ -104,8 +104,8 @@ void vvp_fun_boolean_::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vvp_fun_and::vvp_fun_and(unsigned wid)
|
vvp_fun_and::vvp_fun_and(unsigned wid, bool invert)
|
||||||
: vvp_fun_boolean_(wid)
|
: vvp_fun_boolean_(wid), invert_(invert)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -129,6 +129,8 @@ void vvp_fun_and::run_run()
|
||||||
}
|
}
|
||||||
|
|
||||||
bitbit = bitbit & input_[pdx].value(idx);
|
bitbit = bitbit & input_[pdx].value(idx);
|
||||||
|
if (invert_)
|
||||||
|
bitbit = ~bitbit;
|
||||||
}
|
}
|
||||||
|
|
||||||
result.set_bit(idx, bitbit);
|
result.set_bit(idx, bitbit);
|
||||||
|
|
@ -137,6 +139,34 @@ void vvp_fun_and::run_run()
|
||||||
vvp_send_vec4(ptr->out, result);
|
vvp_send_vec4(ptr->out, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vvp_fun_eeq::vvp_fun_eeq(unsigned wid, bool invert)
|
||||||
|
: vvp_fun_boolean_(wid), invert_(invert)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
vvp_fun_eeq::~vvp_fun_eeq()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void vvp_fun_eeq::run_run()
|
||||||
|
{
|
||||||
|
vvp_net_t*ptr = net_;
|
||||||
|
net_ = 0;
|
||||||
|
|
||||||
|
vvp_vector4_t result (input_[0]);
|
||||||
|
|
||||||
|
for (unsigned idx = 0 ; idx < result.size() ; idx += 1) {
|
||||||
|
vvp_bit4_t bitbit = result.value(idx);
|
||||||
|
bitbit = (bitbit == input_[1].value(idx))? BIT4_1 : BIT4_0;
|
||||||
|
if (invert_)
|
||||||
|
bitbit = ~bitbit;
|
||||||
|
|
||||||
|
result.set_bit(idx, bitbit);
|
||||||
|
}
|
||||||
|
|
||||||
|
vvp_send_vec4(ptr->out, result);
|
||||||
|
}
|
||||||
|
|
||||||
vvp_fun_buf::vvp_fun_buf()
|
vvp_fun_buf::vvp_fun_buf()
|
||||||
{
|
{
|
||||||
net_ = 0;
|
net_ = 0;
|
||||||
|
|
@ -400,8 +430,8 @@ void vvp_fun_not::run_run()
|
||||||
vvp_send_vec4(ptr->out, result);
|
vvp_send_vec4(ptr->out, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
vvp_fun_or::vvp_fun_or(unsigned wid)
|
vvp_fun_or::vvp_fun_or(unsigned wid, bool invert)
|
||||||
: vvp_fun_boolean_(wid)
|
: vvp_fun_boolean_(wid), invert_(invert)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -427,14 +457,16 @@ void vvp_fun_or::run_run()
|
||||||
bitbit = bitbit | input_[pdx].value(idx);
|
bitbit = bitbit | input_[pdx].value(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (invert_)
|
||||||
|
bitbit = ~bitbit;
|
||||||
result.set_bit(idx, bitbit);
|
result.set_bit(idx, bitbit);
|
||||||
}
|
}
|
||||||
|
|
||||||
vvp_send_vec4(ptr->out, result);
|
vvp_send_vec4(ptr->out, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
vvp_fun_xor::vvp_fun_xor(unsigned wid)
|
vvp_fun_xor::vvp_fun_xor(unsigned wid, bool invert)
|
||||||
: vvp_fun_boolean_(wid)
|
: vvp_fun_boolean_(wid), invert_(invert)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -460,6 +492,8 @@ void vvp_fun_xor::run_run()
|
||||||
bitbit = bitbit ^ input_[pdx].value(idx);
|
bitbit = bitbit ^ input_[pdx].value(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (invert_)
|
||||||
|
bitbit = ~bitbit;
|
||||||
result.set_bit(idx, bitbit);
|
result.set_bit(idx, bitbit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -480,10 +514,10 @@ void compile_functor(char*label, char*type, unsigned width,
|
||||||
bool strength_aware = false;
|
bool strength_aware = false;
|
||||||
|
|
||||||
if (strcmp(type, "OR") == 0) {
|
if (strcmp(type, "OR") == 0) {
|
||||||
obj = new vvp_fun_or(width);
|
obj = new vvp_fun_or(width, false);
|
||||||
|
|
||||||
} else if (strcmp(type, "AND") == 0) {
|
} else if (strcmp(type, "AND") == 0) {
|
||||||
obj = new vvp_fun_and(width);
|
obj = new vvp_fun_and(width, false);
|
||||||
|
|
||||||
} else if (strcmp(type, "BUF") == 0) {
|
} else if (strcmp(type, "BUF") == 0) {
|
||||||
obj = new vvp_fun_buf();
|
obj = new vvp_fun_buf();
|
||||||
|
|
@ -496,6 +530,12 @@ void compile_functor(char*label, char*type, unsigned width,
|
||||||
obj = new vvp_fun_bufif(false,false, ostr0, ostr1);
|
obj = new vvp_fun_bufif(false,false, ostr0, ostr1);
|
||||||
strength_aware = true;
|
strength_aware = true;
|
||||||
|
|
||||||
|
} else if (strcmp(type, "NAND") == 0) {
|
||||||
|
obj = new vvp_fun_and(width, true);
|
||||||
|
|
||||||
|
} else if (strcmp(type, "NOR") == 0) {
|
||||||
|
obj = new vvp_fun_or(width, true);
|
||||||
|
|
||||||
} else if (strcmp(type, "NOTIF0") == 0) {
|
} else if (strcmp(type, "NOTIF0") == 0) {
|
||||||
obj = new vvp_fun_bufif(true,true, ostr0, ostr1);
|
obj = new vvp_fun_bufif(true,true, ostr0, ostr1);
|
||||||
strength_aware = true;
|
strength_aware = true;
|
||||||
|
|
@ -529,22 +569,16 @@ void compile_functor(char*label, char*type, unsigned width,
|
||||||
obj = new vvp_fun_rpmos(false);
|
obj = new vvp_fun_rpmos(false);
|
||||||
|
|
||||||
} else if (strcmp(type, "EEQ") == 0) {
|
} else if (strcmp(type, "EEQ") == 0) {
|
||||||
obj = new table_functor_s(ft_EEQ);
|
obj = new vvp_fun_eeq(width, false);
|
||||||
|
|
||||||
} else if (strcmp(type, "NAND") == 0) {
|
|
||||||
obj = new table_functor_s(ft_NAND);
|
|
||||||
|
|
||||||
} else if (strcmp(type, "NOR") == 0) {
|
|
||||||
obj = new table_functor_s(ft_NOR);
|
|
||||||
|
|
||||||
} else if (strcmp(type, "NOT") == 0) {
|
} else if (strcmp(type, "NOT") == 0) {
|
||||||
obj = new vvp_fun_not();
|
obj = new vvp_fun_not();
|
||||||
|
|
||||||
} else if (strcmp(type, "XNOR") == 0) {
|
} else if (strcmp(type, "XNOR") == 0) {
|
||||||
obj = new table_functor_s(ft_XNOR);
|
obj = new vvp_fun_xor(width, true);
|
||||||
|
|
||||||
} else if (strcmp(type, "XOR") == 0) {
|
} else if (strcmp(type, "XOR") == 0) {
|
||||||
obj = new vvp_fun_xor(width);
|
obj = new vvp_fun_xor(width, false);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
yyerror("invalid functor type.");
|
yyerror("invalid functor type.");
|
||||||
|
|
@ -586,6 +620,9 @@ void compile_functor(char*label, char*type, unsigned width,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: logic.cc,v $
|
* $Log: logic.cc,v $
|
||||||
|
* Revision 1.37 2006/11/28 05:57:20 steve
|
||||||
|
* Use new vvp_fun_XXX in place of old functor table for NAND/NOR/XNOR/EEQ.
|
||||||
|
*
|
||||||
* Revision 1.36 2006/01/02 05:32:07 steve
|
* Revision 1.36 2006/01/02 05:32:07 steve
|
||||||
* Require explicit delay node from source.
|
* Require explicit delay node from source.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
28
vvp/logic.h
28
vvp/logic.h
|
|
@ -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
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_CVS_IDENT
|
#ifdef HAVE_CVS_IDENT
|
||||||
#ident "$Id: logic.h,v 1.24 2005/09/19 21:45:09 steve Exp $"
|
#ident "$Id: logic.h,v 1.25 2006/11/28 05:57:20 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "vvp_net.h"
|
# include "vvp_net.h"
|
||||||
|
|
@ -64,11 +64,23 @@ class vvp_fun_boolean_ : public vvp_net_fun_t, protected vvp_gen_event_s {
|
||||||
class vvp_fun_and : public vvp_fun_boolean_ {
|
class vvp_fun_and : public vvp_fun_boolean_ {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit vvp_fun_and(unsigned wid);
|
explicit vvp_fun_and(unsigned wid, bool invert);
|
||||||
~vvp_fun_and();
|
~vvp_fun_and();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void run_run();
|
void run_run();
|
||||||
|
bool invert_;
|
||||||
|
};
|
||||||
|
|
||||||
|
class vvp_fun_eeq : public vvp_fun_boolean_ {
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit vvp_fun_eeq(unsigned wid, bool invert);
|
||||||
|
~vvp_fun_eeq();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void run_run();
|
||||||
|
bool invert_;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -168,35 +180,37 @@ class vvp_fun_not: public vvp_net_fun_t, private vvp_gen_event_s {
|
||||||
class vvp_fun_or : public vvp_fun_boolean_ {
|
class vvp_fun_or : public vvp_fun_boolean_ {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit vvp_fun_or(unsigned wid);
|
explicit vvp_fun_or(unsigned wid, bool invert);
|
||||||
~vvp_fun_or();
|
~vvp_fun_or();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void run_run();
|
void run_run();
|
||||||
|
bool invert_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class vvp_fun_xor : public vvp_fun_boolean_ {
|
class vvp_fun_xor : public vvp_fun_boolean_ {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit vvp_fun_xor(unsigned wid);
|
explicit vvp_fun_xor(unsigned wid, bool invert);
|
||||||
~vvp_fun_xor();
|
~vvp_fun_xor();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void run_run();
|
void run_run();
|
||||||
|
bool invert_;
|
||||||
};
|
};
|
||||||
|
|
||||||
// table functor types
|
// table functor types
|
||||||
|
|
||||||
extern const unsigned char ft_MUXX[];
|
extern const unsigned char ft_MUXX[];
|
||||||
extern const unsigned char ft_EEQ[];
|
extern const unsigned char ft_EEQ[];
|
||||||
extern const unsigned char ft_NAND[];
|
|
||||||
extern const unsigned char ft_NOR[];
|
|
||||||
extern const unsigned char ft_TRIAND[];
|
extern const unsigned char ft_TRIAND[];
|
||||||
extern const unsigned char ft_TRIOR[];
|
extern const unsigned char ft_TRIOR[];
|
||||||
extern const unsigned char ft_XNOR[];
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: logic.h,v $
|
* $Log: logic.h,v $
|
||||||
|
* Revision 1.25 2006/11/28 05:57:20 steve
|
||||||
|
* Use new vvp_fun_XXX in place of old functor table for NAND/NOR/XNOR/EEQ.
|
||||||
|
*
|
||||||
* Revision 1.24 2005/09/19 21:45:09 steve
|
* Revision 1.24 2005/09/19 21:45:09 steve
|
||||||
* Use lazy eval of BUF/NOT/OR/XOR gates.
|
* Use lazy eval of BUF/NOT/OR/XOR gates.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue