@@ -0,0 +1,46 @@ | |||||
class axi_cov extends uvm_subscriber#(axi_tx); | |||||
axi_tx tx; | |||||
`uvm_component_utils(axi_cov) | |||||
covergroup axi_cg; | |||||
ADDR_CP : coverpoint tx.addr { | |||||
option.auto_bin_max = 8; | |||||
} | |||||
WR_RD_CP : coverpoint tx.wr_rd{ | |||||
bins WR = {1'b1}; | |||||
bins RD = {1'b0}; | |||||
} | |||||
BURST_TYPE_CP : coverpoint tx.burst_type { | |||||
bins FIXED = {FIXED}; | |||||
bins WRAP = {WRAP}; | |||||
bins INCR = {INCR}; | |||||
} | |||||
RESP_CP : coverpoint tx.resp { | |||||
bins OKAY = {OKAY}; | |||||
bins EXOKAY = {EXOKAY}; | |||||
bins SLVERR = {SLVERR}; | |||||
bins DECERR = {DECERR}; | |||||
} | |||||
ADDR_CP_X_WR_RD_CP : cross ADDR_CP, WR_RD_CP; | |||||
ADDR_CP_X_BURST_TYPE_CP : cross ADDR_CP, BURST_TYPE_CP; | |||||
ADDR_CP_X_RESP_CP : cross ADDR_CP, RESP_CP; | |||||
WR_RD_CP_X_BURST_TYPE_CP : cross WR_RD_CP, BURST_TYPE_CP; | |||||
WR_RD_CP_X_RESP_CP : cross WR_RD_CP, RESP_CP; | |||||
BURST_TYPE_CP_X_RESP_CP : cross BURST_TYPE_CP, RESP_CP; | |||||
endgroup | |||||
function new(string name = "", uvm_component parent=null); | |||||
super.new(name,parent); | |||||
axi_cg = new(); | |||||
endfunction | |||||
function void write(T t); | |||||
$cast(tx, t); | |||||
$display("time : %0t", $time); | |||||
tx.print(); | |||||
axi_cg.sample(); | |||||
endfunction | |||||
endclass | |||||
@@ -0,0 +1,8 @@ | |||||
class axi_sqr extends uvm_sequencer #(axi_tx); | |||||
`uvm_component_utils(axi_sqr) | |||||
`NEW_COMP | |||||
function void build_phase(uvm_phase phase); | |||||
super.build_phase (phase); | |||||
endfunction | |||||
endclass |
@@ -0,0 +1,43 @@ | |||||
class axi_tx extends uvm_sequence_item; | |||||
rand bit wr_rd; | |||||
rand bit [`ADDR_WIDTH-1:0] addr; | |||||
rand bit [`WIDTH-1:0] dataQ[$]; //to support burst of data | |||||
rand bit [3:0] burst_len; | |||||
rand bit [2:0] burst_size; | |||||
rand burst_type_t burst_type; | |||||
rand bit [3:0] txid; | |||||
bit [1:0] resp; | |||||
bit [31:0] wrap_lower, wrap_upper; | |||||
int tx_size; | |||||
`uvm_object_utils_begin(axi_tx) | |||||
`uvm_field_int(addr, UVM_ALL_ON|UVM_NOPACK); | |||||
`uvm_field_queue_int(dataQ, UVM_ALL_ON|UVM_NOPACK); | |||||
`uvm_field_int(wr_rd, UVM_ALL_ON|UVM_NOPACK); | |||||
`uvm_field_int(burst_len, UVM_ALL_ON|UVM_NOPACK); | |||||
`uvm_field_int(burst_size, UVM_ALL_ON|UVM_NOPACK); | |||||
`uvm_field_enum(burst_type_t, burst_type, UVM_ALL_ON|UVM_NOPACK); | |||||
`uvm_field_int(txid, UVM_ALL_ON|UVM_NOPACK); | |||||
`uvm_field_int(wrap_lower, UVM_ALL_ON|UVM_NOPACK); | |||||
`uvm_field_int(wrap_upper, UVM_ALL_ON|UVM_NOPACK); | |||||
`uvm_object_utils_end | |||||
`NEW_OBJ | |||||
function void post_randomize(); | |||||
if (burst_type == WRAP) begin | |||||
tx_size = (burst_len+1) * (2**burst_size); | |||||
wrap_lower = addr - (addr%tx_size); | |||||
wrap_upper = wrap_lower + tx_size - 1; | |||||
end | |||||
endfunction | |||||
//constraint | |||||
constraint dataQ_c{ | |||||
dataQ.size() == burst_len+1; | |||||
} | |||||
constraint burst_type_c{ | |||||
burst_type != RSVD_BT; | |||||
} | |||||
constraint wrap_aligned_c{ | |||||
(burst_type) == WRAP -> (addr%(2**burst_size)==0); | |||||
} | |||||
endclass | |||||