UVM: Objection Mechanism - IKSciting
1715
post-template-default,single,single-post,postid-1715,single-format-standard,bridge-core-2.8.7,qodef-qi--no-touch,qi-addons-for-elementor-1.7.1,qode-page-transition-enabled,ajax_fade,page_not_loaded,,qode-title-hidden,qode_grid_1300,footer_responsive_adv,qode-content-sidebar-responsive,qode-theme-ver-27.1,qode-theme-bridge,qode_header_in_grid,wpb-js-composer js-comp-ver-6.6.0,vc_responsive,elementor-default,elementor-kit-838

Objection Mechanism

UVM을 처음 접하면 objection이라는 개념이 다소 생소하게 느껴질 수 있다. 사전에서 objection을 찾아보면 ‘이의’, ‘반대’ 등의 뜻을 갖는다고 나와 있다. UVM objection은 end-of-test, 즉, test의 종료 가능 시점을 판단하기 위한 개념으로 사용된다. 조금 더 쉽게 설명하면 다음과 같다.

  • Raising an objection – “지금 작업을 시작할 테니 끝났다고 알리기 전까지는 test를 종료하면 안 돼!”
  • Dropping an objection – “하던 작업이 이제 끝났으니 참고해!”

Objection의 raise와 drop은 주로 test에서 sequence를 시작하기 전과 후에 각각 위치함으로써 해당 sequence가 끝나기 전까지는 test가 종료되지 않도록 방지하는 역할을 한다. 물론 UVM testbench를 구성하면서 필요에 의해 scoreboard 등 다른 곳에서도 objection을 raise/drop 하는 경우도 존재할 수 있지만 꼭 필요한지 면밀히 검토를 해야 한다. 불필요한 objection control은 performance overhead로 이어질 수 있기 때문이다.

다음은 test에서 sequence에 대한 objection을 control하는 예제이다.

class my_test extends uvm_test;

  // ...

  task run_phase(uvm_phase phase);
    super.run_phase(phase);
    phase.raise_objection(this);    // raise an objection
    seq.start(env.agent.sequencer); // start a sequence
    phase.drop_objection(this);     // drop an objection
  endtask: run_phase

endclass: my_test

다음은 test가 아닌 sequence 내부에서 자신의 objection을 control하는 예제이다. 특별한 이유가 없다면 이처럼 sequence 내부에서 objection을 control하는 것보다 위와 같이 test-level에서 control 해주는 것이 관리 및 재사용 관점에서 유리하다. 만약 sequence에서 objection을 control 해야 한다면 한 가지 유의할 점이 있다. 가급적 body에는 실제 sequence의 동작만을 기술하고, raise_objection과 drop_objection은 각각 pre_start와 post_start에 위치시키는 것이 좋다. 또한 sequence start 시 argument에 따라 pre_body와 post_body는 실행되지 않을 수도 있기 때문에 정확한 동작을 이해하고 있지 않다면 pre_start와 post_start를 이용하는 것이 안전하다.

class my_sequence extends uvm_sequence#(my_transaction);

  // ...

  virtual task pre_start();
    starting_phase.raise_objection(this, get_type_name()); // raise an objection
  endtask: pre_start

  virtual task pre_body();
    // raising or dropping an objection here not recommended
  endtask: pre_body

  virtual task body();
    // raising or dropping an objection here not recommended
  endtask: body

  virtual task post_body();
    // raising or dropping an objection here not recommended
  endtask: post_body
 
  virtual task post_start();
    starting_phase.drop_objection(this, get_type_name()); // drop an objection
  endtask: post_start

endclass: my_sequence

Objection은 여러 위치에서 raise/drop 될 수 있으며, nested sequence를 사용하는 경우와 같이 동시에 여러 objection이 raise 된 상태가 될 수도 있다. UVM에서 objection이 raise 되면 내부적으로 objection count가 increment 되기 시작한다. 그리고 각 objection이 drop될 때 objection count가 decrement 된다. 최종적으로 objection count가 0이 되어야 test가 종료될 수 있는 것이다. Objection과 관련된 UVM debug feature는 Command Line Processors for Debugging 페이지를 참고하자.

References

Tags:
6 Comments

Post A Comment