Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
8 years ago

SPI to Avalon MM Master IP

Hi

I am greatly confused by the SPI to Avalon MM Master IP core in Quartus Prime (16.0). After referring to the online documentation https://www.altera.com/documentation/sfo1400787952932.html#iga1401395000089 and https://www.altera.com/content/dam/altera-www/global/en_us/pdfs/literature/ug/ug_embedded_ip.pdf I only have more questions. It seems that the IP core uses encoding in the byte streams. Why is this done and is it possible to turn this off? It seems like an unnecessary step in data processing for the SPI master. Additionally, the read and write processes that illustrated look identical, I'm sure this can't be intentional. What is the "Command" byte sequence that is referred to in these images? I have so many questions! Can someone help me to understand this process better?

Thanks in advance.

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,

    I am doing burst write operation using avalon bfm.

    For burst operaion shall i need to pass the data and address for all burst or bfm will automatically generate the data and address.

    In below task i am only passing base address and the randomized data. But in simulation result I am getting only one data.

    Please anyone give me some idea about this.

    task automatic mm_send_cfg_write;

    input [34:0] addr;

    input int data[int];

    `MM_BFM.set_command_address(addr << 2);

    `MM_BFM.set_command_burst_count(8);

    `MM_BFM.set_command_burst_size(8);

    `MM_BFM.set_command_init_latency(0);

    `MM_BFM.set_command_request(REQ_WRITE);

    for(i=0;i<8;i++)

    begin

    `MM_BFM.set_command_data((data),i);\

    `mm_bfm.set_command_byte_enable(4'hf,i);

    end

    `mm_bfm.set_command_idle(0, 0);

    `mm_bfm.set_command_timeout(0);

    `mm_bfm.push_command();

    while (`mm_bfm.get_response_queue_size() != 1)

    @(posedge `mm_bfm.clk);

    `mm_bfm.pop_response();

    $display("%0t mm traffic generator id configuration write: addr: 0x%h data 0x%h",$time, addr, data);

    $display("mm traffic generator id configuration write: addr: 0x%h data: 0x%h", addr, data);

    endtask

    task data_init(output [31:0] data [int]);

    for(i=0; i<8; i++)

    data = {$random(), $random()};

    endtask

    initial

    begin

    data_init();

    mm_send_cfg_write('d0,wdata);

    end

    Thanks

    venkat