[logo] 
 
Home
News
Activity
About/Contact
Major Tools
  Dinotrace
  Verilator
  Verilog-mode
  Verilog-Perl
Other Tools
  BugVise
  CovVise
  Force-Gate-Sim
  Gspice
  IPC::Locker
  Rsvn
  SVN::S4
  SystemPerl
  Voneline
  WFH
General Info
  Papers

Issue #491

%Error: ...: Expected integral (non-real) input to ITORD

Added by Alex Solomatnikov about 1 year ago. Updated 10 months ago.

Status:Closed Start date:04/24/2012
Priority:Normal Due date:
Assignee:Wilson Snyder % Done:

0%

Category:TranslationError
Target version:-

Description

Not a very descriptive error message, sounds like an internal error message about verilator limitation.

Source code:

module a
...
        real reference_clock_period_value;
        integer period_high;
        integer period_low;
        integer counter_N;
        integer counter_M;
        real diff_before, diff_after;
...
generate
if ( valid_param == 1 )
begin : no_need_to_gen
        initial
        begin
...
        diff_before = abs(counter_M *(period_high + period_low) - counter_N * reference_clock_period_value);

The error is on the last line.

History

Updated by Alex Solomatnikov about 1 year ago

I should add that function definition is under package:

package a_functions;
...
        function real abs (real num);
                abs = (num <0) ? -num : num;
        endfunction
...
endpackage

which is imported by the module. So, it is probably related to package issues.

Updated by Alex Solomatnikov about 1 year ago

The workaround that worked for this:

