Forum Discussion

A_Manikanta's avatar
A_Manikanta
Icon for New Contributor rankNew Contributor
1 year ago
Solved

How to perform read/write to CSR registers in custom controller core through NIOS II processor?

Hi,
We have created a qsys system with NIOS II fast core processor.
We have integrated our custom controller core with NIOS processor.
How to perform read/write to CSR registers in custom controller core through NIOS II Software build tool eclipse?
I am specifically looking for functions, format to use from eclipse. Is there any tutorial, or documents for this ?

Thanks,
Manikanta.
  • Hi


    For the NiosII the CSR Registers are listed under the NiosII Processor Reference Guide.

    https://cdrdv2-public.intel.com/666887/n2cpu-nii5v1gen2-683836-666887.pdf

    To get the registers value it uses the built in function of NiosII to get the registers value.


    If you are trying to get CSR Registers from another custom processor.

    This will require the processor to get its own CSR register and send it to the NiosII processor. (through some other protocol).

    CSR register is a status of the processor and usually not able to be read externally except for a debugger.


    Regards

    Jingyang, Teh



6 Replies

  • tehjingy_Altera's avatar
    tehjingy_Altera
    Icon for Regular Contributor rankRegular Contributor

    Hi


    You could use the macro defined in the nios2.h header file under the BSP folder generated.

    There a multiple macros ranging from NIOS2_READ_STATUS to NIOS2_READ_BSTATUS


    Regards

    Jingyang, Teh


  • tehjingy_Altera's avatar
    tehjingy_Altera
    Icon for Regular Contributor rankRegular Contributor

    Hi


    Any update on this case?

    Did you able to find the macro to read the registers?


    Regards

    Jingyang, Teh


    • A_Manikanta's avatar
      A_Manikanta
      Icon for New Contributor rankNew Contributor
      Hi ,
      Actually im trying to perform write/read operation to custom core CSR registers.
      I am specifically looking for functions, format to use from eclipse. Is there any tutorial, or documents for this ?
  • tehjingy_Altera's avatar
    tehjingy_Altera
    Icon for Regular Contributor rankRegular Contributor

    Hi


    For the NiosII the CSR Registers are listed under the NiosII Processor Reference Guide.

    https://cdrdv2-public.intel.com/666887/n2cpu-nii5v1gen2-683836-666887.pdf

    To get the registers value it uses the built in function of NiosII to get the registers value.


    If you are trying to get CSR Registers from another custom processor.

    This will require the processor to get its own CSR register and send it to the NiosII processor. (through some other protocol).

    CSR register is a status of the processor and usually not able to be read externally except for a debugger.


    Regards

    Jingyang, Teh



  • tehjingy_Altera's avatar
    tehjingy_Altera
    Icon for Regular Contributor rankRegular Contributor

    Hi


    I’m glad that your question has been addressed, I will now transition this thread to community support. If you have a new question, Please login to ‘https://supporttickets.intel.com/s/?language=en_US’, view details of the desire request, and post a feed/response within the next 15 days to allow me to continue to support you. After 15 days, this thread will be transitioned to community support. The community users will be able to help you on your follow-up questions.


    Regards

    Jingyang, Teh