
mainmenu_option next_comment
comment 'Processor            '
bool 'Enable LEON4 SPARC V8 Processor' CONFIG_LEON4
if [ "$CONFIG_LEON4" = "y" ]; then
  int 'Number of processors' CONFIG_PROC_NUM 1
  choice 'Force values from example configuration (see help)' \
    "Minimal-configuration	CONFIG_LEON4_MIN \
     General-purpose-cfg	CONFIG_LEON4_GP \
     High-Performance-cfg	CONFIG_LEON4_HP \
     Custom-configuration	CONFIG_LEON4_CUSTOM" Custom-configuration
  if [ "$CONFIG_LEON4_MIN" = "y" ]; then
    define_int  CONFIG_IU_NWINDOWS 8
    define_bool CONFIG_IU_V8MULDIV n
    define_bool CONFIG_IU_BP n
    define_bool CONFIG_IU_SVT y
    define_int  CONFIG_IU_WATCHPOINTS 0
    define_bool CONFIG_PWD n
    define_hex  CONFIG_IU_RSTADDR 00000
    define_bool CONFIG_FPU_ENABLE n
    define_bool CONFIG_ICACHE_ENABLE y
    define_bool CONFIG_ICACHE_ASSO1 y
    define_bool CONFIG_ICACHE_SZ2 y
    define_bool CONFIG_ICACHE_LZ16 y
    define_bool CONFIG_ICACHE_ALGORND y
    define_bool CONFIG_ICACHE_LOCK n
    define_bool CONFIG_DCACHE_ENABLE y
    define_bool CONFIG_DCACHE_ASSO1 y
    define_bool CONFIG_DCACHE_SZ2 y
    define_bool CONFIG_DCACHE_LZ16 y
    define_bool CONFIG_DCACHE_ALGORND y
    define_bool CONFIG_DCACHE_LOCK n
    define_bool CONFIG_DCACHE_SNOOP n
    define_bool CONFIG_MMU_ENABLE n
    define_bool CONFIG_DSU_ENABLE n
    define_bool CONFIG_NP_ASI n
    define_bool CONFIG_PWRPSR n
    define_bool CONFIG_REX n
  fi
  if [ "$CONFIG_LEON4_GP" = "y" ]; then
    define_int  CONFIG_IU_NWINDOWS 8
    define_bool CONFIG_IU_V8MULDIV y
    define_bool CONFIG_IU_MUL_LATENCY_5 y
    define_bool CONFIG_IU_MUL_MAC n
    define_bool CONFIG_IU_BP y
    define_bool CONFIG_IU_SVT y
    define_int  CONFIG_IU_WATCHPOINTS 2
    define_bool CONFIG_PWD y
    define_hex  CONFIG_IU_RSTADDR 00000
    define_bool CONFIG_FPU_ENABLE n
    define_bool CONFIG_ICACHE_ENABLE y
    define_bool CONFIG_ICACHE_ASSO2 y
    define_bool CONFIG_ICACHE_SZ4 y
    define_bool CONFIG_ICACHE_LZ16 y
    define_bool CONFIG_ICACHE_ALGORND y
    define_bool CONFIG_ICACHE_LOCK n
    define_bool CONFIG_ICACHE_LRAM n
    define_bool CONFIG_DCACHE_ENABLE y
    define_bool CONFIG_DCACHE_ASSO2 y
    define_bool CONFIG_DCACHE_SZ4 y
    define_bool CONFIG_DCACHE_LZ16 y
    define_bool CONFIG_DCACHE_ALGORND y
    define_bool CONFIG_DCACHE_LOCK n
    define_bool CONFIG_DCACHE_SNOOP y
    define_bool CONFIG_DCACHE_SNOOP_FAST y
    define_bool CONFIG_DCACHE_SNOOP_SEPTAG y
    define_bool CONFIG_DCACHE_LRAM n
    define_bool CONFIG_MMU_ENABLE y
    define_bool CONFIG_MMU_SPLIT y
    define_bool CONFIG_MMU_REPARRAY y
    define_bool CONFIG_MMU_I8 y
    define_bool CONFIG_MMU_D8 y
    define_bool CONFIG_MMU_FASTWB y
    define_bool CONFIG_MMU_PAGE_4K y
    define_bool CONFIG_DSU_ENABLE y
    define_bool CONFIG_DSU_ITRACE y
    define_bool CONFIG_DSU_ITRACESZ4 y
    define_bool CONFIG_DSU_ATRACESZ4 y
    define_bool CONFIG_NP_ASI y
    define_bool CONFIG_PWRPSR y
    define_bool CONFIG_REX n
  fi
  if [ "$CONFIG_LEON4_HP" = "y" ]; then
    define_int  CONFIG_IU_NWINDOWS 8
    define_bool CONFIG_IU_V8MULDIV y
    define_bool CONFIG_IU_MUL_LATENCY_2 y
    define_bool CONFIG_IU_MUL_MAC n
    define_bool CONFIG_IU_BP y
    define_bool CONFIG_IU_SVT y
    define_int  CONFIG_IU_WATCHPOINTS 4
    define_bool CONFIG_PWD y
    define_hex  CONFIG_IU_RSTADDR 00000
    define_bool CONFIG_FPU_ENABLE y
    define_bool CONFIG_FPU_GRFPU y
    define_bool CONFIG_FPU_GRFPU_INFMUL y
    define_bool CONFIG_ICACHE_ENABLE y
    define_bool CONFIG_ICACHE_ASSO2 y
    define_bool CONFIG_ICACHE_SZ4 y
    define_bool CONFIG_ICACHE_LZ16 y
    define_bool CONFIG_ICACHE_ALGOLRU y
    define_bool CONFIG_ICACHE_LOCK n
    define_bool CONFIG_ICACHE_LRAM n
    define_bool CONFIG_DCACHE_ENABLE y
    define_bool CONFIG_DCACHE_ASSO2 y
    define_bool CONFIG_DCACHE_SZ4 y
    define_bool CONFIG_DCACHE_LZ16 y
    define_bool CONFIG_DCACHE_ALGOLRU y
    define_bool CONFIG_DCACHE_LOCK n
    define_bool CONFIG_DCACHE_SNOOP y
    define_bool CONFIG_DCACHE_SNOOP_FAST y
    define_bool CONFIG_DCACHE_SNOOP_SEPTAG y
    define_bool CONFIG_DCACHE_LRAM n
    define_bool CONFIG_MMU_ENABLE y
    define_bool CONFIG_MMU_SPLIT y
    define_bool CONFIG_MMU_REPARRAY y
    define_bool CONFIG_MMU_I16 y
    define_bool CONFIG_MMU_D16 y
    define_bool CONFIG_MMU_FASTWB y
    define_bool CONFIG_MMU_PAGE_4K y
    define_bool CONFIG_DSU_ENABLE y
    define_bool CONFIG_DSU_ITRACE y
    define_bool CONFIG_DSU_ITRACESZ4 y
    define_bool CONFIG_DSU_ATRACESZ4 y
    define_bool CONFIG_NP_ASI y
    define_bool CONFIG_PWRPSR y
    define_bool CONFIG_REX n
  fi

  if [ "$CONFIG_LEON4_CUSTOM" = "y" ]; then
    mainmenu_option next_comment
      comment 'Integer unit                                           '
      int 'SPARC register windows' CONFIG_IU_NWINDOWS 8
      bool 'SPARC V8 MUL/DIV instructions' CONFIG_IU_V8MULDIV
      if [ "$CONFIG_IU_V8MULDIV" = "y" ]; then
        choice 'Hardware multiplier latency' \
	  "2-cycles		CONFIG_IU_MUL_LATENCY_2 \
	  4-cycles		CONFIG_IU_MUL_LATENCY_4 \
	  5-cycles		CONFIG_IU_MUL_LATENCY_5" 5-cycles
        if [ "$CONFIG_IU_MUL_LATENCY_4" = "y" -o "$CONFIG_IU_MUL_LATENCY_5" = "y" ]; then
          bool 'SPARC V8e SMAC/UMAC instructions     ' CONFIG_IU_MUL_MAC
        fi
        choice 'Multipler structure        ' \
	  "Inferred		CONFIG_IU_MUL_INFERRED \
	  NTNU_Modgen		CONFIG_IU_MUL_MODGEN \
	  TechSpec		CONFIG_IU_MUL_TECHSPEC \
	  Designware		CONFIG_IU_MUL_DW" Inferred
      fi
      bool 'Single-vector trapping' CONFIG_IU_SVT
      int 'Hardware watchpoints' CONFIG_IU_WATCHPOINTS 0
      bool 'Enable power-down mode ' CONFIG_PWD
      hex ' Reset start address (addr[31:12]) ' CONFIG_IU_RSTADDR 00000
      bool 'SPARC V8E non-privileged ASI access' CONFIG_NP_ASI
      bool 'SPARC V8E partial Write %psr (WRPSR)' CONFIG_WRPSR
      bool 'Enable LEON-REX extension' CONFIG_REX
    endmenu
    mainmenu_option next_comment
    comment 'Floating-point unit'
      bool 'Enable FPU                             ' CONFIG_FPU_ENABLE
      if [ "$CONFIG_FPU_ENABLE" = "y" ]; then
        choice 'FPU core' \
	  "GRFPU		CONFIG_FPU_GRFPU \
	   GRFPU-LITE	CONFIG_FPU_GRFPULITE" GRFPU
        if [ "$CONFIG_FPU_GRFPU" = "y" ]; then
	  choice 'GRFPU multiplier' \
	   "Inferred              CONFIG_FPU_GRFPU_INFMUL \
	    DW                    CONFIG_FPU_GRFPU_DWMUL \
	    ModGen                CONFIG_FPU_GRFPU_MODGEN \
   	    TechSpec              CONFIG_FPU_GRFPU_TECHSPEC" Inferred
        fi
        if [ "$CONFIG_HAS_SHARED_GRFPU" = "y" ]; then
	  bool 'Shared GRFPU                      ' CONFIG_FPU_GRFPU_SH
        fi
        if [ "$CONFIG_FPU_GRFPULITE" = "y" ]; then
	  choice 'GRFPU-LITE controller' \
	   "Simple                CONFIG_FPU_GRFPC0 \
	    Data-forwarding       CONFIG_FPU_GRFPC1 \
	    Non-blocking          CONFIG_FPU_GRFPC2" Simple 	
        fi
        bool 'Use VHDL netlist          ' CONFIG_FPU_NETLIST
      fi
    endmenu
  fi
  mainmenu_option next_comment
  comment 'Cache system'
    if [ "$CONFIG_LEON4_CUSTOM" = "y" ]; then
      bool 'Enable instruction cache       ' CONFIG_ICACHE_ENABLE
      if [ "$CONFIG_ICACHE_ENABLE" = "y" ]; then
        choice 'Associativity (ways)            ' \
	  "1		CONFIG_ICACHE_ASSO1 \
	  2		CONFIG_ICACHE_ASSO2 \
	  3		CONFIG_ICACHE_ASSO3 \
	  4		CONFIG_ICACHE_ASSO4" 1
        choice 'Way size (kbytes/way)' \
	  "1		CONFIG_ICACHE_SZ1 \
	  2		CONFIG_ICACHE_SZ2 \
	  4		CONFIG_ICACHE_SZ4 \
	  8		CONFIG_ICACHE_SZ8 \
	  16		CONFIG_ICACHE_SZ16 \
	  32		CONFIG_ICACHE_SZ32 \
	  64		CONFIG_ICACHE_SZ64 \
	  128		CONFIG_ICACHE_SZ128 \
	  256		CONFIG_ICACHE_SZ256" 4
        choice 'Line size (bytes/line)' \
	  "16		CONFIG_ICACHE_LZ16 \
	  32		CONFIG_ICACHE_LZ32" 32
        if [ "$CONFIG_ICACHE_ASSO1" != "y" ]; then
          choice 'Replacement alorithm' \
	   "Random		CONFIG_ICACHE_ALGORND \
	   Dynamic		CONFIG_ICACHE_ALGOLRU" Random
