int [] resolve(int [] cl1, int [] cl2) { IntVector result = new IntVector(4); int [] combined = new int [cl1.Length + cl2.Length]; Array.Copy(cl1, 0, combined, 0, cl1.Length); Array.Copy(cl2, 0, combined, cl1.Length, cl2.Length); Array.Sort(combined); for (int i = 0; i < combined.Length; ++i) { if (result.empty()) { result.push_back(combined[i]); } else if (result.back == combined[i]) { continue; } else if (result.back == (combined[i] ^ 1)) { result.pop_back(); } else { result.push_back(combined[i]); } } return(result.ToArray()); }
public void add(IntVector new_frees) { for (int i = 0; i < new_frees.size(); ++i) { free_list.push_back(new_frees[i]); } free_list.sort(); }
void finalize_construct_network() { for (int i = 0; i < nodes.size(); ++i) { Gate n = node(i); for (int j = 0; j < n.fanin_names.size(); ++j) { string name = (string)n.fanin_names[j]; Gate pin = find_node_by_name(name); sharp_assert(pin != null); n.fanins.push_back(pin.index); pin.fanouts.push_back(n.index); if (n.is_LATCH()) { pin.set_LATCH_IN(); } } } for (int i = 0; i < nodes.size(); ++i) { Gate n = node(i); if (n.is_PI()) { primary_inputs.push_back(n.index); } if (n.is_PI() || n.is_LATCH()) { inputs.push_back(n.index); } if (n.is_PO()) { primary_outputs.push_back(n.index); } if (n.is_PO() || n.is_LATCH_IN()) { outputs.push_back(n.index); } if (n.is_LATCH()) { latches.push_back(n.index); } if (n.is_COMB()) { combs.push_back(n.index); } } }
public void delete_index(int idx) { delete_count++; if ((double)delete_count / (double)free_list.size() > compact_ratio) { IntVector temp = new IntVector(16); for (int i = 0; i < free_list.size(); ++i) { if (idx == i) //just deleted, so won't be in free_list anymore { continue; } if (variables[free_list[i]] == null || variables[free_list[i]].type == NodeType.FREE) { temp.push_back(free_list[i]); } } free_list = temp; } }
public void add_reason(int uid) { reasons.push_back(uid); }