Forum Discussion
Altera_Forum
Honored Contributor
11 years agoVery good ,this step is completed,Thanks ,
Now im tiring to simulate my custom design(without NIOS) using the testbenches lik what it is done in "Altera JTAG-to-Avalon-MM Tutorial". my custom component is like this (slave): https://www.alteraforum.com/forum/attachment.php?attachmentid=10031 last time I used this method to talk to my hardware from NIOS: --- Quote Start --- # include<stdio.h> # include<unistd.h> # include "system.h" # include "alt_types.h" # include <io.h> # ifndef loadstart # define loadstart 0x0 # endif # ifndef loadnxt # define loadnxt 0x1 # endif # ifndef loadwe # define loadwe 0x2 # endif # ifndef loadeaddr # define loadeaddr 0x3 # endif # ifndef loadAi0 # define loadAi0 0x4 # endif # ifndef loadAi1 # define loadAi1 0x5 # endif # ifndef loadAi2 # define loadAi2 0x6 # endif # ifndef loadAi3 # define loadAi3 0x7 # endif # ifndef loadBi0 # define loadBi0 0x8 # endif # ifndef loadBi1 # define loadBi1 0x9 # endif # ifndef loadBi2 # define loadBi2 0xA # endif # ifndef loadBi3 # define loadBi3 0xB # endif # ifndef readsum # define readsum 0xC # endif # ifndef readpdone # define readpdone 0xD # endif # ifndef readdone # define readdone 0xE # endif void matrixmul(int A[16][16],int B[16][16],int C[16][16]) { int k=0; IOWR(MATRIXMUL_0_BASE,loadwe,1); int i,l,m; for(i=0; i<16; i++) { int j=0; while(j<16) { IOWR(MATRIXMUL_0_BASE,loadeaddr,k); IOWR(MATRIXMUL_0_BASE, loadAi0, A[j]);iowr(matrixmul_0_base, loadai1, a[j+1]); IOWR(MATRIXMUL_0_BASE, loadAi2, A[j+2]);
iowr(matrixmul_0_base, loadai3, a[j+3]);; IOWR(MATRIXMUL_0_BASE, loadBi0, B[j]);
iowr(matrixmul_0_base, loadbi1, b[j+1]); IOWR(MATRIXMUL_0_BASE, loadBi2, B[j+2]);
iowr(matrixmul_0_base, loadbi3, b[j+3]); ... ... --- Quote End --- But Now I dont know how to communicate with my custom hardware in testbench using "avalon_write" or "avalon_read" since I need to access this signals directly: input [2:0] address; input [31:0] writedata; Now I manipulate avalon_write function and used index of "set_command_data" as below: --- Quote Start --- $display(""); test_number = test_number + 1; $display("-----------------------------------------------"); $display("%1d: Test the GCD.", test_number); $display("-----------------------------------------------"); // -------------------------------------------------------- // $display(" * Write 25 to the GCD"); wrdata = 2; wrindex=1; avalon_GCD_write('h20, 2,1); avalon_GCD_write('h20, 25,2); avalon_GCD_write('h20, 5,3); avalon_GCD_write('h20, 1,1); //avalon_GCD_write('h20, wrdata,wrindex); //avalon_GCD_write('h20, wrdata,wrindex); for (int i = 0; i < 32; i++) begin avalon_read('h20+i, rddata); $display(" - GCD register value = %.2Xh", rddata); end $display(""); --------------------------------------------------------------- task avalon_GCD_write ( // ------------------------------------------------------------ input [`AV_ADDRESS_W-1:0] addr, input [`AV_DATA_W-1:0] data, input int index1 ); begin // Construct the BFM request `BFM.set_command_request(REQ_WRITE);//fix `BFM.set_command_idle(0, 0); // idle cycle at the end of each transaction,index? `BFM.set_command_init_latency(0); //fix Sets the number of cycles to postpone the start of a command. `BFM.set_command_address(addr); //fix `BFM.set_command_byte_enable('1,0); // Sets the transaction byte enable,index?? `BFM.set_command_data(data, index1); // Queue the command `BFM.push_command(); // Wait until the transaction has completed while (`BFM.get_response_queue_size() != 1) @(posedge clk); // Dequeue the response and discard `BFM.pop_response(); end endtask --- Quote End --- but i got this error:2330000: ERROR: qsys_system_bfm_master_tb.dut.bfm_master.__check_transaction_index: Cycle index 1 exceeds MAX_BURST_SIZE-1 0 Totally I dont know what am i doing! but I couldn't find any example in "Introduction to Avalon Verification IP Suite" to how to talk to my custom component. especially I need to access "address" in my own custom component. can you show me a good tutorial or tell me what to do? thanks