ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
giaTransduction.cpp
Go to the documentation of this file.
1
20
21#ifndef _WIN32
22
23#ifdef _WIN32
24#ifndef __MINGW32__
25#pragma warning(disable : 4786) // warning C4786: identifier was truncated to '255' characters in the browser information
26#endif
27#endif
28
29#include "giaTransduction.h"
30#include "giaNewBdd.h"
31#include "giaNewTt.h"
32
34
35Gia_Man_t *Gia_ManTransductionBdd(Gia_Man_t *pGia, int nType, int fMspf, int nRandom, int nSortType, int nPiShuffle, int nParameter, int fLevel, Gia_Man_t *pExdc, int fNewLine, int nVerbose) {
36 if(nRandom) {
37 srand(nRandom);
38 nSortType = rand() % 4;
39 nPiShuffle = rand();
40 nParameter = rand() % 16;
41 }
43 Transduction::Transduction<NewBdd::Man, NewBdd::Param, NewBdd::lit, 0xffffffff> t(pGia, nVerbose, fNewLine, nSortType, nPiShuffle, fLevel, pExdc, p);
44 int count = t.CountWires();
45 switch(nType) {
46 case 0:
47 count -= fMspf? t.Mspf(): t.Cspf();
48 break;
49 case 1:
50 count -= t.Resub(fMspf);
51 break;
52 case 2:
53 count -= t.ResubMono(fMspf);
54 break;
55 case 3:
56 count -= t.ResubShared(fMspf);
57 break;
58 case 4:
59 count -= t.RepeatResub(false, fMspf);
60 break;
61 case 5:
62 count -= t.RepeatResub(true, fMspf);
63 break;
64 case 6: {
65 bool fInner = (nParameter / 4) % 2;
66 count -= t.RepeatInner(fMspf, fInner);
67 break;
68 }
69 case 7: {
70 bool fInner = (nParameter / 4) % 2;
71 bool fOuter = (nParameter / 8) % 2;
72 count -= t.RepeatOuter(fMspf, fInner, fOuter);
73 break;
74 }
75 case 8: {
76 bool fFirstMerge = nParameter % 2;
77 bool fMspfMerge = fMspf? (nParameter / 2) % 2: false;
78 bool fInner = (nParameter / 4) % 2;
79 bool fOuter = (nParameter / 8) % 2;
80 count -= t.RepeatAll(fFirstMerge, fMspfMerge, fMspf, fInner, fOuter);
81 break;
82 }
83 default:
84 std::cout << "Unknown transduction type " << nType << std::endl;
85 }
86 assert(t.Verify());
87 assert(count == t.CountWires());
88 return t.GenerateAig();
89}
90
91Gia_Man_t *Gia_ManTransductionTt(Gia_Man_t *pGia, int nType, int fMspf, int nRandom, int nSortType, int nPiShuffle, int nParameter, int fLevel, Gia_Man_t *pExdc, int fNewLine, int nVerbose) {
92 if(nRandom) {
93 srand(nRandom);
94 nSortType = rand() % 4;
95 nPiShuffle = rand();
96 nParameter = rand() % 16;
97 }
99 Transduction::Transduction<NewTt::Man, NewTt::Param, NewTt::lit, 0xffffffff> t(pGia, nVerbose, fNewLine, nSortType, nPiShuffle, fLevel, pExdc, p);
100 int count = t.CountWires();
101 switch(nType) {
102 case 0:
103 count -= fMspf? t.Mspf(): t.Cspf();
104 break;
105 case 1:
106 count -= t.Resub(fMspf);
107 break;
108 case 2:
109 count -= t.ResubMono(fMspf);
110 break;
111 case 3:
112 count -= t.ResubShared(fMspf);
113 break;
114 case 4:
115 count -= t.RepeatResub(false, fMspf);
116 break;
117 case 5:
118 count -= t.RepeatResub(true, fMspf);
119 break;
120 case 6: {
121 bool fInner = (nParameter / 4) % 2;
122 count -= t.RepeatInner(fMspf, fInner);
123 break;
124 }
125 case 7: {
126 bool fInner = (nParameter / 4) % 2;
127 bool fOuter = (nParameter / 8) % 2;
128 count -= t.RepeatOuter(fMspf, fInner, fOuter);
129 break;
130 }
131 case 8: {
132 bool fFirstMerge = nParameter % 2;
133 bool fMspfMerge = fMspf? (nParameter / 2) % 2: false;
134 bool fInner = (nParameter / 4) % 2;
135 bool fOuter = (nParameter / 8) % 2;
136 count -= t.RepeatAll(fFirstMerge, fMspfMerge, fMspf, fInner, fOuter);
137 break;
138 }
139 default:
140 std::cout << "Unknown transduction type " << nType << std::endl;
141 }
142 assert(t.Verify());
143 assert(count == t.CountWires());
144 return t.GenerateAig();
145}
146
148
149#else
150
151#include "gia.h"
152
154
155Gia_Man_t * Gia_ManTransductionBdd(Gia_Man_t *pGia, int nType, int fMspf, int nRandom, int nSortType, int nPiShuffle, int nParameter, int fLevel, Gia_Man_t *pExdc, int fNewLine, int nVerbose)
156{
157 return NULL;
158}
159Gia_Man_t * Gia_ManTransductionTt(Gia_Man_t *pGia, int nType, int fMspf, int nRandom, int nSortType, int nPiShuffle, int nParameter, int fLevel, Gia_Man_t *pExdc, int fNewLine, int nVerbose)
160{
161 return NULL;
162}
163
165
166#endif
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
int RepeatAll(bool fFirstMerge, bool fMspfMerge, bool fMspfResub, bool fInner, bool fOuter)
int RepeatResub(bool fMono, bool fMspf)
int RepeatOuter(bool fMspf, bool fInner, bool fOuter)
int RepeatInner(bool fMspf, bool fInner)
Gia_Man_t * GenerateAig() const
Cube * p
Definition exorList.c:222
ABC_NAMESPACE_IMPL_START Gia_Man_t * Gia_ManTransductionBdd(Gia_Man_t *pGia, int nType, int fMspf, int nRandom, int nSortType, int nPiShuffle, int nParameter, int fLevel, Gia_Man_t *pExdc, int fNewLine, int nVerbose)
Gia_Man_t * Gia_ManTransductionTt(Gia_Man_t *pGia, int nType, int fMspf, int nRandom, int nSortType, int nPiShuffle, int nParameter, int fLevel, Gia_Man_t *pExdc, int fNewLine, int nVerbose)
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
#define assert(ex)
Definition util_old.h:213