지노랩 /JinoLab

[UVM] 3.5 드라이버와 시퀀서 연결 본문

UVM(Universal Verification Methodology)/3. 재사용 가능한 검증 컴포넌트 개발(Developing Reusabl

[UVM] 3.5 드라이버와 시퀀서 연결

지노랩/JinoLab 2025. 3. 12. 12:17

3.5 드라이버와 시퀀서 연결

3.5.1 드라이버와 시퀀서의 연결 방식

  • 드라이버(Driver)와 시퀀서(Sequencer)는 TLM(Transaction-Level Modeling) 인터페이스를 통해 연결된다.
  • 드라이버의 seq_item_port는 시퀀서의 seq_item_export에 연결됨.
  • 시퀀서는 트랜잭션 데이터를 생성하여 seq_item_export를 통해 제공.
  • 드라이버는 seq_item_port를 통해 데이터를 받아 실행하며, 필요 시 응답을 생성할 수도 있음.
  • 이 연결은 상위 환경(Component)이 드라이버와 시퀀서 인스턴스를 포함하여 설정해야 한다.

3.5.2 드라이버와 시퀀서 연결 개념

  1. 시퀀서가 생성한 트랜잭션을 seq_item_export로 전달.
  2. 드라이버는 seq_item_port를 통해 트랜잭션을 수신.
  3. 드라이버는 수신한 트랜잭션을 DUT에 전달.
  4. 필요하면 드라이버가 응답(Response)을 생성하여 시퀀서로 반환할 수도 있음.

3.5.3 드라이버의 seq_item_port

  • seq_item_port는 드라이버가 다음 트랜잭션을 얻기 위해 호출하는 메서드의 집합을 정의한다.
  • 시퀀서와의 상호 작용을 통해 드라이버가 적절한 타이밍에 트랜잭션을 실행하도록 보장한다.
  • seq_item_port를 사용하여 시퀀서로부터 트랜잭션을 가져오는 주요 메서드:
    • get_next_item(): 다음 트랜잭션을 요청하여 블로킹 방식으로 대기.
    • item_done(): 현재 트랜잭션 처리가 완료되었음을 시퀀서에 알림.

3.5.4 시퀀서의 seq_item_export

  • seq_item_export는 드라이버가 요청한 트랜잭션을 제공하는 역할을 한다.
  • 시퀀서가 생성한 트랜잭션이 seq_item_export를 통해 드라이버로 전달됨.
  • 시퀀서는 드라이버가 요청할 때까지 데이터를 대기 상태로 유지할 수 있음.

3.5.5 드라이버와 시퀀서 연결 코드 예제

아래 코드는 simple_env 클래스에서 드라이버와 시퀀서를 연결하는 방법을 보여준다.

class simple_env extends uvm_env;

  simple_sequencer seqr;   // 시퀀서 인스턴스
  simple_driver drv;       // 드라이버 인스턴스

  `uvm_component_utils(simple_env)

  function new (string name, uvm_component parent);
    super.new(name, parent);
  endfunction : new

  virtual function void build_phase(uvm_phase phase);
    super.build_phase(phase);

    seqr = simple_sequencer::type_id::create("seqr", this);
    drv  = simple_driver::type_id::create("drv", this);
  endfunction : build_phase

  virtual function void connect_phase(uvm_phase phase);
    // 드라이버의 seq_item_port를 시퀀서의 seq_item_export에 연결
    drv.seq_item_port.connect(seqr.seq_item_export);
  endfunction : connect_phase

endclass : simple_env

3.5.6 코드 설명

  • Line 3~4: simple_sequencer와 simple_driver 객체를 선언.
  • Line 6: uvm_component_utils 매크로를 추가하여 UVM Factory에서 관리 가능하도록 설정.
  • Line 10~13: 생성자에서 부모 클래스 uvm_env의 생성자를 호출.
  • Line 16~19: build_phase()에서 시퀀서와 드라이버 객체를 생성.
  • Line 22: connect_phase()에서 드라이버의 seq_item_port를 시퀀서의 seq_item_export에 연결.

3.5.7 연결 과정 요약

  1. 환경 클래스(simple_env)에서 simple_sequencer와 simple_driver를 생성.
  2. build_phase()에서 객체를 생성하고 초기화.
  3. connect_phase()에서 드라이버의 seq_item_port를 시퀀서의 seq_item_export에 연결.
  4. 이제 시퀀서에서 생성한 트랜잭션이 드라이버로 전달될 수 있음.

✅ 3.5 요약

  • 드라이버와 시퀀서는 TLM 인터페이스(seq_item_port ↔ seq_item_export)를 통해 연결됨.
  • 시퀀서는 트랜잭션을 생성하여 seq_item_export로 제공.
  • 드라이버는 seq_item_port를 통해 트랜잭션을 받아 실행.
  • 상위 환경(Component)에서 두 객체를 생성하고 connect_phase()에서 연결.
  • UVM의 TLM 메커니즘을 활용하여 유연한 검증 환경을 구축할 수 있음.

 

 

 


 

본 내용은
accellera에서 공개한
Universal Verification Methodology
(UVM) 1.2 User's Guide
를 바탕으로 작성된 글입니다.