Skip to content

Commit

Permalink
add support for vivado xsim
Browse files Browse the repository at this point in the history
  • Loading branch information
skokvermon authored and thommythomaso committed Sep 27, 2022
1 parent 2a4d119 commit 226698b
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 10 deletions.
33 changes: 33 additions & 0 deletions axi.core
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,35 @@ filesets:
file_type : systemVerilogSource
depend :
- ">=pulp-platform.org::common_cells:1.26.0"
benchs:
files:
- src/axi_test.sv
- test/tb_axi_dw_pkg.sv
- test/tb_axi_xbar_pkg.sv
- test/axi_synth_bench.sv
- test/tb_axi_addr_test.sv
- test/tb_axi_atop_filter.sv
- test/tb_axi_cdc.sv
- test/tb_axi_delayer.sv
- test/tb_axi_dw_downsizer.sv
- test/tb_axi_dw_upsizer.sv
- test/tb_axi_fifo.sv
- test/tb_axi_isolate.sv
- test/tb_axi_iw_converter.sv
- test/tb_axi_lite_mailbox.sv
- test/tb_axi_lite_regs.sv
- test/tb_axi_lite_to_apb.sv
- test/tb_axi_lite_to_axi.sv
- test/tb_axi_lite_xbar.sv
- test/tb_axi_modify_address.sv
- test/tb_axi_serializer.sv
- test/tb_axi_sim_mem.sv
- test/tb_axi_to_axi_lite.sv
- test/tb_axi_to_mem_banked.sv
- test/tb_axi_xbar.sv
file_type : systemVerilogSource
depend :
- ">=pulp-platform.org::common_verification:0.2.1"

generators:
axi_intercon_gen:
Expand Down Expand Up @@ -113,3 +142,7 @@ generators:
targets:
default:
filesets : [rtl]
sim:
filesets : [rtl,benchs]
description: Simulate the design
toplevel: tb_axi_dw_downsizer
4 changes: 2 additions & 2 deletions src/axi_demux.sv
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ module axi_demux #(
// Validate parameters.
// pragma translate_off
`ifndef VERILATOR
`ifndef XSIM
`ifndef XILINX_SIMULATOR
initial begin: validate_params
no_mst_ports: assume (NoMstPorts > 0) else
$fatal(1, "The Number of slaves (NoMstPorts) has to be at least 1");
Expand Down Expand Up @@ -774,7 +774,7 @@ module axi_demux_id_counters #(

// pragma translate_off
`ifndef VERILATOR
`ifndef XSIM
`ifndef XILINX_SIMULATOR
// Validate parameters.
cnt_underflow: assert property(
@(posedge clk_i) disable iff (~rst_ni) (pop_en[i] |=> !overflow)) else
Expand Down
2 changes: 1 addition & 1 deletion src/axi_err_slv.sv
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ module axi_err_slv #(

// pragma translate_off
`ifndef VERILATOR
`ifndef XSIM
`ifndef XILINX_SIMULATOR
initial begin
assert (Resp == axi_pkg::RESP_DECERR || Resp == axi_pkg::RESP_SLVERR) else
$fatal(1, "This module may only generate RESP_DECERR or RESP_SLVERR responses!");
Expand Down
6 changes: 5 additions & 1 deletion src/axi_test.sv
Original file line number Diff line number Diff line change
Expand Up @@ -1445,7 +1445,11 @@ package axi_test;
automatic logic rand_success;
wait (b_wait_cnt > 0 && (aw_queue.size() != 0));
aw_beat = aw_queue.pop_front();
rand_success = b_beat.randomize(); assert(rand_success);
`ifdef XILINX_SIMULATOR
rand_success = std::randomize(b_beat); assert (rand_success);
`else
rand_success = b_beat.randomize(); assert (rand_success);
`endif
b_beat.b_id = aw_beat.ax_id;
if (RAND_RESP && !aw_beat.ax_atop[axi_pkg::ATOP_R_RESP])
b_beat.b_resp[1] = $random();
Expand Down
5 changes: 3 additions & 2 deletions src/axi_xbar.sv
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ import cf_math_pkg::idx_width;
// make sure that the default slave does not get changed, if there is an unserved Ax
// pragma translate_off
`ifndef VERILATOR
`ifndef XSIM
`ifndef XILINX_SIMULATOR
default disable iff (~rst_ni);
default_aw_mst_port_en: assert property(
@(posedge clk_i) (slv_ports_req_i[i].aw_valid && !slv_ports_resp_o[i].aw_ready)
Expand Down Expand Up @@ -265,7 +265,7 @@ import cf_math_pkg::idx_width;

// pragma translate_off
`ifndef VERILATOR
`ifndef XSIM
`ifndef XXILINX_SIMULATOR
initial begin : check_params
id_slv_req_ports: assert ($bits(slv_ports_req_i[0].aw.id ) == Cfg.AxiIdWidthSlvPorts) else
$fatal(1, $sformatf("Slv_req and aw_chan id width not equal."));
Expand All @@ -283,6 +283,7 @@ endmodule
module axi_xbar_intf
import cf_math_pkg::idx_width;
#(
parameter axi_pkg::xbar_cfg_t Cfg = '0,
parameter int unsigned AXI_USER_WIDTH = 0,
parameter axi_pkg::xbar_cfg_t Cfg = '0,
parameter bit ATOPS = 1'b1,
Expand Down
2 changes: 1 addition & 1 deletion test/tb_axi_dw_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ package tb_axi_dw_pkg ;
axi_b_id = slv_port_axi.b_id;
$display("%0tns > Master: Got last B with ID: %b",
$time, axi_b_id);
if (this.exp_slv_port_b_queue.empty()) begin
if (this.exp_slv_port_b_queue.is_empty()) begin
incr_failed_tests(1) ;
$warning("Master: unexpected B beat with ID: %b detected!", axi_b_id);
end else begin
Expand Down
6 changes: 3 additions & 3 deletions test/tb_axi_xbar_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ package tb_axi_xbar_pkg;
axi_b_id = masters_axi[i].b_id;
$display("%0tns > Master %0d: Got last B with id: %b",
$time, i, axi_b_id);
if (this.exp_b_queue[i].empty()) begin
if (this.exp_b_queue[i].is_empty()) begin
incr_failed_tests(1);
$warning("Master %d: unexpected B beat with ID: %b detected!", i, axi_b_id);
end else begin
Expand Down Expand Up @@ -358,7 +358,7 @@ package tb_axi_xbar_pkg;
if (slaves_axi[i].ar_valid && slaves_axi[i].ar_ready) begin
incr_conducted_tests(1);
slv_axi_id = slaves_axi[i].ar_id;
if (this.exp_ar_queue[i].empty()) begin
if (this.exp_ar_queue[i].is_empty()) begin
incr_failed_tests(1);
end else begin
// check that the ids are the same
Expand Down Expand Up @@ -386,7 +386,7 @@ package tb_axi_xbar_pkg;
$display("%0tns > Master %0d: Got last R with id: %b",
$time, i, mst_axi_r_id);
end
if (this.exp_r_queue[i].empty()) begin
if (this.exp_r_queue[i].is_empty()) begin
incr_failed_tests(1);
$warning("Master %d: unexpected R beat with ID: %b detected!", i, mst_axi_r_id);
end else begin
Expand Down

0 comments on commit 226698b

Please sign in to comment.