Quantcast
Channel: Altera Forums
Viewing all articles
Browse latest Browse all 19390

Custom Instruction accessing SDRAM

$
0
0
Hello

I am currently trying to update a memory location content inside SDRAM from a custom instruction(function called from nios ii). From what I understand, I need to use avalon memory mapped interfaces.

tried the following implementation below, but would not get it to work. is there something that I missed out or misinterpreted?

inside QSYS the custom instruction having a MM master connected to SDRAM MM slave, and for the custom instruction side, a template for avalon mm simple master is being added with a portion of the codes included for custom instruction.
Code:

//avalon MM Master port
    input clock, reset;
    output reg[31:0] avalon_master_address;
    output[3:0] avalon_master_byteenable;
    output reg avalon_master_read;
    input[31:0] avalon_master_readdata;
    input[1:0] avalon_master_response;
    input avalon_master_waitrequest; //not used
    output reg avalon_master_write;
    output reg[31:0] avalon_master_writedata;

    assign avalon_master_byteenable = 4'b1111;

    always@(posedge clk)
    begin
            if(clk_en)
            begin
                if(start)
                begin
                    case(n)
                    2 :    begin
                            avalon_master_address <= addressA;
                            avalon_master_writedata <= dataB;
                            avalon_master_read <= 1'b0;
                            avalon_master_write <= 1'b1;
                            if(avalon_master_response == 2'b00)
                                n2_done <= 1'b1;
                        end
                end
            end
        end
    end

Thanks in advance

Viewing all articles
Browse latest Browse all 19390

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>