diff --git a/tgt-sizer/scan_logs.cc b/tgt-sizer/scan_logs.cc index a58dd0950..e70a2ffb8 100644 --- a/tgt-sizer/scan_logs.cc +++ b/tgt-sizer/scan_logs.cc @@ -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; diff --git a/tgt-sizer/scan_lpms.cc b/tgt-sizer/scan_lpms.cc index cfd3f45fc..ddd382504 100644 --- a/tgt-sizer/scan_lpms.cc +++ b/tgt-sizer/scan_lpms.cc @@ -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; diff --git a/tgt-sizer/sizer.cc b/tgt-sizer/sizer.cc index d4cd85ec8..2009ea558 100644 --- a/tgt-sizer/sizer.cc +++ b/tgt-sizer/sizer.cc @@ -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); } diff --git a/tgt-sizer/sizer_priv.h b/tgt-sizer/sizer_priv.h index 39fcdcb72..f036d91b9 100644 --- a/tgt-sizer/sizer_priv.h +++ b/tgt-sizer/sizer_priv.h @@ -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;