Skip to content

Commit b740d36

Browse files
committed
Code clean-up
1 parent 248c4c5 commit b740d36

File tree

2 files changed

+1
-127
lines changed

2 files changed

+1
-127
lines changed

design_edit/src/rs_design_edit.cc

Lines changed: 1 addition & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -83,23 +83,16 @@ struct DesignEditRapidSilicon : public ScriptPass {
8383
std::vector<Cell *> remove_prims;
8484
std::vector<Cell *> remove_fab_prims; // TODO : change to unoredred set later
8585
std::vector<Cell *> remove_non_prims;
86-
std::vector<Cell *> remove_wrapper_cells;
8786
std::unordered_set<Wire *> wires_interface;
8887
std::unordered_set<Wire *> del_ins;
8988
std::unordered_set<Wire *> del_outs;
90-
std::unordered_set<Wire *> del_interface_wires;
91-
std::unordered_set<Wire *> del_wrapper_wires;
9289
std::unordered_set<Wire *> del_unused;
9390
std::set<std::pair<Yosys::RTLIL::SigSpec, Yosys::RTLIL::SigSpec>> connections_to_remove;
9491
std::unordered_set<Wire *> orig_intermediate_wires;
95-
std::unordered_set<Wire *> interface_intermediate_wires;
96-
std::map<Yosys::RTLIL::SigBit, Yosys::RTLIL::SigBit> wrapper_conns;
9792
std::map<RTLIL::SigBit, std::vector<RTLIL::Wire *>> io_prim_conn, intf_prim_conn;
98-
std::map<RTLIL::SigBit, RTLIL::SigBit> inout_conn_map;
9993
std::map<Yosys::RTLIL::SigBit, Yosys::RTLIL::SigBit> ifab_sig_map;
10094
std::map<RTLIL::SigBit, std::vector<RTLIL::SigBit>> ofab_sig_map, ofab_conns;
10195
pool<SigBit> prim_out_bits;
102-
pool<SigBit> unused_prim_outs;
10396
pool<SigBit> used_bits;
10497
pool<SigBit> orig_ins, orig_outs, fab_outs, fab_ins;
10598

@@ -888,57 +881,6 @@ struct DesignEditRapidSilicon : public ScriptPass {
888881
}
889882
}
890883

