@@ -70,17 +70,17 @@ struct Coolrunner2SopPass : public Pass {
70
70
tuple<Cell*, const char *>(cell, " \\ PRE" ));
71
71
if (cell->hasPort (" \\ CLR" ))
72
72
special_pterms_no_inv[sigmap (cell->getPort (" \\ CLR" )[0 ])].insert (
73
- tuple<Cell*, const char *>(cell, " \\ PRE " ));
73
+ tuple<Cell*, const char *>(cell, " \\ CLR " ));
74
74
if (cell->hasPort (" \\ CE" ))
75
75
special_pterms_no_inv[sigmap (cell->getPort (" \\ CE" )[0 ])].insert (
76
- tuple<Cell*, const char *>(cell, " \\ PRE " ));
76
+ tuple<Cell*, const char *>(cell, " \\ CE " ));
77
77
78
78
if (cell->hasPort (" \\ C" ))
79
79
special_pterms_inv[sigmap (cell->getPort (" \\ C" )[0 ])].insert (
80
- tuple<Cell*, const char *>(cell, " \\ PRE " ));
80
+ tuple<Cell*, const char *>(cell, " \\ C " ));
81
81
if (cell->hasPort (" \\ G" ))
82
82
special_pterms_inv[sigmap (cell->getPort (" \\ G" )[0 ])].insert (
83
- tuple<Cell*, const char *>(cell, " \\ PRE " ));
83
+ tuple<Cell*, const char *>(cell, " \\ G " ));
84
84
}
85
85
}
86
86
@@ -115,7 +115,7 @@ struct Coolrunner2SopPass : public Pass {
115
115
if (special_pterms_no_inv.count (sop_output) || special_pterms_inv.count (sop_output))
116
116
{
117
117
is_special_pterm = true ;
118
- if (!special_pterms_no_inv. count (sop_output ))
118
+ if (!special_pterms_no_inv[sop_output]. size ( ))
119
119
special_pterm_can_invert = true ;
120
120
}
121
121
@@ -174,10 +174,22 @@ struct Coolrunner2SopPass : public Pass {
174
174
{
175
175
if (special_pterm_can_invert)
176
176
{
177
- log_assert (special_pterms_no_inv. count (sop_output ) == 0 );
177
+ log_assert (special_pterms_no_inv[sop_output]. size ( ) == 0 );
178
178
179
- // XXX TODO
180
- log_assert (!" not implemented yet" );
179
+ for (auto x : special_pterms_inv[sop_output])
180
+ {
181
+ auto cell = std::get<0 >(x);
182
+ // Need to invert the polarity of the cell
183
+ if (cell->type == " \\ FDCP" ) cell->type = " \\ FDCP_N" ;
184
+ else if (cell->type == " \\ FDCP_N" ) cell->type = " \\ FDCP" ;
185
+ else if (cell->type == " \\ FTCP" ) cell->type = " \\ FTCP_N" ;
186
+ else if (cell->type == " \\ FTCP_N" ) cell->type = " \\ FTCP" ;
187
+ else if (cell->type == " \\ FDCPE" ) cell->type = " \\ FDCPE_N" ;
188
+ else if (cell->type == " \\ FDCPE_N" ) cell->type = " \\ FDCPE" ;
189
+ else if (cell->type == " \\ LDCP" ) cell->type = " \\ LDCP_N" ;
190
+ else if (cell->type == " \\ LDCP_N" ) cell->type = " \\ LDCP" ;
191
+ else log_assert (!" Internal error! Bad cell type!" );
192
+ }
181
193
}
182
194
else
183
195
{
0 commit comments