Added $macc eval model

This commit is contained in:
Clifford Wolf 2014-09-06 19:44:28 +02:00
parent fa64942018
commit 98e6463ca7
1 changed files with 22 additions and 0 deletions

View File

@ -23,6 +23,7 @@
#include "kernel/rtlil.h" #include "kernel/rtlil.h"
#include "kernel/sigtools.h" #include "kernel/sigtools.h"
#include "kernel/celltypes.h" #include "kernel/celltypes.h"
#include "kernel/macc.h"
struct ConstEval struct ConstEval
{ {
@ -210,6 +211,27 @@ struct ConstEval
} }
} }
} }
else if (cell->type == "$macc")
{
Macc macc;
macc.from_cell(cell);
if (!eval(macc.bit_ports, undef, cell))
return false;
for (auto &port : macc.ports) {
if (!eval(port.in_a, undef, cell))
return false;
if (!eval(port.in_b, undef, cell))
return false;
}
RTLIL::Const result(0, SIZE(cell->getPort("\\Y")));
if (!macc.eval(result))
log_abort();
set(cell->getPort("\\Y"), result);
}
else else
{ {
RTLIL::SigSpec sig_c, sig_d; RTLIL::SigSpec sig_c, sig_d;