Remove most dependencies on vvp_bit4_t encoding.

Remove dependencies on vvp_bit4_encoding outside of the vvp_net
core types. The table_functor_s class was the worst offfender and
was barely used, so it is now removed completely. There are a few
opcodes in vhtread.cc that also make vvvp_bit4_t encoding
assumptions (and used casts) and those have been fixed. There
were also various VPI interface functions that are fixed.
This commit is contained in:
Stephen Williams
2008-04-20 19:21:41 -07:00
parent 5e30016910
commit 40fd07d46e
10 changed files with 199 additions and 832 deletions
-49
View File
@@ -31,52 +31,6 @@
# include <malloc.h>
#endif
/*
* Implementation of the table functor, which provides logic with up
* to 4 inputs.
*/
table_functor_s::table_functor_s(truth_t t)
: table(t)
{
count_functors_logic += 1;
}
table_functor_s::~table_functor_s()
{
}
/*
* WARNING: This function assumes that the table generator encodes the
* values 0/1/x/z the same as the vvp_bit4_t enumeration values.
*/
void table_functor_s::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&val)
{
input_[ptr.port()] = val;
vvp_vector4_t result (val.size());
for (unsigned idx = 0 ; idx < val.size() ; idx += 1) {
unsigned lookup = 0;
for (unsigned pdx = 4 ; pdx > 0 ; pdx -= 1) {
lookup <<= 2;
if (idx < input_[pdx-1].size())
lookup |= input_[pdx-1].value(idx);
}
unsigned off = lookup / 4;
unsigned shift = lookup % 4 * 2;
unsigned bit_val = table[off] >> shift;
bit_val &= 3;
result.set_bit(idx, (vvp_bit4_t)bit_val);
}
vvp_send_vec4(ptr.ptr()->out, result);
}
vvp_fun_boolean_::vvp_fun_boolean_(unsigned wid)
{
net_ = 0;
@@ -604,9 +558,6 @@ void compile_functor(char*label, char*type, unsigned width,
} else if (strcmp(type, "MUXR") == 0) {
obj = new vvp_fun_muxr;
} else if (strcmp(type, "MUXX") == 0) {
obj = new table_functor_s(ft_MUXX);
} else if (strcmp(type, "MUXZ") == 0) {
obj = new vvp_fun_muxz(width);