Project

General

Profile

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

Issue #1614

Multiple label redefinition/parsing issue for constant functions used in computational loops

Added by Mitch Hayenga 15 days ago. Updated 2 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
TranslationError
% Done:

0%


Description

Minimal case below

  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

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

  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

History

#1 Updated by Wilson Snyder 14 days ago

  • Status changed from New to Confirmed

Will take a look.

You might also be able to work around it by replacing the return with "min=..."

#2 Updated by Wilson Snyder 9 days ago

  • Description updated (diff)
  • Category set to TranslationError

#3 Updated by Wilson Snyder 9 days ago

  • Status changed from Confirmed to Resolved
  • Assignee set to Wilson Snyder

Fixed in git towards eventual 4.024 release.

#4 Updated by Wilson Snyder 2 days ago

  • Status changed from Resolved to Closed

In 4.024.

Also available in: Atom