ilang
1.1.4
ILAng: A Modeling and Verification Platform for SoCs
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Friends
Macros
include
ilang
smt-inout
smt_op.h
1
4
#ifndef SMT_OP_H__
5
#define SMT_OP_H__
6
7
#define CHECK_EMPTY_PARAM(idx, args) \
8
ILA_ASSERT((idx).empty()); \
9
ILA_ASSERT((args).empty())
10
11
#define CHECK_BV_MULTI_ARG(idx, args) \
12
ILA_ASSERT((idx).empty()); \
13
ILA_ASSERT((args).size() >= 2);
14
15
#define CHECK_BOOL_MULTI_ARG(idx, args) CHECK_BV_MULTI_ARG(idx, args)
16
17
#define CHECK_BOOL_ONE_ARG(idx, args) \
18
ILA_ASSERT(idx.empty()); \
19
ILA_ASSERT(args.size() == 1); \
20
ILA_ASSERT(args[0]->_type.is_bool())
21
22
#define CHECK_BOOL_TWO_ARG(idx, args) \
23
ILA_ASSERT((idx).empty()); \
24
ILA_ASSERT((args).size() == 2); \
25
ILA_ASSERT((args)[0]->_type.is_bool()); \
26
ILA_ASSERT((args)[1]->_type.is_bool())
27
28
#define CHECK_BV_TWO_ARG(idx, args) \
29
ILA_ASSERT((idx).empty()); \
30
ILA_ASSERT((args).size() == 2); \
31
ILA_ASSERT((args)[0]->_type._type == var_type::tp::BV); \
32
ILA_ASSERT((args)[1]->_type._type == var_type::tp::BV); \
33
ILA_ASSERT(var_type::eqtype((args)[0]->_type, (args)[1]->_type))
34
35
#define CHECK_BV_COMPARE(idx, args) CHECK_BV_TWO_ARG(idx, args)
36
37
#define CHECK_BV_ONE_ARG(idx, args) \
38
ILA_ASSERT(idx.empty()); \
39
ILA_ASSERT(args.size() == 1); \
40
ILA_ASSERT(args[0]->_type._type == var_type::tp::BV);
41
42
#define CHECK_BV_TWO_ARG_DIFF_WIDTH(idx, args) \
43
ILA_ASSERT((idx).empty()); \
44
ILA_ASSERT((args).size() == 2); \
45
ILA_ASSERT((args)[0]->_type._type == var_type::tp::BV); \
46
ILA_ASSERT((args)[1]->_type._type == var_type::tp::BV);
47
48
#define MAKE_BOOL_RESULT(vlg_expr) \
49
std::string search_name = "##bool_" + (vlg_expr); \
50
if (!IN(search_name, term_container)) { \
51
term_container.insert(std::make_pair( \
52
search_name, \
53
SmtTermInfoVerilog((vlg_expr), var_type(var_type::tp::Bool, 1, ""), \
54
this))); \
55
} \
56
return &(term_container[search_name])
57
58
#define MAKE_MULTI_OP(vlg_expr, args, TYPE, op) \
59
bool first = true; \
60
for (auto&& arg : (args)) { \
61
ILA_ASSERT(arg->_type._type == (TYPE)); \
62
if (first) \
63
(vlg_expr) = "(" + arg->_translate + ")"; \
64
else \
65
(vlg_expr) += " " op "(" + arg->_translate + ")"; \
66
first = false; \
67
}
68
69
#define MAKE_BV_RESULT_TYPE_AS_ARGN(vlg_expr, args, n) \
70
std::string search_name = \
71
"##bv" + std::to_string(args[(n)]->_type._width) + "_" + (vlg_expr); \
72
if (!IN(search_name, term_container)) { \
73
term_container.insert(std::make_pair( \
74
search_name, SmtTermInfoVerilog(vlg_expr, args[(n)]->_type, this))); \
75
} \
76
return &(term_container[search_name])
77
78
#define MAKE_BV_RESULT_TYPE_AS_ARG0(vlg_expr, args) \
79
MAKE_BV_RESULT_TYPE_AS_ARGN(vlg_expr, args, 0)
80
81
#endif // SMT_OP_H__
Generated by
1.8.5