2222 */
2323#include < stdio.h>
2424#include < stdlib.h>
25+ #include < algorithm> // std::fill
2526#include < math.h>
2627#include " odin_types.h"
2728#include " odin_globals.h"
@@ -244,50 +245,50 @@ void calculate_addsub_statistics(node_list_t* addsub) {
244245}
245246void count_node_type (nnode_t * node) {
246247 switch (node->type ) {
247- case LOGICAL_OR:
248- case LOGICAL_AND:
249- case LOGICAL_NOR:
250- case LOGICAL_NAND:
251- case LOGICAL_XOR:
252- case LOGICAL_XNOR:
253- case LOGICAL_NOT:
248+ case LOGICAL_OR: // fallthrough
249+ case LOGICAL_AND: // fallthrough
250+ case LOGICAL_NOR: // fallthrough
251+ case LOGICAL_NAND: // fallthrough
252+ case LOGICAL_XOR: // fallthrough
253+ case LOGICAL_XNOR: // fallthrough
254+ case LOGICAL_NOT: // fallthrough
254255 num_removed_nodes[node->type ]++;
255256 num_removed_nodes[GENERIC]++;
256257 break ;
257258
258- case MUX_2: // fallthrough
259- case SMUX_2:
259+ case MUX_2: // fallthrough
260+ case SMUX_2: // fallthrough
260261 num_removed_nodes[MUX_2]++;
261262 num_removed_nodes[GENERIC]++;
262263 break ;
263264
264- case GENERIC:
265+ case GENERIC: // fallthrough
265266 num_removed_nodes[node->type ]++;
266267 break ;
267268
268- case MINUS:
269+ case MINUS: // fallthrough
269270 /* Minus nodes are built of Add nodes */
270271 num_removed_nodes[ADD]++;
271272 break ;
272273
273274 case PAD_NODE: // fallthrough
274- case GND_NODE:
275- case VCC_NODE:
275+ case GND_NODE: // fallthrough
276+ case VCC_NODE: // fallthrough
276277 /* These are irrelevent so we dont output */
277278 break ;
278279
279- case INPUT_NODE: // fallthrough
280- case OUTPUT_NODE:
280+ case INPUT_NODE: // fallthrough
281+ case OUTPUT_NODE: // fallthrough
281282 /* these stay untouched but are not added to the total*/
282283 num_removed_nodes[node->type ]++;
283284 break ;
284285
285286 case CLOCK_NODE: // fallthrough
286- case FF_NODE:
287- case MULTIPLY:
288- case ADD:
289- case MEMORY:
290- case HARD_IP:
287+ case FF_NODE: // fallthrough
288+ case MULTIPLY: // fallthrough
289+ case ADD: // fallthrough
290+ case MEMORY: // fallthrough
291+ case HARD_IP: // fallthrough
291292 /* these stay untouched */
292293 num_removed_nodes[node->type ]++;
293294 break ;
@@ -300,11 +301,16 @@ void count_node_type(nnode_t* node) {
300301}
301302
302303void report_removed_nodes (long long * node_list) {
303- if (!useless_nodes.node ) return ;
304+ // return if there is no removed logic
305+ if (!useless_nodes.node )
306+ return ;
307+
304308 warning_message (NETLIST, unknown_location, " %s" , " Following unused node(s) removed from the netlist:\n " );
305309 for (int i = 0 ; i < operation_list_END; i++) {
306- if (node_list[i] > 0 ) {
307- std::string msg = std::string (" Number of removed <" ) + operation_list_STR[i][ODIN_LONG_STRING] + " > node(s): " ;
310+ if (node_list[i] > UNUSED_NODE_TYPE) {
311+ std::string msg = std::string (" Number of removed <" )
312+ + operation_list_STR[i][ODIN_LONG_STRING]
313+ + " > node(s): " ;
308314 printf (" %-42s%lld\n " , msg.c_str (), node_list[i]);
309315 }
310316 }
0 commit comments