Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 24

Thread: Programming NIOSII interfaced with custom component, using Avalon MM Interface

  1. #11
    Join Date
    Nov 2013
    Posts
    88
    Rep Power
    1

    Default Re: Programming NIOSII interfaced with custom component, using Avalon MM Interface

    Hi,
    I succeeded in implementing the system on board. My custom component is a 128 tap FIR filter which is to be started by NIOS and stimuli is also provided by nios. I made the custom component in Qsys and implemented the system.
    Now i am able to write the c code successfully on the NIOS without any tool errors.

    But, i am not able to communicate properly. Below is my code:

    int var =1234;
    IOWR(20496,0,11);

    printf("%d\n",var); //prints 1234

    var = IORD(20496,0);

    printf("%d\n",var); // prints 0

    When I am reading the same address and offset, it gives 0.

  2. #12
    Join Date
    Jan 2010
    Location
    India
    Posts
    89
    Rep Power
    1

    Default Re: Programming NIOSII interfaced with custom component, using Avalon MM Interface

    Your c code looks correct. I think there should be some problem in your custom component register interface logic.
    Would you provide that logic?

    Or You can verify using NIOS II Modelsim.You can also use signal tap and check whether data is written into your custom component register or not.

  3. #13
    Join Date
    Nov 2013
    Posts
    88
    Rep Power
    1

    Default Re: Programming NIOSII interfaced with custom component, using Avalon MM Interface

    Hi, the code look like:

    always @(posedge csi_clk or posedge rsi_reset_n) begin // To read
    if (rsi_reset_n) begin

    end else if (avs_s0_read) begin
    avs_s0_readdata = START;
    end else begin
    avs_s0_readdata = 0;
    end
    end

    always @(posedge csi_clk or posedge rsi_reset_n) begin // To write
    if (rsi_reset_n) begin
    START <= 0;
    DATA <= 0;
    end else if (avs_s0_write) begin
    case (avs_s0_address)
    2'b00 : begin//
    START <= avs_s0_writedata;
    end
    2'b01 : begin
    DATA <= avs_s0_writedata;
    end
    default : begin
    DATA <= 0;
    end
    endcase
    end
    end

    In my C ode, i am trying to write START register (as posted previously) and read back START register.
    Please suggest. I need to come out of this issue soon
    Last edited by anuj121990; November 14th, 2013 at 03:36 PM.

  4. #14
    Join Date
    Jan 2010
    Location
    India
    Posts
    89
    Rep Power
    1

    Default Re: Programming NIOSII interfaced with custom component, using Avalon MM Interface

    Quote Originally Posted by anuj121990 View Post
    Hi, the code look like:

    always @(posedge csi_clk or posedge rsi_reset_n) begin // To read
    if (rsi_reset_n) begin

    end else if (avs_s0_read) begin
    avs_s0_readdata = START;
    end else begin
    avs_s0_readdata = 0;
    end
    end
    Its look like your code is correct. Still you can replace above code with this one

    always @(posedge csi_clk or posedge rsi_reset_n)
    begin // To read
    if (rsi_reset_n)
    begin
    avs_s0_readdata <= 0;
    end
    else
    begin
    case(avs_s0_address)
    2'b00 : avs_s0_readdata <= START;
    default : avs_s0_readdata <= 0;
    endcase
    end
    end

    Apart from this what is the read and write latency of your Avalon interface.You can find it in your .tcl file.If write latency is zero then your write logic is correct and if your read latency is 1 then your read logic is correct.

    I have one doubt regarding reset.Is it active high or low? From the name of reset it looks like it is active low and you have used it as a active high. You can also find this from your .tcl file.

    Also make practice to use non blocking statement for sequential logic.

    Regards,

    Krupesh

  5. #15
    Join Date
    Nov 2013
    Posts
    88
    Rep Power
    1

    Default Re: Programming NIOSII interfaced with custom component, using Avalon MM Interface

    Hi,

    I am able to communicate with the custom component successfully.
    Now my final task is to calculate the no of clock cycles consumed by the custom component during the execution.

    I also included Signal Tap II in my design. But i don't know how to use that to calculate no of clock cycles.

    Please help.

  6. #16
    Join Date
    Jan 2010
    Location
    India
    Posts
    89
    Rep Power
    1

    Default Re: Programming NIOSII interfaced with custom component, using Avalon MM Interface

    You can use performance counter or interval timer provided by the Altera or
    You can implement one counter inside your custom component and add one register to read its value.

  7. #17
    Join Date
    Nov 2013
    Posts
    88
    Rep Power
    1

    Default Re: Programming NIOSII interfaced with custom component, using Avalon MM Interface

    I used performance counter, but not able to see anything on the console. Not even the stuff which I was getting before adding the performance counter.
    I followed the steps below:

    1. Added Performance counter in Qsys Design.
    2. Added Timer.
    3. Used:
    PERF_RESET();
    PERF_START_MEASURING();
    PERF_BEGIN();

    // Here is the code block to be tested.
    // I want to know the cycles consumed during this block.

    PERF_END();
    PERF_STOP_MEASURING();
    perf_print_formatted_report();

    Please help if i am missing anything in the process.

  8. #18
    Join Date
    Jan 2010
    Location
    India
    Posts
    89
    Rep Power
    1

    Default Re: Programming NIOSII interfaced with custom component, using Avalon MM Interface

    I have used performance counter long time ago.Its look like that you are doing the same thing. Here is my code

    PERF_RESET(PERFORMANCE_COUNTER_0_BASE);
    PERF_START_MEASURING(PERFORMANCE_COUNTER_0_BASE);
    PERF_BEGIN(PERFORMANCE_COUNTER_0_BASE,1);

    // Here is the code block to be tested.
    // I want to know the cycles consumed during this block.

    PERF_END(PERFORMANCE_COUNTER_0_BASE,1);

    int cycles = IORD(PERFORMANCE_COUNTER_0_BASE,4); //Read the value of counter.Note that offset is set to 4.

    If it is not working then your should design counter in your custom component and read it using avalon interface for the quick solution.

  9. #19
    Join Date
    Nov 2013
    Posts
    88
    Rep Power
    1

    Default Re: Programming NIOSII interfaced with custom component, using Avalon MM Interface

    Thanks a lot zoomkrupesh, cronus10.

    With all your help and guidance, I successfully implemented and tested my project.

    Regards,
    Anuj Agrawal

  10. #20
    Join Date
    Jan 2010
    Location
    India
    Posts
    89
    Rep Power
    1

    Default Re: Programming NIOSII interfaced with custom component, using Avalon MM Interface

    Hi Anuj,

    Would you please share how did you find the solution? So that it will be helpful to other users as well.

    Thanks,

    Krupesh

Similar Threads

  1. Relationship among Niosii, Avalon MM interface, DMA etc..
    By nervecell_23 in forum General Discussion Forum
    Replies: 7
    Last Post: January 21st, 2016, 02:28 AM
  2. Avalon -> Dual Port RAM -> custom hardware interface
    By markaren1 in forum General Discussion Forum
    Replies: 2
    Last Post: January 26th, 2013, 01:47 PM
  3. Burstcount value in a master interface custom component
    By dtromson in forum Quartus II and EDA Tools Discussion
    Replies: 0
    Last Post: April 25th, 2012, 05:44 AM
  4. Avalon-MM Tristate Bridge and custom component
    By neptunus in forum General Discussion Forum
    Replies: 1
    Last Post: October 9th, 2011, 10:41 AM
  5. DDR2 Memory Interfaced as Avalon Slave
    By sheshikanth_2000 in forum IP Discussion
    Replies: 1
    Last Post: June 26th, 2008, 01:55 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •