AXI write phase example. using delay constrain to define which one is first, which one is second
// @ write phase before write addr phase // cfg.write_addr_delay = 10; // cdg.write_data_phase = 0; // @ write phase after write addr phase // cfg.write_addr_phase = 0; // cfg.write_data_phase = 10; task run_phase(); fork write_addr_phase(); write_data_phase(); get_next_trx(); join endtask task get_next_trx(); forever begin @(posedge vif.clk); if (sequencer.item.has_next_trx()) begin trx = sequencer.item.get_next_trx(); if (trx.rw == `WRITE) -> start_write; else -> start_read; end end endtask task write_addr_phase(); forever begin if (start_write.triggered) begin repeat(cfg.write_addr_delay) @(posedge vif.clk); // do write phase end end endtask task write_data_phase(); forever begin if (start_write.triggered) begin repeat(cfg.write_data_delay) @(posedge vif.clk); // do data phase end endtask
沒有留言:
張貼留言