Skip to content

Commit 5f65e24

Browse files
ArcaneNibbleazonenberg
authored andcommittedSep 1, 2017
coolrunner2: Finish fixing special-use p-terms
1 parent fa04366 commit 5f65e24

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed
 

Diff for: ‎techlibs/coolrunner2/coolrunner2_sop.cc

+20-8
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,17 @@ struct Coolrunner2SopPass : public Pass {
7070
tuple<Cell*, const char *>(cell, "\\PRE"));
7171
if (cell->hasPort("\\CLR"))
7272
special_pterms_no_inv[sigmap(cell->getPort("\\CLR")[0])].insert(
73-
tuple<Cell*, const char *>(cell, "\\PRE"));
73+
tuple<Cell*, const char *>(cell, "\\CLR"));
7474
if (cell->hasPort("\\CE"))
7575
special_pterms_no_inv[sigmap(cell->getPort("\\CE")[0])].insert(
76-
tuple<Cell*, const char *>(cell, "\\PRE"));
76+
tuple<Cell*, const char *>(cell, "\\CE"));
7777

7878
if (cell->hasPort("\\C"))
7979
special_pterms_inv[sigmap(cell->getPort("\\C")[0])].insert(
80-
tuple<Cell*, const char *>(cell, "\\PRE"));
80+
tuple<Cell*, const char *>(cell, "\\C"));
8181
if (cell->hasPort("\\G"))
8282
special_pterms_inv[sigmap(cell->getPort("\\G")[0])].insert(
83-
tuple<Cell*, const char *>(cell, "\\PRE"));
83+
tuple<Cell*, const char *>(cell, "\\G"));
8484
}
8585
}
8686

@@ -115,7 +115,7 @@ struct Coolrunner2SopPass : public Pass {
115115
if (special_pterms_no_inv.count(sop_output) || special_pterms_inv.count(sop_output))
116116
{
117117
is_special_pterm = true;
118-
if (!special_pterms_no_inv.count(sop_output))
118+
if (!special_pterms_no_inv[sop_output].size())
119119
special_pterm_can_invert = true;
120120
}
121121

@@ -174,10 +174,22 @@ struct Coolrunner2SopPass : public Pass {
174174
{
175175
if (special_pterm_can_invert)
176176
{
177-
log_assert(special_pterms_no_inv.count(sop_output) == 0);
177+
log_assert(special_pterms_no_inv[sop_output].size() == 0);
178178

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+
}
181193
}
182194
else
183195
{

0 commit comments

Comments
 (0)