-
Notifications
You must be signed in to change notification settings - Fork 1
/
abc_api.h
94 lines (73 loc) · 2.28 KB
/
abc_api.h
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
/*************************************************************************
*
* Copyright (c) 2023 Rajit Manohar
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
**************************************************************************
*/
#ifndef __EXPROPT_ABC_API_H__
#define __EXPROPT_ABC_API_H__
/*
* Minimal API to abc
*/
extern "C" {
void Abc_Start ();
void Abc_Stop ();
typedef struct Abc_Frame_t_ Abc_Frame_t;
Abc_Frame_t *Abc_FrameGetGlobalFrame();
int Cmd_CommandExecute (Abc_Frame_t *pAbc, const char *sCommand);
}
class AbcApi {
public:
AbcApi ();
~AbcApi ();
/*
* @param v_in is the input Verilog file
* @param v_out is where the mapped Verilog netlist should be saved
* @param name is the name of the top-level module
*/
int startSession (const char *v_in, const char *v_out, const char *name);
int runCmd (const char *cmd);
int stdSynthesis ();
int runTiming ();
int endSession ();
private:
char *_name; // name of the module
char *_vin; // Verilog input file
char *_vout; // Verilog output file
bool _parent;
int _childpid;
Abc_Frame_t *_pAbc;
int _logfd;
struct {
int from; // inbound file descriptor
int to; // outbound file descriptor
} _fd;
void _mainloop ();
int _get_full_cmd (char **buf, int *maxsz, int *sz, int *pos);
void _send (const char *s);
void _recv (char *buf, int sz);
bool _startsession (char *name);
bool _endsession ();
bool _run_abc (char *cmd);
// reply to parent
void _ok ();
void _error ();
// check in parent
int _check_ok ();
};
#endif /* __EXPROPT_ABC_API_H__ */