Bump version
[yosys.git] / kernel / celledges.cc
index 314e7c77e76c289798be74513f5e5fcb5361c9a9..c43ba8db330cb079fd2dcf5ef9c6c81155f4aed5 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  yosys -- Yosys Open SYnthesis Suite
  *
- *  Copyright (C) 2012  Clifford Wolf <clifford@clifford.at>
+ *  Copyright (C) 2012  Claire Xenia Wolf <claire@yosyshq.com>
  *
  *  Permission to use, copy, modify, and/or distribute this software for any
  *  purpose with or without fee is hereby granted, provided that the above
@@ -142,6 +142,36 @@ void mux_op(AbstractCellEdgesDatabase *db, RTLIL::Cell *cell)
        }
 }
 
+void bmux_op(AbstractCellEdgesDatabase *db, RTLIL::Cell *cell)
+{
+       int width = GetSize(cell->getPort(ID::Y));
+       int a_width = GetSize(cell->getPort(ID::A));
+       int s_width = GetSize(cell->getPort(ID::S));
+
+       for (int i = 0; i < width; i++)
+       {
+               for (int k = i; k < a_width; k += width)
+                       db->add_edge(cell, ID::A, k, ID::Y, i, -1);
+
+               for (int k = 0; k < s_width; k++)
+                       db->add_edge(cell, ID::S, k, ID::Y, i, -1);
+       }
+}
+
+void demux_op(AbstractCellEdgesDatabase *db, RTLIL::Cell *cell)
+{
+       int width = GetSize(cell->getPort(ID::Y));
+       int a_width = GetSize(cell->getPort(ID::A));
+       int s_width = GetSize(cell->getPort(ID::S));
+
+       for (int i = 0; i < width; i++)
+       {
+               db->add_edge(cell, ID::A, i % a_width, ID::Y, i, -1);
+               for (int k = 0; k < s_width; k++)
+                       db->add_edge(cell, ID::S, k, ID::Y, i, -1);
+       }
+}
+
 PRIVATE_NAMESPACE_END
 
 bool YOSYS_NAMESPACE_PREFIX AbstractCellEdgesDatabase::add_edges_from_cell(RTLIL::Cell *cell)
@@ -187,6 +217,16 @@ bool YOSYS_NAMESPACE_PREFIX AbstractCellEdgesDatabase::add_edges_from_cell(RTLIL
                return true;
        }
 
+       if (cell->type == ID($bmux)) {
+               bmux_op(this, cell);
+               return true;
+       }
+
+       if (cell->type == ID($demux)) {
+               demux_op(this, cell);
+               return true;
+       }
+
        // FIXME: $mul $div $mod $divfloor $modfloor $slice $concat
        // FIXME: $lut $sop $alu $lcu $macc $fa