diff --git a/index.js b/index.js index 8e37cec..f2a8de1 100644 --- a/index.js +++ b/index.js @@ -205,6 +205,8 @@ function yosys_to_digitaljs_mod(name, mod, portmaps, options = {}) { const net = get_net(k); if(net.source !== undefined) { // multiple sources driving one net, disallowed in digitaljs + console.log(k); + console.log(net); throw Error('Multiple sources driving net: ' + net.name); } net.source = { id: d, port: p }; @@ -231,6 +233,8 @@ function yosys_to_digitaljs_mod(name, mod, portmaps, options = {}) { return dname; } function add_busgroup(nbits, groups) { + if (get_net(nbits).source !== undefined) + return; // the bits were already grouped const dname = add_device({ type: 'BusGroup', groups: groups.map(g => g.length) diff --git a/tests/grouping_test.sv b/tests/grouping_test.sv new file mode 100644 index 0000000..57669cc --- /dev/null +++ b/tests/grouping_test.sv @@ -0,0 +1,4 @@ +module grouping_test(input a, b, c, input [2:0] d1, input [3:0] d2, output [2:0] o1, output [3:0] o2); + assign o1 = b ? {1'b0, a, a} : d1; + assign o2 = c ? {2'b0, a, a} : d2; +endmodule