×

Implementing an Out-of-Order Pipelined uvm_driver in UVM

When designing an out-of-order pipelined uvm_driver, the key challenge is handling transactions that complete in a different order than they were issued. This is common in bus protocols like AMBA AXI, where responses may return out of sequence to improve throughput.

Key Design Considerations

  1. Disable Automatic Transaction Recording
    • UVM drivers automatically record transactions, but this may not align with out-of-order execution.
    • Disable automatic recording to manage transactions manually:
    seq_item_port.disable_auto_item_recording();
  2. Parallel Transaction Handling
    • Use SystemVerilog fork-join to allow multiple processes to handle transactions concurrently.
    • Separate processes for request reception and response processing help manage out-of-order execution efficiently.
  3. Tracking Requests and Responses
    • Use unique transaction identifiers (e.g., IDs) to match requests to responses.
    • Store transactions in a queue or associative array for flexible retrieval.

Example Implementation

class out_of_order_driver extends uvm_driver #(transaction);
  `uvm_component_utils(out_of_order_driver)

  // Associative array to store transactions by ID
  transaction trans_queue[int];

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

  virtual task run_phase(uvm_phase phase);
    // Disable automatic transaction recording
    seq_item_port.disable_auto_item_recording();

    fork
      // Process to receive and store requests
      begin
        transaction req;
        forever begin
          seq_item_port.get_next_item(req);
          trans_queue[req.id] = req; // Store using transaction ID
        end
      end

      // Process to handle and respond to transactions out-of-order
      begin
        forever begin
          int response_id;
          transaction rsp;

          // Wait for an available response ID
          wait (trans_queue.exists(response_id));

          // Retrieve the stored transaction
          rsp = trans_queue[response_id];
          trans_queue.delete(response_id); // Remove from queue

          // Process the transaction (drive signals, wait for DUT response)
          // ...

          // Indicate completion of the transaction
          seq_item_port.item_done();
        end
      end
    join_none
  endtask
endclass

Additional Considerations

  • Synchronization: Introduce delays or handshaking to mimic realistic DUT behavior.
  • Error Handling: Implement checks for missing responses or unexpected order violations.
  • Logging & Debugging: Use UVM reporting (uvm_info, uvm_error) to trace transactions.

By structuring the driver to separate request and response processing while tracking transactions efficiently, you ensure accurate and flexible out-of-order execution in your UVM testbench.

Post Comment