Driving clock and data from sequence

Hi,

I want to drive data and clock from sequence.

sequence item:

class inv_transaction extends uvm_sequence_item;
    `uvm_object_utils(inv_transaction)
    function new(string name = "inv_transaction");
        super.new(name);
    endfunction

    bit a;
    bit clk;
endclass

sequence:

class inv_sequence extends uvm_sequence#(inv_transaction);
    `uvm_object_utils(inv_sequence)
    function new(string name = "inv_sequence");
        super.new(name);
    endfunction
  
    virtual task body();
         `uvm_create(req);
         start_item(req);
         req.a =0;      //data driving
         finish_item(req);
         
      
    endtask

 endclass

how to write code for driving clk?

Thanks in advance

In reply to new_uvm_user:

It does not make sense to drive pinlevel signals from the sequence/seq_item.
The seq_item contains data which are intended to be randomized and I do not believe you want to randomize your clock.
The clock should be generated in the toplevel module and distibuted to the destinations where it is used.

In reply to chr_sue:

Thanks for your reply
I don’t want clock randomize.
ok pinlevel signals not drive from sequence. Suppose i want to drive signal ‘a’ not randomize.

`uvm_create(req);
start_item(req);
req.a =0; //data driving
finish_item(req);

start_item(req);
req.a =1; //data driving
finish_item(req);

In reply to new_uvm_user:

I think chr_sue meant " seq_item contains data which could be randomized". This means the seq_item has data that is specific to each test scenario, whether it be random or directed by the test. The timing of each seq_item executed by the driver is controlled by an external clock.

Generally, that clock is an externally generated, constant frequency signal. It gets generated at the top level of the testbench and not controlled by the UVM. But there are test scenarios where you may need to adjust the frequency or stop/start the clock. In that case you send controlling signals to a clock generator in an interface/agent.