`define ABS(x) ((x<0)?-x:x)

So, it does look like an issue with function from package.

Updated by Wilson Snyder about 1 year ago

I believe this is related to bug490. Please try the git version.

Updated by Alex Solomatnikov about 1 year ago

I am not sure. After bug490 fix, I got another set of errors on the same source file, including internal error:

%Error: ...: Expecting expression to be constant, but can't determine constant for FUNCREF 'is_period'
%Error: ...: ... Location of non-constant VARREF 'MAX_STRING_LENGTH': Language violation: reference to non-function-local variable
%Error: ...: Expecting expression to be constant, but can't determine constant for FUNCREF 'get_real_value'
%Error: ...: ... Location of non-constant VARREF 'MAX_STRING_LENGTH': Language violation: reference to non-function-local variable
%Error: ...: Expecting expression to be constant, but can't determine constant for FUNCREF 'get_real_value'
%Error: ...: ... Location of non-constant VARREF 'MAX_STRING_LENGTH': Language violation: reference to non-function-local variable
%Error: Internal Error: ...: ../V3Number.cpp:520: Real conversion on non real number

This version of file was hacked a bit to get around bug474, i.e. a couple of parameters were moved out of packages/modules in the beginning of the file to avoid conflicts:

localparam MEM_INIT_STRING_LENGTH = 512;
localparam MAX_STRING_LENGTH      = 20;

package a_functions;
...

Updated by Alex Solomatnikov about 1 year ago

After I re-produced exactly the same source code as when this bug was filed, I got exactly the same errors.

So, fix for bug490 does not fix this issue.

Updated by Alex Solomatnikov about 1 year ago

Here is gdb backtrace after bug490 fix:

Breakpoint 1, WidthVisitor::checkCvtUS (this=0x7fffffff6790, nodep=0x14ddc7b0) at ../V3Width.cpp:1827
1827            nodep->v3error("Expected integral (non-real) input to "<<nodep->backp()->prettyTypeName());
(gdb) bt
#0  WidthVisitor::checkCvtUS (this=0x7fffffff6790, nodep=0x14ddc7b0) at ../V3Width.cpp:1827
#1  0x00000000006382df in WidthVisitor::visit_Or_Ls32 (this=0x7fffffff6790, nodep=0x14ddc870, vup=0x7fffffff5af0) at ../V3Width.cpp:1322
#2  0x000000000062f1b7 in WidthVisitor::visit (this=0x7fffffff6790, nodep=0x14ddc870, vup=0x7fffffff5af0) at ../V3Width.cpp:240
#3  0x000000000043750b in AstIToRD::accept (this=0x14ddc870, v=..., vup=0x7fffffff5af0) at ../V3AstNodes.h:2797
#4  0x0000000000637cbd in WidthVisitor::visit (this=0x7fffffff6790, nodep=0xb98990, vup=0x7fffffff5c90) at ../V3Width.cpp:1268
#5  0x0000000000637390 in WidthVisitor::visit (this=0x7fffffff6790, nodep=0xb98990, vup=0x7fffffff5c90) at ../V3Width.cpp:1209
#6  0x000000000042d3c5 in AstFuncRef::accept (this=0xb98990, v=..., vup=0x7fffffff5c90) at ../V3AstNodes.h:1277
#7  0x0000000000488f7f in AstNode::iterateAndNext (this=0xb98990, v=..., vup=0x7fffffff5c90) at ../V3Ast.cpp:776
#8  0x0000000000638910 in WidthVisitor::visit_cmp_O1_DSreplace (this=0x7fffffff6790, nodep=0xb26290, vup=0x7fffffff5e20) at ../V3Width.cpp:1397
#9  0x000000000062e791 in WidthVisitor::visit (this=0x7fffffff6790, nodep=0xb26290, vup=0x7fffffff5e20) at ../V3Width.cpp:161
#10 0x000000000043cf97 in AstGt::accept (this=0xb26290, v=..., vup=0x7fffffff5e20) at ../V3AstNodes.h:3250
#11 0x0000000000488f7f in AstNode::iterateAndNext (this=0xb26290, v=..., vup=0x7fffffff5e20) at ../V3Ast.cpp:776
#12 0x00000000006351e3 in WidthVisitor::visit (this=0x7fffffff6790, nodep=0xb27430) at ../V3Width.cpp:924
#13 0x000000000047795f in AstNVisitor::visit (this=0x7fffffff6790, nodep=0xb27430, vup=0x0) at ./V3Ast__gen_visitor.h:95
#14 0x00000000004336d9 in AstIf::accept (this=0xb27430, v=..., vup=0x0) at ../V3AstNodes.h:2171
#15 0x0000000000488f7f in AstNode::iterateAndNext (this=0x1024f90, v=..., vup=0x0) at ../V3Ast.cpp:776
#16 0x0000000000488dd1 in AstNode::iterateChildren (this=0x10248c0, v=..., vup=0x0) at ../V3Ast.cpp:757
#17 0x0000000000638158 in WidthVisitor::visit (this=0x7fffffff6790, nodep=0x10248c0, vup=0x0) at ../V3Width.cpp:1301
#18 0x000000000047665f in AstNVisitor::visit (this=0x7fffffff6790, nodep=0x10248c0, vup=0x0) at ./V3Ast__gen_visitor.h:19
#19 0x0000000000494f4d in AstBegin::accept (this=0x10248c0, v=..., vup=0x0) at ../V3AstNodes.h:1181
#20 0x0000000000488f7f in AstNode::iterateAndNext (this=0x10248c0, v=..., vup=0x0) at ../V3Ast.cpp:776
#21 0x000000000063517b in WidthVisitor::visit (this=0x7fffffff6790, nodep=0xb27270) at ../V3Width.cpp:921
#22 0x000000000047795f in AstNVisitor::visit (this=0x7fffffff6790, nodep=0xb27270, vup=0x0) at ./V3Ast__gen_visitor.h:95
#23 0x00000000004336d9 in AstIf::accept (this=0xb27270, v=..., vup=0x0) at ../V3AstNodes.h:2171
#24 0x0000000000488f7f in AstNode::iterateAndNext (this=0x1024240, v=..., vup=0x0) at ../V3Ast.cpp:776
#25 0x0000000000488dd1 in AstNode::iterateChildren (this=0x1023d80, v=..., vup=0x0) at ../V3Ast.cpp:757
#26 0x0000000000638158 in WidthVisitor::visit (this=0x7fffffff6790, nodep=0x1023d80, vup=0x0) at ../V3Width.cpp:1301
#27 0x000000000047665f in AstNVisitor::visit (this=0x7fffffff6790, nodep=0x1023d80, vup=0x0) at ./V3Ast__gen_visitor.h:19
#28 0x0000000000494f4d in AstBegin::accept (this=0x1023d80, v=..., vup=0x0) at ../V3AstNodes.h:1181
#29 0x0000000000488f7f in AstNode::iterateAndNext (this=0x10230d0, v=..., vup=0x0) at ../V3Ast.cpp:776
#30 0x0000000000488e21 in AstNode::iterateChildren (this=0x1022d80, v=..., vup=0x0) at ../V3Ast.cpp:759
#31 0x0000000000637105 in WidthVisitor::visit (this=0x7fffffff6790, nodep=0x1022d80, vup=0x0) at ../V3Width.cpp:1184
#32 0x000000000047761f in AstNVisitor::visit (this=0x7fffffff6790, nodep=0x1022d80, vup=0x0) at ./V3Ast__gen_visitor.h:82
#33 0x000000000042cedd in AstFunc::accept (this=0x1022d80, v=..., vup=0x0) at ../V3AstNodes.h:1258
#34 0x0000000000488f7f in AstNode::iterateAndNext (this=0x1021b60, v=..., vup=0x0) at ../V3Ast.cpp:776
#35 0x0000000000488df9 in AstNode::iterateChildren (this=0x1021900, v=..., vup=0x0) at ../V3Ast.cpp:758
#36 0x0000000000638158 in WidthVisitor::visit (this=0x7fffffff6790, nodep=0x1021900, vup=0x0) at ../V3Width.cpp:1301
#37 0x000000000047849f in AstNVisitor::visit (this=0x7fffffff6790, nodep=0x1021900, vup=0x0) at ./V3Ast__gen_visitor.h:141
#38 0x000000000047885f in AstNVisitor::visit (this=0x7fffffff6790, nodep=0x1021900, vup=0x0) at ./V3Ast__gen_visitor.h:156
#39 0x000000000042ba13 in AstPackage::accept (this=0x1021900, v=..., vup=0x0) at ../V3AstNodes.h:1062
#40 0x0000000000489046 in AstNode::iterateListBackwards (this=0x5e40a20, v=..., vup=0x0) at ../V3Ast.cpp:794
#41 0x00000000004890cc in AstNode::iterateChildrenBackwards (this=0xab8bc0, v=..., vup=0x0) at ../V3Ast.cpp:802
#42 0x0000000000637fcc in WidthVisitor::visit (this=0x7fffffff6790, nodep=0xab8bc0) at ../V3Width.cpp:1289
#43 0x0000000000475ddb in AstNetlist::accept (this=0xab8bc0, v=..., vup=0x7fffffff6760) at ../V3AstNodes.h:4183
#44 0x00000000004891fd in AstNode::acceptSubtreeReturnEdits (this=0xab8bc0, v=..., vup=0x7fffffff6760) at ../V3Ast.cpp:828
#45 0x000000000063debb in WidthVisitor::mainAcceptEdit (this=0x7fffffff6790, nodep=0xab8bc0) at ../V3Width.cpp:1991
#46 0x00000000006296c1 in V3Width::width (nodep=0xab8bc0) at ../V3Width.cpp:2003
#47 0x000000000046f417 in process () at ../Verilator.cpp:189
#48 0x000000000047491c in main (argc=212, argv=0x7fffffff75b8, env=0x7fffffff7c60) at ../Verilator.cpp:668
(gdb) p *nodep
$1 = {_vptr.AstNode = 0x6f0cf0, m_nextp = 0x0, m_backp = 0x14ddc870, m_op1p = 0xbf82500, m_op2p = 0xbf82690, m_op3p = 0x0, m_op4p = 0x0, m_iterpp = 0x0, m_headtailp = 0x14ddc7b0, m_fileline = 0xbf82430, m_editCount = 3453713, 
  static s_editCntGbl = 3453714, static s_editCntLast = 2926804, m_clonep = 0x0, m_cloneCnt = 0, static s_cloneCntGbl = 47361, m_numeric = 2, m_didWidth = false, m_doingWidth = false, m_width = 64, m_widthMin = 64, m_user1p = 0x0, 
  m_user1Cnt = 0, m_user2Cnt = 0, m_user2p = 0x0, m_user3p = 0x0, m_user3Cnt = 0, m_user4Cnt = 0, m_user4p = 0x0, m_user5p = 0x0, m_user5Cnt = 0}
(gdb) p nodep->backp()->prettyTypeName()
$3 = "ITORD" 
(gdb) up
#1  0x00000000006382df in WidthVisitor::visit_Or_Ls32 (this=0x7fffffff6790, nodep=0x14ddc870, vup=0x7fffffff5af0) at ../V3Width.cpp:1322
1322            checkCvtUS(nodep->lhsp());
(gdb) p *nodep
$4 = {<AstNodeMath> = {<AstNode> = {_vptr.AstNode = 0x669770, m_nextp = 0x0, m_backp = 0xb98990, m_op1p = 0x14ddc7b0, m_op2p = 0x0, m_op3p = 0x0, m_op4p = 0x0, m_iterpp = 0x0, m_headtailp = 0x14ddc870, m_fileline = 0xbf82430, 
      m_editCount = 3453714, static s_editCntGbl = 3453714, static s_editCntLast = 2926804, m_clonep = 0x0, m_cloneCnt = 0, static s_cloneCntGbl = 47361, m_numeric = 2, m_didWidth = false, m_doingWidth = false, m_width = 64, 
      m_widthMin = 64, m_user1p = 0x0, m_user1Cnt = 0, m_user2Cnt = 0, m_user2p = 0x0, m_user3p = 0x0, m_user3Cnt = 0, m_user4Cnt = 0, m_user4p = 0x0, m_user5p = 0x0, m_user5Cnt = 0}, <No data fields>}, <No data fields>}
(gdb) p nodep->backp()->prettyTypeName()
$6 = "FUNCREF 'ABS'" 
(gdb) up
#2  0x000000000062f1b7 in WidthVisitor::visit (this=0x7fffffff6790, nodep=0x14ddc870, vup=0x7fffffff5af0) at ../V3Width.cpp:240
240        virtual void visit(AstIToRD* nodep, AstNUser* vup) {    visit_Or_Ls32(nodep,vup); }
(gdb) up
#3  0x000000000043750b in AstIToRD::accept (this=0x14ddc870, v=..., vup=0x7fffffff5af0) at ../V3AstNodes.h:2797
2797        ASTNODE_NODE_FUNCS(IToRD, ITORD)
(gdb) p *this
$14 = {<AstNodeUniop> = {<AstNodeMath> = {<AstNode> = {_vptr.AstNode = 0x669770, m_nextp = 0x0, m_backp = 0xb98990, m_op1p = 0x14ddc7b0, m_op2p = 0x0, m_op3p = 0x0, m_op4p = 0x0, m_iterpp = 0x0, m_headtailp = 0x14ddc870, 
        m_fileline = 0xbf82430, m_editCount = 3453714, static s_editCntGbl = 3453714, static s_editCntLast = 2926804, m_clonep = 0x0, m_cloneCnt = 0, static s_cloneCntGbl = 47361, m_numeric = 2, m_didWidth = false, 
        m_doingWidth = false, m_width = 64, m_widthMin = 64, m_user1p = 0x0, m_user1Cnt = 0, m_user2Cnt = 0, m_user2p = 0x0, m_user3p = 0x0, m_user3Cnt = 0, m_user4Cnt = 0, m_user4p = 0x0, m_user5p = 0x0, 
        m_user5Cnt = 0}, <No data fields>}, <No data fields>}, <No data fields>}
(gdb) up
#4  0x0000000000637cbd in WidthVisitor::visit (this=0x7fffffff6790, nodep=0xb98990, vup=0x7fffffff5c90) at ../V3Width.cpp:1268
1268                pinp->accept(*this,WidthVP(portp->width(),portp->widthMin(),BOTH).p());
(gdb) p *nodep
$15 = {<AstNode> = {_vptr.AstNode = 0x66cb70, m_nextp = 0x0, m_backp = 0xb26290, m_op1p = 0x0, m_op2p = 0x14ddc870, m_op3p = 0x0, m_op4p = 0x0, m_iterpp = 0x7fffffff5c28, m_headtailp = 0xb98990, m_fileline = 0xbf82360, 
    m_editCount = 32257, static s_editCntGbl = 3453714, static s_editCntLast = 2926804, m_clonep = 0x0, m_cloneCnt = 0, static s_cloneCntGbl = 47361, m_numeric = 0, m_didWidth = false, m_doingWidth = false, m_width = 0, 
    m_widthMin = 0, m_user1p = 0x1, m_user1Cnt = 4, m_user2Cnt = 1, m_user2p = 0x1, m_user3p = 0x0, m_user3Cnt = 0, m_user4Cnt = 0, m_user4p = 0x0, m_user5p = 0x0, m_user5Cnt = 0}, m_taskp = 0x1021b60, m_name = "ABS", m_dotted = "", 
  m_inlinedDots = "", m_packagep = 0x1021900}
(gdb) p nodep->backp()->prettyTypeName()
$17 = "GT" 
(gdb) up
#5  0x0000000000637390 in WidthVisitor::visit (this=0x7fffffff6790, nodep=0xb98990, vup=0x7fffffff5c90) at ../V3Width.cpp:1209
1209        visit(nodep->castNodeFTaskRef(), vup);
(gdb) p *nodep
$18 = {<AstNodeFTaskRef> = {<AstNode> = {_vptr.AstNode = 0x66cb70, m_nextp = 0x0, m_backp = 0xb26290, m_op1p = 0x0, m_op2p = 0x14ddc870, m_op3p = 0x0, m_op4p = 0x0, m_iterpp = 0x7fffffff5c28, m_headtailp = 0xb98990, 
      m_fileline = 0xbf82360, m_editCount = 32257, static s_editCntGbl = 3453714, static s_editCntLast = 2926804, m_clonep = 0x0, m_cloneCnt = 0, static s_cloneCntGbl = 47361, m_numeric = 0, m_didWidth = false, m_doingWidth = false, 
      m_width = 0, m_widthMin = 0, m_user1p = 0x1, m_user1Cnt = 4, m_user2Cnt = 1, m_user2p = 0x1, m_user3p = 0x0, m_user3Cnt = 0, m_user4Cnt = 0, m_user4p = 0x0, m_user5p = 0x0, m_user5Cnt = 0}, m_taskp = 0x1021b60, m_name = "ABS", 
    m_dotted = "", m_inlinedDots = "", m_packagep = 0x1021900}, <No data fields>}
(gdb) p nodep->backp()->prettyTypeName()
$19 = "GT" 
(gdb) up
#6  0x000000000042d3c5 in AstFuncRef::accept (this=0xb98990, v=..., vup=0x7fffffff5c90) at ../V3AstNodes.h:1277
1277        ASTNODE_NODE_FUNCS(FuncRef, FUNCREF)
(gdb) up
#7  0x0000000000488f7f in AstNode::iterateAndNext (this=0xb98990, v=..., vup=0x7fffffff5c90) at ../V3Ast.cpp:776
776        niterp->accept(v, vup);
(gdb) up
#8  0x0000000000638910 in WidthVisitor::visit_cmp_O1_DSreplace (this=0x7fffffff6790, nodep=0xb26290, vup=0x7fffffff5e20) at ../V3Width.cpp:1397
1397            nodep->lhsp()->iterateAndNext(*this,WidthVP(ANYSIZE,0,PRELIM).p());
(gdb) p *nodep
$20 = {<AstNodeMath> = {<AstNode> = {_vptr.AstNode = 0x667690, m_nextp = 0x0, m_backp = 0xb27430, m_op1p = 0xb98990, m_op2p = 0xbf82820, m_op3p = 0x0, m_op4p = 0x0, m_iterpp = 0x7fffffff5db8, m_headtailp = 0xb26290, 
      m_fileline = 0xbf82310, m_editCount = 32268, static s_editCntGbl = 3453714, static s_editCntLast = 2926804, m_clonep = 0x0, m_cloneCnt = 0, static s_cloneCntGbl = 47361, m_numeric = 0, m_didWidth = false, m_doingWidth = false, 
      m_width = 1, m_widthMin = 1, m_user1p = 0x0, m_user1Cnt = 0, m_user2Cnt = 1, m_user2p = 0x1, m_user3p = 0x0, m_user3Cnt = 0, m_user4Cnt = 0, m_user4p = 0x0, m_user5p = 0x0, m_user5Cnt = 0}, <No data fields>}, <No data fields>}
(gdb) p nodep->backp()->prettyTypeName()
$21 = "IF" 
(gdb) up
#9  0x000000000062e791 in WidthVisitor::visit (this=0x7fffffff6790, nodep=0xb26290, vup=0x7fffffff5e20) at ../V3Width.cpp:161
161        virtual void visit(AstGt* nodep, AstNUser* vup) {        visit_cmp_O1_DSreplace(nodep,vup); }
(gdb) up
#10 0x000000000043cf97 in AstGt::accept (this=0xb26290, v=..., vup=0x7fffffff5e20) at ../V3AstNodes.h:3250
3250        ASTNODE_NODE_FUNCS(Gt, GT)
(gdb) up
#11 0x0000000000488f7f in AstNode::iterateAndNext (this=0xb26290, v=..., vup=0x7fffffff5e20) at ../V3Ast.cpp:776
776        niterp->accept(v, vup);
(gdb) up
#12 0x00000000006351e3 in WidthVisitor::visit (this=0x7fffffff6790, nodep=0xb27430) at ../V3Width.cpp:924
924        nodep->condp()->iterateAndNext(*this,WidthVP(1,1,PRELIM).p());
(gdb) p *nodep
$22 = {<AstNodeStmt> = {<AstNode> = {_vptr.AstNode = 0x66adf0, m_nextp = 0x0, m_backp = 0x1024f90, m_op1p = 0xb26290, m_op2p = 0xb25550, m_op3p = 0x0, m_op4p = 0x0, m_iterpp = 0x7fffffff5f08, m_headtailp = 0x1024f90, 
      m_fileline = 0xb24e30, m_editCount = 32269, static s_editCntGbl = 3453714, static s_editCntLast = 2926804, m_clonep = 0x0, m_cloneCnt = 0, static s_cloneCntGbl = 47361, m_numeric = 0, m_didWidth = false, m_doingWidth = false, 
      m_width = 0, m_widthMin = 0, m_user1p = 0x0, m_user1Cnt = 0, m_user2Cnt = 1, m_user2p = 0x1, m_user3p = 0x0, m_user3Cnt = 0, m_user4Cnt = 0, m_user4p = 0x0, m_user5p = 0x0, m_user5Cnt = 0}, <No data fields>}, m_branchPred = {
    m_e = BP_UNKNOWN}}
(gdb) p nodep->backp()->prettyTypeName()
$23 = "ASSIGN" 
(gdb) up
#13 0x000000000047795f in AstNVisitor::visit (this=0x7fffffff6790, nodep=0xb27430, vup=0x0) at ./V3Ast__gen_visitor.h:95
95        virtual void visit(AstIf* nodep, AstNUser* vup) { visit((AstNodeIf*)(nodep),vup); }
(gdb) up
#14 0x00000000004336d9 in AstIf::accept (this=0xb27430, v=..., vup=0x0) at ../V3AstNodes.h:2171
2171        ASTNODE_NODE_FUNCS(If, IF)
(gdb) up
#15 0x0000000000488f7f in AstNode::iterateAndNext (this=0x1024f90, v=..., vup=0x0) at ../V3Ast.cpp:776
776        niterp->accept(v, vup);
(gdb) up
#16 0x0000000000488dd1 in AstNode::iterateChildren (this=0x10248c0, v=..., vup=0x0) at ../V3Ast.cpp:757
757        if (m_op1p) m_op1p->iterateAndNext(v, vup);
(gdb) up
#17 0x0000000000638158 in WidthVisitor::visit (this=0x7fffffff6790, nodep=0x10248c0, vup=0x0) at ../V3Width.cpp:1301
1301        nodep->iterateChildren(*this);
(gdb) p *nodep
$24 = {_vptr.AstNode = 0x692610, m_nextp = 0x0, m_backp = 0xb27270, m_op1p = 0x1024f90, m_op2p = 0x0, m_op3p = 0x0, m_op4p = 0x0, m_iterpp = 0x7fffffff6058, m_headtailp = 0x10248c0, m_fileline = 0x1024830, m_editCount = 32225, 
  static s_editCntGbl = 3453714, static s_editCntLast = 2926804, m_clonep = 0x0, m_cloneCnt = 0, static s_cloneCntGbl = 47361, m_numeric = 0, m_didWidth = false, m_doingWidth = false, m_width = 0, m_widthMin = 0, m_user1p = 0x0, 
  m_user1Cnt = 0, m_user2Cnt = 1, m_user2p = 0x1, m_user3p = 0x0, m_user3Cnt = 0, m_user4Cnt = 3, m_user4p = 0xa0901b0, m_user5p = 0x0, m_user5Cnt = 0}
(gdb) p nodep->backp()->prettyTypeName()
$25 = "IF" 
(gdb) up
#18 0x000000000047665f in AstNVisitor::visit (this=0x7fffffff6790, nodep=0x10248c0, vup=0x0) at ./V3Ast__gen_visitor.h:19
19        virtual void visit(AstBegin* nodep, AstNUser* vup) { visit((AstNode*)(nodep),vup); }
(gdb) up
#19 0x0000000000494f4d in AstBegin::accept (this=0x10248c0, v=..., vup=0x0) at ../V3AstNodes.h:1181
1181        ASTNODE_NODE_FUNCS(Begin, BEGIN)
(gdb) up
#20 0x0000000000488f7f in AstNode::iterateAndNext (this=0x10248c0, v=..., vup=0x0) at ../V3Ast.cpp:776
776        niterp->accept(v, vup);
(gdb) up
#21 0x000000000063517b in WidthVisitor::visit (this=0x7fffffff6790, nodep=0xb27270) at ../V3Width.cpp:921
921            nodep->ifsp()->iterateAndNext(*this);
(gdb) p *nodep
$26 = {<AstNodeStmt> = {<AstNode> = {_vptr.AstNode = 0x66adf0, m_nextp = 0xb269b0, m_backp = 0x1024240, m_op1p = 0x1024770, m_op2p = 0x10248c0, m_op3p = 0x0, m_op4p = 0x0, m_iterpp = 0x7fffffff61a8, m_headtailp = 0x0, 
      m_fileline = 0x1024300, m_editCount = 32272, static s_editCntGbl = 3453714, static s_editCntLast = 2926804, m_clonep = 0x0, m_cloneCnt = 0, static s_cloneCntGbl = 47361, m_numeric = 0, m_didWidth = false, m_doingWidth = false, 
      m_width = 0, m_widthMin = 0, m_user1p = 0x0, m_user1Cnt = 0, m_user2Cnt = 1, m_user2p = 0x1, m_user3p = 0x0, m_user3Cnt = 0, m_user4Cnt = 0, m_user4p = 0x0, m_user5p = 0x0, m_user5Cnt = 0}, <No data fields>}, m_branchPred = {
    m_e = BP_UNKNOWN}}
(gdb) p nodep->backp()->prettyTypeName()
$27 = "ASSIGN" 
(gdb) up
#22 0x000000000047795f in AstNVisitor::visit (this=0x7fffffff6790, nodep=0xb27270, vup=0x0) at ./V3Ast__gen_visitor.h:95
95        virtual void visit(AstIf* nodep, AstNUser* vup) { visit((AstNodeIf*)(nodep),vup); }
(gdb) up
#23 0x00000000004336d9 in AstIf::accept (this=0xb27270, v=..., vup=0x0) at ../V3AstNodes.h:2171
2171        ASTNODE_NODE_FUNCS(If, IF)
(gdb) up
#24 0x0000000000488f7f in AstNode::iterateAndNext (this=0x1024240, v=..., vup=0x0) at ../V3Ast.cpp:776
776        niterp->accept(v, vup);
(gdb) i[
Undefined info command: "[".  Try "help info".
(gdb) up
#25 0x0000000000488dd1 in AstNode::iterateChildren (this=0x1023d80, v=..., vup=0x0) at ../V3Ast.cpp:757
757        if (m_op1p) m_op1p->iterateAndNext(v, vup);
(gdb) up
#26 0x0000000000638158 in WidthVisitor::visit (this=0x7fffffff6790, nodep=0x1023d80, vup=0x0) at ../V3Width.cpp:1301
1301        nodep->iterateChildren(*this);
(gdb) p *nodep
$28 = {_vptr.AstNode = 0x692610, m_nextp = 0x0, m_backp = 0x1023c20, m_op1p = 0x1024240, m_op2p = 0x0, m_op3p = 0x0, m_op4p = 0x0, m_iterpp = 0x7fffffff62f8, m_headtailp = 0x10230d0, m_fileline = 0x1023cf0, m_editCount = 32283, 
  static s_editCntGbl = 3453714, static s_editCntLast = 2926804, m_clonep = 0x0, m_cloneCnt = 0, static s_cloneCntGbl = 47361, m_numeric = 0, m_didWidth = false, m_doingWidth = false, m_width = 0, m_widthMin = 0, m_user1p = 0x0, 
  m_user1Cnt = 0, m_user2Cnt = 1, m_user2p = 0x1, m_user3p = 0x0, m_user3Cnt = 0, m_user4Cnt = 3, m_user4p = 0x9bba620, m_user5p = 0x0, m_user5Cnt = 0}
(gdb) p nodep->backp()->prettyTypeName()
$29 = "VAR 'result'" 
(gdb) up
#27 0x000000000047665f in AstNVisitor::visit (this=0x7fffffff6790, nodep=0x1023d80, vup=0x0) at ./V3Ast__gen_visitor.h:19
19        virtual void visit(AstBegin* nodep, AstNUser* vup) { visit((AstNode*)(nodep),vup); }
(gdb) up
#28 0x0000000000494f4d in AstBegin::accept (this=0x1023d80, v=..., vup=0x0) at ../V3AstNodes.h:1181
1181        ASTNODE_NODE_FUNCS(Begin, BEGIN)
(gdb) up
#29 0x0000000000488f7f in AstNode::iterateAndNext (this=0x10230d0, v=..., vup=0x0) at ../V3Ast.cpp:776
776        niterp->accept(v, vup);
(gdb) up
#30 0x0000000000488e21 in AstNode::iterateChildren (this=0x1022d80, v=..., vup=0x0) at ../V3Ast.cpp:759
759        if (m_op3p) m_op3p->iterateAndNext(v, vup);
(gdb) up
#31 0x0000000000637105 in WidthVisitor::visit (this=0x7fffffff6790, nodep=0x1022d80, vup=0x0) at ../V3Width.cpp:1184
1184        nodep->iterateChildren(*this);
(gdb) p *nodep
$30 = {<AstNode> = {_vptr.AstNode = 0x66cd30, m_nextp = 0xb267f0, m_backp = 0x1021b60, m_op1p = 0x2e38200, m_op2p = 0x0, m_op3p = 0x10230d0, m_op4p = 0x0, m_iterpp = 0x7fffffff6478, m_headtailp = 0x0, m_fileline = 0x1022bb0, 
    m_editCount = 32284, static s_editCntGbl = 3453714, static s_editCntLast = 2926804, m_clonep = 0x0, m_cloneCnt = 0, static s_cloneCntGbl = 47361, m_numeric = 0, m_didWidth = false, m_doingWidth = true, m_width = 0, 
    m_widthMin = 0, m_user1p = 0x1021900, m_user1Cnt = 5, m_user2Cnt = 1, m_user2p = 0x1, m_user3p = 0x69df020, m_user3Cnt = 1, m_user4Cnt = 3, m_user4p = 0x9baf2e0, m_user5p = 0x0, m_user5Cnt = 0}, m_name = 
    "is_refclk_out_of_range_abs", m_cname = "is_refclk_out_of_range_abs", m_taskPublic = false, m_attrIsolateAssign = false, m_prototype = false, m_dpiExport = false, m_dpiImport = false, m_dpiContext = false, m_dpiTask = false, 
  m_pure = false}
(gdb) p nodep->backp()->prettyTypeName()
$31 = "FUNC 'ABS'" 
(gdb) up
#32 0x000000000047761f in AstNVisitor::visit (this=0x7fffffff6790, nodep=0x1022d80, vup=0x0) at ./V3Ast__gen_visitor.h:82
82        virtual void visit(AstFunc* nodep, AstNUser* vup) { visit((AstNodeFTask*)(nodep),vup); }
(gdb) up
#33 0x000000000042cedd in AstFunc::accept (this=0x1022d80, v=..., vup=0x0) at ../V3AstNodes.h:1258
1258        ASTNODE_NODE_FUNCS(Func, FUNC)
(gdb) up
#34 0x0000000000488f7f in AstNode::iterateAndNext (this=0x1021b60, v=..., vup=0x0) at ../V3Ast.cpp:776
776        niterp->accept(v, vup);
(gdb) up
#35 0x0000000000488df9 in AstNode::iterateChildren (this=0x1021900, v=..., vup=0x0) at ../V3Ast.cpp:758
758        if (m_op2p) m_op2p->iterateAndNext(v, vup);
(gdb) up
#36 0x0000000000638158 in WidthVisitor::visit (this=0x7fffffff6790, nodep=0x1021900, vup=0x0) at ../V3Width.cpp:1301
1301        nodep->iterateChildren(*this);
(gdb) p *nodep
$32 = {_vptr.AstNode = 0x66d290, m_nextp = 0xe373a10, m_backp = 0xae1000, m_op1p = 0x0, m_op2p = 0x1021b60, m_op3p = 0x0, m_op4p = 0x0, m_iterpp = 0x0, m_headtailp = 0x0, m_fileline = 0x10217f0, m_editCount = 1080906, 
  static s_editCntGbl = 3453714, static s_editCntLast = 2926804, m_clonep = 0x0, m_cloneCnt = 0, static s_cloneCntGbl = 47361, m_numeric = 0, m_didWidth = false, m_doingWidth = false, m_width = 0, m_widthMin = 0, m_user1p = 0x37, 
  m_user1Cnt = 336, m_user2Cnt = 1, m_user2p = 0x1, m_user3p = 0xa5e7870, m_user3Cnt = 1, m_user4Cnt = 3, m_user4p = 0x69df020, m_user5p = 0x0, m_user5Cnt = 0}
(gdb) p nodep->backp()->prettyTypeName()
$33 = "PACKAGE 'altera_lnsim_functions'" 
(gdb) up
#37 0x000000000047849f in AstNVisitor::visit (this=0x7fffffff6790, nodep=0x1021900, vup=0x0) at ./V3Ast__gen_visitor.h:141
141        virtual void visit(AstNodeModule* nodep, AstNUser* vup) { visit((AstNode*)(nodep),vup); }
(gdb) up
#38 0x000000000047885f in AstNVisitor::visit (this=0x7fffffff6790, nodep=0x1021900, vup=0x0) at ./V3Ast__gen_visitor.h:156
156        virtual void visit(AstPackage* nodep, AstNUser* vup) { visit((AstNodeModule*)(nodep),vup); }
(gdb) up
#39 0x000000000042ba13 in AstPackage::accept (this=0x1021900, v=..., vup=0x0) at ../V3AstNodes.h:1062
1062        ASTNODE_NODE_FUNCS(Package, PACKAGE)
(gdb) up
#40 0x0000000000489046 in AstNode::iterateListBackwards (this=0x5e40a20, v=..., vup=0x0) at ../V3Ast.cpp:794
794        nodep->accept(v, vup);
(gdb) up
#41 0x00000000004890cc in AstNode::iterateChildrenBackwards (this=0xab8bc0, v=..., vup=0x0) at ../V3Ast.cpp:802
802        this->op1p()->iterateListBackwards(v,vup);
(gdb) up
#42 0x0000000000637fcc in WidthVisitor::visit (this=0x7fffffff6790, nodep=0xab8bc0) at ../V3Width.cpp:1289
1289        nodep->iterateChildrenBackwards(*this);
(gdb) p *nodep
$34 = {<AstNode> = {_vptr.AstNode = 0x688cb0, m_nextp = 0x0, m_backp = 0x0, m_op1p = 0x5e40a20, m_op2p = 0x0, m_op3p = 0x0, m_op4p = 0x0, m_iterpp = 0x0, m_headtailp = 0xab8bc0, m_fileline = 0xab8cb0, m_editCount = 1, 
    static s_editCntGbl = 3453714, static s_editCntLast = 2926804, m_clonep = 0x0, m_cloneCnt = 0, static s_cloneCntGbl = 47361, m_numeric = 0, m_didWidth = false, m_doingWidth = false, m_width = 0, m_widthMin = 0, m_user1p = 0x0, 
    m_user1Cnt = 0, m_user2Cnt = 1, m_user2p = 0x1, m_user3p = 0x0, m_user3Cnt = 0, m_user4Cnt = 3, m_user4p = 0xa5e7870, m_user5p = 0x0, m_user5Cnt = 0}, <No data fields>}
(gdb) p nodep->backp()->prettyTypeName()

Program received signal SIGSEGV, Segmentation fault.
0x0000000000485cc2 in AstNode::prettyTypeName (this=0x0) at ../V3Ast.cpp:203
203        if (name()=="") return typeName();

Updated by Wilson Snyder about 1 year ago

I think I'm going to need a small testcase to reproduce this, as I can't seem to recreate it. Your debug dump is very good, so I understand the message is correct (it's converting from an integer but has a real), but looking at the code flow it should have never inserted the ITOD. Sorry.

Updated by Alex Solomatnikov about 1 year ago

Test case:

package generic_functions;

        function real ABS (real num);
                ABS = (num <0) ? -num : num;
        endfunction // ABS 

        function logic is_refclk_out_of_range_abs;
                input real last_refclk_posedge;
                input real reference_clock_period_value;
                input real sim_pll_tolerance_for_refclk;

                real time_diff;
                logic result;
                begin
                        result = 0;
                        if ( last_refclk_posedge >= 0 )
                                begin
                                        time_diff = $realtime - last_refclk_posedge;
                                        if ( ABS(time_diff - reference_clock_period_value) > sim_pll_tolerance_for_refclk )
                                                begin
                                                        result = 1;
                                                end
                                end
                        is_refclk_out_of_range_abs = result;
                end
        endfunction

endpackage

module test ( input wire refclk );

endmodule

Error:

verilator -sv --cc -Wno-fatal test.v --top-module test
%Error: test.v:20: Expected integral (non-real) input to ITORD
%Warning-REALCVT: test.v:20: Implicit conversion of real to integer
%Warning-REALCVT: Use "/* verilator lint_off REALCVT */" and lint_on around source to disable this message.
%Error: Exiting due to 1 error(s)

Updated by Wilson Snyder about 1 year ago

  • Category set to TranslationError
  • Status changed from New to Resolved
  • Assignee set to Wilson Snyder

Easy enough thanks to your good test case.

Fixed in git towards 3.840.

Updated by Wilson Snyder 10 months ago

  • Status changed from Resolved to Closed

In 3.840.

Also available in: Atom