Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
veripoolbot opened this issue Nov 25, 2019 · 3 comments
Assignees
Labels
resolution: fixed Closed; fixed

Comments

@veripoolbot
Copy link
Contributor


Author Name: Mitch Hayenga
Original Redmine Issue: 1614 from https://www.veripool.org

Original Assignee: Wilson Snyder (@wsnyder)


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

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2019-11-26T18:44:39Z


Will take a look.

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

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2019-12-01T22:20:02Z


Fixed in git towards eventual 4.024 release.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2019-12-08T13:11:42Z


In 4.024.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution: fixed Closed; fixed
Projects
None yet
Development

No branches or pull requests

2 participants