#         bool 'Cache locking      ' CONFIG_ICACHE_LOCK
        fi
      fi
#    if [ "$CONFIG_MMU_ENABLE" != "y" ]; then
#      bool 'Enable local instruction RAM            ' CONFIG_ICACHE_LRAM
#    fi
#    if [ "$CONFIG_ICACHE_LRAM" = "y" ]; then
#        choice 'Local data RAM size (kbytes)' \
#	"1		CONFIG_ICACHE_LRAM_SZ1 \
#	2		CONFIG_ICACHE_LRAM_SZ2 \
#	4		CONFIG_ICACHE_LRAM_SZ4 \
#	8		CONFIG_ICACHE_LRAM_SZ8 \
#	16		CONFIG_ICACHE_LRAM_SZ16 \
#	32		CONFIG_ICACHE_LRAM_SZ32 \
#	64		CONFIG_ICACHE_LRAM_SZ64 \
#	128		CONFIG_ICACHE_LRAM_SZ128 \
#	256		CONFIG_ICACHE_LRAM_SZ256" 4
#        hex ' Local instruction RAM start address (8 MSB) ' CONFIG_ICACHE_LRSTART 8e
#    fi
      bool 'Enable data cache       ' CONFIG_DCACHE_ENABLE
      if [ "$CONFIG_DCACHE_ENABLE" = "y" ]; then
        choice 'Associativity (ways)' \
	  "1		CONFIG_DCACHE_ASSO1 \
	  2		CONFIG_DCACHE_ASSO2 \
	  3		CONFIG_DCACHE_ASSO3 \
	  4		CONFIG_DCACHE_ASSO4" 1
        choice 'Way size (kbytes/ways)' \
	  "1		CONFIG_DCACHE_SZ1 \
	  2		CONFIG_DCACHE_SZ2 \
	  4		CONFIG_DCACHE_SZ4 \
	  8		CONFIG_DCACHE_SZ8 \
	  16		CONFIG_DCACHE_SZ16 \
	  32		CONFIG_DCACHE_SZ32 \
	  64		CONFIG_DCACHE_SZ64 \
	  128		CONFIG_DCACHE_SZ128 \
	  256		CONFIG_DCACHE_SZ256" 4
        if [ "$CONFIG_DCACHE_ENABLE" = "y" ]; then
          choice 'Line size (bytes/line)' \
	    "16		CONFIG_DCACHE_LZ16 \
	    32		CONFIG_DCACHE_LZ32" 16
        fi
        if [ "$CONFIG_DCACHE_ASSO1" != "y" ]; then
          choice 'Replacement alorithm' \
	  "Random		CONFIG_DCACHE_ALGORND \
	  Dynamic		CONFIG_DCACHE_ALGOLRU" Random
          bool 'Cache locking      ' CONFIG_DCACHE_LOCK
        fi
        bool 'AHB snooping       ' CONFIG_DCACHE_SNOOP
        if [ "$CONFIG_DCACHE_SNOOP" = "y" ]; then
            bool 'Separate physical/snoop tags  ' CONFIG_DCACHE_SNOOP_SEPTAG
        fi
      fi
    fi
    hex 'Fixed cacheability map  ' CONFIG_CACHE_FIXED 0
    hex '64/128-bit AHB bus map     ' CONFIG_BWMASK 0000
    choice 'Cache and AHB data width' \
	"64-bit		CONFIG_CACHE_64BIT \
	128-bit		CONFIG_CACHE_128BIT" 64-bit 
