mirror of https://github.com/YosysHQ/yosys.git
parent
0d3bf9e725
commit
0aec79a0da
|
@ -52,7 +52,7 @@ struct ShowWorker
|
||||||
std::map<RTLIL::IdString, int> autonames;
|
std::map<RTLIL::IdString, int> autonames;
|
||||||
int single_idx_count;
|
int single_idx_count;
|
||||||
|
|
||||||
struct net_conn { std::set<std::string> in, out; int bits; std::string color; };
|
struct net_conn { std::set<std::pair<std::string, int>> in, out; std::string color; };
|
||||||
std::map<std::string, net_conn> net_conn_map;
|
std::map<std::string, net_conn> net_conn_map;
|
||||||
|
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
@ -268,8 +268,7 @@ struct ShowWorker
|
||||||
if (driver) {
|
if (driver) {
|
||||||
log_assert(!net.empty());
|
log_assert(!net.empty());
|
||||||
label_string += stringf("<s%d> %d:%d - %s%d:%d |", i, pos, pos-c.width+1, repinfo.c_str(), cl, cr);
|
label_string += stringf("<s%d> %d:%d - %s%d:%d |", i, pos, pos-c.width+1, repinfo.c_str(), cl, cr);
|
||||||
net_conn_map[net].in.insert(stringf("x%d:s%d", idx, i));
|
net_conn_map[net].in.insert({stringf("x%d:s%d", idx, i), rep*c.width});
|
||||||
net_conn_map[net].bits = rep*c.width;
|
|
||||||
net_conn_map[net].color = nextColor(c, net_conn_map[net].color);
|
net_conn_map[net].color = nextColor(c, net_conn_map[net].color);
|
||||||
} else
|
} else
|
||||||
if (net.empty()) {
|
if (net.empty()) {
|
||||||
|
@ -282,8 +281,7 @@ struct ShowWorker
|
||||||
pos, pos-rep*c.width+1);
|
pos, pos-rep*c.width+1);
|
||||||
} else {
|
} else {
|
||||||
label_string += stringf("<s%d> %s%d:%d - %d:%d |", i, repinfo.c_str(), cl, cr, pos, pos-rep*c.width+1);
|
label_string += stringf("<s%d> %s%d:%d - %d:%d |", i, repinfo.c_str(), cl, cr, pos, pos-rep*c.width+1);
|
||||||
net_conn_map[net].out.insert(stringf("x%d:s%d", idx, i));
|
net_conn_map[net].out.insert({stringf("x%d:s%d", idx, i), rep*c.width});
|
||||||
net_conn_map[net].bits = rep*c.width;
|
|
||||||
net_conn_map[net].color = nextColor(c, net_conn_map[net].color);
|
net_conn_map[net].color = nextColor(c, net_conn_map[net].color);
|
||||||
}
|
}
|
||||||
pos -= rep * c.width;
|
pos -= rep * c.width;
|
||||||
|
@ -293,6 +291,7 @@ struct ShowWorker
|
||||||
code += stringf("x%d [ shape=record, style=rounded, label=\"%s\" ];\n", idx, label_string.c_str());
|
code += stringf("x%d [ shape=record, style=rounded, label=\"%s\" ];\n", idx, label_string.c_str());
|
||||||
if (!port.empty()) {
|
if (!port.empty()) {
|
||||||
currentColor = xorshift32(currentColor);
|
currentColor = xorshift32(currentColor);
|
||||||
|
log_warning("WIDTHLABEL %s %d\n", log_signal(sig), GetSize(sig));
|
||||||
if (driver)
|
if (driver)
|
||||||
code += stringf("%s:e -> x%d:w [arrowhead=odiamond, arrowtail=odiamond, dir=both, %s, %s];\n", port.c_str(), idx, nextColor(sig).c_str(), widthLabel(sig.size()).c_str());
|
code += stringf("%s:e -> x%d:w [arrowhead=odiamond, arrowtail=odiamond, dir=both, %s, %s];\n", port.c_str(), idx, nextColor(sig).c_str(), widthLabel(sig.size()).c_str());
|
||||||
else
|
else
|
||||||
|
@ -305,10 +304,9 @@ struct ShowWorker
|
||||||
{
|
{
|
||||||
if (!port.empty()) {
|
if (!port.empty()) {
|
||||||
if (driver)
|
if (driver)
|
||||||
net_conn_map[net].in.insert(port);
|
net_conn_map[net].in.insert({port, GetSize(sig)});
|
||||||
else
|
else
|
||||||
net_conn_map[net].out.insert(port);
|
net_conn_map[net].out.insert({port, GetSize(sig)});
|
||||||
net_conn_map[net].bits = sig.size();
|
|
||||||
net_conn_map[net].color = nextColor(sig, net_conn_map[net].color);
|
net_conn_map[net].color = nextColor(sig, net_conn_map[net].color);
|
||||||
}
|
}
|
||||||
if (node != nullptr)
|
if (node != nullptr)
|
||||||
|
@ -478,8 +476,7 @@ struct ShowWorker
|
||||||
std::string code, node;
|
std::string code, node;
|
||||||
code += gen_portbox("", sig, false, &node);
|
code += gen_portbox("", sig, false, &node);
|
||||||
fprintf(f, "%s", code.c_str());
|
fprintf(f, "%s", code.c_str());
|
||||||
net_conn_map[node].out.insert(stringf("p%d", pidx));
|
net_conn_map[node].out.insert({stringf("p%d", pidx), GetSize(sig)});
|
||||||
net_conn_map[node].bits = sig.size();
|
|
||||||
net_conn_map[node].color = nextColor(sig, net_conn_map[node].color);
|
net_conn_map[node].color = nextColor(sig, net_conn_map[node].color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -487,8 +484,7 @@ struct ShowWorker
|
||||||
std::string code, node;
|
std::string code, node;
|
||||||
code += gen_portbox("", sig, true, &node);
|
code += gen_portbox("", sig, true, &node);
|
||||||
fprintf(f, "%s", code.c_str());
|
fprintf(f, "%s", code.c_str());
|
||||||
net_conn_map[node].in.insert(stringf("p%d", pidx));
|
net_conn_map[node].in.insert({stringf("p%d", pidx), GetSize(sig)});
|
||||||
net_conn_map[node].bits = sig.size();
|
|
||||||
net_conn_map[node].color = nextColor(sig, net_conn_map[node].color);
|
net_conn_map[node].color = nextColor(sig, net_conn_map[node].color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -522,17 +518,15 @@ struct ShowWorker
|
||||||
currentColor = xorshift32(currentColor);
|
currentColor = xorshift32(currentColor);
|
||||||
fprintf(f, "%s:e -> %s:w [arrowhead=odiamond, arrowtail=odiamond, dir=both, %s, %s];\n", left_node.c_str(), right_node.c_str(), nextColor(conn).c_str(), widthLabel(conn.first.size()).c_str());
|
fprintf(f, "%s:e -> %s:w [arrowhead=odiamond, arrowtail=odiamond, dir=both, %s, %s];\n", left_node.c_str(), right_node.c_str(), nextColor(conn).c_str(), widthLabel(conn.first.size()).c_str());
|
||||||
} else {
|
} else {
|
||||||
net_conn_map[right_node].bits = conn.first.size();
|
|
||||||
net_conn_map[right_node].color = nextColor(conn, net_conn_map[right_node].color);
|
net_conn_map[right_node].color = nextColor(conn, net_conn_map[right_node].color);
|
||||||
net_conn_map[left_node].bits = conn.first.size();
|
|
||||||
net_conn_map[left_node].color = nextColor(conn, net_conn_map[left_node].color);
|
net_conn_map[left_node].color = nextColor(conn, net_conn_map[left_node].color);
|
||||||
if (left_node[0] == 'x') {
|
if (left_node[0] == 'x') {
|
||||||
net_conn_map[right_node].in.insert(left_node);
|
net_conn_map[right_node].in.insert({left_node, GetSize(conn.first)});
|
||||||
} else if (right_node[0] == 'x') {
|
} else if (right_node[0] == 'x') {
|
||||||
net_conn_map[left_node].out.insert(right_node);
|
net_conn_map[left_node].out.insert({right_node, GetSize(conn.first)});
|
||||||
} else {
|
} else {
|
||||||
net_conn_map[right_node].in.insert(stringf("x%d:e", single_idx_count));
|
net_conn_map[right_node].in.insert({stringf("x%d:e", single_idx_count), GetSize(conn.first)});
|
||||||
net_conn_map[left_node].out.insert(stringf("x%d:w", single_idx_count));
|
net_conn_map[left_node].out.insert({stringf("x%d:w", single_idx_count), GetSize(conn.first)});
|
||||||
fprintf(f, "x%d [shape=box, style=rounded, label=\"BUF\"];\n", single_idx_count++);
|
fprintf(f, "x%d [shape=box, style=rounded, label=\"BUF\"];\n", single_idx_count++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -542,12 +536,13 @@ struct ShowWorker
|
||||||
{
|
{
|
||||||
currentColor = xorshift32(currentColor);
|
currentColor = xorshift32(currentColor);
|
||||||
if (wires_on_demand.count(it.first) > 0) {
|
if (wires_on_demand.count(it.first) > 0) {
|
||||||
if (it.second.in.size() == 1 && it.second.out.size() > 1 && it.second.in.begin()->compare(0, 1, "p") == 0)
|
if (it.second.in.size() == 1 && it.second.out.size() > 1 && it.second.in.begin()->first.compare(0, 1, "p") == 0)
|
||||||
it.second.out.erase(*it.second.in.begin());
|
it.second.out.erase(*it.second.in.begin());
|
||||||
if (it.second.in.size() == 1 && it.second.out.size() == 1) {
|
if (it.second.in.size() == 1 && it.second.out.size() == 1) {
|
||||||
std::string from = *it.second.in.begin(), to = *it.second.out.begin();
|
std::string from = it.second.in.begin()->first, to = it.second.out.begin()->first;
|
||||||
|
int bits = it.second.in.begin()->second;
|
||||||
if (from != to || from.compare(0, 1, "p") != 0)
|
if (from != to || from.compare(0, 1, "p") != 0)
|
||||||
fprintf(f, "%s:e -> %s:w [%s, %s];\n", from.c_str(), to.c_str(), nextColor(it.second.color).c_str(), widthLabel(it.second.bits).c_str());
|
fprintf(f, "%s:e -> %s:w [%s, %s];\n", from.c_str(), to.c_str(), nextColor(it.second.color).c_str(), widthLabel(bits).c_str());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (it.second.in.size() == 0 || it.second.out.size() == 0)
|
if (it.second.in.size() == 0 || it.second.out.size() == 0)
|
||||||
|
@ -556,9 +551,9 @@ struct ShowWorker
|
||||||
fprintf(f, "%s [ shape=point ];\n", it.first.c_str());
|
fprintf(f, "%s [ shape=point ];\n", it.first.c_str());
|
||||||
}
|
}
|
||||||
for (auto &it2 : it.second.in)
|
for (auto &it2 : it.second.in)
|
||||||
fprintf(f, "%s:e -> %s:w [%s, %s];\n", it2.c_str(), it.first.c_str(), nextColor(it.second.color).c_str(), widthLabel(it.second.bits).c_str());
|
fprintf(f, "%s:e -> %s:w [%s, %s];\n", it2.first.c_str(), it.first.c_str(), nextColor(it.second.color).c_str(), widthLabel(it2.second).c_str());
|
||||||
for (auto &it2 : it.second.out)
|
for (auto &it2 : it.second.out)
|
||||||
fprintf(f, "%s:e -> %s:w [%s, %s];\n", it.first.c_str(), it2.c_str(), nextColor(it.second.color).c_str(), widthLabel(it.second.bits).c_str());
|
fprintf(f, "%s:e -> %s:w [%s, %s];\n", it.first.c_str(), it2.first.c_str(), nextColor(it.second.color).c_str(), widthLabel(it2.second).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(f, "}\n");
|
fprintf(f, "}\n");
|
||||||
|
|
Loading…
Reference in New Issue