mirror of https://github.com/YosysHQ/yosys.git
Merge pull request #4417 from kivikakk/cxxrtl-unused-output
cxxrtl: don't emit invalid code on unconnected outputs.
This commit is contained in:
commit
9f94ecf4ed
|
@ -1138,7 +1138,7 @@ struct CxxrtlWorker {
|
||||||
f << indent << "// cell " << cell->name.str() << " syncs\n";
|
f << indent << "// cell " << cell->name.str() << " syncs\n";
|
||||||
for (auto conn : cell->connections())
|
for (auto conn : cell->connections())
|
||||||
if (cell->output(conn.first))
|
if (cell->output(conn.first))
|
||||||
if (is_cxxrtl_sync_port(cell, conn.first)) {
|
if (is_cxxrtl_sync_port(cell, conn.first) && !conn.second.empty()) {
|
||||||
f << indent;
|
f << indent;
|
||||||
dump_sigspec_lhs(conn.second, for_debug);
|
dump_sigspec_lhs(conn.second, for_debug);
|
||||||
f << " = " << mangle(cell) << access << mangle_wire_name(conn.first) << ".curr;\n";
|
f << " = " << mangle(cell) << access << mangle_wire_name(conn.first) << ".curr;\n";
|
||||||
|
|
|
@ -11,3 +11,7 @@ run_subtest () {
|
||||||
|
|
||||||
run_subtest value
|
run_subtest value
|
||||||
run_subtest value_fuzz
|
run_subtest value_fuzz
|
||||||
|
|
||||||
|
# Compile-only test.
|
||||||
|
../../yosys -p "read_verilog test_unconnected_output.v; proc; clean; write_cxxrtl cxxrtl-test-unconnected_output.cc"
|
||||||
|
${CC:-gcc} -std=c++11 -c -o cxxrtl-test-unconnected_output -I../../backends/cxxrtl/runtime cxxrtl-test-unconnected_output.cc
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
(* cxxrtl_blackbox *)
|
||||||
|
module blackbox(...);
|
||||||
|
(* cxxrtl_edge = "p" *)
|
||||||
|
input clk;
|
||||||
|
|
||||||
|
(* cxxrtl_sync *)
|
||||||
|
output [7:0] out1;
|
||||||
|
|
||||||
|
(* cxxrtl_sync *)
|
||||||
|
output [7:0] out2;
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module unconnected_output(
|
||||||
|
input clk,
|
||||||
|
in,
|
||||||
|
output out
|
||||||
|
);
|
||||||
|
blackbox bb (
|
||||||
|
.clock (clock),
|
||||||
|
.in (in),
|
||||||
|
.out1 (out),
|
||||||
|
.out2 (/* unconnected */),
|
||||||
|
);
|
||||||
|
endmodule
|
Loading…
Reference in New Issue