Merge remote-tracking branch 'origin/eddie/muxpack' into xc7mux_wip
[yosys.git] / frontends / aiger / aigerparse.h
1 /*
2 * yosys -- Yosys Open SYnthesis Suite
3 *
4 * Copyright (C) 2012 Clifford Wolf <clifford@clifford.at>
5 * 2019 Eddie Hung <eddie@fpgeh.com>
6 *
7 * Permission to use, copy, modify, and/or distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 *
19 */
20
21 #ifndef ABC_AIGERPARSE
22 #define ABC_AIGERPARSE
23
24 #include "kernel/yosys.h"
25
26 YOSYS_NAMESPACE_BEGIN
27
28 struct AigerReader
29 {
30 RTLIL::Design *design;
31 std::istream &f;
32 RTLIL::IdString clk_name;
33 RTLIL::Module *module;
34 std::string map_filename;
35 bool wideports;
36
37 unsigned M, I, L, O, A;
38 unsigned B, C, J, F; // Optional in AIGER 1.9
39 unsigned line_count;
40 uint32_t piNum, flopNum;
41
42 std::vector<RTLIL::Wire*> inputs;
43 std::vector<RTLIL::Wire*> latches;
44 std::vector<RTLIL::Wire*> outputs;
45 std::vector<RTLIL::Wire*> bad_properties;
46 std::vector<RTLIL::Cell*> boxes;
47
48 AigerReader(RTLIL::Design *design, std::istream &f, RTLIL::IdString module_name, RTLIL::IdString clk_name, std::string map_filename, bool wideports);
49 void parse_aiger();
50 void parse_xaiger();
51 void parse_aiger_ascii();
52 void parse_aiger_binary();
53 void post_process();
54 };
55
56 YOSYS_NAMESPACE_END
57
58 #endif