Agilex™ 7 Hard Processor System Component Reference Manual
ID
683581
Date
10/08/2025
Public
3.1. Simulation Flows
3.2. Clock and Reset Interfaces
3.3. FPGA-to-HPS AXI* Slave Interface
3.4. HPS-to-FPGA AXI* Master Interface
3.5. Lightweight HPS-to-FPGA AXI* Master Interface
3.6. HPS-to-FPGA MPU Event Interface
3.7. Interrupts Interface
3.8. HPS-to-FPGA Debug APB Interface
3.9. FPGA-to-HPS System Trace Macrocell Hardware Event Interface
3.10. HPS-to-FPGA Cross-Trigger Interface
3.11. HPS-to-FPGA Trace Port Interface
3.12. FPGA-to-HPS DMA Handshake Interface
3.13. General Purpose Input Interface
3.14. EMIF Conduit
3.15. Simulating the Agilex™ 7 HPS Component Revision History
4.3.3. test_h2f.sv
- Change directory to <project directory>/simple_tb/simple_tb/sim/ .
- Create a file named test_h2f_128b.sv and edit with contents as shown below.
// test_h2f.sv `timescale 1 ps / 1 ps import altera_axi_bfm_pkg::*; module test_h2f#(); `define h2f_test_m simple_inst.intel_agilex_hps_0.intel_agilex_hps_0. \ fpga_interfaces.hps_inst.s2f_module.h2f_bfm_gen. \ h2f_axi4_manager_inst localparam ADDR_WIDTH = 32; localparam DATA_WIDTH = 128; localparam ID_WIDTH = 4; localparam USER_WIDTH = 8; int i,j; bit status, f_rw[8], f_incr[8][8]; reg [ADDR_WIDTH-1:0] Addr; reg [DATA_WIDTH-1:0] Data[8]; //--------------------------------------------------------------------------------- //---------------------------- BFM Manager (h2f) //--------------------------------------------------------------------------------- initial begin AlteraAxiTransaction wr_resp_tr, rd_resp_tr; BaseAxiBfm#(ADDR_WIDTH, DATA_WIDTH, ID_WIDTH, USER_WIDTH) test_m; test_m = `h2f_test_m.AXI4MAN.bfm; Data[0] = 'h11111111_22222222_33333333_44444444; Data[1] = 'h22222222_33333333_44444444_55555555; Data[2] = 'h33333333_44444444_55555555_66666666; Data[3] = 'hbbbbbbbb_cccccccc_dddddddd_eeeeeeee; test_m.m_reset(); test_m.set_config(AXI_CONFIG_MAX_OUTSTANDING_WR, 2); test_m.set_config(AXI_CONFIG_MAX_OUTSTANDING_RD, 2); $display("\n\n\n\n@%0t, [TESTINFO]: Starting H2F testing \n\n\n\n",$time); /////////////////////////////////////////// SINGLE WRITES ///////////////////////// for (i = 0; i < 4; i++) begin $display("\n@%0t*********** START OF WRITE #%d TEST **** H2F ****\n",$time, i); Addr = (i * 1<<AXI4_BYTES_16); wr_resp_tr = test_m.manager_bfm_wr_tx(); wr_resp_tr.set_id(i); wr_resp_tr.set_awaddr(Addr); wr_resp_tr.set_burst_length(0); wr_resp_tr.set_size(AXI4_BYTES_16); wr_resp_tr.set_data_words(Data[i], 0); wr_resp_tr.set_write_strobes(16'hffff, 0); test_m.put_transaction(wr_resp_tr); test_m.drive_transaction(); $display("\n@%0t********** END OF WRITE #%d TEST **** H2F *****\n",$time, i); end /////////////////////////////////////////// SINGLE READS ///////////////////////// for (i = 0; i < 4; i++) begin $display("\n@%0t********** START OF READ #%d TEST **** H2F ****\n",$time, i); Addr = (i * 1<<AXI4_BYTES_16); rd_resp_tr = test_m.manager_bfm_rd_tx(i, Addr ); //id, addr rd_resp_tr.set_size(AXI4_BYTES_16); test_m.put_transaction(rd_resp_tr); test_m.drive_transaction(); if (rd_resp_tr.get_data_words(0) == Data[i]) begin f_rw[i]=1'b1; $display ("value of f_rw[%d] is %b", i, f_rw[i]); $display ( "@ %t Read correct data (%h) at address (%d)", $time, Data[i], Addr ); end else $display ( "@ %t Error: Expected data (%h) at address (%d), but got %d", $time, Data[i], Addr, rd_resp_tr.get_data_words(0)); $display("\n@%0t********* END OF READ #%d TEST **** H2F ****\n",$time, i); end /////////////////////////////////////////// INCR WRITES/READS //////////////////// for (i = 0; i < 4; i++) begin $display("\n@%0t****** START OF INCR BURST #%d TEST *** H2F ****\n",$time, i); Addr = 32+ (i*1<<AXI4_BYTES_16); wr_resp_tr = test_m.manager_bfm_wr_tx( (4+i), Addr ); // id, addr wr_resp_tr.set_burst_length(3); wr_resp_tr.set_size(AXI4_BYTES_16); wr_resp_tr.set_burst_type(BURST_TYPE_INCR); wr_resp_tr.set_data_words(Data[0], 0); // data, id wr_resp_tr.set_data_words(Data[1], 1); wr_resp_tr.set_data_words(Data[2], 2); wr_resp_tr.set_data_words(Data[3], 3); wr_resp_tr.set_write_strobes(16'hffff, 0); // strobe, id wr_resp_tr.set_write_strobes(16'hffff, 0); wr_resp_tr.set_write_strobes(16'hffff, 0); wr_resp_tr.set_write_strobes(16'hffff, 0); test_m.put_transaction(wr_resp_tr); test_m.drive_transaction(); rd_resp_tr = test_m.manager_bfm_rd_tx( (4+i), Addr ); rd_resp_tr.set_burst_length(3); rd_resp_tr.set_size(AXI4_BYTES_16); rd_resp_tr.set_burst_type(BURST_TYPE_INCR); fork begin test_m.put_transaction(rd_resp_tr); test_m.drive_transaction(); end begin test_m.put_transaction(wr_resp_tr); test_m.drive_transaction(); end join for (j=0; j<4; j++) begin if (rd_resp_tr.get_data_words(j) == Data[j]) begin f_incr[i][j]=1'b1; $display ( "@ %t Read correct data (%h) at address (%h)", $time, Data[j], (Addr + j) ); end else $display ( "@ %t Error: Expected data (%h) at address (%h), but got %h", $time, Data[j], (Addr + j), rd_resp_tr.get_data_words(j)); end //for j loop end //for i loop /////////////////////////////////////////// CHECK TESTS //////////////////// #(5000000 - $time) // wait until a certain time status=1'b1; //assume pass for (i = 0; i < 4; i++) if (f_rw[i]!=1'b1) status=1'b0; for (i=0; i<4; i++) for (j=0; j<2; j++) if (f_incr[i][j]!=1'b1) status=1'b0; if (status==1'b1) $display ("\n\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> pass H2F "); else begin $display ("\n\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> fail H2F "); for (i=0; i<4; i++) for (j=0; j<2; j++) $display (">>> f_rw[%d] is %b >>> f_incr[%d][%d] is %b ", i, f_rw[i], i, j, f_incr[i][j] ); end $display("\n@%0t************** END OF TEST ****** H2F ******\n",$time); end // initial begin endmodule