Skip to content

Fix node has no type on new with randomize #5359

@solomatnikov

Description

@solomatnikov
%Error: txn_class.sv:67:24: new() not expected in this context
                                                     : ... note: In instance 'top'
   67 |       txn_type_t txn = new;
      |                        ^~~
%Error: Internal Error: txn_class.sv:67:24: ../V3Width.cpp:6979: Node has no type
                                                                     : ... note: In instance 'top'
   67 |       txn_type_t txn = new;
      |                        ^~~

Can you attach an example that shows the issue? (Must be openly licensed, ideally in test_regress format.)

class txn_class; // extends uvm_sequence_item;
   rand txn_type_t   req_txn_type;

...

   static function txn_type_t generate_txn(txn_type_t txn_type);
      txn_type_t txn = new;
//      bit success = txn.randomize() with {
//         req_txn_type == txn_type;
//      };
      bit success = txn.randomize();
      assert(success);
      return txn;
   endfunction // generate_txn

endclass

What 'verilator' command line do we use to run your example?

verilator  --cc --exe -sv --assert --trace --trace-params --trace-structs --report-unoptflat --no-timing --timescale 1ps/1ps --x-assign unique --unroll-count 256 

What 'verilator --version' are you using? Did you try it with the git master version?

v5.026-ga0ea96b35

What OS and distribution are you using?

Linux 5.14.0-427.24.1.el9_4.x86_64

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions