当前位置: 首页 > 工具软件 > bash_unit > 使用案例 >

token ‘starting_phase‘. Originating package ‘$unit‘.

孟品
2023-12-01

在学习 《uvm 实战》2.4.3,2.5.1的时候遇到了 starting_phase 再不同 uvm 版本中不一致的问题。

再 uvm 1.2 中弃用了 starting_phaseraise_objectiondrop_obection 并提示:

my_case0.sv, 12
Error found while trying to resolve cross-module reference.
  token 'starting_phase'.  Originating package '$unit'.
  Source info: starting_phase.raise_objection(\this );
  Instance stack trace:
      $unit  /home/xxx/Documents/1800.2-2020-1.1/src/uvm_pkg.sv, 1

Error-[IND] Identifier not declared
my_case0.sv, 11
  Identifier 'starting_phase' has not been declared yet. If this error is not 
  expected, please check if you have set `default_nettype to none.
  Instance stack trace:
      $unit  /home/xxx/Documents/1800.2-2020-1.1/src/uvm_pkg.sv, 1

Error-[XMRE] Cross-module reference resolution error
my_case0.sv, 20
  Error found while trying to resolve cross-module reference.
  token 'starting_phase'.  Originating package '$unit'.
  Source info: starting_phase.drop_objection(\this );
  Instance stack trace:
      $unit  /home/liuyq/Documents/1800.2-2020-1.1/src/uvm_pkg.sv, 1

Error-[IND] Identifier not declared
my_case0.sv, 19
  Identifier 'starting_phase' has not been declared yet. If this error is not 
  expected, please check if you have set `default_nettype to none.
  Instance stack trace:
      $unit  /home/liuyq/Documents/1800.2-2020-1.1/src/uvm_pkg.sv, 1
  


Error-[IND] Identifier not declared
base_test.sv, 28
  Identifier 'get_report_server' has not been declared yet. If this error is 
  not expected, please check if you have set `default_nettype to none.
  

1 warning
5 errors

解决方法是使用 uvm1.1 迁移 uvm1.2 工具 uvm11-to-uvm12.pl

perl uvm11-to-uvm12.pl -write

或者直接修改 my_sequence.sv

修改前

    virtual task body();
       if (starting_phase != null) begin
           starting_phase.raise_objection(this);
       end
       
       repeat (10) begin
         `uvm_do(m_trans)
       end
       
       #1000;
       
       if (starting_phase != null) begin
           starting_phase.drop_objection(this);
       end
    endtask

修改后

   virtual task body(); 
        uvm_phase p = get_starting_phase();
        
        if (p != null) begin
            p.raise_objection(this);
        end
        
        repeat(10) begin
            `uvm_do(m_trans);
        end
        
        #1000;
        
        if (p != null) begin
            p.drop_objection(this);
        end
    endtask
 类似资料: