Skip to content

Commit 0eaa4a0

Browse files
author
Oron Port
committed
Further workaround for verilator/verilator#6893
1 parent f651006 commit 0eaa4a0

File tree

10 files changed

+21
-0
lines changed

10 files changed

+21
-0
lines changed

compiler/stages/src/main/scala/dfhdl/compiler/stages/verilog/VerilogTypePrinter.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,15 @@ protected trait VerilogTypePrinter extends AbstractTypePrinter:
5656
dfType.entries.view
5757
.map((n, v) => s"`${enumName}_${n}: $funcName = \"${enumName}_${n}\";")
5858
.mkString("\n").hindent(2)
59+
// workaround for verilator bug: https://github.com/verilator/verilator/issues/6893
5960
s"""|function [8*${maxCharWidth}:1] $funcName;
61+
| /* verilator lint_off UNUSEDSIGNAL */
6062
| input [${dfType.width - 1}:0] value;
6163
| case (value)
6264
|${cases}
6365
| default: $funcName = "?";
6466
| endcase
67+
| /* verilator lint_on UNUSEDSIGNAL */
6568
|endfunction""".stripMargin
6669
end csDFEnumToStringFuncDcl
6770
def csDFEnumDcl(dfType: DFEnum, global: Boolean): String =

compiler/stages/src/test/scala/StagesSpec/PrintVerilogCodeSpec.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,13 +1163,15 @@ class PrintVerilogCodeSpec extends StageSpec:
11631163
| `define MyEnum_B 1
11641164
| `define MyEnum_C 2
11651165
| function [8*8:1] MyEnum_to_string;
1166+
| /* verilator lint_off UNUSEDSIGNAL */
11661167
| input [1:0] value;
11671168
| case (value)
11681169
| `MyEnum_A: MyEnum_to_string = "MyEnum_A";
11691170
| `MyEnum_B: MyEnum_to_string = "MyEnum_B";
11701171
| `MyEnum_C: MyEnum_to_string = "MyEnum_C";
11711172
| default: MyEnum_to_string = "?";
11721173
| endcase
1174+
| /* verilator lint_on UNUSEDSIGNAL */
11731175
| endfunction
11741176
| parameter bar = {param, "!"};
11751177
| parameter param2 = {2{param}};

lib/src/test/resources/ref/docExamples.ALUSpec/verilog.v2001/hdl/ALU_defs.vh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
`define ALUSel_COPY1 10
1818

1919
function [8*12:1] ALUSel_to_string;
20+
/* verilator lint_off UNUSEDSIGNAL */
2021
input [3:0] value;
2122
case (value)
2223
`ALUSel_ADD: ALUSel_to_string = "ALUSel_ADD";
@@ -32,6 +33,7 @@ function [8*12:1] ALUSel_to_string;
3233
`ALUSel_COPY1: ALUSel_to_string = "ALUSel_COPY1";
3334
default: ALUSel_to_string = "?";
3435
endcase
36+
/* verilator lint_on UNUSEDSIGNAL */
3537
endfunction
3638
`undef ALU_DEFS_MODULE
3739
`endif

