Collect some actual sizer statistics.

This commit is contained in:
Stephen Williams 2014-02-08 18:53:42 -08:00
parent 959ac3229e
commit f5041e6c09
4 changed files with 35 additions and 1 deletions

View File

@ -20,11 +20,24 @@
# include "sizer_priv.h"
void scan_logs_gates(ivl_scope_t scope, ivl_net_logic_t log, struct sizer_statistics&stats)
{
unsigned wid = ivl_logic_width(log);
stats.gate_count += wid;
}
void scan_logs(ivl_scope_t scope, struct sizer_statistics&stats)
{
for (unsigned idx = 0 ; idx < ivl_scope_logs(scope) ; idx += 1) {
ivl_net_logic_t log = ivl_scope_log(scope, idx);
switch (ivl_logic_type(log)) {
case IVL_LO_AND:
case IVL_LO_OR:
case IVL_LO_XOR:
case IVL_LO_XNOR:
scan_logs_gates(scope, log, stats);
break;
default:
stats.log_unknown += 1;
break;

View File

@ -19,7 +19,7 @@
# include "sizer_priv.h"
static void scan_lpms_ff(ivl_scope_t scope, ivl_lpm_t lpm, struct sizer_statistics&stats)
static void scan_lpms_ff(ivl_scope_t, ivl_lpm_t lpm, struct sizer_statistics&stats)
{
ivl_nexus_t out = ivl_lpm_q(lpm);
unsigned wid = get_nexus_width(out);
@ -32,9 +32,25 @@ void scan_lpms(ivl_scope_t scope, struct sizer_statistics&stats)
for (unsigned idx = 0 ; idx < ivl_scope_lpms(scope) ; idx += 1) {
ivl_lpm_t lpm = ivl_scope_lpm(scope,idx);
switch (ivl_lpm_type(lpm)) {
// Part select nodes don't actually take up
// hardware. These represent things like bundle
// manipulations, which are done in routing.
case IVL_LPM_PART_VP:
case IVL_LPM_PART_PV:
case IVL_LPM_CONCAT:
case IVL_LPM_CONCATZ:
case IVL_LPM_REPEAT:
break;
case IVL_LPM_ADD:
stats.adder_count += 1;
break;
// D-Type flip-flops.
case IVL_LPM_FF:
scan_lpms_ff(scope, lpm, stats);
break;
default:
stats.lpm_unknown += 1;
break;

View File

@ -111,6 +111,7 @@ static void emit_sizer_root(ivl_design_t des, ivl_scope_t model)
scan_lpms(model, stats);
fprintf(sizer_out, " Flip-Flops : %u\n", stats.flop_count);
fprintf(sizer_out, " Logic Gates : %u\n", stats.gate_count);
fprintf(sizer_out, " LPM Unknown : %u\n", stats.lpm_unknown);
fprintf(sizer_out, " Logic Unknown: %u\n", stats.log_unknown);
}

View File

@ -26,6 +26,8 @@
struct sizer_statistics {
unsigned flop_count;
unsigned gate_count;
unsigned adder_count;
unsigned lpm_unknown;
unsigned log_unknown;
@ -33,6 +35,8 @@ struct sizer_statistics {
inline sizer_statistics()
{
flop_count = 0;
gate_count = 0;
adder_count = 0;
lpm_unknown = 0;
log_unknown = 0;