#    if [ "$CONFIG_MMU_ENABLE" != "y" ]; then
#      bool 'Enable local data RAM            ' CONFIG_DCACHE_LRAM
#    fi
#    if [ "$CONFIG_DCACHE_LRAM" = "y" ]; then
#        choice 'Local data RAM size (kbytes)' \
#	"1		CONFIG_DCACHE_LRAM_SZ1 \
#	2		CONFIG_DCACHE_LRAM_SZ2 \
#	4		CONFIG_DCACHE_LRAM_SZ4 \
#	8		CONFIG_DCACHE_LRAM_SZ8 \
#	16		CONFIG_DCACHE_LRAM_SZ16 \
#	32		CONFIG_DCACHE_LRAM_SZ32 \
#	64		CONFIG_DCACHE_LRAM_SZ64 \
#	128		CONFIG_DCACHE_LRAM_SZ128 \
#	256		CONFIG_DCACHE_LRAM_SZ256" 4
#        hex ' Local data RAM start address (8 MSB) ' CONFIG_DCACHE_LRSTART 8f
#    fi
  endmenu

  if [ "$CONFIG_LEON4_CUSTOM" = "y" ]; then
    mainmenu_option next_comment
    comment 'MMU'
    bool 'Enable MMU       ' CONFIG_MMU_ENABLE
    if [ "$CONFIG_MMU_ENABLE" = "y" ]; then
      choice 'MMU type              ' \
	  "combined	CONFIG_MMU_COMBINED \
	   split		CONFIG_MMU_SPLIT" combined
      choice 'TLB replacement sheme              ' \
	  "LRU      	CONFIG_MMU_REPARRAY \
	   Increment	CONFIG_MMU_REPINCREMENT" Increment 
         choice 'Instruction (or combined) TLB entries' \
	  "2		CONFIG_MMU_I2 \
	  4		CONFIG_MMU_I4 \
	  8		CONFIG_MMU_I8 \
	  16		CONFIG_MMU_I16 \
	  32		CONFIG_MMU_I32 \
	  64		CONFIG_MMU_I64" 8
      if [ "$CONFIG_MMU_SPLIT" = "y" ]; then
         choice 'Data TLB entries' \
	  "2		CONFIG_MMU_D2 \
	  4		CONFIG_MMU_D4 \
	  8		CONFIG_MMU_D8 \
	  16		CONFIG_MMU_D16 \
	  32		CONFIG_MMU_D32 \
	  64		CONFIG_MMU_D64" 8
	  bool 'Fast writebuffer       ' CONFIG_MMU_FASTWB
      fi
      choice 'MMU page size' \
	  "4K		CONFIG_MMU_PAGE_4K \
	  8K		CONFIG_MMU_PAGE_8K \
	  16K		CONFIG_MMU_PAGE_16K \
	  32K		CONFIG_MMU_PAGE_32K \
	  Programmable	CONFIG_MMU_PAGE_PROG" 4K
    fi
    endmenu
  fi
  mainmenu_option next_comment
    comment 'Debug Support Unit        '
    bool 'Enable LEON4 Debug support unit    ' CONFIG_DSU_ENABLE
    if [ "$CONFIG_DSU_ENABLE" = "y" ]; then
      bool 'Instruction trace buffer' CONFIG_DSU_ITRACE
      if [ "$CONFIG_DSU_ITRACE" = "y" ]; then
        choice 'Instruction trace buffer size (kbytes)' \
	"1		CONFIG_DSU_ITRACESZ1 \
	2		CONFIG_DSU_ITRACESZ2 \
	4		CONFIG_DSU_ITRACESZ4 \
	8		CONFIG_DSU_ITRACESZ8 \
	16		CONFIG_DSU_ITRACESZ16" 1
        bool 'Enable two-port instruction trace buffer' CONFIG_DSU_ITRACE_2P
      fi
      bool 'AHB trace buffer' CONFIG_DSU_ATRACE
      if [ "$CONFIG_DSU_ATRACE" = "y" ]; then
        choice 'AHB trace buffer size (kbytes)' \
	"1		CONFIG_DSU_ATRACESZ1 \
	2		CONFIG_DSU_ATRACESZ2 \
	4		CONFIG_DSU_ATRACESZ4 \
	8		CONFIG_DSU_ATRACESZ8 \
	16		CONFIG_DSU_ATRACESZ16" 1
        bool 'Enable AHB trace buffer filters ' CONFIG_DSU_AFILT
        bool 'Enable statistics outputs       ' CONFIG_DSU_ASTAT
        choice 'AHB watchpoints' \
	"Pipelined	CONFIG_DSU_AHBWP2 \
	Enabled		CONFIG_DSU_AHBWP1 \
	Disabled	CONFIG_DSU_AHBWP0 " Pipelined
      fi
    fi
    bool 'Enable LEON4 Statistics Module       ' CONFIG_STAT_ENABLE
    if [ "$CONFIG_STAT_ENABLE" = "y" ]; then
      int 'Number of counters (1 - 64)           ' CONFIG_STAT_CNT 4
      int 'Number of accumulative counters       ' CONFIG_STAT_NMAX 0
    fi
  endmenu

  mainmenu_option next_comment
  comment 'Fault-tolerance  '
      choice 'IU Register file protection     ' \
	"None		CONFIG_IUFT_NONE \
	TMR		CONFIG_IUFT_TMR" None
#      bool 'Register file error injection' CONFIG_RF_ERRINJ
      choice 'Cache memory protection     ' \
	  "None		CONFIG_CACHE_FT_NONE \
	   Parity		CONFIG_CACHE_FT_EN \
 	   SECDEC-BCH 		CONFIG_CACHE_FT_BCH \
	   TechSpec		CONFIG_CACHE_FT_TECH" None
#      int 'Cache memory error injection' CONFIG_CACHE_ERRINJ 0
      bool 'Use LEON4 netlist         ' CONFIG_LEON4_NETLIST
  endmenu

  mainmenu_option next_comment
    comment 'VHDL debug settings       '
    bool 'Processor disassembly to console         ' CONFIG_IU_DISAS
    if [ "$CONFIG_IU_DISAS" = "y" ]; then
      bool 'Processor disassembly in netlist         ' CONFIG_IU_DISAS_NET
    fi
    bool '32-bit program counters       ' CONFIG_DEBUG_PC32
  endmenu
fi
endmenu

