class ahb_msequence extends uvm_sequence #(ahb_mtran);
  `uvm_object_utils(ahb_msequence)
  rand int itr;
  constraint itr_num {itr inside {[100:200]};}
  rand int b2b_delay;
  rand bit en_b2b_delay;
  constraint b2b_delay_c {b2b_delay inside {[0:5000]};}


  rand int haddr;
  constraint haddr_c {haddr inside {32'h8000_6000,32'h2000_8000};}


  function new (string name = "");
    super.new(name);
  endfunction: new

  task body;
        ahb_mtran tx;
        tx = ahb_mtran::type_id::create("tx");
        start_item(tx); //indicates to the driver that we have a tran ready to go
        //when start_item returns, => driver is ready to receive the item
        //driver is ready to receive the tran.
        $display($time," tx.b2b_delay = %d ",tx.b2b_delay);
//        assert (tx.randomize() with {tx.haddr>=32'h8001_0000 && tx.haddr<32'h8001_1000;} );
        assert (tx.randomize());// with {tx.haddr inside {32'h8000_6000,32'h2000_8000};} );
        tx.b2b_delay = this.b2b_delay;
        $display($time," tx.b2b_delay = %d ",tx.b2b_delay);
        tx.haddr = this.haddr;
        tx.en_b2b_delay = this.en_b2b_delay;
        $display("tx.hburst = %s",tx.hburst);
        finish_item(tx); //this sends the transaction to the driver
        //start_item,finish_item syncronises with the driver.
  endtask: body

endclass: ahb_msequence