axi_slv_wr_driver

AXI Slave Write Driver object.It does :

Receives AW Command and the WLAST from the interface and then passes that transaction to the user environment, the user will then create a BRESP transaction and pass it back to the driver to drive the B channel.

Receives WRITE transactions from the user environment and drives the AW and W channels.

Trigger an event when the AW Command is accepted.

Trigger an event when the WLAST is accepted.

Receives READY transactions from the user environment and drives the AWREADY signal of the AW channel.

Receives READY transactions from the user environment and drives the WREADY signal of the W channel.

Generates re-ordered B Channel responses.

Information
class member

axi_vif_mem_proxy `AXI_PARAM_ORDER  vif_proxy;AXI VIF Proxy Class

xil_seq_item_pull_port #(axi_ready_gen, axi_ready_gen)  awready_seq_item_port;provides the method to send awready information to axi_slv_wr_driver

xil_seq_item_pull_port #(axi_ready_gen, axi_ready_gen)  wready_seq_item_port;provides the method to send wready information to axi_slv_wr_driver

xil_seq_item_pull_port #(axi_transaction,axi_transaction) seq_item_port;provides method to send write transaction to axi_slv_wr_driver

Functions
new
function new(
string name = "unnamed_axi_slv_wr_driver"
);

Constructor to create an AXI slave write driver

set_vif
function void set_vif(
axi_vif_mem_proxy `AXI_PARAM_ORDER vif
);

Assigns the virtual interface of the driver.

set_awready_gen
function void set_awready_gen(
input axi_ready_gen_t new_gen
);

Sets awready of the AXI slave write driver. There are three ways for awready generation in AXI slave write driver.

1.User can first create a axi_ready_gen, customerize it and then use set_awready_gen to send it to AXI slave write driver. User can't fill in more than 500 axi_ready_gen at one time, otherwise it will error out.

2.User can can first create a axi_ready_gen, customerize it and then use send_awready to send it to AXI slave write driver.

