-
Notifications
You must be signed in to change notification settings - Fork 0
/
call_abc.cc
153 lines (137 loc) · 4.61 KB
/
call_abc.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
// procedures to start and stop the ABC framework
// (should be called before and after the ABC procedures are called)
extern "C"
{
extern void Abc_Start();
extern void Abc_Stop();
// procedures to get the ABC framework and execute commands in it
extern void * Abc_FrameGetGlobalFrame();
extern int Cmd_CommandExecute( void * pAbc, char * sCommand );
}
int call_abc(int flag)
{
// variables
void * pAbc;
FILE *fp;
char Command1[500], Command2[500], Command3[500], Command4[500], Command5[500], Command6[500], Command7[500];
//////////////////////////////////////////////////////////////////////////
// start the ABC framework
Abc_Start();
pAbc = Abc_FrameGetGlobalFrame();
if(flag == 0)
{
sprintf( Command1, "read_blif ./blif_files/ckt_org_simu.blif");
if ( Cmd_CommandExecute( pAbc, Command1 ) )
{
fprintf( stdout, "Cannot execute command \"%s\".\n", Command1 );
return 1;
}
sprintf( Command1, "write_verilog ./verilog_files/ckt_org_simu.v");
if ( Cmd_CommandExecute( pAbc, Command1 ) )
{
fprintf( stdout, "Cannot execute command \"%s\".\n", Command1 );
return 1;
}
}
else if(flag == 1)
{
sprintf( Command1, "read_blif ./blif_files/ckt_org_sim_simu.blif");
if ( Cmd_CommandExecute( pAbc, Command1 ) )
{
fprintf( stdout, "Cannot execute command \"%s\".\n", Command1 );
return 1;
}
sprintf( Command1, "sweep; write_verilog ./verilog_files/ckt_org_sim_simu.v");
if ( Cmd_CommandExecute( pAbc, Command1 ) )
{
fprintf( stdout, "Cannot execute command \"%s\".\n", Command1 );
return 1;
}
}
else if(flag == 2)
{
sprintf( Command1, "read_blif ./blif_files/ckt_assure_simu.blif");
if ( Cmd_CommandExecute( pAbc, Command1 ) )
{
fprintf( stdout, "Cannot execute command \"%s\".\n", Command1 );
return 1;
}
sprintf( Command1, "write_verilog ./verilog_files/ckt_assure_simu.v");
if ( Cmd_CommandExecute( pAbc, Command1 ) )
{
fprintf( stdout, "Cannot execute command \"%s\".\n", Command1 );
return 1;
}
}
else if(flag == 3)
{
sprintf( Command1, "read_blif ./blif_files/ckt_org_simu_copy.blif");
if ( Cmd_CommandExecute( pAbc, Command1 ) )
{
fprintf( stdout, "Cannot execute command \"%s\".\n", Command1 );
return 1;
}
sprintf( Command1, "write_verilog ./verilog_files/ckt_org_simu_copy.v");
if ( Cmd_CommandExecute( pAbc, Command1 ) )
{
fprintf( stdout, "Cannot execute command \"%s\".\n", Command1 );
return 1;
}
}
else if(flag == 4)
{
sprintf( Command1, "read_blif ./blif_files/ckt_org_sim_simu_copy.blif");
if ( Cmd_CommandExecute( pAbc, Command1 ) )
{
fprintf( stdout, "Cannot execute command \"%s\".\n", Command1 );
return 1;
}
sprintf( Command1, "sweep; write_verilog ./verilog_files/ckt_org_sim_simu_copy.v");
if ( Cmd_CommandExecute( pAbc, Command1 ) )
{
fprintf( stdout, "Cannot execute command \"%s\".\n", Command1 );
return 1;
}
}
else if(flag == 5)
{
sprintf( Command1, "read_blif ./blif_files/ckt_org_sim_simu_copy.blif");
if ( Cmd_CommandExecute( pAbc, Command1 ) )
{
fprintf( stdout, "Cannot execute command \"%s\".\n", Command1 );
return 1;
}
sprintf( Command1, "sweep; write_verilog ./verilog_files/ckt_org_sim_simu_copy.v");
if ( Cmd_CommandExecute( pAbc, Command1 ) )
{
fprintf( stdout, "Cannot execute command \"%s\".\n", Command1 );
return 1;
}
}
else if(flag == 6)
{
sprintf( Command1, "read_blif ./blif_files/compare_ckt_max_sat.blif");
if ( Cmd_CommandExecute( pAbc, Command1 ) )
{
fprintf( stdout, "Cannot execute command \"%s\".\n", Command1 );
return 1;
}
sprintf( Command1, "sweep;strash; write_cnf compare_ckt_max_sat.cnf");
if ( Cmd_CommandExecute( pAbc, Command1 ) )
{
fprintf( stdout, "Cannot execute command \"%s\".\n", Command1 );
return 1;
}
}
//////////////////////////////////////////////////////////////////////////
// stop the ABC framework
Abc_Stop();
return 0;
}