Forum Discussion

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

Memory address problem related to create a custom instruction

Hello,

I'm working to compile the application sample from Nios II Custom Instruction User Guide.

I made the hardware setup and configuration with QSys without problem and I've programmed the BeMicro SDK board but I've a problem with the software application on Nios II EDS.

After create the BSP project and application project I need to customize this defines for MEMORY_DEVICE_SIZE on crc_main.c but I don't know what values I need to use:


/* Change the name of memory device according to what you are using
 *  e.g.: DDR_SDRAM_0# #_SPAN
 *        SSRAM_0# #_SPAN                                        
 */
# define MEMORY_DEVICE_SIZE DDR_SDRAM# #_SPAN

Here I put the system.h section with the mobile_ddr_sdram's configuration and custom instruction's configuration made automatically by Nios II EDS using the sopcfile that I made using QSys. This file include the Custom Instruction CRC from the guide:


/*
 * mobile_ddr_sdram configuration
 *
 */
# define ALT_MODULE_CLASS_mobile_ddr_sdram mtx_avalon_sdram_mddr
# define MOBILE_DDR_SDRAM_BASE 0x4000000
# define MOBILE_DDR_SDRAM_IRQ -1
# define MOBILE_DDR_SDRAM_IRQ_INTERRUPT_CONTROLLER_ID -1
# define MOBILE_DDR_SDRAM_NAME "/dev/mobile_ddr_sdram"
# define MOBILE_DDR_SDRAM_SPAN 67108864
# define MOBILE_DDR_SDRAM_TYPE "mtx_avalon_sdram_mddr"
/*
 * Custom instruction macros
 *
 */
# define ALT_CI_CRC_0(n,A) __builtin_custom_ini(ALT_CI_CRC_0_N+(n&ALT_CI_CRC_0_N_MASK),(A))
# define ALT_CI_CRC_0_N 0x0
# define ALT_CI_CRC_0_N_MASK ((1<<3)-1)

I need that someone help me to know what value I need to use in the MEMORY_DEVICE_SIZE defines on crc_main.c.

Thanks.

Fabricio.

1 Reply

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

    If I correctly understand your question, you only need to add MOBILE_ to the template define in order to match the name of your ddr device:

    # define MEMORY_DEVICE_SIZE MOBILE_DDR_SDRAM_SPAN