3. If neither of above method is being called, then AXI slave write driver will a) if XIL_DO_NOT_USE_ADV_RANDOMIZATION is being defined, awready is being generated with cheap_random(this is for tools which doesn't support advanced randomization.  b) else awready will be randomly generated

get_awready_gen
function axi_ready_gen_t get_awready_gen();

Returns awready_gen

set_wready_gen
function void set_wready_gen(
input axi_ready_gen_t new_gen
);

Sets wready of the AXI slave write driver. There are three ways for wready generation in AXI slave write driver.

1.User can first create a axi_ready_gen, customerize it and then use set_wready_gen to send it to AXI slave write driver. User can't fill in more than 500 axi_ready_gen at one time, otherwise it will error out.

2.User can can first create a axi_ready_gen, customerize it and then use send_wready to send it to AXI slave write driver.

3. If neither of above method is being called, then AXI slave write driver will a) if XIL_DO_NOT_USE_ADV_RANDOMIZATION is being defined, wready is being generated with cheap_random(this is for tools which doesn't support advanced randomization.  b) else wready will be randomly generated

get_wready_gen
function axi_ready_gen_t get_wready_gen();

Returns wready_gen

set_reorder_response_ability
function void set_reorder_response_ability (
input xil_axi_reorder_ability_t value
);

Sets reorder_response_ability of the Driver. refer xil_axi_reorder_ability_t about reorder transaction.

get_reorder_response_ability
function xil_axi_reorder_ability_t get_reorder_response_ability ();

Returns reorder_response_ability of the Driver. refer xil_axi_reorder_ability_t about reorder transaction.

set_reorder_backoff_range
function void set_reorder_backoff_range(
input xil_axi_uint min,
input xil_axi_uint max
);

Sets the reordering backoff timer range of the slave write driver.  Since the slave may pop the BRESP quicker than one is available, if there is only one entry then insert a backoff that will allow for some accumulation of time.  so perhaps another BRESP will be ready to send. This time is randomized between min and max.

get_reorder_backoff_range
function void get_reorder_backoff_range(
output xil_axi_uint min,
output xil_axi_uint max
);

Gets the reordering backoff timer range

set_forward_progress_timeout_value
function void set_forward_progress_timeout_value (
input xil_axi_uint new_timeout
);

Sets the number of cycles that the driver will wait for AW/W/B accepted until it will flag a watch dog error of the axi_slv_wr_driver. Default value is 50000. Setting this to a very large value will cause a hung simulation to continue for a longer time.  Setting this to a very small number may not allow enough time for simulation to respond.

get_forward_progress_timeout_value
function xil_axi_uint get_forward_progress_timeout_value ();

Returns the number of cycles that the driver will wait for AW/W/B accepted until it will flag a watch dog error of the axi_slv_wr_driver. Default value is 50000 and user can use set_forward_progress_timeout_value to change it.

set_waiting_valid_timeout_value
function void set_waiting_valid_timeout_value (
input xil_axi_uint new_timeout
);

Sets waiting_valid_timeout_value of the slave write driver. waiting_valid_timeout_value is used for driver to wait a certain number of cycles for bvalid/bready handshake occurs before it time out.

get_waiting_valid_timeout_value
function xil_axi_uint get_waiting_valid_timeout_value ();

Returns waiting_valid_timeout_value of the slave write driver. waiting_valid_timeout_value is used for driver to wait a certain number of cycles for bvalid/bready handshake occurs before it time out.

set_transaction_depth
function void set_transaction_depth(
input xil_axi_uint new_depth
);

Sets the number of WRITE transactions that the Driver will have in flight at one time.

get_transaction_depth
function xil_axi_uint get_transaction_depth();

Returns the maximum number of WRITE transactions that the Driver will have in flight at one time.

get_num_pending_cmds
function xil_axi_uint get_num_pending_cmds();

Returns number of commands in pending

get_cmds_inflight
function xil_axi_uint get_cmds_inflight();

Returns number of commands in flight

set_xfer_wrcmd_order
virtual function void set_xfer_wrcmd_order(
input xil_axi_xfer_wrcmd_order_t update
);

Sets wrcmd_order of the slave write driver. Refer xil_axi_xfer_wrcmd_order_t for order between write command and write data.

get_xfer_wrcmd_order
virtual function xil_axi_xfer_wrcmd_order_t get_xfer_wrcmd_order();

Returns wrcmd_order of the slave write driver.Refer xil_axi_xfer_wrcmd_order_t for order between write command and write data.

set_inbound_fifo_depth
virtual function void set_inbound_fifo_depth(
input xil_axi_uint update
);

Sets inbound_fifo_depth of the slave write driver for wready generation.In axi slave write driver, when write command order is not XIL_AXI_WRCMD_ORDER_CMD_BEFORE_DATA, wready generation mimics an inbound buffer of depth inbound_fifo_depth.Once wdata beat counts reach inbound_fifo_depth, it checks whether there is outstanding commands. If there is no pending command request,stop wready generation and wait till there is at least one active request.

get_inbound_fifo_depth
virtual function xil_axi_uint get_inbound_fifo_depth();

Returns inbound_fifo_depth of the Driver

is_driver_idle
function xil_axi_boolean_t is_driver_idle();

Returns TRUE if the Driver is idle, else FALSE

set_awaddr_watchdog_delay
function void set_awaddr_watchdog_delay(
input xil_axi_uint new_depth
);

Sets awaddr_watchdog_delay of the slave write driver.When axi_transaction's xfer_wrcmd_order is XIL_AXI_WRCMD_ORDER_DATA_BEFORE_CMD, awready generation of axi_slv_wr_driver will fire watchdog AXI_WR_SLV_DATA_BEFORE_CMD_DEADLOCK WATCHDOG if it doesn't see wvalid assert high after waiting awaddr_watchdog_delay clock cycles.

get_awaddr_watchdog_delay
function xil_axi_uint get_awaddr_watchdog_delay();

Returns awaddr_watchdog_delay of the slave write driver.When axi_transaction's xfer_wrcmd_order is XIL_AXI_WRCMD_ORDER_DATA_BEFORE_CMD, awready generation of axi_slv_wr_driver will fire watchdog AXI_WR_SLV_DATA_BEFORE_CMD_DEADLOCK WATCHDOG if it doesn't see wvalid assert high after waiting awaddr_watchdog_delay clock cycles.

get_adjust_response_delay_enabled
virtual function xil_axi_boolean_t get_adjust_response_delay_enabled();

Returns the current state of adjust_response_delay_enabled of the transaction.

set_adjust_response_delay_enabled
virtual function void set_adjust_response_delay_enabled(
input xil_axi_boolean_t update
);

Sets the value of adjust_response_delay_enabled of the transaction.

run_phase
task run_phase();

Start control processes for operation

stop_phase
virtual task stop_phase();

Stops all control processes.

get_wr_reactive
virtual task get_wr_reactive (
output axi_transaction transfer
);

Returns write reactive transaction with write command information.  The slave VIP agent gets write transaction command information,fill in write response and send it back to Slave VIP interface.The usage of this API is shown below and it MUST be put in initial, forever procedure since get_wr_reactive is blocking, so does send. Please refer example design simset sim_allconfig for more details.

initial begin
forever begin :slv_run
slv_agent.wr_driver.get_wr_reactive(wr_reactive);
fill_reactive(wr_reactive);
slv_agent.wr_driver.send(wr_reactive);
end
end

//fill reactive response for write transaction
function automatic void fill_reactive(inout axi_transaction t);
xil_axi_resp_t bresp;
xil_axi_user_beat buser;
buser = $urandom_range(0,1<< <=:c_buser_width:> -1);
if( <=:c_has_bresp:>== 0) begin
bresp = XIL_AXI_RESP_OKAY;
end else begin
if(t.get_all_resp_okay() == XIL_AXI_TRUE) begin
bresp = XIL_AXI_RESP_OKAY;
end else begin
if(t.get_axi_version() != XIL_VERSION_LITE) begin
if (t.get_exclude_resp_exokay() == XIL_AXI_TRUE) begin
void'(randomize(bresp)with{bresp inside {XIL_AXI_RESP_OKAY, XIL_AXI_RESP_DECERR, XIL_AXI_RESP_SLVERR };});
end else begin
bresp = XIL_AXI_RESP_DECERR;
end
end else begin
void'(randomize(bresp) with {bresp inside {XIL_AXI_RESP_OKAY, XIL_AXI_RESP_DECERR, XIL_AXI_RESP_SLVERR};});
end
end
end
t.set_buser(buser);
t.set_bresp(bresp);
endfunction: fill_reactive
create_transaction
virtual function axi_transaction create_transaction (
string name = "unnamed_transaction"
);

Returns an AXI transaction class that has been "newed"

send_wready
task send_wready(
input axi_ready_gen t
);

Sends the ready structure to the driver for controlling the WREADY channel

create_ready
virtual function axi_ready_gen create_ready (
string name = "unnamed_ready"
);

Returns a ready class that has been "newed".

send_awready
task send_awready(
input axi_ready_gen t
);

Sends the ready structure to the slave write driver for controlling the AWREADY channel.his is blocking process which will not return till this ready is being sent out.

send
task send(
input axi_transaction t
);

Sends the AXI transaction to the driver

wait_rsp
task wait_rsp(
output axi_transaction t
);

This blocking function will not return until driver send back response transaction