How to get response from child sequence

I have a sequence that starts up two low-level API sequences through seq.start(low_level_sequencer, this). These low-level sequences in turn generate reads and writes on a APB bus. The APB slave can respond with a transaction error and the low-level sequences don’t have the knowledge to handle this so I need to pass the error response to the higher level sequence.

How is this done?

In reply to KSteffensen:

Can you show some code snippets of exactly what’s going on? What do you expect the virtual sequence to do with the error response?
It actually sounds like you’re looking for a layered sequence. Check out the Cookbook.

In reply to tfitz:

The worker sequences body methods are long these lines:


task body();
  apb_sequence_item seq_item, response;

  seq_item = apb_sequence_item::type_id::create("seq_item");
  this.start_item(seq_item);

  seq_item.randomize() with {address == local::address;
                             data == local::data;
                             kind == APB_WRITE;};

  this.finish_item(seq_item);
  this.get_response(response);

endtask : body


The relevant part of the higher level sequence looks like this


foreach(regs[i]) begin
  wr_seq = apb_single_write_seq::type_id::create("apb_single_write_seq");
  
  wr_seq.randomize() with {address == regs[i].address;
                           data == regs[i].data;}
  
  wr_seq.start(p_sequencer.master_seq);

  // Here I would like to know if the write went well or not and take appropriate action depending on the DUT I'm working on
end

I’m not sure layered sequences are an exact fit for this. I understand they are more for handling complex protocols where a transaction can be broken down into several smaller transactions, like PCIe. In this case I’m more interested in getting information on whether the transaction was successful and what data was actually read.

Well, what you have here is a 1:1 layering. You’re choosing the address and data in the higher level sequence. Rather than randomize wr_seq with the address and data constrained, simply create a “high-level sequence item” with address and data fields and pass that to the lower-level sequence which will translate that into the APB transactions.
You don’t need to pass the whole response back up the the high level either. You can use a response transaction that includes just the error bit and/or any other information you want.