lib/src/test/resources/ref/docExamples.ALUSpec/verilog.v95/hdl/ALU_defs.vh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
`define ALUSel_COPY1 10
1818

1919
function [8*12:1] ALUSel_to_string;
20+
/* verilator lint_off UNUSEDSIGNAL */
2021
input [3:0] value;
2122
case (value)
2223
`ALUSel_ADD: ALUSel_to_string = "ALUSel_ADD";
@@ -32,6 +33,7 @@ function [8*12:1] ALUSel_to_string;
3233
`ALUSel_COPY1: ALUSel_to_string = "ALUSel_COPY1";
3334
default: ALUSel_to_string = "?";
3435
endcase
36+
/* verilator lint_on UNUSEDSIGNAL */
3537
endfunction
3638
`undef ALU_DEFS_MODULE
3739
`endif

lib/src/test/resources/ref/docExamples.UART_TxSpec/verilog.v2001/hdl/UART_Tx.v

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ module UART_Tx#(
2323
`define Status_StopBit 8
2424
`define Status_Finalize 16
2525
function [8*15:1] Status_to_string;
26+
/* verilator lint_off UNUSEDSIGNAL */
2627
input [4:0] value;
2728
case (value)
2829
`Status_Idle: Status_to_string = "Status_Idle";
@@ -32,6 +33,7 @@ module UART_Tx#(
3233
`Status_Finalize: Status_to_string = "Status_Finalize";
3334
default: Status_to_string = "?";
3435
endcase
36+
/* verilator lint_on UNUSEDSIGNAL */
3537
endfunction
3638
reg [4:0] status;
3739
reg [clog2(BIT_CLOCKS) - 1:0] bitClkCnt;

lib/src/test/resources/ref/docExamples.UART_TxSpec/verilog.v95/hdl/UART_Tx.v

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ module UART_Tx(
2222
`define Status_StopBit 8
2323
`define Status_Finalize 16
2424
function [8*15:1] Status_to_string;
25+
/* verilator lint_off UNUSEDSIGNAL */
2526
input [4:0] value;
2627
case (value)
2728
`Status_Idle: Status_to_string = "Status_Idle";
@@ -31,6 +32,7 @@ module UART_Tx(
3132
`Status_Finalize: Status_to_string = "Status_Finalize";
3233
default: Status_to_string = "?";
3334
endcase
35+
/* verilator lint_on UNUSEDSIGNAL */
3436
endfunction
3537
input wire clk;
3638
input wire rst;

lib/src/test/resources/ref/docExamples.ugdemos.demo4.LRShiftFlatSpec/verilog.v2001/hdl/LRShiftFlat_defs.vh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
`define ShiftDir_Right 1
99

1010
function [8*14:1] ShiftDir_to_string;
11+
/* verilator lint_off UNUSEDSIGNAL */
1112
input [0:0] value;
1213
case (value)
1314
`ShiftDir_Left: ShiftDir_to_string = "ShiftDir_Left";
1415
`ShiftDir_Right: ShiftDir_to_string = "ShiftDir_Right";
1516
default: ShiftDir_to_string = "?";
1617
endcase
18+
/* verilator lint_on UNUSEDSIGNAL */
1719
endfunction
1820
`undef LRSHIFTFLAT_DEFS_MODULE
1921
`endif

lib/src/test/resources/ref/docExamples.ugdemos.demo4.LRShiftFlatSpec/verilog.v95/hdl/LRShiftFlat_defs.vh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
`define ShiftDir_Right 1
99

1010
function [8*14:1] ShiftDir_to_string;
11+
/* verilator lint_off UNUSEDSIGNAL */
1112
input [0:0] value;
1213
case (value)
1314
`ShiftDir_Left: ShiftDir_to_string = "ShiftDir_Left";
1415
`ShiftDir_Right: ShiftDir_to_string = "ShiftDir_Right";
1516
default: ShiftDir_to_string = "?";
1617
endcase
18+
/* verilator lint_on UNUSEDSIGNAL */
1719
endfunction
1820
`undef LRSHIFTFLAT_DEFS_MODULE
1921
`endif

lib/src/test/resources/ref/docExamples.ugdemos.demo5.LRShiftDirectSpec/verilog.v2001/hdl/LRShiftDirect_defs.vh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
`define ShiftDir_Right 1
99

1010
function [8*14:1] ShiftDir_to_string;
11+
/* verilator lint_off UNUSEDSIGNAL */
1112
input [0:0] value;
1213
case (value)
1314
`ShiftDir_Left: ShiftDir_to_string = "ShiftDir_Left";
1415
`ShiftDir_Right: ShiftDir_to_string = "ShiftDir_Right";
1516
default: ShiftDir_to_string = "?";
1617
endcase
18+
/* verilator lint_on UNUSEDSIGNAL */
1719
endfunction
1820
`undef LRSHIFTDIRECT_DEFS_MODULE
1921
`endif

lib/src/test/resources/ref/docExamples.ugdemos.demo5.LRShiftDirectSpec/verilog.v95/hdl/LRShiftDirect_defs.vh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
`define ShiftDir_Right 1
99

1010
function [8*14:1] ShiftDir_to_string;
11+
/* verilator lint_off UNUSEDSIGNAL */
1112
input [0:0] value;
1213
case (value)
1314
`ShiftDir_Left: ShiftDir_to_string = "ShiftDir_Left";
1415
`ShiftDir_Right: ShiftDir_to_string = "ShiftDir_Right";
1516
default: ShiftDir_to_string = "?";
1617
endcase
18+
/* verilator lint_on UNUSEDSIGNAL */
1719
endfunction
1820
`undef LRSHIFTDIRECT_DEFS_MODULE
1921
`endif

0 commit comments

Comments
 (0)