yosys-master
|
#include <ezsat.h>
Data Structures | |
struct | _V |
Public Types | |
enum | OpId { OpNot, OpAnd, OpOr, OpXor, OpIFF, OpITE } |
Public Member Functions | |
ezSAT () | |
virtual | ~ezSAT () |
void | keep_cnf () |
void | non_incremental () |
bool | mode_keep_cnf () const |
bool | mode_non_incremental () const |
int | value (bool val) |
int | literal () |
int | literal (const std::string &name) |
int | frozen_literal () |
int | frozen_literal (const std::string &name) |
int | expression (OpId op, int a=0, int b=0, int c=0, int d=0, int e=0, int f=0) |
int | expression (OpId op, const std::vector< int > &args) |
void | lookup_literal (int id, std::string &name) const |
const std::string & | lookup_literal (int id) const |
void | lookup_expression (int id, OpId &op, std::vector< int > &args) const |
const std::vector< int > & | lookup_expression (int id, OpId &op) const |
int | parse_string (const std::string &text) |
std::string | to_string (int id) const |
int | numLiterals () const |
int | numExpressions () const |
int | eval (int id, const std::vector< int > &values) const |
virtual bool | solver (const std::vector< int > &modelExpressions, std::vector< bool > &modelValues, const std::vector< int > &assumptions) |
bool | solve (const std::vector< int > &modelExpressions, std::vector< bool > &modelValues, const std::vector< int > &assumptions) |
bool | solve (const std::vector< int > &modelExpressions, std::vector< bool > &modelValues, int a=0, int b=0, int c=0, int d=0, int e=0, int f=0) |
bool | solve (int a=0, int b=0, int c=0, int d=0, int e=0, int f=0) |
void | setSolverTimeout (int newTimeoutSeconds) |
bool | getSolverTimoutStatus () |
virtual void | clear () |
virtual void | freeze (int id) |
virtual bool | eliminated (int idx) |
void | assume (int id) |
int | bind (int id, bool auto_freeze=true) |
int | bound (int id) const |
int | numCnfVariables () const |
int | numCnfClauses () const |
const std::vector< std::vector < int > > & | cnf () const |
void | consumeCnf () |
void | consumeCnf (std::vector< std::vector< int >> &cnf) |
void | getFullCnf (std::vector< std::vector< int >> &full_cnf) const |
std::string | cnfLiteralInfo (int idx) const |
int | VAR (_V a) |
int | NOT (_V a) |
int | AND (_V a=0, _V b=0, _V c=0, _V d=0, _V e=0, _V f=0) |
int | OR (_V a=0, _V b=0, _V c=0, _V d=0, _V e=0, _V f=0) |
int | XOR (_V a=0, _V b=0, _V c=0, _V d=0, _V e=0, _V f=0) |
int | IFF (_V a, _V b=0, _V c=0, _V d=0, _V e=0, _V f=0) |
int | ITE (_V a, _V b, _V c) |
void | SET (_V a, _V b) |
std::vector< int > | vec_const (const std::vector< bool > &bits) |
std::vector< int > | vec_const_signed (int64_t value, int numBits) |
std::vector< int > | vec_const_unsigned (uint64_t value, int numBits) |
std::vector< int > | vec_var (int numBits) |
std::vector< int > | vec_var (std::string name, int numBits) |
std::vector< int > | vec_cast (const std::vector< int > &vec1, int toBits, bool signExtend=false) |
std::vector< int > | vec_not (const std::vector< int > &vec1) |
std::vector< int > | vec_and (const std::vector< int > &vec1, const std::vector< int > &vec2) |
std::vector< int > | vec_or (const std::vector< int > &vec1, const std::vector< int > &vec2) |
std::vector< int > | vec_xor (const std::vector< int > &vec1, const std::vector< int > &vec2) |
std::vector< int > | vec_iff (const std::vector< int > &vec1, const std::vector< int > &vec2) |
std::vector< int > | vec_ite (const std::vector< int > &vec1, const std::vector< int > &vec2, const std::vector< int > &vec3) |
std::vector< int > | vec_ite (int sel, const std::vector< int > &vec1, const std::vector< int > &vec2) |
std::vector< int > | vec_count (const std::vector< int > &vec, int numBits, bool clip=true) |
std::vector< int > | vec_add (const std::vector< int > &vec1, const std::vector< int > &vec2) |
std::vector< int > | vec_sub (const std::vector< int > &vec1, const std::vector< int > &vec2) |
std::vector< int > | vec_neg (const std::vector< int > &vec) |
void | vec_cmp (const std::vector< int > &vec1, const std::vector< int > &vec2, int &carry, int &overflow, int &sign, int &zero) |
int | vec_lt_signed (const std::vector< int > &vec1, const std::vector< int > &vec2) |
int | vec_le_signed (const std::vector< int > &vec1, const std::vector< int > &vec2) |
int | vec_ge_signed (const std::vector< int > &vec1, const std::vector< int > &vec2) |
int | vec_gt_signed (const std::vector< int > &vec1, const std::vector< int > &vec2) |
int | vec_lt_unsigned (const std::vector< int > &vec1, const std::vector< int > &vec2) |
int | vec_le_unsigned (const std::vector< int > &vec1, const std::vector< int > &vec2) |
int | vec_ge_unsigned (const std::vector< int > &vec1, const std::vector< int > &vec2) |
int | vec_gt_unsigned (const std::vector< int > &vec1, const std::vector< int > &vec2) |
int | vec_eq (const std::vector< int > &vec1, const std::vector< int > &vec2) |
int | vec_ne (const std::vector< int > &vec1, const std::vector< int > &vec2) |
std::vector< int > | vec_shl (const std::vector< int > &vec1, int shift, bool signExtend=false) |
std::vector< int > | vec_srl (const std::vector< int > &vec1, int shift) |
std::vector< int > | vec_shr (const std::vector< int > &vec1, int shift, bool signExtend=false) |
std::vector< int > | vec_srr (const std::vector< int > &vec1, int shift) |
std::vector< int > | vec_shift (const std::vector< int > &vec1, int shift, int extend_left, int extend_right) |
std::vector< int > | vec_shift_right (const std::vector< int > &vec1, const std::vector< int > &vec2, bool vec2_signed, int extend_left, int extend_right) |
std::vector< int > | vec_shift_left (const std::vector< int > &vec1, const std::vector< int > &vec2, bool vec2_signed, int extend_left, int extend_right) |
void | vec_append (std::vector< int > &vec, const std::vector< int > &vec1) const |
void | vec_append_signed (std::vector< int > &vec, const std::vector< int > &vec1, int64_t value) |
void | vec_append_unsigned (std::vector< int > &vec, const std::vector< int > &vec1, uint64_t value) |
int64_t | vec_model_get_signed (const std::vector< int > &modelExpressions, const std::vector< bool > &modelValues, const std::vector< int > &vec1) const |
uint64_t | vec_model_get_unsigned (const std::vector< int > &modelExpressions, const std::vector< bool > &modelValues, const std::vector< int > &vec1) const |
int | vec_reduce_and (const std::vector< int > &vec1) |
int | vec_reduce_or (const std::vector< int > &vec1) |
void | vec_set (const std::vector< int > &vec1, const std::vector< int > &vec2) |
void | vec_set_signed (const std::vector< int > &vec1, int64_t value) |
void | vec_set_unsigned (const std::vector< int > &vec1, uint64_t value) |
struct ezSATbit | bit (_V a) |
struct ezSATvec | vec (const std::vector< int > &vec) |
void | printDIMACS (FILE *f, bool verbose=false) const |
void | printInternalState (FILE *f) const |
int | onehot (const std::vector< int > &vec, bool max_only=false) |
int | manyhot (const std::vector< int > &vec, int min_hot, int max_hot=-1) |
int | ordered (const std::vector< int > &vec1, const std::vector< int > &vec2, bool allow_equal=true) |
Data Fields | |
int | solverTimeout |
bool | solverTimoutStatus |
Static Public Attributes | |
static const int | CONST_TRUE = 1 |
static const int | CONST_FALSE = 2 |
Protected Member Functions | |
void | preSolverCallback () |
Private Member Functions | |
void | add_clause (const std::vector< int > &args) |
void | add_clause (const std::vector< int > &args, bool argsPolarity, int a=0, int b=0, int c=0) |
void | add_clause (int a, int b=0, int c=0) |
int | bind_cnf_not (const std::vector< int > &args) |
int | bind_cnf_and (const std::vector< int > &args) |
int | bind_cnf_or (const std::vector< int > &args) |
Private Attributes | |
bool | flag_keep_cnf |
bool | flag_non_incremental |
bool | non_incremental_solve_used_up |
std::map< std::string, int > | literalsCache |
std::vector< std::string > | literals |
std::map< std::pair< OpId, std::vector< int > >, int > | expressionsCache |
std::vector< std::pair< OpId, std::vector< int > > > | expressions |
bool | cnfConsumed |
int | cnfVariableCount |
int | cnfClausesCount |
std::vector< int > | cnfLiteralVariables |
std::vector< int > | cnfExpressionVariables |
std::vector< std::vector< int > > | cnfClauses |
std::vector< std::vector< int > > | cnfClausesBackup |
enum ezSAT::OpId |
Enumerator | |
---|---|
OpNot | |
OpAnd | |
OpOr | |
OpXor | |
OpIFF | |
OpITE |
Definition at line 44 of file ezsat.h.
|
private |
|
private |
|
private |
Definition at line 201 of file ezsat.h.
void ezSAT::assume | ( | int | id | ) |
Definition at line 388 of file ezsat.cc.
int ezSAT::bind | ( | int | id, |
bool | auto_freeze = true |
||
) |
Definition at line 520 of file ezsat.cc.
|
private |
|
private |
|
private |
int ezSAT::bound | ( | int | id | ) | const |
|
virtual |
|
inline |
std::string ezSAT::cnfLiteralInfo | ( | int | idx | ) | const |
void ezSAT::consumeCnf | ( | ) |
void ezSAT::consumeCnf | ( | std::vector< std::vector< int >> & | cnf | ) |
|
virtual |
int ezSAT::eval | ( | int | id, |
const std::vector< int > & | values | ||
) | const |
Definition at line 293 of file ezsat.cc.
int ezSAT::expression | ( | OpId | op, |
int | a = 0 , |
||
int | b = 0 , |
||
int | c = 0 , |
||
int | d = 0 , |
||
int | e = 0 , |
||
int | f = 0 |
||
) |
Definition at line 102 of file ezsat.cc.
int ezSAT::expression | ( | OpId | op, |
const std::vector< int > & | args | ||
) |
Definition at line 110 of file ezsat.cc.
|
virtual |
int ezSAT::frozen_literal | ( | ) |
Definition at line 88 of file ezsat.cc.
int ezSAT::frozen_literal | ( | const std::string & | name | ) |
Definition at line 95 of file ezsat.cc.
void ezSAT::getFullCnf | ( | std::vector< std::vector< int >> & | full_cnf | ) | const |
Definition at line 213 of file ezsat.h.
Definition at line 217 of file ezsat.h.
|
inline |
int ezSAT::literal | ( | ) |
void ezSAT::lookup_expression | ( | int | id, |
OpId & | op, | ||
std::vector< int > & | args | ||
) | const |
Definition at line 218 of file ezsat.cc.
const std::vector< int > & ezSAT::lookup_expression | ( | int | id, |
OpId & | op | ||
) | const |
Definition at line 225 of file ezsat.cc.
void ezSAT::lookup_literal | ( | int | id, |
std::string & | name | ||
) | const |
int ezSAT::manyhot | ( | const std::vector< int > & | vec, |
int | min_hot, | ||
int | max_hot = -1 |
||
) |
Definition at line 1333 of file ezsat.cc.
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 197 of file ezsat.h.
|
inline |
|
inline |
|
inline |
Definition at line 112 of file ezsat.h.
|
inline |
int ezSAT::onehot | ( | const std::vector< int > & | vec, |
bool | max_only = false |
||
) |
Definition at line 1303 of file ezsat.cc.
Definition at line 205 of file ezsat.h.
int ezSAT::ordered | ( | const std::vector< int > & | vec1, |
const std::vector< int > & | vec2, | ||
bool | allow_equal = true |
||
) |
Definition at line 1371 of file ezsat.cc.
int ezSAT::parse_string | ( | const std::string & | text | ) |
|
protected |
void ezSAT::printDIMACS | ( | FILE * | f, |
bool | verbose = false |
||
) | const |
Definition at line 1188 of file ezsat.cc.
void ezSAT::printInternalState | ( | FILE * | f | ) | const |
Definition at line 1263 of file ezsat.cc.
|
inline |
|
inline |
Definition at line 122 of file ezsat.h.
|
inline |
Definition at line 126 of file ezsat.h.
|
inline |
Definition at line 137 of file ezsat.h.
|
virtual |
std::string ezSAT::to_string | ( | int | id | ) | const |
Definition at line 237 of file ezsat.cc.
int ezSAT::value | ( | bool | val | ) |
|
inline |
ezSATvec ezSAT::vec | ( | const std::vector< int > & | vec | ) |
Definition at line 1183 of file ezsat.cc.
std::vector< int > ezSAT::vec_add | ( | const std::vector< int > & | vec1, |
const std::vector< int > & | vec2 | ||
) |
Definition at line 819 of file ezsat.cc.
std::vector< int > ezSAT::vec_and | ( | const std::vector< int > & | vec1, |
const std::vector< int > & | vec2 | ||
) |
void ezSAT::vec_append | ( | std::vector< int > & | vec, |
const std::vector< int > & | vec1 | ||
) | const |
void ezSAT::vec_append_signed | ( | std::vector< int > & | vec, |
const std::vector< int > & | vec1, | ||
int64_t | value | ||
) |
void ezSAT::vec_append_unsigned | ( | std::vector< int > & | vec, |
const std::vector< int > & | vec1, | ||
uint64_t | value | ||
) |
std::vector< int > ezSAT::vec_cast | ( | const std::vector< int > & | vec1, |
int | toBits, | ||
bool | signExtend = false |
||
) |
void ezSAT::vec_cmp | ( | const std::vector< int > & | vec1, |
const std::vector< int > & | vec2, | ||
int & | carry, | ||
int & | overflow, | ||
int & | sign, | ||
int & | zero | ||
) |
Definition at line 873 of file ezsat.cc.
std::vector< int > ezSAT::vec_const | ( | const std::vector< bool > & | bits | ) |
std::vector< int > ezSAT::vec_const_signed | ( | int64_t | value, |
int | numBits | ||
) |
std::vector< int > ezSAT::vec_const_unsigned | ( | uint64_t | value, |
int | numBits | ||
) |
std::vector< int > ezSAT::vec_count | ( | const std::vector< int > & | vec, |
int | numBits, | ||
bool | clip = true |
||
) |
Definition at line 789 of file ezsat.cc.
int ezSAT::vec_eq | ( | const std::vector< int > & | vec1, |
const std::vector< int > & | vec2 | ||
) |
Definition at line 954 of file ezsat.cc.
int ezSAT::vec_ge_signed | ( | const std::vector< int > & | vec1, |
const std::vector< int > & | vec2 | ||
) |
Definition at line 912 of file ezsat.cc.
int ezSAT::vec_ge_unsigned | ( | const std::vector< int > & | vec1, |
const std::vector< int > & | vec2 | ||
) |
Definition at line 940 of file ezsat.cc.
int ezSAT::vec_gt_signed | ( | const std::vector< int > & | vec1, |
const std::vector< int > & | vec2 | ||
) |
Definition at line 919 of file ezsat.cc.
int ezSAT::vec_gt_unsigned | ( | const std::vector< int > & | vec1, |
const std::vector< int > & | vec2 | ||
) |
Definition at line 947 of file ezsat.cc.
std::vector< int > ezSAT::vec_iff | ( | const std::vector< int > & | vec1, |
const std::vector< int > & | vec2 | ||
) |
std::vector< int > ezSAT::vec_ite | ( | const std::vector< int > & | vec1, |
const std::vector< int > & | vec2, | ||
const std::vector< int > & | vec3 | ||
) |
std::vector< int > ezSAT::vec_ite | ( | int | sel, |
const std::vector< int > & | vec1, | ||
const std::vector< int > & | vec2 | ||
) |
int ezSAT::vec_le_signed | ( | const std::vector< int > & | vec1, |
const std::vector< int > & | vec2 | ||
) |
Definition at line 905 of file ezsat.cc.
int ezSAT::vec_le_unsigned | ( | const std::vector< int > & | vec1, |
const std::vector< int > & | vec2 | ||
) |
Definition at line 933 of file ezsat.cc.
int ezSAT::vec_lt_signed | ( | const std::vector< int > & | vec1, |
const std::vector< int > & | vec2 | ||
) |
Definition at line 898 of file ezsat.cc.
int ezSAT::vec_lt_unsigned | ( | const std::vector< int > & | vec1, |
const std::vector< int > & | vec2 | ||
) |
Definition at line 926 of file ezsat.cc.
int64_t ezSAT::vec_model_get_signed | ( | const std::vector< int > & | modelExpressions, |
const std::vector< bool > & | modelValues, | ||
const std::vector< int > & | vec1 | ||
) | const |
uint64_t ezSAT::vec_model_get_unsigned | ( | const std::vector< int > & | modelExpressions, |
const std::vector< bool > & | modelValues, | ||
const std::vector< int > & | vec1 | ||
) | const |
int ezSAT::vec_ne | ( | const std::vector< int > & | vec1, |
const std::vector< int > & | vec2 | ||
) |
Definition at line 959 of file ezsat.cc.
std::vector< int > ezSAT::vec_neg | ( | const std::vector< int > & | vec | ) |
Definition at line 867 of file ezsat.cc.
std::vector< int > ezSAT::vec_not | ( | const std::vector< int > & | vec1 | ) |
std::vector< int > ezSAT::vec_or | ( | const std::vector< int > & | vec1, |
const std::vector< int > & | vec2 | ||
) |
int ezSAT::vec_reduce_and | ( | const std::vector< int > & | vec1 | ) |
Definition at line 1139 of file ezsat.cc.
int ezSAT::vec_reduce_or | ( | const std::vector< int > & | vec1 | ) |
Definition at line 1144 of file ezsat.cc.
void ezSAT::vec_set | ( | const std::vector< int > & | vec1, |
const std::vector< int > & | vec2 | ||
) |
void ezSAT::vec_set_signed | ( | const std::vector< int > & | vec1, |
int64_t | value | ||
) |
void ezSAT::vec_set_unsigned | ( | const std::vector< int > & | vec1, |
uint64_t | value | ||
) |
std::vector< int > ezSAT::vec_shift | ( | const std::vector< int > & | vec1, |
int | shift, | ||
int | extend_left, | ||
int | extend_right | ||
) |
std::vector< int > ezSAT::vec_shift_left | ( | const std::vector< int > & | vec1, |
const std::vector< int > & | vec2, | ||
bool | vec2_signed, | ||
int | extend_left, | ||
int | extend_right | ||
) |
Definition at line 1059 of file ezsat.cc.
std::vector< int > ezSAT::vec_shift_right | ( | const std::vector< int > & | vec1, |
const std::vector< int > & | vec2, | ||
bool | vec2_signed, | ||
int | extend_left, | ||
int | extend_right | ||
) |
Definition at line 1016 of file ezsat.cc.
std::vector< int > ezSAT::vec_shl | ( | const std::vector< int > & | vec1, |
int | shift, | ||
bool | signExtend = false |
||
) |
|
inline |
Definition at line 266 of file ezsat.h.
std::vector< int > ezSAT::vec_srl | ( | const std::vector< int > & | vec1, |
int | shift | ||
) |
|
inline |
Definition at line 267 of file ezsat.h.
std::vector< int > ezSAT::vec_sub | ( | const std::vector< int > & | vec1, |
const std::vector< int > & | vec2 | ||
) |
Definition at line 843 of file ezsat.cc.
std::vector< int > ezSAT::vec_var | ( | int | numBits | ) |
std::vector< int > ezSAT::vec_var | ( | std::string | name, |
int | numBits | ||
) |
std::vector< int > ezSAT::vec_xor | ( | const std::vector< int > & | vec1, |
const std::vector< int > & | vec2 | ||
) |
Definition at line 209 of file ezsat.h.
|
private |
|
private |
|
private |