@@ -28,6 +28,8 @@ OTHER DEALINGS IN THE SOFTWARE.
28
28
#include " bdd/cudd/cuddInt.h"
29
29
#include " bdd/cudd/cudd.h"
30
30
31
+ #include " odin_error.h"
32
+ #include " odin_util.h"
31
33
#include " ace.h"
32
34
#include " vtr_memory.h"
33
35
@@ -45,13 +47,6 @@ OTHER DEALINGS IN THE SOFTWARE.
45
47
#define BPI 32
46
48
#define LOGBPI 5
47
49
48
- #define fail (why ) {\
49
- (void ) fprintf (stderr, " Fatal error: file %s, line %d\n %s\n " ,\
50
- __FILE__, __LINE__, why);\
51
- (void ) fflush (stdout);\
52
- abort ();\
53
- }
54
-
55
50
#define LOOPINIT (size ) ((size <= BPI) ? 1 : WHICH_WORD((size)-1 ))
56
51
57
52
#define WHICH_WORD (element ) (((element) >> LOGBPI) + 1 )
@@ -65,8 +60,8 @@ typedef unsigned int *pset;
65
60
66
61
#define ALLOC (type, num ) ((type *) malloc(sizeof (type) * (num)))
67
62
68
- #define set_remove (set, e ) (set[WHICH_WORD(e)] &= ~ (1 << WHICH_BIT(e)))
69
- #define set_insert (set, e ) (set[WHICH_WORD(e)] |= 1 << WHICH_BIT(e))
63
+ #define set_remove (set, e ) (set[WHICH_WORD(e)] &= ~ (shift_left_value_with_overflow_check( 0x1 , WHICH_BIT(e) )))
64
+ #define set_insert (set, e ) (set[WHICH_WORD(e)] |= (shift_left_value_with_overflow_check( 0x1 , WHICH_BIT(e)) ))
70
65
#define set_new (size ) set_clear(ALLOC(unsigned int , set_size(size)), size)
71
66
#define set_size (size ) ((size) <= BPI ? 2 : (WHICH_WORD((size)-1 ) + 1 ))
72
67
@@ -109,13 +104,13 @@ void alloc_and_init_ace_structs(netlist_t *net) {
109
104
/*
110
105
printf ( "alloc_and_init_activity_info\n");
111
106
printf ( "----------------------------\n");
112
- printf ("PIs in network: %d \n", net->num_top_input_nodes);
113
- printf ("POs in network: %d \n", net->num_top_output_nodes);
107
+ printf ("PIs in network: %ld \n", net->num_top_input_nodes);
108
+ printf ("POs in network: %ld \n", net->num_top_output_nodes);
114
109
115
- printf ("Nodes in network: %d \n", net->num_internal_nodes);
116
- printf ("FF Nodes in network: %d \n", net->num_ff_nodes);
117
- printf ("Forward Level Nodes in network: %d \n", net->num_forward_levels);
118
- printf ("Backward Level Nodes in network: %d \n", net->num_backward_levels);
110
+ printf ("Nodes in network: %ld \n", net->num_internal_nodes);
111
+ printf ("FF Nodes in network: %ld \n", net->num_ff_nodes);
112
+ printf ("Forward Level Nodes in network: %ld \n", net->num_forward_levels);
113
+ printf ("Backward Level Nodes in network: %ld \n", net->num_backward_levels);
119
114
*/
120
115
121
116
// GND Node
@@ -398,7 +393,7 @@ void output_ace_info (netlist_t *net, FILE *act_out ) {
398
393
void output_ace_info_node ( char *name, ace_obj_info_t *info, FILE *act_out ) {
399
394
400
395
/*
401
- printf ( "%s %f %f %f DEBUG: ONES: %3d TOGGLES: %d \n",
396
+ printf ( "%s %f %f %f DEBUG: ONES: %3d TOGGLES: %ld \n",
402
397
name,
403
398
info->static_prob,
404
399
info->switch_prob ,
@@ -440,22 +435,34 @@ pset set_clear(pset r, int size)
440
435
int node_error (int code) {
441
436
switch (code) {
442
437
case 0 :
443
- fail ( " node_get_cube: node does not have a function" );
438
+ error_message (ACE,- 1 , - 1 , " %s " , " node_get_cube: node does not have a function" );
444
439
/* NOTREACHED */
440
+ break ;
441
+
445
442
case 1 :
446
- fail ( " node_get_cube: cube index out of bounds" );
443
+ error_message (ACE,- 1 , - 1 , " %s " , " node_get_cube: cube index out of bounds" );
447
444
/* NOTREACHED */
445
+ break ;
446
+
448
447
case 2 :
449
- fail ( " node_get_literal: bad cube" );
448
+ error_message (ACE,- 1 , - 1 , " %s " , " node_get_literal: bad cube" );
450
449
/* NOTREACHED */
450
+ break ;
451
+
451
452
case 4 :
452
- fail ( " foreach_fanin: node changed during generation" );
453
+ error_message (ACE,- 1 , - 1 , " %s " , " foreach_fanin: node changed during generation" );
453
454
/* NOTREACHED */
455
+ break ;
456
+
454
457
case 5 :
455
- fail ( " foreach_fanout: node changed during generation" );
458
+ error_message (ACE,- 1 , - 1 , " %s " , " foreach_fanout: node changed during generation" );
456
459
/* NOTREACHED */
460
+ break ;
461
+
457
462
default :
458
- fail (" error code unused" );
463
+ error_message (ACE,-1 , -1 , " %s" ," error code unused" );
464
+ break ;
465
+
459
466
}
460
467
return 0 ;
461
468
}
@@ -488,7 +495,7 @@ ace_cube_t * ace_cube_dup(ace_cube_t * cube) {
488
495
set_insert (cube_copy->cube , 2 * i + 1 );
489
496
break ;
490
497
default :
491
- fail ( " Bad literal." );
498
+ error_message (ACE,- 1 , - 1 , " %s " , " Bad literal." );
492
499
}
493
500
}
494
501
return (cube_copy);
@@ -639,7 +646,7 @@ double calc_cube_switch_prob_recur(DdManager * mgr, DdNode * bdd, ace_cube_t * c
639
646
+ (1.0 - fanin_info->static_prob ) * else_prob;
640
647
break ;
641
648
default :
642
- fail ( " Bad literal." );
649
+ error_message (ACE,- 1 , - 1 , " %s " , " Bad literal." );
643
650
}
644
651
st__insert (visited, (char *) bdd, (char *) current_prob);
645
652
0 commit comments