Skip to content

Commit

Permalink
Fixed bug related to bus grouping.
Browse files Browse the repository at this point in the history
  • Loading branch information
tilk committed May 21, 2020
1 parent 64f60fc commit b48f5ab
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand All @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions tests/grouping_test.sv
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit b48f5ab

Please sign in to comment.