Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions regression/verilog/modules/decoder1.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
KNOWNBUG
decoder1.sv

^EXIT=0$
^SIGNAL=0$
--
--
No support for recursive module dependencies.
25 changes: 25 additions & 0 deletions regression/verilog/modules/decoder1.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Example of a recursive module instantiation

module decoder#(parameter N = 4) (input [N-1:0] binary, output [2**N-1:0] unary);

generate
if(N==1)
assign unary = binary;
else begin
// generate one N-1 bit decoder recursively
wire [2**(N-1)-1:0] output_rec;
decoder #(N-1) decoder_rec(binary[N-2:0], output_rec);
wire top = binary[N-1];
assign unary = {output_rec & {2**(N-1){top}}, output_rec & {2**(N-1){!top}}};
end
endgenerate

endmodule

module decoder_tb;

wire [15:0] unary;
decoder decoder1(4'd5, unary);
p0: assert final (unary == 'b0000_0000_0001_0000); // 16

endmodule