Project

General

Profile

[logo] 
 
Home
About/Contact
Major Tools
  Dinotrace
  Verilator
  Verilog-mode
  Verilog-Perl
Other Tools
  IPC::Locker
  Parallel::Forker
  Voneline
General Info
  Papers

Issue #1614

Updated by Wilson Snyder 8 months ago

Minimal case below

<pre>


1 function automatic integer min(input integer a, input integer b);
2 return (a < b) ? a : b;
3 endfunction
4
5
6 module fail #(parameter A=16, parameter B=8)
7 (input [A-1:0] a,
8 input [B-1:0] b,
9 output logic [min(A,B)-1:0] c);
10
11 always_comb
12 for (int i = 0; i < min(A,B); i++)
13 assign c[i] = a[i] | b[i];
14
15 endmodule

[mhayenga@euphoria verilator_test]$ verilator -sv fail.sv --cc -Wall
[mhayenga@euphoria verilator_test]$ cd obj_dir/
[mhayenga@euphoria obj_dir]$ make -f Vfail.mk
/usr/bin/perl /usr/local/share/verilator/bin/verilator_includer -DVL_INCLUDE_OPT=include Vfail.cpp Vfail___024unit.cpp > Vfail__ALLcls.cpp
g++ -I. -MMD -I/usr/local/share/verilator/include -I/usr/local/share/verilator/include/vltstd -DVL_PRINTF=printf -DVM_COVERAGE=0 -DVM_SC=0 -DVM_TRACE=0 -faligned-new -fcf-protection=none -Wno-bool-operation -Wno-sign-compare -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-shadow -c -o Vfail__ALLcls.o Vfail__ALLcls.cpp
In file included from Vfail__ALLcls.cpp:3:
Vfail.cpp: In static member function ‘static void Vfail::_combo__TOP__1(Vfail__Syms*)’:
Vfail.cpp:133:9: error: duplicate label ‘__Vlabel1’
133 | __Vlabel1: ;
| ^~~~~~~~~
Vfail.cpp: In static member function ‘static void Vfail::_settle__TOP__2(Vfail__Syms*)’:
Vfail.cpp:174:9: error: duplicate label ‘__Vlabel2’
174 | __Vlabel2: ;
| ^~~~~~~~~
make: *** [/usr/local/share/verilator/include/verilated.mk:183: Vfail__ALLcls.o] Error 1
</pre>



The issue goes away if the code is changed to the following

<pre>


1 function automatic integer min(input integer a, input integer b);
2 return (a < b) ? a : b;
3 endfunction
4
5
6 module fail #(parameter A=16, parameter B=8)
7 (input [A-1:0] a,
8 input [B-1:0] b,
9 output logic [min(A,B)-1:0] c);
10
11 localparam EFF_LEN = min(A,B);
12 always_comb
13 for (int i = 0; i < EFF_LEN; i++)
14 assign c[i] = a[i] | b[i];
15
16 endmodule
</pre>


Back