yosys-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ezsat.cc File Reference
#include "ezsat.h"
#include <cmath>
#include <algorithm>
#include <cassert>
#include <string>
#include <stdlib.h>
+ Include dependency graph for ezsat.cc:

Go to the source code of this file.

Macros

#define X(op)   case ezSAT::op: text += #op; break;
 

Functions

static std::string my_int_to_string (int i)
 
static void fulladder (ezSAT *that, int a, int b, int c, int &y, int &x)
 
static void halfadder (ezSAT *that, int a, int b, int &y, int &x)
 
static int my_clog2 (int x)
 
static std::string expression2str (const std::pair< ezSAT::OpId, std::vector< int >> &data)
 

Macro Definition Documentation

#define X (   op)    case ezSAT::op: text += #op; break;

Function Documentation

static std::string expression2str ( const std::pair< ezSAT::OpId, std::vector< int >> &  data)
static

Definition at line 1242 of file ezsat.cc.

1243 {
1244  std::string text;
1245  switch (data.first) {
1246 #define X(op) case ezSAT::op: text += #op; break;
1247  X(OpNot)
1248  X(OpAnd)
1249  X(OpOr)
1250  X(OpXor)
1251  X(OpIFF)
1252  X(OpITE)
1253  default:
1254  abort();
1255 #undef X
1256  }
1257  text += ":";
1258  for (auto it : data.second)
1259  text += " " + my_int_to_string(it);
1260  return text;
1261 }
static std::string my_int_to_string(int i)
Definition: ezsat.cc:32
#define X(op)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void fulladder ( ezSAT that,
int  a,
int  b,
int  c,
int &  y,
int &  x 
)
static

Definition at line 765 of file ezsat.cc.

766 {
767  int tmp = that->XOR(a, b);
768  int new_x = that->XOR(tmp, c);
769  int new_y = that->OR(that->AND(a, b), that->AND(c, tmp));
770 #if 0
771  printf("FULLADD> a=%s, b=%s, c=%s, carry=%s, sum=%s\n", that->to_string(a).c_str(), that->to_string(b).c_str(),
772  that->to_string(c).c_str(), that->to_string(new_y).c_str(), that->to_string(new_x).c_str());
773 #endif
774  x = new_x, y = new_y;
775 }
int AND(_V a=0, _V b=0, _V c=0, _V d=0, _V e=0, _V f=0)
Definition: ezsat.h:201
std::string to_string(int id) const
Definition: ezsat.cc:237
int XOR(_V a=0, _V b=0, _V c=0, _V d=0, _V e=0, _V f=0)
Definition: ezsat.h:209
int OR(_V a=0, _V b=0, _V c=0, _V d=0, _V e=0, _V f=0)
Definition: ezsat.h:205

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void halfadder ( ezSAT that,
int  a,
int  b,
int &  y,
int &  x 
)
static

Definition at line 778 of file ezsat.cc.

779 {
780  int new_x = that->XOR(a, b);
781  int new_y = that->AND(a, b);
782 #if 0
783  printf("HALFADD> a=%s, b=%s, carry=%s, sum=%s\n", that->to_string(a).c_str(), that->to_string(b).c_str(),
784  that->to_string(new_y).c_str(), that->to_string(new_x).c_str());
785 #endif
786  x = new_x, y = new_y;
787 }
int AND(_V a=0, _V b=0, _V c=0, _V d=0, _V e=0, _V f=0)
Definition: ezsat.h:201
std::string to_string(int id) const
Definition: ezsat.cc:237
int XOR(_V a=0, _V b=0, _V c=0, _V d=0, _V e=0, _V f=0)
Definition: ezsat.h:209

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int my_clog2 ( int  x)
static

Definition at line 1008 of file ezsat.cc.

1009 {
1010  int result = 0;
1011  for (x--; x > 0; result++)
1012  x >>= 1;
1013  return result;
1014 }

+ Here is the caller graph for this function:

static std::string my_int_to_string ( int  i)
static

Definition at line 32 of file ezsat.cc.

33 {
34 #ifdef __MINGW32__
35  char buffer[64];
36  snprintf(buffer, 64, "%d", i);
37  return buffer;
38 #else
39  return std::to_string(i);
40 #endif
41 }

+ Here is the caller graph for this function: