Cleanup of dfflibmap cellmap exploration code

This commit is contained in:
Clifford Wolf 2013-12-20 14:21:18 +01:00
parent eaf7d9675d
commit 1fb29050e5
1 changed files with 20 additions and 17 deletions

View File

@ -473,23 +473,26 @@ struct DfflibmapPass : public Pass {
find_cell_sr(libparser.ast, "$_DFFSR_PPN_", true, true, false); find_cell_sr(libparser.ast, "$_DFFSR_PPN_", true, true, false);
find_cell_sr(libparser.ast, "$_DFFSR_PPP_", true, true, true); find_cell_sr(libparser.ast, "$_DFFSR_PPP_", true, true, true);
int level = 0; // try to implement as many cells as possible just by inverting
while (level < 3) { // the SET and RESET pins. If necessary, implement cell types
bool did_something = false; // by inverting both D and Q. Only invert clock pins if there
switch (level) { // is no other way of implementing the cell.
case 2: while (1)
did_something |= expand_cellmap("$_DFF_*_", "C"); {
did_something |= expand_cellmap("$_DFF_*??_", "C"); if (expand_cellmap("$_DFF_?*?_", "R") ||
did_something |= expand_cellmap("$_DFFSR_*??_", "C"); expand_cellmap("$_DFFSR_?*?_", "S") ||
case 1: expand_cellmap("$_DFFSR_??*_", "R"))
did_something |= expand_cellmap("$_DFF_??*_", "DQ"); continue;
case 0:
did_something |= expand_cellmap("$_DFF_?*?_", "R"); if (expand_cellmap("$_DFF_??*_", "DQ"))
did_something |= expand_cellmap("$_DFFSR_?*?_", "S"); continue;
did_something |= expand_cellmap("$_DFFSR_??*_", "R");
} if (expand_cellmap("$_DFF_*_", "C") ||
if (!did_something) expand_cellmap("$_DFF_*??_", "C") ||
level++; expand_cellmap("$_DFFSR_*??_", "C"))
continue;
break;
} }
map_sr_to_arst("$_DFFSR_NNN_", "$_DFF_NN0_"); map_sr_to_arst("$_DFFSR_NNN_", "$_DFF_NN0_");