891-
void handle_inout_connection(Module* mod)
892-
{
893-
for(auto &conn : mod->connections())
894-
{
895-
std::vector<RTLIL::SigBit> conn_lhs = conn.first.to_sigbit_vector();
896-
std::vector<RTLIL::SigBit> conn_rhs = conn.second.to_sigbit_vector();
897-
bool remove_conn = false;
898-
for (size_t i = 0; i < conn_lhs.size(); ++i)
899-
{
900-
if (conn_rhs[i].wire != nullptr)
901-
if (conn_rhs[i].wire->port_input && conn_rhs[i].wire->port_output)
902-
{
903-
inout_conn_map[conn_lhs[i]] = conn_rhs[i];
904-
remove_conn = true;
905-
}
906-
}
907-
if (remove_conn)
908-
{
909-
connections_to_remove.insert(conn);
910-
}
911-
}
912-
913-
remove_extra_conns(mod);
914-
connections_to_remove.clear();
915-
916-
for (auto cell : mod->cells())
917-
{
918-
for (auto conn : cell->connections())
919-
{
920-
IdString portName = conn.first;
921-
bool unset_port = true;
922-
RTLIL::SigSpec sigspec;
923-
for (SigBit bit : conn.second)
924-
{
925-
if (inout_conn_map.count(bit) > 0)
926-
{
927-
if (unset_port)
928-
{
929-
cell->unsetPort(portName);
930-
unset_port = false;
931-
}
932-
sigspec.append(inout_conn_map[bit]);
933-
} else {
934-
sigspec.append(bit);
935-
}
936-
}
937-
if (!unset_port) cell->setPort(portName, sigspec);
938-
}
939-
}
940-
}
941-
942884
void process_wire(Cell *cell, const IdString &portName, RTLIL::Wire *wire) {
943885
if (cell->input(portName)) {
944886
if (wire->port_input) {
@@ -1126,71 +1068,7 @@ struct DesignEditRapidSilicon : public ScriptPass {
11261068
}
11271069
}
11281070

1129-
void clean_flattened(Module *mod)
1130-
{
1131-
for(auto &conn : mod->connections())
1132-
{
1133-
std::vector<RTLIL::SigBit> conn_lhs = conn.first.to_sigbit_vector();
1134-
std::vector<RTLIL::SigBit> conn_rhs = conn.second.to_sigbit_vector();
1135-
for (size_t i = 0; i < conn_lhs.size(); i++) {
1136-
if (conn_lhs[i].wire != nullptr && conn_rhs[i].wire != nullptr)
1137-
{
1138-
wrapper_conns.insert(std::make_pair(conn_lhs[i], conn_rhs[i]));
1139-
} else {
1140-
std::cerr << "Unexpected behaviour from flatten pass" << std::endl;
1141-
}
1142-
}
1143-
}
1144-
1145-
for (auto cell : mod->cells()) {
1146-
string module_name = cell->type.str();
1147-
bool is_fabric_instance = (module_name.substr(0, 8) == "\\fabric_") ? true : false;
1148-
if (is_fabric_instance) continue;
1149-
for (auto conn : cell->connections()) {
1150-
IdString portName = conn.first;
1151-
bool unset_port = true;
1152-
RTLIL::SigSpec sigspec;
1153-
for (SigBit bit : conn.second)
1154-
{
1155-
if (bit.wire != nullptr)
1156-
{
1157-
bool appended = false;
1158-
for (auto it = wrapper_conns.begin(); it != wrapper_conns.end(); ++it) {
1159-
if (it->second == bit) {
1160-
if (unset_port) {
1161-
cell->unsetPort(portName);
1162-
unset_port = false;
1163-
}
1164-
sigspec.append(it->first);
1165-
appended = true;
1166-
break;
1167-
} else if (it->first == bit) {
1168-
if (unset_port) {
1169-
cell->unsetPort(portName);
1170-
unset_port = false;
1171-
}
1172-
sigspec.append(it->second);
1173-
appended = true;
1174-
break;
1175-
}
1176-
}
1177-
if(!appended) sigspec.append(bit);
1178-
}
1179-
else {
1180-
sigspec.append(bit);
1181-
}
1182-
}
1183-
if (!unset_port)
1184-
{
1185-
cell->setPort(portName, sigspec);
1186-
}
1187-
}
1188-
}
1189-
1190-
mod->connections_.clear();
1191-
}
1192-
1193-
void elapsed_time (time_point<high_resolution_clock> start,
1071+
void elapsed_time(time_point<high_resolution_clock> start,
11941072
time_point<high_resolution_clock> end)
11951073
{
11961074
auto duration = duration_cast<nanoseconds>(end - start);

design_edit/src/rs_design_edit.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ enum Technologies { GENERIC, GENESIS, GENESIS_2, GENESIS_3 };
6262
std::vector<pin_data*> pins;
6363
std::vector<std::string> wrapper_files;
6464
std::vector<std::string> post_route_wrapper;
65-
std::unordered_set<std::string> clk_outs;
6665
std::unordered_set<std::string> primitives;
6766
std::unordered_set<std::string> out_prims;
6867
std::unordered_set<std::string> soc_intf_prims;
@@ -76,7 +75,6 @@ std::unordered_set<std::string> in_prim_outs;
7675
std::unordered_set<std::string> io_prim_wires;
7776
std::unordered_set<std::string> common_clks_resets;
7877
std::unordered_set<std::string> orig_inst_conns;
79-
std::unordered_set<std::string> interface_inst_conns;
8078
std::unordered_set<std::string> keep_wires;
8179
std::string io_config_json;
8280
std::string sdc_file;
@@ -85,7 +83,5 @@ std::string tech;
8583

8684
std::vector<std::string> tokenizeString(const std::string &input);
8785
void processSdcFile(std::istream &input);
88-
void get_loc_map_by_io();
89-
void write_checker_file();
9086

9187
#endif // DESIGN_EDIT_UTILS_H

0 commit comments

Comments
 (0)