# FILE: header.tk
# This file is boilerplate TCL/TK function definitions for 'make xconfig'.
#
# CHANGES
# =======
#
# 8 January 1999, Michael Elizabeth Chastain, <mec@shout.net>
# - Remove unused do_cmd function (part of the 2.0 sound support).
# - Arrange buttons in three columns for better screen fitting.
# - Add CONSTANT_Y, CONSTANT_M, CONSTANT_N for commands like:
#     dep_tristate 'foo' CONFIG_FOO m
#
# 23 January 1999, Michael Elizabeth Chastain, <mec@shout.net>
# - Shut vfix the hell up.
#
# 24 January 1999, Michael Elizabeth Chastain, <mec@shout.net>
# - Improve the exit message (Jeff Ronne).

#
# This is a handy replacement for ".widget cget" that requires neither tk4
# nor additional source code uglification.
#
proc cget { w option } {
	return "[lindex [$w configure $option] 4]"
}

#
# Function to compensate for broken config.in scripts like the sound driver,
# which make dependencies on variables that are never even conditionally
# defined.
#
proc vfix { var } {
	global $var
	if [ catch {eval concat $$var} ] {
		set $var 4
	}
}

#
# Constant values used by certain dep_tristate commands.
#
set CONSTANT_Y 1
set CONSTANT_M 2
set CONSTANT_N 0
set CONSTANT_E 4

#
# Create a "reference" object to steal colors from.
#
button .ref

#
# On monochrome displays, -disabledforeground is blank by default; that's
# bad.  Fill it with -foreground instead.
#
if { [cget .ref -disabledforeground] == "" } {
	.ref configure -disabledforeground [cget .ref -foreground]
}


#
# Define some macros we will need to parse the config.in file.
#

proc mainmenu_name { text } {
	wm title . "$text"
}

proc menu_option { w menu_num text } {
	global menus_per_column
	global processed_top_level
	set processed_top_level [expr $processed_top_level + 1]
	if { $processed_top_level <= $menus_per_column } then {
	    set myframe left
	} elseif { $processed_top_level <= [expr 2 * $menus_per_column] } then {
	    set myframe middle
	} else {
	    set myframe right
	} 
	button .f0.x$menu_num -anchor w -text "$text" \
	    -command "$w .$w \"$text\""
	pack .f0.x$menu_num -pady 0 -side top -fill x -in .f0.$myframe
}

proc load_configfile { w title func } {
	catch {destroy $w}
	toplevel $w -class Dialog
	global loadfile
	frame $w.x
	label $w.bm -bitmap questhead
	pack  $w.bm -pady 10 -side top -padx 10
	label $w.x.l -text "Enter filename:" -relief raised
	entry $w.x.x -width 35 -relief sunken -borderwidth 2 \
		-textvariable loadfile
	pack $w.x.l $w.x.x -anchor w -side left
	pack $w.x -side top -pady 10
	wm title $w "$title" 

	set oldFocus [focus]
	frame $w.f
	button $w.f.back -text "OK" -width 20 \
		-command "destroy $w; focus $oldFocus;$func .fileio"
	button $w.f.canc -text "Cancel" \
		-width 20 -command "destroy $w; focus $oldFocus"
	pack $w.f.back $w.f.canc -side left -pady 10 -padx 45
	pack $w.f -pady 10 -side bottom -padx 10 -anchor w
	focus $w
	global winx; global winy
	set winx [expr [winfo x .]+30]; set winy [expr [winfo y .]+30]
	wm geometry $w +$winx+$winy
}

bind all <Alt-q> {maybe_exit .maybe}

proc maybe_exit { w } {
	catch {destroy $w}
	toplevel $w -class Dialog
	label $w.bm -bitmap questhead
	pack  $w.bm -pady 10 -side top -padx 10
	message $w.m -width 400 -aspect 300 \
		-text "Changes will be lost.  Are you sure?" -relief flat
	pack  $w.m -pady 10 -side top -padx 10
	wm title $w "Are you sure?" 

	set oldFocus [focus]
	frame $w.f
	button $w.f.back -text "OK" -width 20 \
		-command "exit 1"
	button $w.f.canc -text "Cancel" \
		-width 20 -command "destroy $w; focus $oldFocus"
	pack $w.f.back $w.f.canc -side left -pady 10 -padx 45
	pack $w.f -pady 10 -side bottom -padx 10 -anchor w
  	bind $w <Return> "exit 1"
    	bind $w <Escape> "destroy $w; focus $oldFocus"
	focus $w
	global winx; global winy
	set winx [expr [winfo x .]+30]; set winy [expr [winfo y .]+30]
	wm geometry $w +$winx+$winy
}

proc read_config_file { w } {
	global loadfile
	if { [string length $loadfile] != 0 && [file readable $loadfile] == 1 } then {
		read_config $loadfile
	} else {
		catch {destroy $w}
		toplevel $w -class Dialog
		message $w.m -width 400 -aspect 300 -text \
			"Unable to read file $loadfile" \
			 -relief raised 
		label $w.bm -bitmap error
		pack $w.bm $w.m -pady 10 -side top -padx 10
		wm title $w "Xconfig Internal Error" 

		set oldFocus [focus]
		frame $w.f
		button $w.f.back -text "Bummer" \
			-width 10 -command "destroy $w; focus $oldFocus"
		pack $w.f.back -side bottom -pady 10 -anchor s
		pack $w.f -pady 10 -side top -padx 10 -anchor s
		focus $w
		global winx; global winy
		set winx [expr [winfo x .]+30]; set winy [expr [winfo y .]+30]
		wm geometry $w +$winx+$winy
	}
}

proc write_config_file  { w } {
	global loadfile
	if { [string length $loadfile] != 0 
    		&& ([file writable $loadfile] == 1 || ([file exists $loadfile] == 0 && [file writable [file dirname $loadfile]] == 1)) } then {
		writeconfig $loadfile .null
	} else {
		catch {destroy $w}
		toplevel $w -class Dialog
		message $w.m -width 400 -aspect 300 -text \
			"Unable to write file $loadfile" \
			 -relief raised 
		label $w.bm -bitmap error
		pack $w.bm $w.m -pady 10 -side top -padx 10
		wm title $w "Xconfig Internal Error" 

		set oldFocus [focus]
		frame $w.f
		button $w.f.back -text "OK" \
			-width 10 -command "destroy $w; focus $oldFocus"
		pack $w.f.back -side bottom -pady 10 -anchor s
		pack $w.f -pady 10 -side top -padx 10 -anchor s
		focus $w
		global winx; global winy
		set winx [expr [winfo x .]+30]; set winy [expr [winfo y .]+30]
		wm geometry $w +$winx+$winy
	}
}

proc read_config { filename } {
	set file1 [open $filename r]
	clear_choices
	while { [gets $file1 line] >= 0} {
		if [regexp {([0-9A-Za-z_]+)=([ynm])} $line foo var value] {
			if { $value == "y" } then { set cmd "global $var; set $var 1" }
			if { $value == "n" } then { set cmd "global $var; set $var 0" }
			if { $value == "m" } then { set cmd "global $var; set $var 2" }
			eval $cmd
		}
		if [regexp {# ([0-9A-Za-z_]+) is not set} $line foo var] {
			set cmd "global $var; set $var 0"
			eval $cmd
		}
		if [regexp {([0-9A-Za-z_]+)=([0-9A-Fa-f]+)} $line foo var value] {
			set cmd "global $var; set $var $value"
			eval $cmd
		}
		if [regexp {([0-9A-Za-z_]+)="([^"]*)"} $line foo var value] {
			set cmd "global $var; set $var \"$value\""
			eval $cmd
		}
	}
	close $file1
	update_choices
	update_mainmenu
}
proc write_comment { file1 file2 text } {
    	puts $file1 ""
	puts $file1 "#"
	puts $file1 "# $text"
	puts $file1 "#"
	puts $file2 "/*"
	puts $file2 " * $text"
	puts $file2 " */"
}

proc effective_dep { deplist } {
	global CONFIG_MODULES
	set depend 1
	foreach i $deplist {
		if {$i == 0} then {set depend 0}
		if {$i == 2 && $depend == 1} then {set depend 2}
	}
	if {$depend == 2 && $CONFIG_MODULES == 0} then {set depend 0}
	return $depend
}

proc sync_tristate { var dep } {
	global CONFIG_MODULES
	if {$dep == 0 && ($var == 1 || $var == 2)} then {
		set var 0
	} elseif {$dep == 2 && $var == 1} then {
		set var 2
	} elseif {$var == 2 && $CONFIG_MODULES == 0} then {
		if {$dep == 1} then {set var 1} else {set var 0}
	}
	return $var
}

proc sync_bool { var dep modset } {
	set var [sync_tristate $var $dep]
	if {$dep == 2 && $var == 2} then {
		set var $modset
	}
	return $var
}

proc write_tristate { file1 file2 varname variable deplist modset } {
	set variable [sync_tristate $variable [effective_dep $deplist]]
	if { $variable == 2 } \
		then { set variable $modset }
	if { $variable == 1 } \
		then { puts $file1 "$varname=y"; \
		       puts $file2 "#define $varname 1" } \
	elseif { $variable == 2 } \
		then { puts $file1 "$varname=m"; \
		       puts $file2 "#undef  $varname"; \
		       puts $file2 "#define ${varname}_MODULE 1" } \
	elseif { $variable == 0 } \
		then { puts $file1 "# $varname is not set"; \
		       puts $file2 "#undef  $varname"} \
	else { \
	    puts stdout "ERROR - Attempting to write value for unconfigured variable ($varname)." \
	}
}

proc write_int { file1 file2 varname variable dep } {
	if { $dep == 0 } \
		then { puts $file1 "# $varname is not set"; \
		       puts $file2 "#undef  $varname"} \
	else {
		puts $file1 "$varname=$variable"; \
		puts $file2 "#define $varname ($variable)"; \
	}
}

proc write_hex { file1 file2 varname variable dep } {
	if { $dep == 0 } \
		then { puts $file1 "# $varname is not set"; \
		       puts $file2 "#undef  $varname"} \
	else {
		puts $file1 "$varname=$variable"; \
		puts -nonewline $file2 "#define $varname "; \
		puts $file2 [exec echo $variable | sed s/^0\[xX\]//]; \
	}
}

proc write_string { file1 file2 varname variable dep } {
	if { $dep == 0 } \
		then { puts $file1 "# $varname is not set"; \
		       puts $file2 "#undef  $varname"} \
	else {
		puts $file1 "$varname=\"$variable\""; \
		puts $file2 "#define $varname \"$variable\""; \
	}
}

proc option_name {w mnum line text helpidx} {
	button $w.x$line.l -text "$text" -relief groove -anchor w
	$w.x$line.l configure -activefore [cget $w.x$line.l -fg] \
				-activeback [cget $w.x$line.l -bg]
	button $w.x$line.help -text "Help" -relief raised \
		-command "dohelp .dohelp $helpidx .menu$mnum"
	pack $w.x$line.help -side right -fill y
	pack $w.x$line.l -side right -fill both -expand on
}

proc toggle_switch2 {w mnum line text variable} {
	frame $w.x$line -relief sunken
	radiobutton $w.x$line.y -text "y" -variable $variable -value 1 \
		-relief groove -width 2 -command "update_active"
#	radiobutton $w.x$line.m -text "-"  -variable $variable -value 2 \
#		-relief groove -width 2 -command "update_active"
	radiobutton $w.x$line.n -text "n"  -variable $variable -value 0 \
		-relief groove -width 2 -command "update_active"

	option_name $w $mnum $line $text $variable

	pack $w.x$line.n $w.x$line.y -side right -fill y
}

proc toggle_switch3 {w mnum line text variable} {
	frame $w.x$line -relief sunken
	radiobutton $w.x$line.y -text "y" -variable $variable -value 1 \
		-relief groove -width 2 -command "update_active"
	radiobutton $w.x$line.m -text "m"  -variable $variable -value 2 \
		-relief groove -width 2 -command "update_active"
	radiobutton $w.x$line.n -text "n"  -variable $variable -value 0 \
		-relief groove -width 2 -command "update_active"

	option_name $w $mnum $line $text $variable

	global CONFIG_MODULES
	if {($CONFIG_MODULES == 0)} then {
		$w.x$line.m configure -state disabled
	}
	pack $w.x$line.n $w.x$line.m $w.x$line.y -side right -fill y
}

proc bool {w mnum line text variable} {
	toggle_switch2 $w $mnum $line $text $variable
#	$w.x$line.m configure -state disabled
	pack $w.x$line -anchor w -fill both -expand on
}

proc tristate {w mnum line text variable } {
	toggle_switch3 $w $mnum $line $text $variable
	pack $w.x$line -anchor w -fill both -expand on
}

proc dep_tristate {w mnum line text variable } {
	tristate $w $mnum $line $text $variable
}

proc dep_bool {w mnum line text variable } {
	bool $w $mnum $line $text $variable
}

proc int { w mnum line text variable } {
	frame $w.x$line
	entry $w.x$line.x -width 11 -relief sunken -borderwidth 2 \
		-textvariable $variable
	option_name $w $mnum $line $text $variable
	pack $w.x$line.x -anchor w -side right -fill y
	pack $w.x$line -anchor w -fill both -expand on
}

proc hex { w mnum line text variable } {
	int $w $mnum $line $text $variable
}

proc istring { w mnum line text variable } {
	frame $w.x$line
	entry $w.x$line.x -width 18 -relief sunken -borderwidth 2 \
		-textvariable $variable
	option_name $w $mnum $line $text $variable
	pack $w.x$line.x -anchor w -side right -fill y
	pack $w.x$line -anchor w -fill both -expand on
}

proc minimenu { w mnum line text variable helpidx } {
	frame $w.x$line
	menubutton $w.x$line.x -textvariable $variable -menu \
		$w.x$line.x.menu -relief raised \
		-anchor w
	option_name $w $mnum $line $text $helpidx
	pack $w.x$line.x -anchor w -side right -fill y
	pack $w.x$line -anchor w -fill both -expand on
}

proc menusplit {w m n} {
	if { $n > 2 } then {
		update idletasks
		set menuoptsize [expr [$m yposition 2] - [$m yposition 1]]   
		set maxsize [winfo screenheight $w]
		set splitpoint [expr $maxsize * 4 / 5 / $menuoptsize - 1]
		for {set i [expr $splitpoint + 1]} {$i <= $n} {incr i $splitpoint} {
			$m entryconfigure $i -columnbreak 1
		}
	}
}

proc menutitle {text menu w} {
	wm title $w "$text"
}

proc submenu { w mnum line text subnum } {
	frame $w.x$line
	button $w.x$line.l -text "" -width 9 -relief groove
	$w.x$line.l configure -activefore [cget $w.x$line.l -fg] \
		-activeback [cget $w.x$line.l -bg] -state disabled
	button $w.x$line.m -text "$text" -relief raised -anchor w \
		-command "catch {destroy .menu$subnum}; menu$subnum .menu$subnum \"$text\""
	pack $w.x$line.l -side left -fill both
	pack $w.x$line.m -anchor w -side right -fill both -expand on
	pack $w.x$line -anchor w -fill both -expand on
}

proc comment {w mnum line text } {
	frame $w.x$line
	button $w.x$line.l -text "" -width 15 -relief groove
	$w.x$line.l configure -activefore [cget $w.x$line.l -fg] \
		-activeback [cget $w.x$line.l -bg] -state disabled
	button $w.x$line.m -text "$text" -relief groove -anchor w
	$w.x$line.m configure -activefore [cget $w.x$line.m -fg] \
		-activeback [cget $w.x$line.m -bg]
	pack $w.x$line.l -side left -fill both
	pack $w.x$line.m -anchor w -side right -fill both -expand on
	pack $w.x$line -anchor w -fill both -expand on
}

proc readhelp {tag fn}  {
	set message ""
	set b 0
	if { [file readable $fn] == 1} then {
		set fhandle [open $fn r]
		while {[gets $fhandle inline] >= 0} {
			if { $b == 0 } {
				if { [regexp $tag $inline ] } {
					set b 1
					set message "$inline:\n"
				}
			} else {
				if { [regexp {^[^ \t]} $inline]} {
					break
				}
				set message "$message\n$inline"
			}
		}
		close $fhandle
	}
	return $message
}

proc dohelp {w var parent}  {
	catch {destroy $w}
	toplevel $w -class Dialog

	set filefound 0
	set found 0
	set lineno 0

	if { [file readable config.help] == 1} then {
		set filefound 1
		# First escape sed regexp special characters in var:
		set var [exec echo "$var" | sed s/\[\]\[\/.^$*\]/\\\\&/g]
		# Now pick out right help text:
		set message [readhelp $var config.help]
		set found [expr [string length "$message"] > 0]
	}

	frame $w.f1
	pack $w.f1 -fill both -expand on

	# Do the OK button
	#
	set oldFocus [focus]
	frame $w.f2
	button $w.f2.ok -text "OK" \
		-width 10 -command "destroy $w; catch {focus $oldFocus}"
	pack $w.f2.ok -side bottom -pady 6 -anchor n
	pack $w.f2 -side bottom -padx 10 -anchor s

	scrollbar $w.f1.vscroll -command "$w.f1.canvas yview"
	pack $w.f1.vscroll -side right -fill y

	canvas $w.f1.canvas -relief flat -borderwidth 0 \
		-yscrollcommand "$w.f1.vscroll set"
	frame $w.f1.f
	pack $w.f1.canvas -side right -fill y -expand on

	if { $found == 0 } then {
		if { $filefound == 0 } then {
		message $w.f1.f.m -width 750 -aspect 300 -relief flat -text \
			"No help available - unable to open file config.help."
		} else {
		message $w.f1.f.m -width 400 -aspect 300 -relief flat -text \
			"No help available for $var"
		}
		label $w.f1.bm -bitmap error
		wm title $w "RTFM"
	} else {
		text $w.f1.f.m -width 73 -relief flat -wrap word
		$w.f1.f.m insert 0.0 $message
		$w.f1.f.m conf -state disabled -height [$w.f1.f.m index end]

		label $w.f1.bm -bitmap info
		wm title $w "Configuration help" 
	}
	pack $w.f1.f.m -side left
	pack $w.f1.bm $w.f1.f -side left -padx 10

	focus $w
	set winx [expr [winfo x $parent]+20]
	set winy [expr [winfo y $parent]+20]
	wm geometry $w +$winx+$winy
	set sizok [expr [winfo reqheight $w.f2.ok] + 12]
	set maxy [expr [winfo screenheight .] * 3 / 4]
	set canvtotal [winfo reqheight $w.f1.f.m]
	if [expr $sizok + $canvtotal < $maxy] {
		set sizy $canvtotal
	} else {
		set sizy [expr $maxy - $sizok]
	}
	$w.f1.canvas configure -height $sizy -width [winfo reqwidth $w.f1.f.m] \
		-scrollregion "0 0 [winfo reqwidth $w.f1.f.m] \
			[winfo reqheight $w.f1.f.m]"
	$w.f1.canvas create window 0 0 -anchor nw -window $w.f1.f
	update idletasks

	set maxy [winfo screenheight .]
	if [expr $sizok + $canvtotal < $maxy] {
		set sizy [expr $sizok + $canvtotal]
	} else {
		set sizy $maxy
	}
	wm maxsize $w [winfo width $w] $sizy
}

bind all <Alt-s> { catch {exec cp -f .config .config.old}; \
		writeconfig .config config.h; wrapup .wrap }

proc wrapup {w }  {
	catch {destroy $w}
	toplevel $w -class Dialog

	global CONFIG_MODVERSIONS; vfix CONFIG_MODVERSIONS
	message $w.m -width 460 -aspect 300 -relief raised -text \
		"End of design configuration. "
	label $w.bm -bitmap info
	pack $w.bm $w.m -pady 10 -side top -padx 10
	wm title $w "LEON build instructions" 

	set oldFocus [focus]
	frame $w.f
	button $w.f.back -text "OK" \
		-width 10 -command "exit 2"
	pack $w.f.back -side bottom -pady 10 -anchor s
	pack $w.f -pady 10 -side top -padx 10 -anchor s
	focus $w
        bind $w <Return> "exit 2"
	global winx; global winy
	set winx [expr [winfo x .]+30]; set winy [expr [winfo y .]+30]
	wm geometry $w +$winx+$winy

}

proc unregister_active {num} {
	global active_menus
	set index [lsearch -exact $active_menus $num]
	if {$index != -1} then {set active_menus [lreplace $active_menus $index $index]}
}

proc update_active {} {
	global active_menus total_menus
	set max 0
	if {[llength $active_menus] > 0} then {
		set max [lindex $active_menus end]
		update_define [toplevel_menu [lindex $active_menus 0]] $max 0
	}
	foreach i $active_menus {
		if {[winfo exists .menu$i] == 0} then {
			unregister_active $i
		} else {
			update_menu$i
		}
	}
	update_define [expr $max + 1] $total_menus 1
	update_mainmenu
}

proc configure_entry {w option items} {
	foreach i $items {
		$w.$i configure -state $option
	}
}

proc validate_int {name val default} {
	if {([exec echo $val | sed s/^-//g | tr -d \[:digit:\] ] != "")} then {
		global $name; set $name $default
	}
}

proc validate_hex {name val default} {
	if {([exec echo $val | tr -d \[:xdigit:\] ] != "")} then {
		global $name; set $name $default
	}
}

proc update_define {first last allow_update} {
	for {set i $first} {$i <= $last} {incr i} {
		update_define_menu$i
		if {$allow_update == 1} then update
	}
}

#
# Next set up the particulars for the top level menu, and define a few
# buttons which we will stick down at the bottom.
#

frame .f0 
frame .f0.left
frame .f0.middle
frame .f0.right

set active_menus [list]
set processed_top_level 0
set ARCH sparc
set menus_per_column 4
set total_menus 30

proc toplevel_menu {num} {
	if {$num == 4} then {return 3}
	if {$num == 5} then {return 3}
	if {$num == 6} then {return 3}
	if {$num == 7} then {return 3}
	if {$num == 8} then {return 3}
	if {$num == 9} then {return 3}
	if {$num == 10} then {return 3}
	if {$num == 15} then {return 14}
	if {$num == 16} then {return 15}
	if {$num == 17} then {return 15}
	if {$num == 18} then {return 14}
	if {$num == 19} then {return 14}
	if {$num == 20} then {return 14}
	if {$num == 21} then {return 14}
	if {$num == 22} then {return 14}
	if {$num == 23} then {return 14}
	if {$num == 24} then {return 14}
	if {$num == 25} then {return 14}
	if {$num == 26} then {return 14}
	if {$num == 27} then {return 26}
	if {$num == 28} then {return 26}
	if {$num == 29} then {return 14}
	return $num
}

mainmenu_name "LEON3MP Design Configuration"
menu_option menu1 1 "Synthesis      "
proc menu1 {w title} {
	set oldFocus [focus]
	catch {destroy $w; unregister_active 1}
	toplevel $w -class Dialog
	wm withdraw $w
	global active_menus
	set active_menus [lsort -integer [linsert $active_menus end 1]]
	message $w.m -width 400 -aspect 300 -text \
		"Synthesis      "  -relief raised
	pack $w.m -pady 10 -side top -padx 10
	wm title $w "Synthesis      " 

	bind $w <Escape> "catch {focus $oldFocus}; destroy $w; unregister_active 1; break"
	set nextscript "catch {focus $oldFocus}; destroy $w; unregister_active 1; menu2 .menu2 \"$title\""
	frame $w.f
	button $w.f.back -text "Main Menu" \
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 1"
	button $w.f.next -text "Next" -underline 0\
		-width 15 -command $nextscript
	bind all <Alt-n> $nextscript
	button $w.f.prev -text "Prev" -underline 0\
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 1; menu0 .menu0 \"$title\""
	$w.f.prev configure -state disabled
	pack $w.f.back $w.f.next $w.f.prev -side left -expand on
	pack $w.f -pady 10 -side bottom -anchor w -fill x
	frame $w.topline -relief ridge -borderwidth 2 -height 2
	pack $w.topline -side top -fill x

	frame $w.botline -relief ridge -borderwidth 2 -height 2
	pack $w.botline -side bottom -fill x

	frame $w.config
	pack $w.config -fill y -expand on

	scrollbar $w.config.vscroll -command "$w.config.canvas yview"
	pack $w.config.vscroll -side right -fill y

	canvas $w.config.canvas -height 1\
		-relief flat -borderwidth 0 -yscrollcommand "$w.config.vscroll set" \
		-width [expr [winfo screenwidth .] * 1 / 2] 
	frame $w.config.f
	bind $w <Key-Down> "$w.config.canvas yview scroll  1 unit;break;"
	bind $w <Key-Up> "$w.config.canvas yview scroll  -1 unit;break;"
	bind $w <Key-Next> "$w.config.canvas yview scroll  1 page;break;"
	bind $w <Key-Prior> "$w.config.canvas yview scroll  -1 page;break;"
	bind $w <Key-Home> "$w.config.canvas yview moveto 0;break;"
	bind $w <Key-End> "$w.config.canvas yview moveto 1 ;break;"
	pack $w.config.canvas -side right -fill y


	global tmpvar_0
	minimenu $w.config.f 1 0 "Target technology                           " tmpvar_0 CONFIG_SYN_INFERRED
	menu $w.config.f.x0.x.menu -tearoffcommand "menutitle \"Target technology                           \""
	$w.config.f.x0.x.menu add radiobutton -label "Inferred" -variable tmpvar_0 -value "Inferred" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Actel-Axcelerator" -variable tmpvar_0 -value "Actel-Axcelerator" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Actel-Axcelerator-DSP" -variable tmpvar_0 -value "Actel-Axcelerator-DSP" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Actel-Proasic" -variable tmpvar_0 -value "Actel-Proasic" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Actel-ProasicPlus" -variable tmpvar_0 -value "Actel-ProasicPlus" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Actel-Proasic3" -variable tmpvar_0 -value "Actel-Proasic3" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Actel-Proasic3E" -variable tmpvar_0 -value "Actel-Proasic3E" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Actel-Proasic3L" -variable tmpvar_0 -value "Actel-Proasic3L" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Actel-IGLOO/p/L" -variable tmpvar_0 -value "Actel-IGLOO/p/L" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Actel-IGLOO2" -variable tmpvar_0 -value "Actel-IGLOO2" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Actel-SmartFusion2" -variable tmpvar_0 -value "Actel-SmartFusion2" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Actel-RTG4" -variable tmpvar_0 -value "Actel-RTG4" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Actel-Fusion" -variable tmpvar_0 -value "Actel-Fusion" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Aeroflex-UT025CRH" -variable tmpvar_0 -value "Aeroflex-UT025CRH" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Aeroflex-UT130HBD" -variable tmpvar_0 -value "Aeroflex-UT130HBD" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Aeroflex-UT90NHBD" -variable tmpvar_0 -value "Aeroflex-UT90NHBD" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Altera-CycloneIII" -variable tmpvar_0 -value "Altera-CycloneIII" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Altera-Stratix" -variable tmpvar_0 -value "Altera-Stratix" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Altera-StratixII" -variable tmpvar_0 -value "Altera-StratixII" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Altera-StratixIII" -variable tmpvar_0 -value "Altera-StratixIII" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Altera-StratixIV" -variable tmpvar_0 -value "Altera-StratixIV" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Altera-StratixV" -variable tmpvar_0 -value "Altera-StratixV" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Altera-Others" -variable tmpvar_0 -value "Altera-Others" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Atmel-ATC18" -variable tmpvar_0 -value "Atmel-ATC18" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Atmel-ATC18RHA" -variable tmpvar_0 -value "Atmel-ATC18RHA" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Custom1" -variable tmpvar_0 -value "Custom1" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "DARE" -variable tmpvar_0 -value "DARE" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "IBM-CMOS9SF" -variable tmpvar_0 -value "IBM-CMOS9SF" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Lattice-EC/ECP/XP" -variable tmpvar_0 -value "Lattice-EC/ECP/XP" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Quicklogic-Eclipse" -variable tmpvar_0 -value "Quicklogic-Eclipse" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "RH-LIB18T" -variable tmpvar_0 -value "RH-LIB18T" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "RH-UMC" -variable tmpvar_0 -value "RH-UMC" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "RHS65" -variable tmpvar_0 -value "RHS65" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "SAED32" -variable tmpvar_0 -value "SAED32" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "SMIC130" -variable tmpvar_0 -value "SMIC130" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "TM65Gplus" -variable tmpvar_0 -value "TM65Gplus" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "TSMC90" -variable tmpvar_0 -value "TSMC90" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "UMC180" -variable tmpvar_0 -value "UMC180" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Xilinx-Artix7" -variable tmpvar_0 -value "Xilinx-Artix7" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Xilinx-Kintex7" -variable tmpvar_0 -value "Xilinx-Kintex7" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Xilinx-Spartan3" -variable tmpvar_0 -value "Xilinx-Spartan3" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Xilinx-Spartan3E" -variable tmpvar_0 -value "Xilinx-Spartan3E" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Xilinx-Spartan6" -variable tmpvar_0 -value "Xilinx-Spartan6" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Xilinx-Virtex2" -variable tmpvar_0 -value "Xilinx-Virtex2" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Xilinx-Virtex4" -variable tmpvar_0 -value "Xilinx-Virtex4" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Xilinx-Virtex5" -variable tmpvar_0 -value "Xilinx-Virtex5" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Xilinx-Virtex6" -variable tmpvar_0 -value "Xilinx-Virtex6" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Xilinx-Virtex7" -variable tmpvar_0 -value "Xilinx-Virtex7" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Xilinx-Zynq7000" -variable tmpvar_0 -value "Xilinx-Zynq7000" -command "update_active"
	menusplit $w $w.config.f.x0.x.menu 49
	global tmpvar_1
	minimenu $w.config.f 1 1 "Memory Library                           " tmpvar_1 CONFIG_MEM_INFERRED
	menu $w.config.f.x1.x.menu -tearoffcommand "menutitle \"Memory Library                           \""
	$w.config.f.x1.x.menu add radiobutton -label "Inferred" -variable tmpvar_1 -value "Inferred" -command "update_active"
	$w.config.f.x1.x.menu add radiobutton -label "UMC18" -variable tmpvar_1 -value "UMC18" -command "update_active"
	$w.config.f.x1.x.menu add radiobutton -label "RH-UMC" -variable tmpvar_1 -value "RH-UMC" -command "update_active"
	$w.config.f.x1.x.menu add radiobutton -label "SAED32" -variable tmpvar_1 -value "SAED32" -command "update_active"
	$w.config.f.x1.x.menu add radiobutton -label "DARE" -variable tmpvar_1 -value "DARE" -command "update_active"
	$w.config.f.x1.x.menu add radiobutton -label "RHS65" -variable tmpvar_1 -value "RHS65" -command "update_active"
	$w.config.f.x1.x.menu add radiobutton -label "Artisan" -variable tmpvar_1 -value "Artisan" -command "update_active"
	$w.config.f.x1.x.menu add radiobutton -label "Custom1" -variable tmpvar_1 -value "Custom1" -command "update_active"
	$w.config.f.x1.x.menu add radiobutton -label "Virage" -variable tmpvar_1 -value "Virage" -command "update_active"
	$w.config.f.x1.x.menu add radiobutton -label "Virage-TSMC90" -variable tmpvar_1 -value "Virage-TSMC90" -command "update_active"
	menusplit $w $w.config.f.x1.x.menu 10
	global tmpvar_2
	minimenu $w.config.f 1 2 "Transceiver type                           " tmpvar_2 CONFIG_TRANS_GTP0
	menu $w.config.f.x2.x.menu -tearoffcommand "menutitle \"Transceiver type                           \""
	$w.config.f.x2.x.menu add radiobutton -label "GTP0" -variable tmpvar_2 -value "GTP0" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "GTP1" -variable tmpvar_2 -value "GTP1" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "GTX0" -variable tmpvar_2 -value "GTX0" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "GTX1" -variable tmpvar_2 -value "GTX1" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "GTH0" -variable tmpvar_2 -value "GTH0" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "GTH1" -variable tmpvar_2 -value "GTH1" -command "update_active"
	menusplit $w $w.config.f.x2.x.menu 6
	bool $w.config.f 1 3 "Infer RAM" CONFIG_SYN_INFER_RAM
	bool $w.config.f 1 4 "Infer pads" CONFIG_SYN_INFER_PADS
	bool $w.config.f 1 5 "Disable asynchronous reset" CONFIG_SYN_NO_ASYNC
	bool $w.config.f 1 6 "Enable scan support       " CONFIG_SYN_SCAN



	focus $w
	update_active
	global winx; global winy
	set winx [expr [winfo x .]+30]; set winy [expr [winfo y .]+30]
	if {[winfo exists $w]} then {wm geometry $w +$winx+$winy}
	update idletasks
	if {[winfo exists $w]} then  {$w.config.canvas create window 0 0 -anchor nw -window $w.config.f

	$w.config.canvas configure \
		-width [expr [winfo reqwidth $w.config.f] + 1]\
		-scrollregion "-1 -1 [expr [winfo reqwidth $w.config.f] + 1] \
			 [expr [winfo reqheight $w.config.f] + 1]"

	set winy [expr [winfo reqh $w] - [winfo reqh $w.config.canvas]]
	set scry [expr [winfo screenh $w] / 2]
	set maxy [expr [winfo screenh $w] * 3 / 4]
	set canvtotal [expr [winfo reqh $w.config.f] + 2]
	if [expr $winy + $canvtotal < $maxy] {
		$w.config.canvas configure -height $canvtotal
	} else {
		$w.config.canvas configure -height [expr $scry - $winy]
		}
	}
	update idletasks
	if {[winfo exists $w]} then {
	wm maxsize $w [winfo width $w] [winfo screenheight $w]
	wm minsize $w [winfo width $w] 100

	wm deiconify $w
}
}

proc update_menu1 {} {
	global CONFIG_SYN_INFERRED
	global CONFIG_SYN_CUSTOM1
	global CONFIG_SYN_ATC18
	global CONFIG_SYN_TSMC90
	global CONFIG_SYN_UMC
	global CONFIG_SYN_RHUMC
	global CONFIG_SYN_DARE
	global CONFIG_SYN_SAED32
	global CONFIG_SYN_RHS65
	global CONFIG_SYN_ARTISAN
	if {($CONFIG_SYN_INFERRED == 1 || $CONFIG_SYN_CUSTOM1 == 1 || $CONFIG_SYN_ATC18 == 1 || $CONFIG_SYN_TSMC90 == 1 || $CONFIG_SYN_UMC == 1 || $CONFIG_SYN_RHUMC == 1 || $CONFIG_SYN_DARE == 1 || $CONFIG_SYN_SAED32 == 1 || $CONFIG_SYN_RHS65 == 1 || $CONFIG_SYN_ARTISAN == 1)} then {configure_entry .menu1.config.f.x1 normal {x l}} else {configure_entry .menu1.config.f.x1 disabled {x l}}
	global CONFIG_SYN_VIRTEX5
	global CONFIG_SYN_VIRTEX6
	global CONFIG_SYN_VIRTEX7
	if {($CONFIG_SYN_VIRTEX5 == 1 || $CONFIG_SYN_VIRTEX6 == 1 || $CONFIG_SYN_VIRTEX7 == 1)} then {configure_entry .menu1.config.f.x2 normal {x l}} else {configure_entry .menu1.config.f.x2 disabled {x l}}
	global CONFIG_SYN_INFER_RAM
	if {($CONFIG_SYN_INFERRED != 1)} then {
	configure_entry .menu1.config.f.x3 normal {n l y}} else {configure_entry .menu1.config.f.x3 disabled {y n l}}
	global CONFIG_SYN_INFER_PADS
	if {($CONFIG_SYN_INFERRED != 1)} then {
	configure_entry .menu1.config.f.x4 normal {n l y}} else {configure_entry .menu1.config.f.x4 disabled {y n l}}
}


proc update_define_menu1 {} {
	update_define_mainmenu
	global CONFIG_MODULES
	global tmpvar_0
	global CONFIG_SYN_INFERRED
	if {$tmpvar_0 == "Inferred"} then {set CONFIG_SYN_INFERRED 1} else {set CONFIG_SYN_INFERRED 0}
	global CONFIG_SYN_AXCEL
	if {$tmpvar_0 == "Actel-Axcelerator"} then {set CONFIG_SYN_AXCEL 1} else {set CONFIG_SYN_AXCEL 0}
	global CONFIG_SYN_AXDSP
	if {$tmpvar_0 == "Actel-Axcelerator-DSP"} then {set CONFIG_SYN_AXDSP 1} else {set CONFIG_SYN_AXDSP 0}
	global CONFIG_SYN_PROASIC
	if {$tmpvar_0 == "Actel-Proasic"} then {set CONFIG_SYN_PROASIC 1} else {set CONFIG_SYN_PROASIC 0}
	global CONFIG_SYN_PROASICPLUS
	if {$tmpvar_0 == "Actel-ProasicPlus"} then {set CONFIG_SYN_PROASICPLUS 1} else {set CONFIG_SYN_PROASICPLUS 0}
	global CONFIG_SYN_PROASIC3
	if {$tmpvar_0 == "Actel-Proasic3"} then {set CONFIG_SYN_PROASIC3 1} else {set CONFIG_SYN_PROASIC3 0}
	global CONFIG_SYN_PROASIC3E
	if {$tmpvar_0 == "Actel-Proasic3E"} then {set CONFIG_SYN_PROASIC3E 1} else {set CONFIG_SYN_PROASIC3E 0}
	global CONFIG_SYN_PROASIC3L
	if {$tmpvar_0 == "Actel-Proasic3L"} then {set CONFIG_SYN_PROASIC3L 1} else {set CONFIG_SYN_PROASIC3L 0}
	global CONFIG_SYN_IGLOO
	if {$tmpvar_0 == "Actel-IGLOO/p/L"} then {set CONFIG_SYN_IGLOO 1} else {set CONFIG_SYN_IGLOO 0}
	global CONFIG_SYN_IGLOO2
	if {$tmpvar_0 == "Actel-IGLOO2"} then {set CONFIG_SYN_IGLOO2 1} else {set CONFIG_SYN_IGLOO2 0}
	global CONFIG_SYN_SF2
	if {$tmpvar_0 == "Actel-SmartFusion2"} then {set CONFIG_SYN_SF2 1} else {set CONFIG_SYN_SF2 0}
	global CONFIG_SYN_RTG4
	if {$tmpvar_0 == "Actel-RTG4"} then {set CONFIG_SYN_RTG4 1} else {set CONFIG_SYN_RTG4 0}
	global CONFIG_SYN_FUSION
	if {$tmpvar_0 == "Actel-Fusion"} then {set CONFIG_SYN_FUSION 1} else {set CONFIG_SYN_FUSION 0}
	global CONFIG_SYN_UT025CRH
	if {$tmpvar_0 == "Aeroflex-UT025CRH"} then {set CONFIG_SYN_UT025CRH 1} else {set CONFIG_SYN_UT025CRH 0}
	global CONFIG_SYN_UT130HBD
	if {$tmpvar_0 == "Aeroflex-UT130HBD"} then {set CONFIG_SYN_UT130HBD 1} else {set CONFIG_SYN_UT130HBD 0}
	global CONFIG_SYN_UT90NHBD
	if {$tmpvar_0 == "Aeroflex-UT90NHBD"} then {set CONFIG_SYN_UT90NHBD 1} else {set CONFIG_SYN_UT90NHBD 0}
	global CONFIG_SYN_CYCLONEIII
	if {$tmpvar_0 == "Altera-CycloneIII"} then {set CONFIG_SYN_CYCLONEIII 1} else {set CONFIG_SYN_CYCLONEIII 0}
	global CONFIG_SYN_STRATIX
	if {$tmpvar_0 == "Altera-Stratix"} then {set CONFIG_SYN_STRATIX 1} else {set CONFIG_SYN_STRATIX 0}
	global CONFIG_SYN_STRATIXII
	if {$tmpvar_0 == "Altera-StratixII"} then {set CONFIG_SYN_STRATIXII 1} else {set CONFIG_SYN_STRATIXII 0}
	global CONFIG_SYN_STRATIXIII
	if {$tmpvar_0 == "Altera-StratixIII"} then {set CONFIG_SYN_STRATIXIII 1} else {set CONFIG_SYN_STRATIXIII 0}
	global CONFIG_SYN_STRATIXIV
	if {$tmpvar_0 == "Altera-StratixIV"} then {set CONFIG_SYN_STRATIXIV 1} else {set CONFIG_SYN_STRATIXIV 0}
	global CONFIG_SYN_STRATIXV
	if {$tmpvar_0 == "Altera-StratixV"} then {set CONFIG_SYN_STRATIXV 1} else {set CONFIG_SYN_STRATIXV 0}
	global CONFIG_SYN_ALTERA
	if {$tmpvar_0 == "Altera-Others"} then {set CONFIG_SYN_ALTERA 1} else {set CONFIG_SYN_ALTERA 0}
	global CONFIG_SYN_ATC18
	if {$tmpvar_0 == "Atmel-ATC18"} then {set CONFIG_SYN_ATC18 1} else {set CONFIG_SYN_ATC18 0}
	global CONFIG_SYN_ATC18RHA
	if {$tmpvar_0 == "Atmel-ATC18RHA"} then {set CONFIG_SYN_ATC18RHA 1} else {set CONFIG_SYN_ATC18RHA 0}
	global CONFIG_SYN_CUSTOM1
	if {$tmpvar_0 == "Custom1"} then {set CONFIG_SYN_CUSTOM1 1} else {set CONFIG_SYN_CUSTOM1 0}
	global CONFIG_SYN_DARE
	if {$tmpvar_0 == "DARE"} then {set CONFIG_SYN_DARE 1} else {set CONFIG_SYN_DARE 0}
	global CONFIG_SYN_CMOS9SF
	if {$tmpvar_0 == "IBM-CMOS9SF"} then {set CONFIG_SYN_CMOS9SF 1} else {set CONFIG_SYN_CMOS9SF 0}
	global CONFIG_SYN_LATTICE
	if {$tmpvar_0 == "Lattice-EC/ECP/XP"} then {set CONFIG_SYN_LATTICE 1} else {set CONFIG_SYN_LATTICE 0}
	global CONFIG_SYN_ECLIPSE
	if {$tmpvar_0 == "Quicklogic-Eclipse"} then {set CONFIG_SYN_ECLIPSE 1} else {set CONFIG_SYN_ECLIPSE 0}
	global CONFIG_SYN_RH_LIB18T
	if {$tmpvar_0 == "RH-LIB18T"} then {set CONFIG_SYN_RH_LIB18T 1} else {set CONFIG_SYN_RH_LIB18T 0}
	global CONFIG_SYN_RHUMC
	if {$tmpvar_0 == "RH-UMC"} then {set CONFIG_SYN_RHUMC 1} else {set CONFIG_SYN_RHUMC 0}
	global CONFIG_SYN_RHS65
	if {$tmpvar_0 == "RHS65"} then {set CONFIG_SYN_RHS65 1} else {set CONFIG_SYN_RHS65 0}
	global CONFIG_SYN_SAED32
	if {$tmpvar_0 == "SAED32"} then {set CONFIG_SYN_SAED32 1} else {set CONFIG_SYN_SAED32 0}
	global CONFIG_SYN_SMIC13
	if {$tmpvar_0 == "SMIC130"} then {set CONFIG_SYN_SMIC13 1} else {set CONFIG_SYN_SMIC13 0}
	global CONFIG_SYN_TM65GPLUS
	if {$tmpvar_0 == "TM65Gplus"} then {set CONFIG_SYN_TM65GPLUS 1} else {set CONFIG_SYN_TM65GPLUS 0}
	global CONFIG_SYN_TSMC90
	if {$tmpvar_0 == "TSMC90"} then {set CONFIG_SYN_TSMC90 1} else {set CONFIG_SYN_TSMC90 0}
	global CONFIG_SYN_UMC
	if {$tmpvar_0 == "UMC180"} then {set CONFIG_SYN_UMC 1} else {set CONFIG_SYN_UMC 0}
	global CONFIG_SYN_ARTIX7
	if {$tmpvar_0 == "Xilinx-Artix7"} then {set CONFIG_SYN_ARTIX7 1} else {set CONFIG_SYN_ARTIX7 0}
	global CONFIG_SYN_KINTEX7
	if {$tmpvar_0 == "Xilinx-Kintex7"} then {set CONFIG_SYN_KINTEX7 1} else {set CONFIG_SYN_KINTEX7 0}
	global CONFIG_SYN_SPARTAN3
	if {$tmpvar_0 == "Xilinx-Spartan3"} then {set CONFIG_SYN_SPARTAN3 1} else {set CONFIG_SYN_SPARTAN3 0}
	global CONFIG_SYN_SPARTAN3E
	if {$tmpvar_0 == "Xilinx-Spartan3E"} then {set CONFIG_SYN_SPARTAN3E 1} else {set CONFIG_SYN_SPARTAN3E 0}
	global CONFIG_SYN_SPARTAN6
	if {$tmpvar_0 == "Xilinx-Spartan6"} then {set CONFIG_SYN_SPARTAN6 1} else {set CONFIG_SYN_SPARTAN6 0}
	global CONFIG_SYN_VIRTEX2
	if {$tmpvar_0 == "Xilinx-Virtex2"} then {set CONFIG_SYN_VIRTEX2 1} else {set CONFIG_SYN_VIRTEX2 0}
	global CONFIG_SYN_VIRTEX4
	if {$tmpvar_0 == "Xilinx-Virtex4"} then {set CONFIG_SYN_VIRTEX4 1} else {set CONFIG_SYN_VIRTEX4 0}
	global CONFIG_SYN_VIRTEX5
	if {$tmpvar_0 == "Xilinx-Virtex5"} then {set CONFIG_SYN_VIRTEX5 1} else {set CONFIG_SYN_VIRTEX5 0}
	global CONFIG_SYN_VIRTEX6
	if {$tmpvar_0 == "Xilinx-Virtex6"} then {set CONFIG_SYN_VIRTEX6 1} else {set CONFIG_SYN_VIRTEX6 0}
	global CONFIG_SYN_VIRTEX7
	if {$tmpvar_0 == "Xilinx-Virtex7"} then {set CONFIG_SYN_VIRTEX7 1} else {set CONFIG_SYN_VIRTEX7 0}
	global CONFIG_SYN_ZYNQ7000
	if {$tmpvar_0 == "Xilinx-Zynq7000"} then {set CONFIG_SYN_ZYNQ7000 1} else {set CONFIG_SYN_ZYNQ7000 0}
	global tmpvar_1
	global CONFIG_MEM_INFERRED
	if {$tmpvar_1 == "Inferred"} then {set CONFIG_MEM_INFERRED 1} else {set CONFIG_MEM_INFERRED 0}
	global CONFIG_MEM_UMC
	if {$tmpvar_1 == "UMC18"} then {set CONFIG_MEM_UMC 1} else {set CONFIG_MEM_UMC 0}
	global CONFIG_MEM_RHUMC
	if {$tmpvar_1 == "RH-UMC"} then {set CONFIG_MEM_RHUMC 1} else {set CONFIG_MEM_RHUMC 0}
	global CONFIG_MEM_SAED32
	if {$tmpvar_1 == "SAED32"} then {set CONFIG_MEM_SAED32 1} else {set CONFIG_MEM_SAED32 0}
	global CONFIG_MEM_DARE
	if {$tmpvar_1 == "DARE"} then {set CONFIG_MEM_DARE 1} else {set CONFIG_MEM_DARE 0}
	global CONFIG_MEM_RHS65
	if {$tmpvar_1 == "RHS65"} then {set CONFIG_MEM_RHS65 1} else {set CONFIG_MEM_RHS65 0}
	global CONFIG_MEM_ARTISAN
	if {$tmpvar_1 == "Artisan"} then {set CONFIG_MEM_ARTISAN 1} else {set CONFIG_MEM_ARTISAN 0}
	global CONFIG_MEM_CUSTOM1
	if {$tmpvar_1 == "Custom1"} then {set CONFIG_MEM_CUSTOM1 1} else {set CONFIG_MEM_CUSTOM1 0}
	global CONFIG_MEM_VIRAGE
	if {$tmpvar_1 == "Virage"} then {set CONFIG_MEM_VIRAGE 1} else {set CONFIG_MEM_VIRAGE 0}
	global CONFIG_MEM_VIRAGE90
	if {$tmpvar_1 == "Virage-TSMC90"} then {set CONFIG_MEM_VIRAGE90 1} else {set CONFIG_MEM_VIRAGE90 0}
	global tmpvar_2
	global CONFIG_TRANS_GTP0
	if {$tmpvar_2 == "GTP0"} then {set CONFIG_TRANS_GTP0 1} else {set CONFIG_TRANS_GTP0 0}
	global CONFIG_TRANS_GTP1
	if {$tmpvar_2 == "GTP1"} then {set CONFIG_TRANS_GTP1 1} else {set CONFIG_TRANS_GTP1 0}
	global CONFIG_TRANS_GTX0
	if {$tmpvar_2 == "GTX0"} then {set CONFIG_TRANS_GTX0 1} else {set CONFIG_TRANS_GTX0 0}
	global CONFIG_TRANS_GTX1
	if {$tmpvar_2 == "GTX1"} then {set CONFIG_TRANS_GTX1 1} else {set CONFIG_TRANS_GTX1 0}
	global CONFIG_TRANS_GTH0
	if {$tmpvar_2 == "GTH0"} then {set CONFIG_TRANS_GTH0 1} else {set CONFIG_TRANS_GTH0 0}
	global CONFIG_TRANS_GTH1
	if {$tmpvar_2 == "GTH1"} then {set CONFIG_TRANS_GTH1 1} else {set CONFIG_TRANS_GTH1 0}
	global CONFIG_SYN_INFER_RAM
	if {($CONFIG_SYN_INFERRED != 1)} then {
	set CONFIG_SYN_INFER_RAM [expr $CONFIG_SYN_INFER_RAM&15]} else {set CONFIG_SYN_INFER_RAM [expr $CONFIG_SYN_INFER_RAM|16]}
	global CONFIG_SYN_INFER_PADS
	if {($CONFIG_SYN_INFERRED != 1)} then {
	set CONFIG_SYN_INFER_PADS [expr $CONFIG_SYN_INFER_PADS&15]} else {set CONFIG_SYN_INFER_PADS [expr $CONFIG_SYN_INFER_PADS|16]}
}


menu_option menu2 2 "Clock generation"
proc menu2 {w title} {
	set oldFocus [focus]
	catch {destroy $w; unregister_active 2}
	toplevel $w -class Dialog
	wm withdraw $w
	global active_menus
	set active_menus [lsort -integer [linsert $active_menus end 2]]
	message $w.m -width 400 -aspect 300 -text \
		"Clock generation"  -relief raised
	pack $w.m -pady 10 -side top -padx 10
	wm title $w "Clock generation" 

	bind $w <Escape> "catch {focus $oldFocus}; destroy $w; unregister_active 2; break"
	set nextscript "catch {focus $oldFocus}; destroy $w; unregister_active 2; menu3 .menu3 \"$title\""
	frame $w.f
	button $w.f.back -text "Main Menu" \
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 2"
	button $w.f.next -text "Next" -underline 0\
		-width 15 -command $nextscript
	bind all <Alt-n> $nextscript
	button $w.f.prev -text "Prev" -underline 0\
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 2; menu1 .menu1 \"$title\""
	bind $w <Alt-p> "catch {focus $oldFocus}; destroy $w; unregister_active 2; menu1 .menu1 \"$title\";break"
	pack $w.f.back $w.f.next $w.f.prev -side left -expand on
	pack $w.f -pady 10 -side bottom -anchor w -fill x
	frame $w.topline -relief ridge -borderwidth 2 -height 2
	pack $w.topline -side top -fill x

	frame $w.botline -relief ridge -borderwidth 2 -height 2
	pack $w.botline -side bottom -fill x

	frame $w.config
	pack $w.config -fill y -expand on

	scrollbar $w.config.vscroll -command "$w.config.canvas yview"
	pack $w.config.vscroll -side right -fill y

	canvas $w.config.canvas -height 1\
		-relief flat -borderwidth 0 -yscrollcommand "$w.config.vscroll set" \
		-width [expr [winfo screenwidth .] * 1 / 2] 
	frame $w.config.f
	bind $w <Key-Down> "$w.config.canvas yview scroll  1 unit;break;"
	bind $w <Key-Up> "$w.config.canvas yview scroll  -1 unit;break;"
	bind $w <Key-Next> "$w.config.canvas yview scroll  1 page;break;"
	bind $w <Key-Prior> "$w.config.canvas yview scroll  -1 page;break;"
	bind $w <Key-Home> "$w.config.canvas yview moveto 0;break;"
	bind $w <Key-End> "$w.config.canvas yview moveto 1 ;break;"
	pack $w.config.canvas -side right -fill y


	global tmpvar_3
	minimenu $w.config.f 2 0 "Clock generator                     " tmpvar_3 CONFIG_CLK_INFERRED
	menu $w.config.f.x0.x.menu -tearoffcommand "menutitle \"Clock generator                     \""
	$w.config.f.x0.x.menu add radiobutton -label "Inferred" -variable tmpvar_3 -value "Inferred" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Actel-HCLKBUF" -variable tmpvar_3 -value "Actel-HCLKBUF" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Aeroflex-UT130HBD" -variable tmpvar_3 -value "Aeroflex-UT130HBD" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Altera-ALTPLL" -variable tmpvar_3 -value "Altera-ALTPLL" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Lattice-EXPLL" -variable tmpvar_3 -value "Lattice-EXPLL" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Proasic3-PLL" -variable tmpvar_3 -value "Proasic3-PLL" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Proasic3E-PLL" -variable tmpvar_3 -value "Proasic3E-PLL" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Proasic3L-PLL" -variable tmpvar_3 -value "Proasic3L-PLL" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Fusion-PLL" -variable tmpvar_3 -value "Fusion-PLL" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "RH-LIB18T-PLL" -variable tmpvar_3 -value "RH-LIB18T-PLL" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "RHUMC-PLL" -variable tmpvar_3 -value "RHUMC-PLL" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "DARE-PLL" -variable tmpvar_3 -value "DARE-PLL" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "SAED32-PLL" -variable tmpvar_3 -value "SAED32-PLL" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "EASIC45-PLL" -variable tmpvar_3 -value "EASIC45-PLL" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "RHS65-PLL" -variable tmpvar_3 -value "RHS65-PLL" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Xilinx-PLLE2" -variable tmpvar_3 -value "Xilinx-PLLE2" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Xilinx-CLKDLL" -variable tmpvar_3 -value "Xilinx-CLKDLL" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Xilinx-DCM" -variable tmpvar_3 -value "Xilinx-DCM" -command "update_active"
	menusplit $w $w.config.f.x0.x.menu 18
	int $w.config.f 2 1 "Clock multiplication factor (allowed values are tech dependent)" CONFIG_CLK_MUL
	int $w.config.f 2 2 "Clock division factor (allowed values are tech dependent)" CONFIG_CLK_DIV
	int $w.config.f 2 3 "Outout division factor (1 - 32)" CONFIG_OCLK_DIV
	int $w.config.f 2 4 "Outout division factor, 2nd clk (0 - 32, see help)" CONFIG_OCLKB_DIV
	int $w.config.f 2 5 "Outout division factor, 3rd clk (0 - 32, see help)" CONFIG_OCLKC_DIV
	bool $w.config.f 2 6 "Enable Xilinx CLKDLL for PCI clock" CONFIG_PCI_CLKDLL
	bool $w.config.f 2 7 "Disable external feedback for SDRAM clock" CONFIG_CLK_NOFB
	bool $w.config.f 2 8 "Use PCI clock as system clock" CONFIG_PCI_SYSCLK



	focus $w
	update_active
	global winx; global winy
	set winx [expr [winfo x .]+30]; set winy [expr [winfo y .]+30]
	if {[winfo exists $w]} then {wm geometry $w +$winx+$winy}
	update idletasks
	if {[winfo exists $w]} then  {$w.config.canvas create window 0 0 -anchor nw -window $w.config.f

	$w.config.canvas configure \
		-width [expr [winfo reqwidth $w.config.f] + 1]\
		-scrollregion "-1 -1 [expr [winfo reqwidth $w.config.f] + 1] \
			 [expr [winfo reqheight $w.config.f] + 1]"

	set winy [expr [winfo reqh $w] - [winfo reqh $w.config.canvas]]
	set scry [expr [winfo screenh $w] / 2]
	set maxy [expr [winfo screenh $w] * 3 / 4]
	set canvtotal [expr [winfo reqh $w.config.f] + 2]
	if [expr $winy + $canvtotal < $maxy] {
		$w.config.canvas configure -height $canvtotal
	} else {
		$w.config.canvas configure -height [expr $scry - $winy]
		}
	}
	update idletasks
	if {[winfo exists $w]} then {
	wm maxsize $w [winfo width $w] [winfo screenheight $w]
	wm minsize $w [winfo width $w] 100

	wm deiconify $w
}
}

proc update_menu2 {} {
	global CONFIG_CLK_DCM
	global CONFIG_CLK_ALTDLL
	global CONFIG_CLK_LATDLL
	global CONFIG_CLK_PRO3PLL
	global CONFIG_CLK_PRO3EPLL
	global CONFIG_CLK_PRO3LPLL
	global CONFIG_CLK_CLKDLL
	global CONFIG_CLK_LIB18T
	global CONFIG_CLK_FUSPLL
	global CONFIG_CLK_CLKPLLE2
	global CONFIG_CLK_MUL
	if {($CONFIG_CLK_DCM == 1 || $CONFIG_CLK_ALTDLL == 1 || $CONFIG_CLK_LATDLL == 1 || $CONFIG_CLK_PRO3PLL == 1 || $CONFIG_CLK_PRO3EPLL == 1 || $CONFIG_CLK_PRO3LPLL == 1 || $CONFIG_CLK_CLKDLL == 1 || $CONFIG_CLK_LIB18T == 1 || $CONFIG_CLK_FUSPLL == 1 || $CONFIG_CLK_CLKPLLE2 == 1)} then {.menu2.config.f.x1.x configure -state normal -foreground [ cget .ref -foreground ]; .menu2.config.f.x1.l configure -state normal; } else {.menu2.config.f.x1.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu2.config.f.x1.l configure -state disabled}
	global CONFIG_CLK_DIV
	if {($CONFIG_CLK_DCM == 1 || $CONFIG_CLK_ALTDLL == 1 || $CONFIG_CLK_LATDLL == 1 || $CONFIG_CLK_PRO3PLL == 1 || $CONFIG_CLK_PRO3EPLL == 1 || $CONFIG_CLK_PRO3LPLL == 1 || $CONFIG_CLK_CLKDLL == 1 || $CONFIG_CLK_LIB18T == 1 || $CONFIG_CLK_FUSPLL == 1 || $CONFIG_CLK_CLKPLLE2 == 1)} then {.menu2.config.f.x2.x configure -state normal -foreground [ cget .ref -foreground ]; .menu2.config.f.x2.l configure -state normal; } else {.menu2.config.f.x2.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu2.config.f.x2.l configure -state disabled}
	global CONFIG_OCLK_DIV
	if {($CONFIG_CLK_PRO3PLL == 1 || $CONFIG_CLK_PRO3EPLL == 1 || $CONFIG_CLK_PRO3LPLL == 1 || $CONFIG_CLK_FUSPLL == 1)} then {.menu2.config.f.x3.x configure -state normal -foreground [ cget .ref -foreground ]; .menu2.config.f.x3.l configure -state normal; } else {.menu2.config.f.x3.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu2.config.f.x3.l configure -state disabled}
	global CONFIG_OCLKB_DIV
	if {($CONFIG_CLK_PRO3PLL == 1 || $CONFIG_CLK_PRO3EPLL == 1 || $CONFIG_CLK_PRO3LPLL == 1 || $CONFIG_CLK_FUSPLL == 1)} then {.menu2.config.f.x4.x configure -state normal -foreground [ cget .ref -foreground ]; .menu2.config.f.x4.l configure -state normal; } else {.menu2.config.f.x4.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu2.config.f.x4.l configure -state disabled}
	global CONFIG_OCLKC_DIV
	if {($CONFIG_CLK_PRO3PLL == 1 || $CONFIG_CLK_PRO3EPLL == 1 || $CONFIG_CLK_PRO3LPLL == 1 || $CONFIG_CLK_FUSPLL == 1)} then {.menu2.config.f.x5.x configure -state normal -foreground [ cget .ref -foreground ]; .menu2.config.f.x5.l configure -state normal; } else {.menu2.config.f.x5.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu2.config.f.x5.l configure -state disabled}
	global CONFIG_PCI_CLKDLL
	if {($CONFIG_CLK_CLKDLL == 1 || $CONFIG_CLK_DCM == 1)} then {
	configure_entry .menu2.config.f.x6 normal {n l y}} else {configure_entry .menu2.config.f.x6 disabled {y n l}}
	global CONFIG_CLK_NOFB
	if {($CONFIG_CLK_DCM == 1)} then {
	configure_entry .menu2.config.f.x7 normal {n l y}} else {configure_entry .menu2.config.f.x7 disabled {y n l}}
	global CONFIG_PCI_ENABLE
	global CONFIG_PCI_SYSCLK
	if {($CONFIG_PCI_ENABLE != 1)} then {
	configure_entry .menu2.config.f.x8 normal {n l y}} else {configure_entry .menu2.config.f.x8 disabled {y n l}}
}


proc update_define_menu2 {} {
	update_define_mainmenu
	global CONFIG_MODULES
	global tmpvar_3
	global CONFIG_CLK_INFERRED
	if {$tmpvar_3 == "Inferred"} then {set CONFIG_CLK_INFERRED 1} else {set CONFIG_CLK_INFERRED 0}
	global CONFIG_CLK_HCLKBUF
	if {$tmpvar_3 == "Actel-HCLKBUF"} then {set CONFIG_CLK_HCLKBUF 1} else {set CONFIG_CLK_HCLKBUF 0}
	global CONFIG_CLK_UT130HBD
	if {$tmpvar_3 == "Aeroflex-UT130HBD"} then {set CONFIG_CLK_UT130HBD 1} else {set CONFIG_CLK_UT130HBD 0}
	global CONFIG_CLK_ALTDLL
	if {$tmpvar_3 == "Altera-ALTPLL"} then {set CONFIG_CLK_ALTDLL 1} else {set CONFIG_CLK_ALTDLL 0}
	global CONFIG_CLK_LATDLL
	if {$tmpvar_3 == "Lattice-EXPLL"} then {set CONFIG_CLK_LATDLL 1} else {set CONFIG_CLK_LATDLL 0}
	global CONFIG_CLK_PRO3PLL
	if {$tmpvar_3 == "Proasic3-PLL"} then {set CONFIG_CLK_PRO3PLL 1} else {set CONFIG_CLK_PRO3PLL 0}
	global CONFIG_CLK_PRO3EPLL
	if {$tmpvar_3 == "Proasic3E-PLL"} then {set CONFIG_CLK_PRO3EPLL 1} else {set CONFIG_CLK_PRO3EPLL 0}
	global CONFIG_CLK_PRO3LPLL
	if {$tmpvar_3 == "Proasic3L-PLL"} then {set CONFIG_CLK_PRO3LPLL 1} else {set CONFIG_CLK_PRO3LPLL 0}
	global CONFIG_CLK_FUSPLL
	if {$tmpvar_3 == "Fusion-PLL"} then {set CONFIG_CLK_FUSPLL 1} else {set CONFIG_CLK_FUSPLL 0}
	global CONFIG_CLK_LIB18T
	if {$tmpvar_3 == "RH-LIB18T-PLL"} then {set CONFIG_CLK_LIB18T 1} else {set CONFIG_CLK_LIB18T 0}
	global CONFIG_CLK_RHUMC
	if {$tmpvar_3 == "RHUMC-PLL"} then {set CONFIG_CLK_RHUMC 1} else {set CONFIG_CLK_RHUMC 0}
	global CONFIG_CLK_DARE
	if {$tmpvar_3 == "DARE-PLL"} then {set CONFIG_CLK_DARE 1} else {set CONFIG_CLK_DARE 0}
	global CONFIG_CLK_SAED32
	if {$tmpvar_3 == "SAED32-PLL"} then {set CONFIG_CLK_SAED32 1} else {set CONFIG_CLK_SAED32 0}
	global CONFIG_CLK_EASIC45
	if {$tmpvar_3 == "EASIC45-PLL"} then {set CONFIG_CLK_EASIC45 1} else {set CONFIG_CLK_EASIC45 0}
	global CONFIG_CLK_RHS65
	if {$tmpvar_3 == "RHS65-PLL"} then {set CONFIG_CLK_RHS65 1} else {set CONFIG_CLK_RHS65 0}
	global CONFIG_CLK_CLKPLLE2
	if {$tmpvar_3 == "Xilinx-PLLE2"} then {set CONFIG_CLK_CLKPLLE2 1} else {set CONFIG_CLK_CLKPLLE2 0}
	global CONFIG_CLK_CLKDLL
	if {$tmpvar_3 == "Xilinx-CLKDLL"} then {set CONFIG_CLK_CLKDLL 1} else {set CONFIG_CLK_CLKDLL 0}
	global CONFIG_CLK_DCM
	if {$tmpvar_3 == "Xilinx-DCM"} then {set CONFIG_CLK_DCM 1} else {set CONFIG_CLK_DCM 0}
	global CONFIG_CLK_MUL
	if {($CONFIG_CLK_DCM == 1 || $CONFIG_CLK_ALTDLL == 1 || $CONFIG_CLK_LATDLL == 1 || $CONFIG_CLK_PRO3PLL == 1 || $CONFIG_CLK_PRO3EPLL == 1 || $CONFIG_CLK_PRO3LPLL == 1 || $CONFIG_CLK_CLKDLL == 1 || $CONFIG_CLK_LIB18T == 1 || $CONFIG_CLK_FUSPLL == 1 || $CONFIG_CLK_CLKPLLE2 == 1)} then {validate_int CONFIG_CLK_MUL "$CONFIG_CLK_MUL" 2}
	global CONFIG_CLK_DIV
	if {($CONFIG_CLK_DCM == 1 || $CONFIG_CLK_ALTDLL == 1 || $CONFIG_CLK_LATDLL == 1 || $CONFIG_CLK_PRO3PLL == 1 || $CONFIG_CLK_PRO3EPLL == 1 || $CONFIG_CLK_PRO3LPLL == 1 || $CONFIG_CLK_CLKDLL == 1 || $CONFIG_CLK_LIB18T == 1 || $CONFIG_CLK_FUSPLL == 1 || $CONFIG_CLK_CLKPLLE2 == 1)} then {validate_int CONFIG_CLK_DIV "$CONFIG_CLK_DIV" 2}
	global CONFIG_OCLK_DIV
	if {($CONFIG_CLK_PRO3PLL == 1 || $CONFIG_CLK_PRO3EPLL == 1 || $CONFIG_CLK_PRO3LPLL == 1 || $CONFIG_CLK_FUSPLL == 1)} then {validate_int CONFIG_OCLK_DIV "$CONFIG_OCLK_DIV" 1}
	global CONFIG_OCLKB_DIV
	if {($CONFIG_CLK_PRO3PLL == 1 || $CONFIG_CLK_PRO3EPLL == 1 || $CONFIG_CLK_PRO3LPLL == 1 || $CONFIG_CLK_FUSPLL == 1)} then {validate_int CONFIG_OCLKB_DIV "$CONFIG_OCLKB_DIV" 0}
	global CONFIG_OCLKC_DIV
	if {($CONFIG_CLK_PRO3PLL == 1 || $CONFIG_CLK_PRO3EPLL == 1 || $CONFIG_CLK_PRO3LPLL == 1 || $CONFIG_CLK_FUSPLL == 1)} then {validate_int CONFIG_OCLKC_DIV "$CONFIG_OCLKC_DIV" 0}
	global CONFIG_PCI_CLKDLL
	if {($CONFIG_CLK_CLKDLL == 1 || $CONFIG_CLK_DCM == 1)} then {
	set CONFIG_PCI_CLKDLL [expr $CONFIG_PCI_CLKDLL&15]} else {set CONFIG_PCI_CLKDLL [expr $CONFIG_PCI_CLKDLL|16]}
	global CONFIG_CLK_NOFB
	if {($CONFIG_CLK_DCM == 1)} then {
	set CONFIG_CLK_NOFB [expr $CONFIG_CLK_NOFB&15]} else {set CONFIG_CLK_NOFB [expr $CONFIG_CLK_NOFB|16]}
	global CONFIG_PCI_ENABLE
	global CONFIG_PCI_SYSCLK
	if {($CONFIG_PCI_ENABLE != 1)} then {
	set CONFIG_PCI_SYSCLK [expr $CONFIG_PCI_SYSCLK&15]} else {set CONFIG_PCI_SYSCLK [expr $CONFIG_PCI_SYSCLK|16]}
}


menu_option menu3 3 "Processor            "
proc menu3 {w title} {
	set oldFocus [focus]
	catch {destroy $w; unregister_active 3}
	toplevel $w -class Dialog
	wm withdraw $w
	global active_menus
	set active_menus [lsort -integer [linsert $active_menus end 3]]
	message $w.m -width 400 -aspect 300 -text \
		"Processor            "  -relief raised
	pack $w.m -pady 10 -side top -padx 10
	wm title $w "Processor            " 

	bind $w <Escape> "catch {focus $oldFocus}; destroy $w; unregister_active 3; break"
	set nextscript "catch {focus $oldFocus}; menu4 .menu4 \"$title\""
	frame $w.f
	button $w.f.back -text "Main Menu" \
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 3"
	button $w.f.next -text "Next" -underline 0\
		-width 15 -command $nextscript
	bind all <Alt-n> $nextscript
	button $w.f.prev -text "Prev" -underline 0\
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 3; menu2 .menu2 \"$title\""
	bind $w <Alt-p> "catch {focus $oldFocus}; destroy $w; unregister_active 3; menu2 .menu2 \"$title\";break"
	pack $w.f.back $w.f.next $w.f.prev -side left -expand on
	pack $w.f -pady 10 -side bottom -anchor w -fill x
	frame $w.topline -relief ridge -borderwidth 2 -height 2
	pack $w.topline -side top -fill x

	frame $w.botline -relief ridge -borderwidth 2 -height 2
	pack $w.botline -side bottom -fill x

	frame $w.config
	pack $w.config -fill y -expand on

	scrollbar $w.config.vscroll -command "$w.config.canvas yview"
	pack $w.config.vscroll -side right -fill y

	canvas $w.config.canvas -height 1\
		-relief flat -borderwidth 0 -yscrollcommand "$w.config.vscroll set" \
		-width [expr [winfo screenwidth .] * 1 / 2] 
	frame $w.config.f
	bind $w <Key-Down> "$w.config.canvas yview scroll  1 unit;break;"
	bind $w <Key-Up> "$w.config.canvas yview scroll  -1 unit;break;"
	bind $w <Key-Next> "$w.config.canvas yview scroll  1 page;break;"
	bind $w <Key-Prior> "$w.config.canvas yview scroll  -1 page;break;"
	bind $w <Key-Home> "$w.config.canvas yview moveto 0;break;"
	bind $w <Key-End> "$w.config.canvas yview moveto 1 ;break;"
	pack $w.config.canvas -side right -fill y


	global tmpvar_4
	minimenu $w.config.f 3 0 "Select processor (Changes file list - requires \"make distclean\")" tmpvar_4 CONFIG_LEON3
	menu $w.config.f.x0.x.menu -tearoffcommand "menutitle \"Select processor (Changes file list - requires \"make distclean\")\""
	$w.config.f.x0.x.menu add radiobutton -label "LEON3" -variable tmpvar_4 -value "LEON3" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "LEON4" -variable tmpvar_4 -value "LEON4" -command "update_active"
	menusplit $w $w.config.f.x0.x.menu 2
	int $w.config.f 3 1 "Number of processors" CONFIG_PROC_NUM
	global tmpvar_5
	minimenu $w.config.f 3 2 "Force values from example configuration (see help)" tmpvar_5 CONFIG_LEON_MIN
	menu $w.config.f.x2.x.menu -tearoffcommand "menutitle \"Force values from example configuration (see help)\""
	$w.config.f.x2.x.menu add radiobutton -label "Minimal-configuration" -variable tmpvar_5 -value "Minimal-configuration" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "General-purpose-cfg" -variable tmpvar_5 -value "General-purpose-cfg" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "High-Performance-cfg" -variable tmpvar_5 -value "High-Performance-cfg" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "Custom-configuration" -variable tmpvar_5 -value "Custom-configuration" -command "update_active"
	menusplit $w $w.config.f.x2.x.menu 4
	submenu $w.config.f 3 3 "Integer unit                                           " 4
	submenu $w.config.f 3 4 "Floating-point unit" 5
	submenu $w.config.f 3 5 "Cache system" 6
	submenu $w.config.f 3 6 "MMU" 7
	submenu $w.config.f 3 7 "Debug Support Unit        " 8
	submenu $w.config.f 3 8 "Fault-tolerance  " 9
	submenu $w.config.f 3 9 "VHDL debug settings       " 10



	focus $w
	update_active
	global winx; global winy
	set winx [expr [winfo x .]+30]; set winy [expr [winfo y .]+30]
	if {[winfo exists $w]} then {wm geometry $w +$winx+$winy}
	update idletasks
	if {[winfo exists $w]} then  {$w.config.canvas create window 0 0 -anchor nw -window $w.config.f

	$w.config.canvas configure \
		-width [expr [winfo reqwidth $w.config.f] + 1]\
		-scrollregion "-1 -1 [expr [winfo reqwidth $w.config.f] + 1] \
			 [expr [winfo reqheight $w.config.f] + 1]"

	set winy [expr [winfo reqh $w] - [winfo reqh $w.config.canvas]]
	set scry [expr [winfo screenh $w] / 2]
	set maxy [expr [winfo screenh $w] * 3 / 4]
	set canvtotal [expr [winfo reqh $w.config.f] + 2]
	if [expr $winy + $canvtotal < $maxy] {
		$w.config.canvas configure -height $canvtotal
	} else {
		$w.config.canvas configure -height [expr $scry - $winy]
		}
	}
	update idletasks
	if {[winfo exists $w]} then {
	wm maxsize $w [winfo width $w] [winfo screenheight $w]
	wm minsize $w [winfo width $w] 100

	wm deiconify $w
}
}

proc update_menu3 {} {
	global CONFIG_LEON_CUSTOM
	if {($CONFIG_LEON_CUSTOM == 1)} then {configure_entry .menu3.config.f.x3 normal {m}} else {configure_entry .menu3.config.f.x3 disabled {m}}
	if {($CONFIG_LEON_CUSTOM == 1)} then {configure_entry .menu3.config.f.x4 normal {m}} else {configure_entry .menu3.config.f.x4 disabled {m}}
	if {($CONFIG_LEON_CUSTOM == 1)} then {configure_entry .menu3.config.f.x6 normal {m}} else {configure_entry .menu3.config.f.x6 disabled {m}}
}


proc update_define_menu3 {} {
	update_define_mainmenu
	global CONFIG_MODULES
	global CONFIG_IU_NWINDOWS
	global CONFIG_IU_V8MULDIV
	global CONFIG_IU_BP
	global CONFIG_IU_SVT
	global CONFIG_IU_LDELAY
	global CONFIG_IU_WATCHPOINTS
	global CONFIG_PWD
	global CONFIG_IU_RSTADDR
	global CONFIG_FPU_ENABLE
	global CONFIG_ICACHE_ENABLE
	global CONFIG_ICACHE_ASSO1
	global CONFIG_ICACHE_SZ2
	global CONFIG_ICACHE_LZ16
	global CONFIG_ICACHE_ALGORND
	global CONFIG_ICACHE_LOCK
	global CONFIG_DCACHE_ENABLE
	global CONFIG_DCACHE_ASSO1
	global CONFIG_DCACHE_SZ2
	global CONFIG_DCACHE_LZ16
	global CONFIG_DCACHE_ALGORND
	global CONFIG_DCACHE_LOCK
	global CONFIG_DCACHE_SNOOP
	global CONFIG_MMU_ENABLE
	global CONFIG_DSU_ENABLE
	global CONFIG_NP_ASI
	global CONFIG_PWRPSR
	global CONFIG_IU_MUL_LATENCY_5
	global CONFIG_IU_MUL_MAC
	global CONFIG_ICACHE_ASSO2
	global CONFIG_ICACHE_SZ4
	global CONFIG_ICACHE_LRAM
	global CONFIG_DCACHE_ASSO2
	global CONFIG_DCACHE_SZ4
	global CONFIG_DCACHE_SNOOP_SEPTAG
	global CONFIG_DCACHE_SNOOP_SP
	global CONFIG_DCACHE_LRAM
	global CONFIG_MMU_SPLIT
	global CONFIG_MMU_REPARRAY
	global CONFIG_MMU_I8
	global CONFIG_MMU_D8
	global CONFIG_MMU_FASTWB
	global CONFIG_MMU_PAGE_4K
	global CONFIG_DSU_ITRACE
	global CONFIG_DSU_ITRACESZ4
	global CONFIG_DSU_ATRACESZ4
	global CONFIG_IU_MUL_LATENCY_2
	global CONFIG_FPU_GRFPU
	global CONFIG_FPU_GRFPU_INFMUL
	global CONFIG_ICACHE_ALGOLRU
	global CONFIG_DCACHE_ALGOLRU
	global CONFIG_MMU_I16
	global CONFIG_MMU_D16
	global tmpvar_4
	global CONFIG_LEON3
	if {$tmpvar_4 == "LEON3"} then {set CONFIG_LEON3 1} else {set CONFIG_LEON3 0}
	global CONFIG_LEON4
	if {$tmpvar_4 == "LEON4"} then {set CONFIG_LEON4 1} else {set CONFIG_LEON4 0}
	global tmpvar_5
	global CONFIG_LEON_MIN
	if {$tmpvar_5 == "Minimal-configuration"} then {set CONFIG_LEON_MIN 1} else {set CONFIG_LEON_MIN 0}
	global CONFIG_LEON_GP
	if {$tmpvar_5 == "General-purpose-cfg"} then {set CONFIG_LEON_GP 1} else {set CONFIG_LEON_GP 0}
	global CONFIG_LEON_HP
	if {$tmpvar_5 == "High-Performance-cfg"} then {set CONFIG_LEON_HP 1} else {set CONFIG_LEON_HP 0}
	global CONFIG_LEON_CUSTOM
	if {$tmpvar_5 == "Custom-configuration"} then {set CONFIG_LEON_CUSTOM 1} else {set CONFIG_LEON_CUSTOM 0}
	if {($CONFIG_LEON_MIN == 1)} then {set CONFIG_IU_NWINDOWS 8 }
	if {($CONFIG_LEON_MIN == 1)} then {	global CONSTANT_N
set CONFIG_IU_V8MULDIV $CONSTANT_N }
	if {($CONFIG_LEON_MIN == 1)} then {	global CONSTANT_N
set CONFIG_IU_BP $CONSTANT_N }
	if {($CONFIG_LEON_MIN == 1)} then {	global CONSTANT_Y
set CONFIG_IU_SVT $CONSTANT_Y }
	if {($CONFIG_LEON_MIN == 1)} then {set CONFIG_IU_LDELAY 1 }
	if {($CONFIG_LEON_MIN == 1)} then {set CONFIG_IU_WATCHPOINTS 0 }
	if {($CONFIG_LEON_MIN == 1)} then {	global CONSTANT_N
set CONFIG_PWD $CONSTANT_N }
	if {($CONFIG_LEON_MIN == 1)} then {set CONFIG_IU_RSTADDR 00000 }
	if {($CONFIG_LEON_MIN == 1)} then {	global CONSTANT_N
set CONFIG_FPU_ENABLE $CONSTANT_N }
	if {($CONFIG_LEON_MIN == 1)} then {	global CONSTANT_Y
set CONFIG_ICACHE_ENABLE $CONSTANT_Y }
	if {($CONFIG_LEON_MIN == 1)} then {	global CONSTANT_Y
set CONFIG_ICACHE_ASSO1 $CONSTANT_Y }
	if {($CONFIG_LEON_MIN == 1)} then {	global CONSTANT_Y
set CONFIG_ICACHE_SZ2 $CONSTANT_Y }
	if {($CONFIG_LEON_MIN == 1)} then {	global CONSTANT_Y
set CONFIG_ICACHE_LZ16 $CONSTANT_Y }
	if {($CONFIG_LEON_MIN == 1)} then {	global CONSTANT_Y
set CONFIG_ICACHE_ALGORND $CONSTANT_Y }
	if {($CONFIG_LEON_MIN == 1)} then {	global CONSTANT_N
set CONFIG_ICACHE_LOCK $CONSTANT_N }
	if {($CONFIG_LEON_MIN == 1)} then {	global CONSTANT_Y
set CONFIG_DCACHE_ENABLE $CONSTANT_Y }
	if {($CONFIG_LEON_MIN == 1)} then {	global CONSTANT_Y
set CONFIG_DCACHE_ASSO1 $CONSTANT_Y }
	if {($CONFIG_LEON_MIN == 1)} then {	global CONSTANT_Y
set CONFIG_DCACHE_SZ2 $CONSTANT_Y }
	if {($CONFIG_LEON_MIN == 1)} then {	global CONSTANT_Y
set CONFIG_DCACHE_LZ16 $CONSTANT_Y }
	if {($CONFIG_LEON_MIN == 1)} then {	global CONSTANT_Y
set CONFIG_DCACHE_ALGORND $CONSTANT_Y }
	if {($CONFIG_LEON_MIN == 1)} then {	global CONSTANT_N
set CONFIG_DCACHE_LOCK $CONSTANT_N }
	if {($CONFIG_LEON_MIN == 1)} then {	global CONSTANT_N
set CONFIG_DCACHE_SNOOP $CONSTANT_N }
	if {($CONFIG_LEON_MIN == 1)} then {	global CONSTANT_N
set CONFIG_MMU_ENABLE $CONSTANT_N }
	if {($CONFIG_LEON_MIN == 1)} then {	global CONSTANT_N
set CONFIG_DSU_ENABLE $CONSTANT_N }
	if {($CONFIG_LEON_MIN == 1)} then {	global CONSTANT_N
set CONFIG_NP_ASI $CONSTANT_N }
	if {($CONFIG_LEON_MIN == 1)} then {	global CONSTANT_N
set CONFIG_PWRPSR $CONSTANT_N }
	if {($CONFIG_LEON_GP == 1)} then {set CONFIG_IU_NWINDOWS 8 }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_Y
set CONFIG_IU_V8MULDIV $CONSTANT_Y }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_Y
set CONFIG_IU_MUL_LATENCY_5 $CONSTANT_Y }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_N
set CONFIG_IU_MUL_MAC $CONSTANT_N }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_Y
set CONFIG_IU_BP $CONSTANT_Y }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_Y
set CONFIG_IU_SVT $CONSTANT_Y }
	if {($CONFIG_LEON_GP == 1)} then {set CONFIG_IU_LDELAY 1 }
	if {($CONFIG_LEON_GP == 1)} then {set CONFIG_IU_WATCHPOINTS 2 }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_Y
set CONFIG_PWD $CONSTANT_Y }
	if {($CONFIG_LEON_GP == 1)} then {set CONFIG_IU_RSTADDR 00000 }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_N
set CONFIG_FPU_ENABLE $CONSTANT_N }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_Y
set CONFIG_ICACHE_ENABLE $CONSTANT_Y }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_Y
set CONFIG_ICACHE_ASSO2 $CONSTANT_Y }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_Y
set CONFIG_ICACHE_SZ4 $CONSTANT_Y }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_Y
set CONFIG_ICACHE_LZ16 $CONSTANT_Y }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_Y
set CONFIG_ICACHE_ALGORND $CONSTANT_Y }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_N
set CONFIG_ICACHE_LOCK $CONSTANT_N }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_N
set CONFIG_ICACHE_LRAM $CONSTANT_N }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_Y
set CONFIG_DCACHE_ENABLE $CONSTANT_Y }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_Y
set CONFIG_DCACHE_ASSO2 $CONSTANT_Y }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_Y
set CONFIG_DCACHE_SZ4 $CONSTANT_Y }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_Y
set CONFIG_DCACHE_LZ16 $CONSTANT_Y }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_Y
set CONFIG_DCACHE_ALGORND $CONSTANT_Y }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_N
set CONFIG_DCACHE_LOCK $CONSTANT_N }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_Y
set CONFIG_DCACHE_SNOOP $CONSTANT_Y }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_Y
set CONFIG_DCACHE_SNOOP_SEPTAG $CONSTANT_Y }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_N
set CONFIG_DCACHE_SNOOP_SP $CONSTANT_N }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_N
set CONFIG_DCACHE_LRAM $CONSTANT_N }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_Y
set CONFIG_MMU_ENABLE $CONSTANT_Y }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_Y
set CONFIG_MMU_SPLIT $CONSTANT_Y }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_Y
set CONFIG_MMU_REPARRAY $CONSTANT_Y }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_Y
set CONFIG_MMU_I8 $CONSTANT_Y }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_Y
set CONFIG_MMU_D8 $CONSTANT_Y }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_Y
set CONFIG_MMU_FASTWB $CONSTANT_Y }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_Y
set CONFIG_MMU_PAGE_4K $CONSTANT_Y }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_Y
set CONFIG_DSU_ENABLE $CONSTANT_Y }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_Y
set CONFIG_DSU_ITRACE $CONSTANT_Y }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_Y
set CONFIG_DSU_ITRACESZ4 $CONSTANT_Y }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_Y
set CONFIG_DSU_ATRACESZ4 $CONSTANT_Y }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_Y
set CONFIG_NP_ASI $CONSTANT_Y }
	if {($CONFIG_LEON_GP == 1)} then {	global CONSTANT_Y
set CONFIG_PWRPSR $CONSTANT_Y }
	if {($CONFIG_LEON_HP == 1)} then {set CONFIG_IU_NWINDOWS 8 }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_Y
set CONFIG_IU_V8MULDIV $CONSTANT_Y }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_Y
set CONFIG_IU_MUL_LATENCY_2 $CONSTANT_Y }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_N
set CONFIG_IU_MUL_MAC $CONSTANT_N }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_Y
set CONFIG_IU_BP $CONSTANT_Y }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_Y
set CONFIG_IU_SVT $CONSTANT_Y }
	if {($CONFIG_LEON_HP == 1)} then {set CONFIG_IU_LDELAY 1 }
	if {($CONFIG_LEON_HP == 1)} then {set CONFIG_IU_WATCHPOINTS 4 }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_Y
set CONFIG_PWD $CONSTANT_Y }
	if {($CONFIG_LEON_HP == 1)} then {set CONFIG_IU_RSTADDR 00000 }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_Y
set CONFIG_FPU_ENABLE $CONSTANT_Y }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_Y
set CONFIG_FPU_GRFPU $CONSTANT_Y }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_Y
set CONFIG_FPU_GRFPU_INFMUL $CONSTANT_Y }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_Y
set CONFIG_ICACHE_ENABLE $CONSTANT_Y }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_Y
set CONFIG_ICACHE_ASSO2 $CONSTANT_Y }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_Y
set CONFIG_ICACHE_SZ4 $CONSTANT_Y }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_Y
set CONFIG_ICACHE_LZ16 $CONSTANT_Y }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_Y
set CONFIG_ICACHE_ALGOLRU $CONSTANT_Y }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_N
set CONFIG_ICACHE_LOCK $CONSTANT_N }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_N
set CONFIG_ICACHE_LRAM $CONSTANT_N }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_Y
set CONFIG_DCACHE_ENABLE $CONSTANT_Y }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_Y
set CONFIG_DCACHE_ASSO2 $CONSTANT_Y }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_Y
set CONFIG_DCACHE_SZ4 $CONSTANT_Y }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_Y
set CONFIG_DCACHE_LZ16 $CONSTANT_Y }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_Y
set CONFIG_DCACHE_ALGOLRU $CONSTANT_Y }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_N
set CONFIG_DCACHE_LOCK $CONSTANT_N }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_Y
set CONFIG_DCACHE_SNOOP $CONSTANT_Y }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_Y
set CONFIG_DCACHE_SNOOP_SEPTAG $CONSTANT_Y }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_N
set CONFIG_DCACHE_SNOOP_SP $CONSTANT_N }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_N
set CONFIG_DCACHE_LRAM $CONSTANT_N }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_Y
set CONFIG_MMU_ENABLE $CONSTANT_Y }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_Y
set CONFIG_MMU_SPLIT $CONSTANT_Y }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_Y
set CONFIG_MMU_REPARRAY $CONSTANT_Y }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_Y
set CONFIG_MMU_I16 $CONSTANT_Y }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_Y
set CONFIG_MMU_D16 $CONSTANT_Y }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_Y
set CONFIG_MMU_FASTWB $CONSTANT_Y }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_Y
set CONFIG_MMU_PAGE_4K $CONSTANT_Y }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_Y
set CONFIG_DSU_ENABLE $CONSTANT_Y }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_Y
set CONFIG_DSU_ITRACE $CONSTANT_Y }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_Y
set CONFIG_DSU_ITRACESZ4 $CONSTANT_Y }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_Y
set CONFIG_DSU_ATRACESZ4 $CONSTANT_Y }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_Y
set CONFIG_NP_ASI $CONSTANT_Y }
	if {($CONFIG_LEON_HP == 1)} then {	global CONSTANT_Y
set CONFIG_PWRPSR $CONSTANT_Y }
}


proc menu4 {w title} {
	set oldFocus [focus]
	catch {focus .menu3}
	catch {destroy $w; unregister_active 4}
	toplevel $w -class Dialog
	wm withdraw $w
	global active_menus
	set active_menus [lsort -integer [linsert $active_menus end 4]]
	message $w.m -width 400 -aspect 300 -text \
		"Integer unit                                           "  -relief raised
	pack $w.m -pady 10 -side top -padx 10
	wm title $w "Integer unit                                           " 

	bind $w <Escape> "catch {focus $oldFocus}; destroy $w; unregister_active 4; break"
	set nextscript "catch {focus $oldFocus}; destroy $w; unregister_active 4; menu5 .menu5 \"$title\""
	frame $w.f
	button $w.f.back -text "OK" \
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 4"
	button $w.f.next -text "Next" -underline 0\
		-width 15 -command $nextscript
	bind all <Alt-n> $nextscript
	button $w.f.prev -text "Prev" -underline 0\
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 4; menu3 .menu3 \"$title\""
	bind $w <Alt-p> "catch {focus $oldFocus}; destroy $w; unregister_active 4; menu3 .menu3 \"$title\";break"
	pack $w.f.back $w.f.next $w.f.prev -side left -expand on
	pack $w.f -pady 10 -side bottom -anchor w -fill x
	frame $w.topline -relief ridge -borderwidth 2 -height 2
	pack $w.topline -side top -fill x

	frame $w.botline -relief ridge -borderwidth 2 -height 2
	pack $w.botline -side bottom -fill x

	frame $w.config
	pack $w.config -fill y -expand on

	scrollbar $w.config.vscroll -command "$w.config.canvas yview"
	pack $w.config.vscroll -side right -fill y

	canvas $w.config.canvas -height 1\
		-relief flat -borderwidth 0 -yscrollcommand "$w.config.vscroll set" \
		-width [expr [winfo screenwidth .] * 1 / 2] 
	frame $w.config.f
	bind $w <Key-Down> "$w.config.canvas yview scroll  1 unit;break;"
	bind $w <Key-Up> "$w.config.canvas yview scroll  -1 unit;break;"
	bind $w <Key-Next> "$w.config.canvas yview scroll  1 page;break;"
	bind $w <Key-Prior> "$w.config.canvas yview scroll  -1 page;break;"
	bind $w <Key-Home> "$w.config.canvas yview moveto 0;break;"
	bind $w <Key-End> "$w.config.canvas yview moveto 1 ;break;"
	pack $w.config.canvas -side right -fill y


	int $w.config.f 4 0 "SPARC register windows" CONFIG_IU_NWINDOWS
	bool $w.config.f 4 1 "SPARC V8 MUL/DIV instructions" CONFIG_IU_V8MULDIV
	global tmpvar_6
	minimenu $w.config.f 4 2 "Hardware multiplier latency" tmpvar_6 CONFIG_IU_MUL_LATENCY_2
	menu $w.config.f.x2.x.menu -tearoffcommand "menutitle \"Hardware multiplier latency\""
	$w.config.f.x2.x.menu add radiobutton -label "2-cycles" -variable tmpvar_6 -value "2-cycles" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "4-cycles" -variable tmpvar_6 -value "4-cycles" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "5-cycles" -variable tmpvar_6 -value "5-cycles" -command "update_active"
	menusplit $w $w.config.f.x2.x.menu 3
	bool $w.config.f 4 3 "SPARC V8e SMAC/UMAC instructions     " CONFIG_IU_MUL_MAC
	global tmpvar_7
	minimenu $w.config.f 4 4 "Multipler structure        " tmpvar_7 CONFIG_IU_MUL_INFERRED
	menu $w.config.f.x4.x.menu -tearoffcommand "menutitle \"Multipler structure        \""
	$w.config.f.x4.x.menu add radiobutton -label "Inferred" -variable tmpvar_7 -value "Inferred" -command "update_active"
	$w.config.f.x4.x.menu add radiobutton -label "NTNU_Modgen" -variable tmpvar_7 -value "NTNU_Modgen" -command "update_active"
	$w.config.f.x4.x.menu add radiobutton -label "TechSpec" -variable tmpvar_7 -value "TechSpec" -command "update_active"
	$w.config.f.x4.x.menu add radiobutton -label "Designware" -variable tmpvar_7 -value "Designware" -command "update_active"
	menusplit $w $w.config.f.x4.x.menu 4
	bool $w.config.f 4 5 "Single-vector trapping" CONFIG_IU_SVT
	int $w.config.f 4 6 "Load delay" CONFIG_IU_LDELAY
	int $w.config.f 4 7 "Hardware watchpoints" CONFIG_IU_WATCHPOINTS
	bool $w.config.f 4 8 "Enable power-down mode " CONFIG_PWD
	hex $w.config.f 4 9 " Reset start address (addr\[31:12\]) " CONFIG_IU_RSTADDR
	bool $w.config.f 4 10 "SPARC V8E non-privileged ASI access" CONFIG_NP_ASI
	bool $w.config.f 4 11 "SPARC V8E partial Write %psr (WRPSR)" CONFIG_WRPSR
	bool $w.config.f 4 12 "SPARC V8E AWP and regfile partitioning " CONFIG_ALTWIN
	bool $w.config.f 4 13 "Enable LEON-REX extension" CONFIG_REX



	focus $w
	update_active
	global winx; global winy
	if {[winfo exists .menu3] == 0} then {menu3 .menu3 "Processor            "}
	set winx [expr [winfo x .menu3]+30]; set winy [expr [winfo y .menu3]+30]
	if {[winfo exists $w]} then {wm geometry $w +$winx+$winy}
	update idletasks
	if {[winfo exists $w]} then  {$w.config.canvas create window 0 0 -anchor nw -window $w.config.f

	$w.config.canvas configure \
		-width [expr [winfo reqwidth $w.config.f] + 1]\
		-scrollregion "-1 -1 [expr [winfo reqwidth $w.config.f] + 1] \
			 [expr [winfo reqheight $w.config.f] + 1]"

	set winy [expr [winfo reqh $w] - [winfo reqh $w.config.canvas]]
	set scry [expr [winfo screenh $w] / 2]
	set maxy [expr [winfo screenh $w] * 3 / 4]
	set canvtotal [expr [winfo reqh $w.config.f] + 2]
	if [expr $winy + $canvtotal < $maxy] {
		$w.config.canvas configure -height $canvtotal
	} else {
		$w.config.canvas configure -height [expr $scry - $winy]
		}
	}
	update idletasks
	if {[winfo exists $w]} then {
	wm maxsize $w [winfo width $w] [winfo screenheight $w]
	wm minsize $w [winfo width $w] 100

	wm deiconify $w
}
}

proc update_menu4 {} {
	global CONFIG_LEON_CUSTOM
	global CONFIG_IU_NWINDOWS
	if {($CONFIG_LEON_CUSTOM == 1)} then {.menu4.config.f.x0.x configure -state normal -foreground [ cget .ref -foreground ]; .menu4.config.f.x0.l configure -state normal; } else {.menu4.config.f.x0.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu4.config.f.x0.l configure -state disabled}
	global CONFIG_IU_V8MULDIV
	if {($CONFIG_LEON_CUSTOM == 1)} then {
	configure_entry .menu4.config.f.x1 normal {n l y}} else {configure_entry .menu4.config.f.x1 disabled {y n l}}
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_IU_V8MULDIV == 1)} then {configure_entry .menu4.config.f.x2 normal {x l}} else {configure_entry .menu4.config.f.x2 disabled {x l}}
	global CONFIG_IU_MUL_LATENCY_4
	global CONFIG_IU_MUL_LATENCY_5
	global CONFIG_IU_MUL_MAC
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_IU_V8MULDIV == 1) && ($CONFIG_IU_MUL_LATENCY_4 == 1 || $CONFIG_IU_MUL_LATENCY_5 == 1)} then {
	configure_entry .menu4.config.f.x3 normal {n l y}} else {configure_entry .menu4.config.f.x3 disabled {y n l}}
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_IU_V8MULDIV == 1)} then {configure_entry .menu4.config.f.x4 normal {x l}} else {configure_entry .menu4.config.f.x4 disabled {x l}}
	global CONFIG_IU_SVT
	if {($CONFIG_LEON_CUSTOM == 1)} then {
	configure_entry .menu4.config.f.x5 normal {n l y}} else {configure_entry .menu4.config.f.x5 disabled {y n l}}
	global CONFIG_IU_LDELAY
	if {($CONFIG_LEON_CUSTOM == 1)} then {.menu4.config.f.x6.x configure -state normal -foreground [ cget .ref -foreground ]; .menu4.config.f.x6.l configure -state normal; } else {.menu4.config.f.x6.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu4.config.f.x6.l configure -state disabled}
	global CONFIG_IU_WATCHPOINTS
	if {($CONFIG_LEON_CUSTOM == 1)} then {.menu4.config.f.x7.x configure -state normal -foreground [ cget .ref -foreground ]; .menu4.config.f.x7.l configure -state normal; } else {.menu4.config.f.x7.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu4.config.f.x7.l configure -state disabled}
	global CONFIG_PWD
	if {($CONFIG_LEON_CUSTOM == 1)} then {
	configure_entry .menu4.config.f.x8 normal {n l y}} else {configure_entry .menu4.config.f.x8 disabled {y n l}}
	global CONFIG_IU_RSTADDR
	if {($CONFIG_LEON_CUSTOM == 1)} then {.menu4.config.f.x9.x configure -state normal -foreground [ cget .ref -foreground ]; .menu4.config.f.x9.l configure -state normal; } else {.menu4.config.f.x9.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu4.config.f.x9.l configure -state disabled}
	global CONFIG_NP_ASI
	if {($CONFIG_LEON_CUSTOM == 1)} then {
	configure_entry .menu4.config.f.x10 normal {n l y}} else {configure_entry .menu4.config.f.x10 disabled {y n l}}
	global CONFIG_WRPSR
	if {($CONFIG_LEON_CUSTOM == 1)} then {
	configure_entry .menu4.config.f.x11 normal {n l y}} else {configure_entry .menu4.config.f.x11 disabled {y n l}}
	global CONFIG_LEON3
	global CONFIG_ALTWIN
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_LEON3 == 1)} then {
	configure_entry .menu4.config.f.x12 normal {n l y}} else {configure_entry .menu4.config.f.x12 disabled {y n l}}
	global CONFIG_REX
	if {($CONFIG_LEON_CUSTOM == 1)} then {
	configure_entry .menu4.config.f.x13 normal {n l y}} else {configure_entry .menu4.config.f.x13 disabled {y n l}}
}


proc update_define_menu4 {} {
	update_define_mainmenu
	global CONFIG_MODULES
	global CONFIG_LEON_CUSTOM
	global CONFIG_IU_NWINDOWS
	if {($CONFIG_LEON_CUSTOM == 1)} then {validate_int CONFIG_IU_NWINDOWS "$CONFIG_IU_NWINDOWS" 8}
	global CONFIG_IU_V8MULDIV
	if {($CONFIG_LEON_CUSTOM == 1)} then {
	set CONFIG_IU_V8MULDIV [expr $CONFIG_IU_V8MULDIV&15]} else {set CONFIG_IU_V8MULDIV [expr $CONFIG_IU_V8MULDIV|16]}
	global tmpvar_6
	global CONFIG_IU_MUL_LATENCY_2
	if {$tmpvar_6 == "2-cycles"} then {set CONFIG_IU_MUL_LATENCY_2 1} else {set CONFIG_IU_MUL_LATENCY_2 0}
	global CONFIG_IU_MUL_LATENCY_4
	if {$tmpvar_6 == "4-cycles"} then {set CONFIG_IU_MUL_LATENCY_4 1} else {set CONFIG_IU_MUL_LATENCY_4 0}
	global CONFIG_IU_MUL_LATENCY_5
	if {$tmpvar_6 == "5-cycles"} then {set CONFIG_IU_MUL_LATENCY_5 1} else {set CONFIG_IU_MUL_LATENCY_5 0}
	global CONFIG_IU_MUL_MAC
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_IU_V8MULDIV == 1) && ($CONFIG_IU_MUL_LATENCY_4 == 1 || $CONFIG_IU_MUL_LATENCY_5 == 1)} then {
	set CONFIG_IU_MUL_MAC [expr $CONFIG_IU_MUL_MAC&15]} else {set CONFIG_IU_MUL_MAC [expr $CONFIG_IU_MUL_MAC|16]}
	global tmpvar_7
	global CONFIG_IU_MUL_INFERRED
	if {$tmpvar_7 == "Inferred"} then {set CONFIG_IU_MUL_INFERRED 1} else {set CONFIG_IU_MUL_INFERRED 0}
	global CONFIG_IU_MUL_MODGEN
	if {$tmpvar_7 == "NTNU_Modgen"} then {set CONFIG_IU_MUL_MODGEN 1} else {set CONFIG_IU_MUL_MODGEN 0}
	global CONFIG_IU_MUL_TECHSPEC
	if {$tmpvar_7 == "TechSpec"} then {set CONFIG_IU_MUL_TECHSPEC 1} else {set CONFIG_IU_MUL_TECHSPEC 0}
	global CONFIG_IU_MUL_DW
	if {$tmpvar_7 == "Designware"} then {set CONFIG_IU_MUL_DW 1} else {set CONFIG_IU_MUL_DW 0}
	global CONFIG_IU_SVT
	if {($CONFIG_LEON_CUSTOM == 1)} then {
	set CONFIG_IU_SVT [expr $CONFIG_IU_SVT&15]} else {set CONFIG_IU_SVT [expr $CONFIG_IU_SVT|16]}
	global CONFIG_IU_LDELAY
	if {($CONFIG_LEON_CUSTOM == 1)} then {validate_int CONFIG_IU_LDELAY "$CONFIG_IU_LDELAY" 1}
	global CONFIG_IU_WATCHPOINTS
	if {($CONFIG_LEON_CUSTOM == 1)} then {validate_int CONFIG_IU_WATCHPOINTS "$CONFIG_IU_WATCHPOINTS" 0}
	global CONFIG_PWD
	if {($CONFIG_LEON_CUSTOM == 1)} then {
	set CONFIG_PWD [expr $CONFIG_PWD&15]} else {set CONFIG_PWD [expr $CONFIG_PWD|16]}
	global CONFIG_IU_RSTADDR
	if {($CONFIG_LEON_CUSTOM == 1)} then {validate_hex CONFIG_IU_RSTADDR "$CONFIG_IU_RSTADDR" 00000}
	global CONFIG_NP_ASI
	if {($CONFIG_LEON_CUSTOM == 1)} then {
	set CONFIG_NP_ASI [expr $CONFIG_NP_ASI&15]} else {set CONFIG_NP_ASI [expr $CONFIG_NP_ASI|16]}
	global CONFIG_WRPSR
	if {($CONFIG_LEON_CUSTOM == 1)} then {
	set CONFIG_WRPSR [expr $CONFIG_WRPSR&15]} else {set CONFIG_WRPSR [expr $CONFIG_WRPSR|16]}
	global CONFIG_LEON3
	global CONFIG_ALTWIN
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_LEON3 == 1)} then {
	set CONFIG_ALTWIN [expr $CONFIG_ALTWIN&15]} else {set CONFIG_ALTWIN [expr $CONFIG_ALTWIN|16]}
	global CONFIG_REX
	if {($CONFIG_LEON_CUSTOM == 1)} then {
	set CONFIG_REX [expr $CONFIG_REX&15]} else {set CONFIG_REX [expr $CONFIG_REX|16]}
}


proc menu5 {w title} {
	set oldFocus [focus]
	catch {focus .menu3}
	catch {destroy $w; unregister_active 5}
	toplevel $w -class Dialog
	wm withdraw $w
	global active_menus
	set active_menus [lsort -integer [linsert $active_menus end 5]]
	message $w.m -width 400 -aspect 300 -text \
		"Floating-point unit"  -relief raised
	pack $w.m -pady 10 -side top -padx 10
	wm title $w "Floating-point unit" 

	bind $w <Escape> "catch {focus $oldFocus}; destroy $w; unregister_active 5; break"
	set nextscript "catch {focus $oldFocus}; destroy $w; unregister_active 5; menu6 .menu6 \"$title\""
	frame $w.f
	button $w.f.back -text "OK" \
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 5"
	button $w.f.next -text "Next" -underline 0\
		-width 15 -command $nextscript
	bind all <Alt-n> $nextscript
	button $w.f.prev -text "Prev" -underline 0\
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 5; menu4 .menu4 \"$title\""
	bind $w <Alt-p> "catch {focus $oldFocus}; destroy $w; unregister_active 5; menu4 .menu4 \"$title\";break"
	pack $w.f.back $w.f.next $w.f.prev -side left -expand on
	pack $w.f -pady 10 -side bottom -anchor w -fill x
	frame $w.topline -relief ridge -borderwidth 2 -height 2
	pack $w.topline -side top -fill x

	frame $w.botline -relief ridge -borderwidth 2 -height 2
	pack $w.botline -side bottom -fill x

	frame $w.config
	pack $w.config -fill y -expand on

	scrollbar $w.config.vscroll -command "$w.config.canvas yview"
	pack $w.config.vscroll -side right -fill y

	canvas $w.config.canvas -height 1\
		-relief flat -borderwidth 0 -yscrollcommand "$w.config.vscroll set" \
		-width [expr [winfo screenwidth .] * 1 / 2] 
	frame $w.config.f
	bind $w <Key-Down> "$w.config.canvas yview scroll  1 unit;break;"
	bind $w <Key-Up> "$w.config.canvas yview scroll  -1 unit;break;"
	bind $w <Key-Next> "$w.config.canvas yview scroll  1 page;break;"
	bind $w <Key-Prior> "$w.config.canvas yview scroll  -1 page;break;"
	bind $w <Key-Home> "$w.config.canvas yview moveto 0;break;"
	bind $w <Key-End> "$w.config.canvas yview moveto 1 ;break;"
	pack $w.config.canvas -side right -fill y


	bool $w.config.f 5 0 "Enable FPU                             " CONFIG_FPU_ENABLE
	global tmpvar_8
	minimenu $w.config.f 5 1 "FPU core" tmpvar_8 CONFIG_FPU_GRFPU
	menu $w.config.f.x1.x.menu -tearoffcommand "menutitle \"FPU core\""
	$w.config.f.x1.x.menu add radiobutton -label "GRFPU" -variable tmpvar_8 -value "GRFPU" -command "update_active"
	$w.config.f.x1.x.menu add radiobutton -label "GRFPU-LITE" -variable tmpvar_8 -value "GRFPU-LITE" -command "update_active"
	menusplit $w $w.config.f.x1.x.menu 2
	global tmpvar_9
	minimenu $w.config.f 5 2 "GRFPU multiplier" tmpvar_9 CONFIG_FPU_GRFPU_INFMUL
	menu $w.config.f.x2.x.menu -tearoffcommand "menutitle \"GRFPU multiplier\""
	$w.config.f.x2.x.menu add radiobutton -label "Inferred" -variable tmpvar_9 -value "Inferred" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "DW" -variable tmpvar_9 -value "DW" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "ModGen" -variable tmpvar_9 -value "ModGen" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "TechSpec" -variable tmpvar_9 -value "TechSpec" -command "update_active"
	menusplit $w $w.config.f.x2.x.menu 4
	bool $w.config.f 5 3 "Shared GRFPU                      " CONFIG_FPU_GRFPU_SH
	global tmpvar_10
	minimenu $w.config.f 5 4 "GRFPU-LITE controller" tmpvar_10 CONFIG_FPU_GRFPC0
	menu $w.config.f.x4.x.menu -tearoffcommand "menutitle \"GRFPU-LITE controller\""
	$w.config.f.x4.x.menu add radiobutton -label "Simple" -variable tmpvar_10 -value "Simple" -command "update_active"
	$w.config.f.x4.x.menu add radiobutton -label "Data-forwarding" -variable tmpvar_10 -value "Data-forwarding" -command "update_active"
	$w.config.f.x4.x.menu add radiobutton -label "Non-blocking" -variable tmpvar_10 -value "Non-blocking" -command "update_active"
	menusplit $w $w.config.f.x4.x.menu 3
	bool $w.config.f 5 5 "Use VHDL netlist          " CONFIG_FPU_NETLIST



	focus $w
	update_active
	global winx; global winy
	if {[winfo exists .menu3] == 0} then {menu3 .menu3 "Processor            "}
	set winx [expr [winfo x .menu3]+30]; set winy [expr [winfo y .menu3]+30]
	if {[winfo exists $w]} then {wm geometry $w +$winx+$winy}
	update idletasks
	if {[winfo exists $w]} then  {$w.config.canvas create window 0 0 -anchor nw -window $w.config.f

	$w.config.canvas configure \
		-width [expr [winfo reqwidth $w.config.f] + 1]\
		-scrollregion "-1 -1 [expr [winfo reqwidth $w.config.f] + 1] \
			 [expr [winfo reqheight $w.config.f] + 1]"

	set winy [expr [winfo reqh $w] - [winfo reqh $w.config.canvas]]
	set scry [expr [winfo screenh $w] / 2]
	set maxy [expr [winfo screenh $w] * 3 / 4]
	set canvtotal [expr [winfo reqh $w.config.f] + 2]
	if [expr $winy + $canvtotal < $maxy] {
		$w.config.canvas configure -height $canvtotal
	} else {
		$w.config.canvas configure -height [expr $scry - $winy]
		}
	}
	update idletasks
	if {[winfo exists $w]} then {
	wm maxsize $w [winfo width $w] [winfo screenheight $w]
	wm minsize $w [winfo width $w] 100

	wm deiconify $w
}
}

proc update_menu5 {} {
	global CONFIG_LEON_CUSTOM
	global CONFIG_FPU_ENABLE
	if {($CONFIG_LEON_CUSTOM == 1)} then {
	configure_entry .menu5.config.f.x0 normal {n l y}} else {configure_entry .menu5.config.f.x0 disabled {y n l}}
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_FPU_ENABLE == 1)} then {configure_entry .menu5.config.f.x1 normal {x l}} else {configure_entry .menu5.config.f.x1 disabled {x l}}
	global CONFIG_FPU_GRFPU
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_FPU_ENABLE == 1) && ($CONFIG_FPU_GRFPU == 1)} then {configure_entry .menu5.config.f.x2 normal {x l}} else {configure_entry .menu5.config.f.x2 disabled {x l}}
	global CONFIG_FPU_GRFPU_SH
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_FPU_ENABLE == 1)} then {
	configure_entry .menu5.config.f.x3 normal {n l y}} else {configure_entry .menu5.config.f.x3 disabled {y n l}}
	global CONFIG_FPU_GRFPULITE
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_FPU_ENABLE == 1) && ($CONFIG_FPU_GRFPULITE == 1)} then {configure_entry .menu5.config.f.x4 normal {x l}} else {configure_entry .menu5.config.f.x4 disabled {x l}}
	global CONFIG_FPU_NETLIST
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_FPU_ENABLE == 1)} then {
	configure_entry .menu5.config.f.x5 normal {n l y}} else {configure_entry .menu5.config.f.x5 disabled {y n l}}
}


proc update_define_menu5 {} {
	update_define_mainmenu
	global CONFIG_MODULES
	global CONFIG_LEON_CUSTOM
	global CONFIG_FPU_ENABLE
	if {($CONFIG_LEON_CUSTOM == 1)} then {
	set CONFIG_FPU_ENABLE [expr $CONFIG_FPU_ENABLE&15]} else {set CONFIG_FPU_ENABLE [expr $CONFIG_FPU_ENABLE|16]}
	global tmpvar_8
	global CONFIG_FPU_GRFPU
	if {$tmpvar_8 == "GRFPU"} then {set CONFIG_FPU_GRFPU 1} else {set CONFIG_FPU_GRFPU 0}
	global CONFIG_FPU_GRFPULITE
	if {$tmpvar_8 == "GRFPU-LITE"} then {set CONFIG_FPU_GRFPULITE 1} else {set CONFIG_FPU_GRFPULITE 0}
	global tmpvar_9
	global CONFIG_FPU_GRFPU_INFMUL
	if {$tmpvar_9 == "Inferred"} then {set CONFIG_FPU_GRFPU_INFMUL 1} else {set CONFIG_FPU_GRFPU_INFMUL 0}
	global CONFIG_FPU_GRFPU_DWMUL
	if {$tmpvar_9 == "DW"} then {set CONFIG_FPU_GRFPU_DWMUL 1} else {set CONFIG_FPU_GRFPU_DWMUL 0}
	global CONFIG_FPU_GRFPU_MODGEN
	if {$tmpvar_9 == "ModGen"} then {set CONFIG_FPU_GRFPU_MODGEN 1} else {set CONFIG_FPU_GRFPU_MODGEN 0}
	global CONFIG_FPU_GRFPU_TECHSPEC
	if {$tmpvar_9 == "TechSpec"} then {set CONFIG_FPU_GRFPU_TECHSPEC 1} else {set CONFIG_FPU_GRFPU_TECHSPEC 0}
	global CONFIG_FPU_GRFPU_SH
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_FPU_ENABLE == 1)} then {
	set CONFIG_FPU_GRFPU_SH [expr $CONFIG_FPU_GRFPU_SH&15]} else {set CONFIG_FPU_GRFPU_SH [expr $CONFIG_FPU_GRFPU_SH|16]}
	global tmpvar_10
	global CONFIG_FPU_GRFPC0
	if {$tmpvar_10 == "Simple"} then {set CONFIG_FPU_GRFPC0 1} else {set CONFIG_FPU_GRFPC0 0}
	global CONFIG_FPU_GRFPC1
	if {$tmpvar_10 == "Data-forwarding"} then {set CONFIG_FPU_GRFPC1 1} else {set CONFIG_FPU_GRFPC1 0}
	global CONFIG_FPU_GRFPC2
	if {$tmpvar_10 == "Non-blocking"} then {set CONFIG_FPU_GRFPC2 1} else {set CONFIG_FPU_GRFPC2 0}
	global CONFIG_FPU_NETLIST
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_FPU_ENABLE == 1)} then {
	set CONFIG_FPU_NETLIST [expr $CONFIG_FPU_NETLIST&15]} else {set CONFIG_FPU_NETLIST [expr $CONFIG_FPU_NETLIST|16]}
}


proc menu6 {w title} {
	set oldFocus [focus]
	catch {focus .menu3}
	catch {destroy $w; unregister_active 6}
	toplevel $w -class Dialog
	wm withdraw $w
	global active_menus
	set active_menus [lsort -integer [linsert $active_menus end 6]]
	message $w.m -width 400 -aspect 300 -text \
		"Cache system"  -relief raised
	pack $w.m -pady 10 -side top -padx 10
	wm title $w "Cache system" 

	bind $w <Escape> "catch {focus $oldFocus}; destroy $w; unregister_active 6; break"
	set nextscript "catch {focus $oldFocus}; destroy $w; unregister_active 6; menu7 .menu7 \"$title\""
	frame $w.f
	button $w.f.back -text "OK" \
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 6"
	button $w.f.next -text "Next" -underline 0\
		-width 15 -command $nextscript
	bind all <Alt-n> $nextscript
	button $w.f.prev -text "Prev" -underline 0\
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 6; menu5 .menu5 \"$title\""
	bind $w <Alt-p> "catch {focus $oldFocus}; destroy $w; unregister_active 6; menu5 .menu5 \"$title\";break"
	pack $w.f.back $w.f.next $w.f.prev -side left -expand on
	pack $w.f -pady 10 -side bottom -anchor w -fill x
	frame $w.topline -relief ridge -borderwidth 2 -height 2
	pack $w.topline -side top -fill x

	frame $w.botline -relief ridge -borderwidth 2 -height 2
	pack $w.botline -side bottom -fill x

	frame $w.config
	pack $w.config -fill y -expand on

	scrollbar $w.config.vscroll -command "$w.config.canvas yview"
	pack $w.config.vscroll -side right -fill y

	canvas $w.config.canvas -height 1\
		-relief flat -borderwidth 0 -yscrollcommand "$w.config.vscroll set" \
		-width [expr [winfo screenwidth .] * 1 / 2] 
	frame $w.config.f
	bind $w <Key-Down> "$w.config.canvas yview scroll  1 unit;break;"
	bind $w <Key-Up> "$w.config.canvas yview scroll  -1 unit;break;"
	bind $w <Key-Next> "$w.config.canvas yview scroll  1 page;break;"
	bind $w <Key-Prior> "$w.config.canvas yview scroll  -1 page;break;"
	bind $w <Key-Home> "$w.config.canvas yview moveto 0;break;"
	bind $w <Key-End> "$w.config.canvas yview moveto 1 ;break;"
	pack $w.config.canvas -side right -fill y


	bool $w.config.f 6 0 "Enable instruction cache       " CONFIG_ICACHE_ENABLE
	global tmpvar_11
	minimenu $w.config.f 6 1 "Associativity (ways)            " tmpvar_11 CONFIG_ICACHE_ASSO1
	menu $w.config.f.x1.x.menu -tearoffcommand "menutitle \"Associativity (ways)            \""
	$w.config.f.x1.x.menu add radiobutton -label "1" -variable tmpvar_11 -value "1" -command "update_active"
	$w.config.f.x1.x.menu add radiobutton -label "2" -variable tmpvar_11 -value "2" -command "update_active"
	$w.config.f.x1.x.menu add radiobutton -label "3" -variable tmpvar_11 -value "3" -command "update_active"
	$w.config.f.x1.x.menu add radiobutton -label "4" -variable tmpvar_11 -value "4" -command "update_active"
	menusplit $w $w.config.f.x1.x.menu 4
	global tmpvar_12
	minimenu $w.config.f 6 2 "Way size (kbytes/way)" tmpvar_12 CONFIG_ICACHE_SZ1
	menu $w.config.f.x2.x.menu -tearoffcommand "menutitle \"Way size (kbytes/way)\""
	$w.config.f.x2.x.menu add radiobutton -label "1" -variable tmpvar_12 -value "1" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "2" -variable tmpvar_12 -value "2" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "4" -variable tmpvar_12 -value "4" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "8" -variable tmpvar_12 -value "8" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "16" -variable tmpvar_12 -value "16" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "32" -variable tmpvar_12 -value "32" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "64" -variable tmpvar_12 -value "64" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "128" -variable tmpvar_12 -value "128" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "256" -variable tmpvar_12 -value "256" -command "update_active"
	menusplit $w $w.config.f.x2.x.menu 9
	global tmpvar_13
	minimenu $w.config.f 6 3 "Line size (bytes/line)" tmpvar_13 CONFIG_ICACHE_LZ16
	menu $w.config.f.x3.x.menu -tearoffcommand "menutitle \"Line size (bytes/line)\""
	$w.config.f.x3.x.menu add radiobutton -label "16" -variable tmpvar_13 -value "16" -command "update_active"
	$w.config.f.x3.x.menu add radiobutton -label "32" -variable tmpvar_13 -value "32" -command "update_active"
	menusplit $w $w.config.f.x3.x.menu 2
	global tmpvar_14
	minimenu $w.config.f 6 4 "Replacement alorithm" tmpvar_14 CONFIG_ICACHE_ALGORND
	menu $w.config.f.x4.x.menu -tearoffcommand "menutitle \"Replacement alorithm\""
	$w.config.f.x4.x.menu add radiobutton -label "Random" -variable tmpvar_14 -value "Random" -command "update_active"
	$w.config.f.x4.x.menu add radiobutton -label "LRU/Dynamic" -variable tmpvar_14 -value "LRU/Dynamic" -command "update_active"
	menusplit $w $w.config.f.x4.x.menu 2
	bool $w.config.f 6 5 "Cache locking      " CONFIG_ICACHE_LOCK
	bool $w.config.f 6 6 "Enable local instruction RAM            " CONFIG_ICACHE_LRAM
	global tmpvar_15
	minimenu $w.config.f 6 7 "Local data RAM size (kbytes)" tmpvar_15 CONFIG_ICACHE_LRAM_SZ1
	menu $w.config.f.x7.x.menu -tearoffcommand "menutitle \"Local data RAM size (kbytes)\""
	$w.config.f.x7.x.menu add radiobutton -label "1" -variable tmpvar_15 -value "1" -command "update_active"
	$w.config.f.x7.x.menu add radiobutton -label "2" -variable tmpvar_15 -value "2" -command "update_active"
	$w.config.f.x7.x.menu add radiobutton -label "4" -variable tmpvar_15 -value "4" -command "update_active"
	$w.config.f.x7.x.menu add radiobutton -label "8" -variable tmpvar_15 -value "8" -command "update_active"
	$w.config.f.x7.x.menu add radiobutton -label "16" -variable tmpvar_15 -value "16" -command "update_active"
	$w.config.f.x7.x.menu add radiobutton -label "32" -variable tmpvar_15 -value "32" -command "update_active"
	$w.config.f.x7.x.menu add radiobutton -label "64" -variable tmpvar_15 -value "64" -command "update_active"
	$w.config.f.x7.x.menu add radiobutton -label "128" -variable tmpvar_15 -value "128" -command "update_active"
	$w.config.f.x7.x.menu add radiobutton -label "256" -variable tmpvar_15 -value "256" -command "update_active"
	menusplit $w $w.config.f.x7.x.menu 9
	hex $w.config.f 6 8 " Local instruction RAM start address (8 MSB) " CONFIG_ICACHE_LRSTART
	bool $w.config.f 6 9 "Enable data cache       " CONFIG_DCACHE_ENABLE
	global tmpvar_16
	minimenu $w.config.f 6 10 "Associativity (ways)" tmpvar_16 CONFIG_DCACHE_ASSO1
	menu $w.config.f.x10.x.menu -tearoffcommand "menutitle \"Associativity (ways)\""
	$w.config.f.x10.x.menu add radiobutton -label "1" -variable tmpvar_16 -value "1" -command "update_active"
	$w.config.f.x10.x.menu add radiobutton -label "2" -variable tmpvar_16 -value "2" -command "update_active"
	$w.config.f.x10.x.menu add radiobutton -label "3" -variable tmpvar_16 -value "3" -command "update_active"
	$w.config.f.x10.x.menu add radiobutton -label "4" -variable tmpvar_16 -value "4" -command "update_active"
	menusplit $w $w.config.f.x10.x.menu 4
	global tmpvar_17
	minimenu $w.config.f 6 11 "Way size (kbytes/ways)" tmpvar_17 CONFIG_DCACHE_SZ1
	menu $w.config.f.x11.x.menu -tearoffcommand "menutitle \"Way size (kbytes/ways)\""
	$w.config.f.x11.x.menu add radiobutton -label "1" -variable tmpvar_17 -value "1" -command "update_active"
	$w.config.f.x11.x.menu add radiobutton -label "2" -variable tmpvar_17 -value "2" -command "update_active"
	$w.config.f.x11.x.menu add radiobutton -label "4" -variable tmpvar_17 -value "4" -command "update_active"
	$w.config.f.x11.x.menu add radiobutton -label "8" -variable tmpvar_17 -value "8" -command "update_active"
	$w.config.f.x11.x.menu add radiobutton -label "16" -variable tmpvar_17 -value "16" -command "update_active"
	$w.config.f.x11.x.menu add radiobutton -label "32" -variable tmpvar_17 -value "32" -command "update_active"
	$w.config.f.x11.x.menu add radiobutton -label "64" -variable tmpvar_17 -value "64" -command "update_active"
	$w.config.f.x11.x.menu add radiobutton -label "128" -variable tmpvar_17 -value "128" -command "update_active"
	$w.config.f.x11.x.menu add radiobutton -label "256" -variable tmpvar_17 -value "256" -command "update_active"
	menusplit $w $w.config.f.x11.x.menu 9
	global tmpvar_18
	minimenu $w.config.f 6 12 "Line size (bytes/line)" tmpvar_18 CONFIG_DCACHE_LZ16
	menu $w.config.f.x12.x.menu -tearoffcommand "menutitle \"Line size (bytes/line)\""
	$w.config.f.x12.x.menu add radiobutton -label "16" -variable tmpvar_18 -value "16" -command "update_active"
	$w.config.f.x12.x.menu add radiobutton -label "32" -variable tmpvar_18 -value "32" -command "update_active"
	menusplit $w $w.config.f.x12.x.menu 2
	global tmpvar_19
	minimenu $w.config.f 6 13 "Replacement alorithm" tmpvar_19 CONFIG_DCACHE_ALGORND
	menu $w.config.f.x13.x.menu -tearoffcommand "menutitle \"Replacement alorithm\""
	$w.config.f.x13.x.menu add radiobutton -label "Random" -variable tmpvar_19 -value "Random" -command "update_active"
	$w.config.f.x13.x.menu add radiobutton -label "LRU/Dynamic" -variable tmpvar_19 -value "LRU/Dynamic" -command "update_active"
	menusplit $w $w.config.f.x13.x.menu 2
	bool $w.config.f 6 14 "Cache locking      " CONFIG_DCACHE_LOCK
	bool $w.config.f 6 15 "AHB snooping       " CONFIG_DCACHE_SNOOP
	bool $w.config.f 6 16 "Separate physical/snoop tags  " CONFIG_DCACHE_SNOOP_SEPTAG
	bool $w.config.f 6 17 "Use SP RAM for separate tags  " CONFIG_DCACHE_SNOOP_SP
	hex $w.config.f 6 18 "Fixed cacheability map  " CONFIG_CACHE_FIXED
	hex $w.config.f 6 19 "64/128-bit AHB bus map (only affects LEON4)    " CONFIG_BWMASK
	global tmpvar_20
	minimenu $w.config.f 6 20 "Cache and AHB data width (only affects LEON4)" tmpvar_20 CONFIG_CACHE_64BIT
	menu $w.config.f.x20.x.menu -tearoffcommand "menutitle \"Cache and AHB data width (only affects LEON4)\""
	$w.config.f.x20.x.menu add radiobutton -label "64-bit" -variable tmpvar_20 -value "64-bit" -command "update_active"
	$w.config.f.x20.x.menu add radiobutton -label "128-bit" -variable tmpvar_20 -value "128-bit" -command "update_active"
	menusplit $w $w.config.f.x20.x.menu 2
	bool $w.config.f 6 21 "Enable local data RAM            " CONFIG_DCACHE_LRAM
	global tmpvar_21
	minimenu $w.config.f 6 22 "Local data RAM size (kbytes)" tmpvar_21 CONFIG_DCACHE_LRAM_SZ1
	menu $w.config.f.x22.x.menu -tearoffcommand "menutitle \"Local data RAM size (kbytes)\""
	$w.config.f.x22.x.menu add radiobutton -label "1" -variable tmpvar_21 -value "1" -command "update_active"
	$w.config.f.x22.x.menu add radiobutton -label "2" -variable tmpvar_21 -value "2" -command "update_active"
	$w.config.f.x22.x.menu add radiobutton -label "4" -variable tmpvar_21 -value "4" -command "update_active"
	$w.config.f.x22.x.menu add radiobutton -label "8" -variable tmpvar_21 -value "8" -command "update_active"
	$w.config.f.x22.x.menu add radiobutton -label "16" -variable tmpvar_21 -value "16" -command "update_active"
	$w.config.f.x22.x.menu add radiobutton -label "32" -variable tmpvar_21 -value "32" -command "update_active"
	$w.config.f.x22.x.menu add radiobutton -label "64" -variable tmpvar_21 -value "64" -command "update_active"
	$w.config.f.x22.x.menu add radiobutton -label "128" -variable tmpvar_21 -value "128" -command "update_active"
	$w.config.f.x22.x.menu add radiobutton -label "256" -variable tmpvar_21 -value "256" -command "update_active"
	menusplit $w $w.config.f.x22.x.menu 9
	hex $w.config.f 6 23 " Local data RAM start address (8 MSB) " CONFIG_DCACHE_LRSTART



	focus $w
	update_active
	global winx; global winy
	if {[winfo exists .menu3] == 0} then {menu3 .menu3 "Processor            "}
	set winx [expr [winfo x .menu3]+30]; set winy [expr [winfo y .menu3]+30]
	if {[winfo exists $w]} then {wm geometry $w +$winx+$winy}
	update idletasks
	if {[winfo exists $w]} then  {$w.config.canvas create window 0 0 -anchor nw -window $w.config.f

	$w.config.canvas configure \
		-width [expr [winfo reqwidth $w.config.f] + 1]\
		-scrollregion "-1 -1 [expr [winfo reqwidth $w.config.f] + 1] \
			 [expr [winfo reqheight $w.config.f] + 1]"

	set winy [expr [winfo reqh $w] - [winfo reqh $w.config.canvas]]
	set scry [expr [winfo screenh $w] / 2]
	set maxy [expr [winfo screenh $w] * 3 / 4]
	set canvtotal [expr [winfo reqh $w.config.f] + 2]
	if [expr $winy + $canvtotal < $maxy] {
		$w.config.canvas configure -height $canvtotal
	} else {
		$w.config.canvas configure -height [expr $scry - $winy]
		}
	}
	update idletasks
	if {[winfo exists $w]} then {
	wm maxsize $w [winfo width $w] [winfo screenheight $w]
	wm minsize $w [winfo width $w] 100

	wm deiconify $w
}
}

proc update_menu6 {} {
	global CONFIG_LEON_CUSTOM
	global CONFIG_ICACHE_ENABLE
	if {($CONFIG_LEON_CUSTOM == 1)} then {
	configure_entry .menu6.config.f.x0 normal {n l y}} else {configure_entry .menu6.config.f.x0 disabled {y n l}}
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_ICACHE_ENABLE == 1)} then {configure_entry .menu6.config.f.x1 normal {x l}} else {configure_entry .menu6.config.f.x1 disabled {x l}}
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_ICACHE_ENABLE == 1)} then {configure_entry .menu6.config.f.x2 normal {x l}} else {configure_entry .menu6.config.f.x2 disabled {x l}}
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_ICACHE_ENABLE == 1)} then {configure_entry .menu6.config.f.x3 normal {x l}} else {configure_entry .menu6.config.f.x3 disabled {x l}}
	global CONFIG_ICACHE_ASSO1
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_ICACHE_ENABLE == 1) && ($CONFIG_ICACHE_ASSO1 != 1)} then {configure_entry .menu6.config.f.x4 normal {x l}} else {configure_entry .menu6.config.f.x4 disabled {x l}}
	global CONFIG_LEON3
	global CONFIG_ICACHE_LOCK
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_ICACHE_ENABLE == 1) && ($CONFIG_ICACHE_ASSO1 != 1) && ($CONFIG_LEON3 == 1)} then {
	configure_entry .menu6.config.f.x5 normal {n l y}} else {configure_entry .menu6.config.f.x5 disabled {y n l}}
	global CONFIG_MMU_ENABLE
	global CONFIG_ICACHE_LRAM
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_LEON3 == 1) && ($CONFIG_MMU_ENABLE != 1)} then {
	configure_entry .menu6.config.f.x6 normal {n l y}} else {configure_entry .menu6.config.f.x6 disabled {y n l}}
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_LEON3 == 1) && ($CONFIG_ICACHE_LRAM == 1)} then {configure_entry .menu6.config.f.x7 normal {x l}} else {configure_entry .menu6.config.f.x7 disabled {x l}}
	global CONFIG_ICACHE_LRSTART
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_LEON3 == 1) && ($CONFIG_ICACHE_LRAM == 1)} then {.menu6.config.f.x8.x configure -state normal -foreground [ cget .ref -foreground ]; .menu6.config.f.x8.l configure -state normal; } else {.menu6.config.f.x8.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu6.config.f.x8.l configure -state disabled}
	global CONFIG_DCACHE_ENABLE
	if {($CONFIG_LEON_CUSTOM == 1)} then {
	configure_entry .menu6.config.f.x9 normal {n l y}} else {configure_entry .menu6.config.f.x9 disabled {y n l}}
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_DCACHE_ENABLE == 1)} then {configure_entry .menu6.config.f.x10 normal {x l}} else {configure_entry .menu6.config.f.x10 disabled {x l}}
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_DCACHE_ENABLE == 1)} then {configure_entry .menu6.config.f.x11 normal {x l}} else {configure_entry .menu6.config.f.x11 disabled {x l}}
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_DCACHE_ENABLE == 1)} then {configure_entry .menu6.config.f.x12 normal {x l}} else {configure_entry .menu6.config.f.x12 disabled {x l}}
	global CONFIG_DCACHE_ASSO1
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_DCACHE_ENABLE == 1) && ($CONFIG_DCACHE_ASSO1 != 1)} then {configure_entry .menu6.config.f.x13 normal {x l}} else {configure_entry .menu6.config.f.x13 disabled {x l}}
	global CONFIG_DCACHE_LOCK
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_DCACHE_ENABLE == 1) && ($CONFIG_DCACHE_ASSO1 != 1)} then {
	configure_entry .menu6.config.f.x14 normal {n l y}} else {configure_entry .menu6.config.f.x14 disabled {y n l}}
	global CONFIG_DCACHE_SNOOP
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_DCACHE_ENABLE == 1)} then {
	configure_entry .menu6.config.f.x15 normal {n l y}} else {configure_entry .menu6.config.f.x15 disabled {y n l}}
	global CONFIG_DCACHE_SNOOP_SEPTAG
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_DCACHE_ENABLE == 1) && ($CONFIG_DCACHE_SNOOP == 1)} then {
	configure_entry .menu6.config.f.x16 normal {n l y}} else {configure_entry .menu6.config.f.x16 disabled {y n l}}
	global CONFIG_DCACHE_SNOOP_SP
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_DCACHE_ENABLE == 1) && ($CONFIG_DCACHE_SNOOP == 1) && ($CONFIG_LEON3 == 1) && ($CONFIG_DCACHE_SNOOP_SEPTAG == 1)} then {
	configure_entry .menu6.config.f.x17 normal {n l y}} else {configure_entry .menu6.config.f.x17 disabled {y n l}}
	global CONFIG_DCACHE_LRAM
	if {($CONFIG_LEON3 == 1) && ($CONFIG_MMU_ENABLE != 1)} then {
	configure_entry .menu6.config.f.x21 normal {n l y}} else {configure_entry .menu6.config.f.x21 disabled {y n l}}
	if {($CONFIG_LEON3 == 1) && ($CONFIG_DCACHE_LRAM == 1)} then {configure_entry .menu6.config.f.x22 normal {x l}} else {configure_entry .menu6.config.f.x22 disabled {x l}}
	global CONFIG_DCACHE_LRSTART
	if {($CONFIG_LEON3 == 1) && ($CONFIG_DCACHE_LRAM == 1)} then {.menu6.config.f.x23.x configure -state normal -foreground [ cget .ref -foreground ]; .menu6.config.f.x23.l configure -state normal; } else {.menu6.config.f.x23.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu6.config.f.x23.l configure -state disabled}
}


proc update_define_menu6 {} {
	update_define_mainmenu
	global CONFIG_MODULES
	global CONFIG_LEON_CUSTOM
	global CONFIG_ICACHE_ENABLE
	if {($CONFIG_LEON_CUSTOM == 1)} then {
	set CONFIG_ICACHE_ENABLE [expr $CONFIG_ICACHE_ENABLE&15]} else {set CONFIG_ICACHE_ENABLE [expr $CONFIG_ICACHE_ENABLE|16]}
	global tmpvar_11
	global CONFIG_ICACHE_ASSO1
	if {$tmpvar_11 == "1"} then {set CONFIG_ICACHE_ASSO1 1} else {set CONFIG_ICACHE_ASSO1 0}
	global CONFIG_ICACHE_ASSO2
	if {$tmpvar_11 == "2"} then {set CONFIG_ICACHE_ASSO2 1} else {set CONFIG_ICACHE_ASSO2 0}
	global CONFIG_ICACHE_ASSO3
	if {$tmpvar_11 == "3"} then {set CONFIG_ICACHE_ASSO3 1} else {set CONFIG_ICACHE_ASSO3 0}
	global CONFIG_ICACHE_ASSO4
	if {$tmpvar_11 == "4"} then {set CONFIG_ICACHE_ASSO4 1} else {set CONFIG_ICACHE_ASSO4 0}
	global tmpvar_12
	global CONFIG_ICACHE_SZ1
	if {$tmpvar_12 == "1"} then {set CONFIG_ICACHE_SZ1 1} else {set CONFIG_ICACHE_SZ1 0}
	global CONFIG_ICACHE_SZ2
	if {$tmpvar_12 == "2"} then {set CONFIG_ICACHE_SZ2 1} else {set CONFIG_ICACHE_SZ2 0}
	global CONFIG_ICACHE_SZ4
	if {$tmpvar_12 == "4"} then {set CONFIG_ICACHE_SZ4 1} else {set CONFIG_ICACHE_SZ4 0}
	global CONFIG_ICACHE_SZ8
	if {$tmpvar_12 == "8"} then {set CONFIG_ICACHE_SZ8 1} else {set CONFIG_ICACHE_SZ8 0}
	global CONFIG_ICACHE_SZ16
	if {$tmpvar_12 == "16"} then {set CONFIG_ICACHE_SZ16 1} else {set CONFIG_ICACHE_SZ16 0}
	global CONFIG_ICACHE_SZ32
	if {$tmpvar_12 == "32"} then {set CONFIG_ICACHE_SZ32 1} else {set CONFIG_ICACHE_SZ32 0}
	global CONFIG_ICACHE_SZ64
	if {$tmpvar_12 == "64"} then {set CONFIG_ICACHE_SZ64 1} else {set CONFIG_ICACHE_SZ64 0}
	global CONFIG_ICACHE_SZ128
	if {$tmpvar_12 == "128"} then {set CONFIG_ICACHE_SZ128 1} else {set CONFIG_ICACHE_SZ128 0}
	global CONFIG_ICACHE_SZ256
	if {$tmpvar_12 == "256"} then {set CONFIG_ICACHE_SZ256 1} else {set CONFIG_ICACHE_SZ256 0}
	global tmpvar_13
	global CONFIG_ICACHE_LZ16
	if {$tmpvar_13 == "16"} then {set CONFIG_ICACHE_LZ16 1} else {set CONFIG_ICACHE_LZ16 0}
	global CONFIG_ICACHE_LZ32
	if {$tmpvar_13 == "32"} then {set CONFIG_ICACHE_LZ32 1} else {set CONFIG_ICACHE_LZ32 0}
	global tmpvar_14
	global CONFIG_ICACHE_ALGORND
	if {$tmpvar_14 == "Random"} then {set CONFIG_ICACHE_ALGORND 1} else {set CONFIG_ICACHE_ALGORND 0}
	global CONFIG_ICACHE_ALGOLRU
	if {$tmpvar_14 == "LRU/Dynamic"} then {set CONFIG_ICACHE_ALGOLRU 1} else {set CONFIG_ICACHE_ALGOLRU 0}
	global CONFIG_LEON3
	global CONFIG_ICACHE_LOCK
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_ICACHE_ENABLE == 1) && ($CONFIG_ICACHE_ASSO1 != 1) && ($CONFIG_LEON3 == 1)} then {
	set CONFIG_ICACHE_LOCK [expr $CONFIG_ICACHE_LOCK&15]} else {set CONFIG_ICACHE_LOCK [expr $CONFIG_ICACHE_LOCK|16]}
	global CONFIG_MMU_ENABLE
	global CONFIG_ICACHE_LRAM
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_LEON3 == 1) && ($CONFIG_MMU_ENABLE != 1)} then {
	set CONFIG_ICACHE_LRAM [expr $CONFIG_ICACHE_LRAM&15]} else {set CONFIG_ICACHE_LRAM [expr $CONFIG_ICACHE_LRAM|16]}
	global tmpvar_15
	global CONFIG_ICACHE_LRAM_SZ1
	if {$tmpvar_15 == "1"} then {set CONFIG_ICACHE_LRAM_SZ1 1} else {set CONFIG_ICACHE_LRAM_SZ1 0}
	global CONFIG_ICACHE_LRAM_SZ2
	if {$tmpvar_15 == "2"} then {set CONFIG_ICACHE_LRAM_SZ2 1} else {set CONFIG_ICACHE_LRAM_SZ2 0}
	global CONFIG_ICACHE_LRAM_SZ4
	if {$tmpvar_15 == "4"} then {set CONFIG_ICACHE_LRAM_SZ4 1} else {set CONFIG_ICACHE_LRAM_SZ4 0}
	global CONFIG_ICACHE_LRAM_SZ8
	if {$tmpvar_15 == "8"} then {set CONFIG_ICACHE_LRAM_SZ8 1} else {set CONFIG_ICACHE_LRAM_SZ8 0}
	global CONFIG_ICACHE_LRAM_SZ16
	if {$tmpvar_15 == "16"} then {set CONFIG_ICACHE_LRAM_SZ16 1} else {set CONFIG_ICACHE_LRAM_SZ16 0}
	global CONFIG_ICACHE_LRAM_SZ32
	if {$tmpvar_15 == "32"} then {set CONFIG_ICACHE_LRAM_SZ32 1} else {set CONFIG_ICACHE_LRAM_SZ32 0}
	global CONFIG_ICACHE_LRAM_SZ64
	if {$tmpvar_15 == "64"} then {set CONFIG_ICACHE_LRAM_SZ64 1} else {set CONFIG_ICACHE_LRAM_SZ64 0}
	global CONFIG_ICACHE_LRAM_SZ128
	if {$tmpvar_15 == "128"} then {set CONFIG_ICACHE_LRAM_SZ128 1} else {set CONFIG_ICACHE_LRAM_SZ128 0}
	global CONFIG_ICACHE_LRAM_SZ256
	if {$tmpvar_15 == "256"} then {set CONFIG_ICACHE_LRAM_SZ256 1} else {set CONFIG_ICACHE_LRAM_SZ256 0}
	global CONFIG_ICACHE_LRSTART
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_LEON3 == 1) && ($CONFIG_ICACHE_LRAM == 1)} then {validate_hex CONFIG_ICACHE_LRSTART "$CONFIG_ICACHE_LRSTART" 8e}
	global CONFIG_DCACHE_ENABLE
	if {($CONFIG_LEON_CUSTOM == 1)} then {
	set CONFIG_DCACHE_ENABLE [expr $CONFIG_DCACHE_ENABLE&15]} else {set CONFIG_DCACHE_ENABLE [expr $CONFIG_DCACHE_ENABLE|16]}
	global tmpvar_16
	global CONFIG_DCACHE_ASSO1
	if {$tmpvar_16 == "1"} then {set CONFIG_DCACHE_ASSO1 1} else {set CONFIG_DCACHE_ASSO1 0}
	global CONFIG_DCACHE_ASSO2
	if {$tmpvar_16 == "2"} then {set CONFIG_DCACHE_ASSO2 1} else {set CONFIG_DCACHE_ASSO2 0}
	global CONFIG_DCACHE_ASSO3
	if {$tmpvar_16 == "3"} then {set CONFIG_DCACHE_ASSO3 1} else {set CONFIG_DCACHE_ASSO3 0}
	global CONFIG_DCACHE_ASSO4
	if {$tmpvar_16 == "4"} then {set CONFIG_DCACHE_ASSO4 1} else {set CONFIG_DCACHE_ASSO4 0}
	global tmpvar_17
	global CONFIG_DCACHE_SZ1
	if {$tmpvar_17 == "1"} then {set CONFIG_DCACHE_SZ1 1} else {set CONFIG_DCACHE_SZ1 0}
	global CONFIG_DCACHE_SZ2
	if {$tmpvar_17 == "2"} then {set CONFIG_DCACHE_SZ2 1} else {set CONFIG_DCACHE_SZ2 0}
	global CONFIG_DCACHE_SZ4
	if {$tmpvar_17 == "4"} then {set CONFIG_DCACHE_SZ4 1} else {set CONFIG_DCACHE_SZ4 0}
	global CONFIG_DCACHE_SZ8
	if {$tmpvar_17 == "8"} then {set CONFIG_DCACHE_SZ8 1} else {set CONFIG_DCACHE_SZ8 0}
	global CONFIG_DCACHE_SZ16
	if {$tmpvar_17 == "16"} then {set CONFIG_DCACHE_SZ16 1} else {set CONFIG_DCACHE_SZ16 0}
	global CONFIG_DCACHE_SZ32
	if {$tmpvar_17 == "32"} then {set CONFIG_DCACHE_SZ32 1} else {set CONFIG_DCACHE_SZ32 0}
	global CONFIG_DCACHE_SZ64
	if {$tmpvar_17 == "64"} then {set CONFIG_DCACHE_SZ64 1} else {set CONFIG_DCACHE_SZ64 0}
	global CONFIG_DCACHE_SZ128
	if {$tmpvar_17 == "128"} then {set CONFIG_DCACHE_SZ128 1} else {set CONFIG_DCACHE_SZ128 0}
	global CONFIG_DCACHE_SZ256
	if {$tmpvar_17 == "256"} then {set CONFIG_DCACHE_SZ256 1} else {set CONFIG_DCACHE_SZ256 0}
	global tmpvar_18
	global CONFIG_DCACHE_LZ16
	if {$tmpvar_18 == "16"} then {set CONFIG_DCACHE_LZ16 1} else {set CONFIG_DCACHE_LZ16 0}
	global CONFIG_DCACHE_LZ32
	if {$tmpvar_18 == "32"} then {set CONFIG_DCACHE_LZ32 1} else {set CONFIG_DCACHE_LZ32 0}
	global tmpvar_19
	global CONFIG_DCACHE_ALGORND
	if {$tmpvar_19 == "Random"} then {set CONFIG_DCACHE_ALGORND 1} else {set CONFIG_DCACHE_ALGORND 0}
	global CONFIG_DCACHE_ALGOLRU
	if {$tmpvar_19 == "LRU/Dynamic"} then {set CONFIG_DCACHE_ALGOLRU 1} else {set CONFIG_DCACHE_ALGOLRU 0}
	global CONFIG_DCACHE_LOCK
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_DCACHE_ENABLE == 1) && ($CONFIG_DCACHE_ASSO1 != 1)} then {
	set CONFIG_DCACHE_LOCK [expr $CONFIG_DCACHE_LOCK&15]} else {set CONFIG_DCACHE_LOCK [expr $CONFIG_DCACHE_LOCK|16]}
	global CONFIG_DCACHE_SNOOP
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_DCACHE_ENABLE == 1)} then {
	set CONFIG_DCACHE_SNOOP [expr $CONFIG_DCACHE_SNOOP&15]} else {set CONFIG_DCACHE_SNOOP [expr $CONFIG_DCACHE_SNOOP|16]}
	global CONFIG_DCACHE_SNOOP_SEPTAG
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_DCACHE_ENABLE == 1) && ($CONFIG_DCACHE_SNOOP == 1)} then {
	set CONFIG_DCACHE_SNOOP_SEPTAG [expr $CONFIG_DCACHE_SNOOP_SEPTAG&15]} else {set CONFIG_DCACHE_SNOOP_SEPTAG [expr $CONFIG_DCACHE_SNOOP_SEPTAG|16]}
	global CONFIG_DCACHE_SNOOP_SP
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_DCACHE_ENABLE == 1) && ($CONFIG_DCACHE_SNOOP == 1) && ($CONFIG_LEON3 == 1) && ($CONFIG_DCACHE_SNOOP_SEPTAG == 1)} then {
	set CONFIG_DCACHE_SNOOP_SP [expr $CONFIG_DCACHE_SNOOP_SP&15]} else {set CONFIG_DCACHE_SNOOP_SP [expr $CONFIG_DCACHE_SNOOP_SP|16]}
	global tmpvar_20
	global CONFIG_CACHE_64BIT
	if {$tmpvar_20 == "64-bit"} then {set CONFIG_CACHE_64BIT 1} else {set CONFIG_CACHE_64BIT 0}
	global CONFIG_CACHE_128BIT
	if {$tmpvar_20 == "128-bit"} then {set CONFIG_CACHE_128BIT 1} else {set CONFIG_CACHE_128BIT 0}
	global CONFIG_DCACHE_LRAM
	if {($CONFIG_LEON3 == 1) && ($CONFIG_MMU_ENABLE != 1)} then {
	set CONFIG_DCACHE_LRAM [expr $CONFIG_DCACHE_LRAM&15]} else {set CONFIG_DCACHE_LRAM [expr $CONFIG_DCACHE_LRAM|16]}
	global tmpvar_21
	global CONFIG_DCACHE_LRAM_SZ1
	if {$tmpvar_21 == "1"} then {set CONFIG_DCACHE_LRAM_SZ1 1} else {set CONFIG_DCACHE_LRAM_SZ1 0}
	global CONFIG_DCACHE_LRAM_SZ2
	if {$tmpvar_21 == "2"} then {set CONFIG_DCACHE_LRAM_SZ2 1} else {set CONFIG_DCACHE_LRAM_SZ2 0}
	global CONFIG_DCACHE_LRAM_SZ4
	if {$tmpvar_21 == "4"} then {set CONFIG_DCACHE_LRAM_SZ4 1} else {set CONFIG_DCACHE_LRAM_SZ4 0}
	global CONFIG_DCACHE_LRAM_SZ8
	if {$tmpvar_21 == "8"} then {set CONFIG_DCACHE_LRAM_SZ8 1} else {set CONFIG_DCACHE_LRAM_SZ8 0}
	global CONFIG_DCACHE_LRAM_SZ16
	if {$tmpvar_21 == "16"} then {set CONFIG_DCACHE_LRAM_SZ16 1} else {set CONFIG_DCACHE_LRAM_SZ16 0}
	global CONFIG_DCACHE_LRAM_SZ32
	if {$tmpvar_21 == "32"} then {set CONFIG_DCACHE_LRAM_SZ32 1} else {set CONFIG_DCACHE_LRAM_SZ32 0}
	global CONFIG_DCACHE_LRAM_SZ64
	if {$tmpvar_21 == "64"} then {set CONFIG_DCACHE_LRAM_SZ64 1} else {set CONFIG_DCACHE_LRAM_SZ64 0}
	global CONFIG_DCACHE_LRAM_SZ128
	if {$tmpvar_21 == "128"} then {set CONFIG_DCACHE_LRAM_SZ128 1} else {set CONFIG_DCACHE_LRAM_SZ128 0}
	global CONFIG_DCACHE_LRAM_SZ256
	if {$tmpvar_21 == "256"} then {set CONFIG_DCACHE_LRAM_SZ256 1} else {set CONFIG_DCACHE_LRAM_SZ256 0}
	global CONFIG_DCACHE_LRSTART
	if {($CONFIG_LEON3 == 1) && ($CONFIG_DCACHE_LRAM == 1)} then {validate_hex CONFIG_DCACHE_LRSTART "$CONFIG_DCACHE_LRSTART" 8f}
}


proc menu7 {w title} {
	set oldFocus [focus]
	catch {focus .menu3}
	catch {destroy $w; unregister_active 7}
	toplevel $w -class Dialog
	wm withdraw $w
	global active_menus
	set active_menus [lsort -integer [linsert $active_menus end 7]]
	message $w.m -width 400 -aspect 300 -text \
		"MMU"  -relief raised
	pack $w.m -pady 10 -side top -padx 10
	wm title $w "MMU" 

	bind $w <Escape> "catch {focus $oldFocus}; destroy $w; unregister_active 7; break"
	set nextscript "catch {focus $oldFocus}; destroy $w; unregister_active 7; menu8 .menu8 \"$title\""
	frame $w.f
	button $w.f.back -text "OK" \
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 7"
	button $w.f.next -text "Next" -underline 0\
		-width 15 -command $nextscript
	bind all <Alt-n> $nextscript
	button $w.f.prev -text "Prev" -underline 0\
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 7; menu6 .menu6 \"$title\""
	bind $w <Alt-p> "catch {focus $oldFocus}; destroy $w; unregister_active 7; menu6 .menu6 \"$title\";break"
	pack $w.f.back $w.f.next $w.f.prev -side left -expand on
	pack $w.f -pady 10 -side bottom -anchor w -fill x
	frame $w.topline -relief ridge -borderwidth 2 -height 2
	pack $w.topline -side top -fill x

	frame $w.botline -relief ridge -borderwidth 2 -height 2
	pack $w.botline -side bottom -fill x

	frame $w.config
	pack $w.config -fill y -expand on

	scrollbar $w.config.vscroll -command "$w.config.canvas yview"
	pack $w.config.vscroll -side right -fill y

	canvas $w.config.canvas -height 1\
		-relief flat -borderwidth 0 -yscrollcommand "$w.config.vscroll set" \
		-width [expr [winfo screenwidth .] * 1 / 2] 
	frame $w.config.f
	bind $w <Key-Down> "$w.config.canvas yview scroll  1 unit;break;"
	bind $w <Key-Up> "$w.config.canvas yview scroll  -1 unit;break;"
	bind $w <Key-Next> "$w.config.canvas yview scroll  1 page;break;"
	bind $w <Key-Prior> "$w.config.canvas yview scroll  -1 page;break;"
	bind $w <Key-Home> "$w.config.canvas yview moveto 0;break;"
	bind $w <Key-End> "$w.config.canvas yview moveto 1 ;break;"
	pack $w.config.canvas -side right -fill y


	bool $w.config.f 7 0 "Enable MMU       " CONFIG_MMU_ENABLE
	global tmpvar_22
	minimenu $w.config.f 7 1 "MMU type              " tmpvar_22 CONFIG_MMU_COMBINED
	menu $w.config.f.x1.x.menu -tearoffcommand "menutitle \"MMU type              \""
	$w.config.f.x1.x.menu add radiobutton -label "combined" -variable tmpvar_22 -value "combined" -command "update_active"
	$w.config.f.x1.x.menu add radiobutton -label "split" -variable tmpvar_22 -value "split" -command "update_active"
	menusplit $w $w.config.f.x1.x.menu 2
	global tmpvar_23
	minimenu $w.config.f 7 2 "TLB replacement sheme              " tmpvar_23 CONFIG_MMU_REPARRAY
	menu $w.config.f.x2.x.menu -tearoffcommand "menutitle \"TLB replacement sheme              \""
	$w.config.f.x2.x.menu add radiobutton -label "LRU" -variable tmpvar_23 -value "LRU" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "Increment" -variable tmpvar_23 -value "Increment" -command "update_active"
	menusplit $w $w.config.f.x2.x.menu 2
	global tmpvar_24
	minimenu $w.config.f 7 3 "Instruction (or combined) TLB entries" tmpvar_24 CONFIG_MMU_I2
	menu $w.config.f.x3.x.menu -tearoffcommand "menutitle \"Instruction (or combined) TLB entries\""
	$w.config.f.x3.x.menu add radiobutton -label "2" -variable tmpvar_24 -value "2" -command "update_active"
	$w.config.f.x3.x.menu add radiobutton -label "4" -variable tmpvar_24 -value "4" -command "update_active"
	$w.config.f.x3.x.menu add radiobutton -label "8" -variable tmpvar_24 -value "8" -command "update_active"
	$w.config.f.x3.x.menu add radiobutton -label "16" -variable tmpvar_24 -value "16" -command "update_active"
	$w.config.f.x3.x.menu add radiobutton -label "32" -variable tmpvar_24 -value "32" -command "update_active"
	$w.config.f.x3.x.menu add radiobutton -label "64" -variable tmpvar_24 -value "64" -command "update_active"
	menusplit $w $w.config.f.x3.x.menu 6
	global tmpvar_25
	minimenu $w.config.f 7 4 "Data TLB entries" tmpvar_25 CONFIG_MMU_D2
	menu $w.config.f.x4.x.menu -tearoffcommand "menutitle \"Data TLB entries\""
	$w.config.f.x4.x.menu add radiobutton -label "2" -variable tmpvar_25 -value "2" -command "update_active"
	$w.config.f.x4.x.menu add radiobutton -label "4" -variable tmpvar_25 -value "4" -command "update_active"
	$w.config.f.x4.x.menu add radiobutton -label "8" -variable tmpvar_25 -value "8" -command "update_active"
	$w.config.f.x4.x.menu add radiobutton -label "16" -variable tmpvar_25 -value "16" -command "update_active"
	$w.config.f.x4.x.menu add radiobutton -label "32" -variable tmpvar_25 -value "32" -command "update_active"
	$w.config.f.x4.x.menu add radiobutton -label "64" -variable tmpvar_25 -value "64" -command "update_active"
	menusplit $w $w.config.f.x4.x.menu 6
	bool $w.config.f 7 5 "Fast writebuffer       " CONFIG_MMU_FASTWB
	global tmpvar_26
	minimenu $w.config.f 7 6 "MMU page size" tmpvar_26 CONFIG_MMU_PAGE_4K
	menu $w.config.f.x6.x.menu -tearoffcommand "menutitle \"MMU page size\""
	$w.config.f.x6.x.menu add radiobutton -label "4K" -variable tmpvar_26 -value "4K" -command "update_active"
	$w.config.f.x6.x.menu add radiobutton -label "8K" -variable tmpvar_26 -value "8K" -command "update_active"
	$w.config.f.x6.x.menu add radiobutton -label "16K" -variable tmpvar_26 -value "16K" -command "update_active"
	$w.config.f.x6.x.menu add radiobutton -label "32K" -variable tmpvar_26 -value "32K" -command "update_active"
	$w.config.f.x6.x.menu add radiobutton -label "Programmable" -variable tmpvar_26 -value "Programmable" -command "update_active"
	menusplit $w $w.config.f.x6.x.menu 5



	focus $w
	update_active
	global winx; global winy
	if {[winfo exists .menu3] == 0} then {menu3 .menu3 "Processor            "}
	set winx [expr [winfo x .menu3]+30]; set winy [expr [winfo y .menu3]+30]
	if {[winfo exists $w]} then {wm geometry $w +$winx+$winy}
	update idletasks
	if {[winfo exists $w]} then  {$w.config.canvas create window 0 0 -anchor nw -window $w.config.f

	$w.config.canvas configure \
		-width [expr [winfo reqwidth $w.config.f] + 1]\
		-scrollregion "-1 -1 [expr [winfo reqwidth $w.config.f] + 1] \
			 [expr [winfo reqheight $w.config.f] + 1]"

	set winy [expr [winfo reqh $w] - [winfo reqh $w.config.canvas]]
	set scry [expr [winfo screenh $w] / 2]
	set maxy [expr [winfo screenh $w] * 3 / 4]
	set canvtotal [expr [winfo reqh $w.config.f] + 2]
	if [expr $winy + $canvtotal < $maxy] {
		$w.config.canvas configure -height $canvtotal
	} else {
		$w.config.canvas configure -height [expr $scry - $winy]
		}
	}
	update idletasks
	if {[winfo exists $w]} then {
	wm maxsize $w [winfo width $w] [winfo screenheight $w]
	wm minsize $w [winfo width $w] 100

	wm deiconify $w
}
}

proc update_menu7 {} {
	global CONFIG_LEON_CUSTOM
	global CONFIG_MMU_ENABLE
	if {($CONFIG_LEON_CUSTOM == 1)} then {
	configure_entry .menu7.config.f.x0 normal {n l y}} else {configure_entry .menu7.config.f.x0 disabled {y n l}}
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_MMU_ENABLE == 1)} then {configure_entry .menu7.config.f.x1 normal {x l}} else {configure_entry .menu7.config.f.x1 disabled {x l}}
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_MMU_ENABLE == 1)} then {configure_entry .menu7.config.f.x2 normal {x l}} else {configure_entry .menu7.config.f.x2 disabled {x l}}
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_MMU_ENABLE == 1)} then {configure_entry .menu7.config.f.x3 normal {x l}} else {configure_entry .menu7.config.f.x3 disabled {x l}}
	global CONFIG_MMU_SPLIT
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_MMU_ENABLE == 1) && ($CONFIG_MMU_SPLIT == 1)} then {configure_entry .menu7.config.f.x4 normal {x l}} else {configure_entry .menu7.config.f.x4 disabled {x l}}
	global CONFIG_MMU_FASTWB
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_MMU_ENABLE == 1) && ($CONFIG_MMU_SPLIT == 1)} then {
	configure_entry .menu7.config.f.x5 normal {n l y}} else {configure_entry .menu7.config.f.x5 disabled {y n l}}
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_MMU_ENABLE == 1)} then {configure_entry .menu7.config.f.x6 normal {x l}} else {configure_entry .menu7.config.f.x6 disabled {x l}}
}


proc update_define_menu7 {} {
	update_define_mainmenu
	global CONFIG_MODULES
	global CONFIG_LEON_CUSTOM
	global CONFIG_MMU_ENABLE
	if {($CONFIG_LEON_CUSTOM == 1)} then {
	set CONFIG_MMU_ENABLE [expr $CONFIG_MMU_ENABLE&15]} else {set CONFIG_MMU_ENABLE [expr $CONFIG_MMU_ENABLE|16]}
	global tmpvar_22
	global CONFIG_MMU_COMBINED
	if {$tmpvar_22 == "combined"} then {set CONFIG_MMU_COMBINED 1} else {set CONFIG_MMU_COMBINED 0}
	global CONFIG_MMU_SPLIT
	if {$tmpvar_22 == "split"} then {set CONFIG_MMU_SPLIT 1} else {set CONFIG_MMU_SPLIT 0}
	global tmpvar_23
	global CONFIG_MMU_REPARRAY
	if {$tmpvar_23 == "LRU"} then {set CONFIG_MMU_REPARRAY 1} else {set CONFIG_MMU_REPARRAY 0}
	global CONFIG_MMU_REPINCREMENT
	if {$tmpvar_23 == "Increment"} then {set CONFIG_MMU_REPINCREMENT 1} else {set CONFIG_MMU_REPINCREMENT 0}
	global tmpvar_24
	global CONFIG_MMU_I2
	if {$tmpvar_24 == "2"} then {set CONFIG_MMU_I2 1} else {set CONFIG_MMU_I2 0}
	global CONFIG_MMU_I4
	if {$tmpvar_24 == "4"} then {set CONFIG_MMU_I4 1} else {set CONFIG_MMU_I4 0}
	global CONFIG_MMU_I8
	if {$tmpvar_24 == "8"} then {set CONFIG_MMU_I8 1} else {set CONFIG_MMU_I8 0}
	global CONFIG_MMU_I16
	if {$tmpvar_24 == "16"} then {set CONFIG_MMU_I16 1} else {set CONFIG_MMU_I16 0}
	global CONFIG_MMU_I32
	if {$tmpvar_24 == "32"} then {set CONFIG_MMU_I32 1} else {set CONFIG_MMU_I32 0}
	global CONFIG_MMU_I64
	if {$tmpvar_24 == "64"} then {set CONFIG_MMU_I64 1} else {set CONFIG_MMU_I64 0}
	global tmpvar_25
	global CONFIG_MMU_D2
	if {$tmpvar_25 == "2"} then {set CONFIG_MMU_D2 1} else {set CONFIG_MMU_D2 0}
	global CONFIG_MMU_D4
	if {$tmpvar_25 == "4"} then {set CONFIG_MMU_D4 1} else {set CONFIG_MMU_D4 0}
	global CONFIG_MMU_D8
	if {$tmpvar_25 == "8"} then {set CONFIG_MMU_D8 1} else {set CONFIG_MMU_D8 0}
	global CONFIG_MMU_D16
	if {$tmpvar_25 == "16"} then {set CONFIG_MMU_D16 1} else {set CONFIG_MMU_D16 0}
	global CONFIG_MMU_D32
	if {$tmpvar_25 == "32"} then {set CONFIG_MMU_D32 1} else {set CONFIG_MMU_D32 0}
	global CONFIG_MMU_D64
	if {$tmpvar_25 == "64"} then {set CONFIG_MMU_D64 1} else {set CONFIG_MMU_D64 0}
	global CONFIG_MMU_FASTWB
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_MMU_ENABLE == 1) && ($CONFIG_MMU_SPLIT == 1)} then {
	set CONFIG_MMU_FASTWB [expr $CONFIG_MMU_FASTWB&15]} else {set CONFIG_MMU_FASTWB [expr $CONFIG_MMU_FASTWB|16]}
	global tmpvar_26
	global CONFIG_MMU_PAGE_4K
	if {$tmpvar_26 == "4K"} then {set CONFIG_MMU_PAGE_4K 1} else {set CONFIG_MMU_PAGE_4K 0}
	global CONFIG_MMU_PAGE_8K
	if {$tmpvar_26 == "8K"} then {set CONFIG_MMU_PAGE_8K 1} else {set CONFIG_MMU_PAGE_8K 0}
	global CONFIG_MMU_PAGE_16K
	if {$tmpvar_26 == "16K"} then {set CONFIG_MMU_PAGE_16K 1} else {set CONFIG_MMU_PAGE_16K 0}
	global CONFIG_MMU_PAGE_32K
	if {$tmpvar_26 == "32K"} then {set CONFIG_MMU_PAGE_32K 1} else {set CONFIG_MMU_PAGE_32K 0}
	global CONFIG_MMU_PAGE_PROG
	if {$tmpvar_26 == "Programmable"} then {set CONFIG_MMU_PAGE_PROG 1} else {set CONFIG_MMU_PAGE_PROG 0}
}


proc menu8 {w title} {
	set oldFocus [focus]
	catch {focus .menu3}
	catch {destroy $w; unregister_active 8}
	toplevel $w -class Dialog
	wm withdraw $w
	global active_menus
	set active_menus [lsort -integer [linsert $active_menus end 8]]
	message $w.m -width 400 -aspect 300 -text \
		"Debug Support Unit        "  -relief raised
	pack $w.m -pady 10 -side top -padx 10
	wm title $w "Debug Support Unit        " 

	bind $w <Escape> "catch {focus $oldFocus}; destroy $w; unregister_active 8; break"
	set nextscript "catch {focus $oldFocus}; destroy $w; unregister_active 8; menu9 .menu9 \"$title\""
	frame $w.f
	button $w.f.back -text "OK" \
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 8"
	button $w.f.next -text "Next" -underline 0\
		-width 15 -command $nextscript
	bind all <Alt-n> $nextscript
	button $w.f.prev -text "Prev" -underline 0\
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 8; menu7 .menu7 \"$title\""
	bind $w <Alt-p> "catch {focus $oldFocus}; destroy $w; unregister_active 8; menu7 .menu7 \"$title\";break"
	pack $w.f.back $w.f.next $w.f.prev -side left -expand on
	pack $w.f -pady 10 -side bottom -anchor w -fill x
	frame $w.topline -relief ridge -borderwidth 2 -height 2
	pack $w.topline -side top -fill x

	frame $w.botline -relief ridge -borderwidth 2 -height 2
	pack $w.botline -side bottom -fill x

	frame $w.config
	pack $w.config -fill y -expand on

	scrollbar $w.config.vscroll -command "$w.config.canvas yview"
	pack $w.config.vscroll -side right -fill y

	canvas $w.config.canvas -height 1\
		-relief flat -borderwidth 0 -yscrollcommand "$w.config.vscroll set" \
		-width [expr [winfo screenwidth .] * 1 / 2] 
	frame $w.config.f
	bind $w <Key-Down> "$w.config.canvas yview scroll  1 unit;break;"
	bind $w <Key-Up> "$w.config.canvas yview scroll  -1 unit;break;"
	bind $w <Key-Next> "$w.config.canvas yview scroll  1 page;break;"
	bind $w <Key-Prior> "$w.config.canvas yview scroll  -1 page;break;"
	bind $w <Key-Home> "$w.config.canvas yview moveto 0;break;"
	bind $w <Key-End> "$w.config.canvas yview moveto 1 ;break;"
	pack $w.config.canvas -side right -fill y


	bool $w.config.f 8 0 "Enable LEON Debug support unit    " CONFIG_DSU_ENABLE
	bool $w.config.f 8 1 "Instruction trace buffer" CONFIG_DSU_ITRACE
	global tmpvar_27
	minimenu $w.config.f 8 2 "Instruction trace buffer size (kbytes)" tmpvar_27 CONFIG_DSU_ITRACESZ1
	menu $w.config.f.x2.x.menu -tearoffcommand "menutitle \"Instruction trace buffer size (kbytes)\""
	$w.config.f.x2.x.menu add radiobutton -label "1" -variable tmpvar_27 -value "1" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "2" -variable tmpvar_27 -value "2" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "4" -variable tmpvar_27 -value "4" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "8" -variable tmpvar_27 -value "8" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "16" -variable tmpvar_27 -value "16" -command "update_active"
	menusplit $w $w.config.f.x2.x.menu 5
	bool $w.config.f 8 3 "Enable two-port instruction trace buffer" CONFIG_DSU_ITRACE_2P
	bool $w.config.f 8 4 "AHB trace buffer" CONFIG_DSU_ATRACE
	global tmpvar_28
	minimenu $w.config.f 8 5 "AHB trace buffer size (kbytes)" tmpvar_28 CONFIG_DSU_ATRACESZ1
	menu $w.config.f.x5.x.menu -tearoffcommand "menutitle \"AHB trace buffer size (kbytes)\""
	$w.config.f.x5.x.menu add radiobutton -label "1" -variable tmpvar_28 -value "1" -command "update_active"
	$w.config.f.x5.x.menu add radiobutton -label "2" -variable tmpvar_28 -value "2" -command "update_active"
	$w.config.f.x5.x.menu add radiobutton -label "4" -variable tmpvar_28 -value "4" -command "update_active"
	$w.config.f.x5.x.menu add radiobutton -label "8" -variable tmpvar_28 -value "8" -command "update_active"
	$w.config.f.x5.x.menu add radiobutton -label "16" -variable tmpvar_28 -value "16" -command "update_active"
	menusplit $w $w.config.f.x5.x.menu 5
	bool $w.config.f 8 6 "Enable AHB trace buffer filters " CONFIG_DSU_AFILT
	bool $w.config.f 8 7 "Enable statistics outputs       " CONFIG_DSU_ASTAT
	global tmpvar_29
	minimenu $w.config.f 8 8 "AHB watchpoints" tmpvar_29 CONFIG_DSU_AHBWP2
	menu $w.config.f.x8.x.menu -tearoffcommand "menutitle \"AHB watchpoints\""
	$w.config.f.x8.x.menu add radiobutton -label "Pipelined" -variable tmpvar_29 -value "Pipelined" -command "update_active"
	$w.config.f.x8.x.menu add radiobutton -label "Enabled" -variable tmpvar_29 -value "Enabled" -command "update_active"
	$w.config.f.x8.x.menu add radiobutton -label "Disabled" -variable tmpvar_29 -value "Disabled" -command "update_active"
	menusplit $w $w.config.f.x8.x.menu 3
	bool $w.config.f 8 9 "Enable LEON Statistics Module       " CONFIG_STAT_ENABLE
	int $w.config.f 8 10 "Number of counters (1 - 64)           " CONFIG_STAT_CNT
	int $w.config.f 8 11 "Number of accumulative counters       " CONFIG_STAT_NMAX



	focus $w
	update_active
	global winx; global winy
	if {[winfo exists .menu3] == 0} then {menu3 .menu3 "Processor            "}
	set winx [expr [winfo x .menu3]+30]; set winy [expr [winfo y .menu3]+30]
	if {[winfo exists $w]} then {wm geometry $w +$winx+$winy}
	update idletasks
	if {[winfo exists $w]} then  {$w.config.canvas create window 0 0 -anchor nw -window $w.config.f

	$w.config.canvas configure \
		-width [expr [winfo reqwidth $w.config.f] + 1]\
		-scrollregion "-1 -1 [expr [winfo reqwidth $w.config.f] + 1] \
			 [expr [winfo reqheight $w.config.f] + 1]"

	set winy [expr [winfo reqh $w] - [winfo reqh $w.config.canvas]]
	set scry [expr [winfo screenh $w] / 2]
	set maxy [expr [winfo screenh $w] * 3 / 4]
	set canvtotal [expr [winfo reqh $w.config.f] + 2]
	if [expr $winy + $canvtotal < $maxy] {
		$w.config.canvas configure -height $canvtotal
	} else {
		$w.config.canvas configure -height [expr $scry - $winy]
		}
	}
	update idletasks
	if {[winfo exists $w]} then {
	wm maxsize $w [winfo width $w] [winfo screenheight $w]
	wm minsize $w [winfo width $w] 100

	wm deiconify $w
}
}

proc update_menu8 {} {
	global CONFIG_DSU_ENABLE
	global CONFIG_DSU_ITRACE
	if {($CONFIG_DSU_ENABLE == 1)} then {
	configure_entry .menu8.config.f.x1 normal {n l y}} else {configure_entry .menu8.config.f.x1 disabled {y n l}}
	if {($CONFIG_DSU_ENABLE == 1) && ($CONFIG_DSU_ITRACE == 1)} then {configure_entry .menu8.config.f.x2 normal {x l}} else {configure_entry .menu8.config.f.x2 disabled {x l}}
	global CONFIG_DSU_ITRACE_2P
	if {($CONFIG_DSU_ENABLE == 1) && ($CONFIG_DSU_ITRACE == 1)} then {
	configure_entry .menu8.config.f.x3 normal {n l y}} else {configure_entry .menu8.config.f.x3 disabled {y n l}}
	global CONFIG_DSU_ATRACE
	if {($CONFIG_DSU_ENABLE == 1)} then {
	configure_entry .menu8.config.f.x4 normal {n l y}} else {configure_entry .menu8.config.f.x4 disabled {y n l}}
	if {($CONFIG_DSU_ENABLE == 1) && ($CONFIG_DSU_ATRACE == 1)} then {configure_entry .menu8.config.f.x5 normal {x l}} else {configure_entry .menu8.config.f.x5 disabled {x l}}
	global CONFIG_DSU_AFILT
	if {($CONFIG_DSU_ENABLE == 1) && ($CONFIG_DSU_ATRACE == 1)} then {
	configure_entry .menu8.config.f.x6 normal {n l y}} else {configure_entry .menu8.config.f.x6 disabled {y n l}}
	global CONFIG_DSU_ASTAT
	if {($CONFIG_DSU_ENABLE == 1) && ($CONFIG_DSU_ATRACE == 1)} then {
	configure_entry .menu8.config.f.x7 normal {n l y}} else {configure_entry .menu8.config.f.x7 disabled {y n l}}
	if {($CONFIG_DSU_ENABLE == 1) && ($CONFIG_DSU_ATRACE == 1)} then {configure_entry .menu8.config.f.x8 normal {x l}} else {configure_entry .menu8.config.f.x8 disabled {x l}}
	global CONFIG_STAT_ENABLE
	global CONFIG_STAT_CNT
	if {($CONFIG_STAT_ENABLE == 1)} then {.menu8.config.f.x10.x configure -state normal -foreground [ cget .ref -foreground ]; .menu8.config.f.x10.l configure -state normal; } else {.menu8.config.f.x10.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu8.config.f.x10.l configure -state disabled}
	global CONFIG_STAT_NMAX
	if {($CONFIG_STAT_ENABLE == 1)} then {.menu8.config.f.x11.x configure -state normal -foreground [ cget .ref -foreground ]; .menu8.config.f.x11.l configure -state normal; } else {.menu8.config.f.x11.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu8.config.f.x11.l configure -state disabled}
}


proc update_define_menu8 {} {
	update_define_mainmenu
	global CONFIG_MODULES
	global CONFIG_DSU_ENABLE
	global CONFIG_DSU_ITRACE
	if {($CONFIG_DSU_ENABLE == 1)} then {
	set CONFIG_DSU_ITRACE [expr $CONFIG_DSU_ITRACE&15]} else {set CONFIG_DSU_ITRACE [expr $CONFIG_DSU_ITRACE|16]}
	global tmpvar_27
	global CONFIG_DSU_ITRACESZ1
	if {$tmpvar_27 == "1"} then {set CONFIG_DSU_ITRACESZ1 1} else {set CONFIG_DSU_ITRACESZ1 0}
	global CONFIG_DSU_ITRACESZ2
	if {$tmpvar_27 == "2"} then {set CONFIG_DSU_ITRACESZ2 1} else {set CONFIG_DSU_ITRACESZ2 0}
	global CONFIG_DSU_ITRACESZ4
	if {$tmpvar_27 == "4"} then {set CONFIG_DSU_ITRACESZ4 1} else {set CONFIG_DSU_ITRACESZ4 0}
	global CONFIG_DSU_ITRACESZ8
	if {$tmpvar_27 == "8"} then {set CONFIG_DSU_ITRACESZ8 1} else {set CONFIG_DSU_ITRACESZ8 0}
	global CONFIG_DSU_ITRACESZ16
	if {$tmpvar_27 == "16"} then {set CONFIG_DSU_ITRACESZ16 1} else {set CONFIG_DSU_ITRACESZ16 0}
	global CONFIG_DSU_ITRACE_2P
	if {($CONFIG_DSU_ENABLE == 1) && ($CONFIG_DSU_ITRACE == 1)} then {
	set CONFIG_DSU_ITRACE_2P [expr $CONFIG_DSU_ITRACE_2P&15]} else {set CONFIG_DSU_ITRACE_2P [expr $CONFIG_DSU_ITRACE_2P|16]}
	global CONFIG_DSU_ATRACE
	if {($CONFIG_DSU_ENABLE == 1)} then {
	set CONFIG_DSU_ATRACE [expr $CONFIG_DSU_ATRACE&15]} else {set CONFIG_DSU_ATRACE [expr $CONFIG_DSU_ATRACE|16]}
	global tmpvar_28
	global CONFIG_DSU_ATRACESZ1
	if {$tmpvar_28 == "1"} then {set CONFIG_DSU_ATRACESZ1 1} else {set CONFIG_DSU_ATRACESZ1 0}
	global CONFIG_DSU_ATRACESZ2
	if {$tmpvar_28 == "2"} then {set CONFIG_DSU_ATRACESZ2 1} else {set CONFIG_DSU_ATRACESZ2 0}
	global CONFIG_DSU_ATRACESZ4
	if {$tmpvar_28 == "4"} then {set CONFIG_DSU_ATRACESZ4 1} else {set CONFIG_DSU_ATRACESZ4 0}
	global CONFIG_DSU_ATRACESZ8
	if {$tmpvar_28 == "8"} then {set CONFIG_DSU_ATRACESZ8 1} else {set CONFIG_DSU_ATRACESZ8 0}
	global CONFIG_DSU_ATRACESZ16
	if {$tmpvar_28 == "16"} then {set CONFIG_DSU_ATRACESZ16 1} else {set CONFIG_DSU_ATRACESZ16 0}
	global CONFIG_DSU_AFILT
	if {($CONFIG_DSU_ENABLE == 1) && ($CONFIG_DSU_ATRACE == 1)} then {
	set CONFIG_DSU_AFILT [expr $CONFIG_DSU_AFILT&15]} else {set CONFIG_DSU_AFILT [expr $CONFIG_DSU_AFILT|16]}
	global CONFIG_DSU_ASTAT
	if {($CONFIG_DSU_ENABLE == 1) && ($CONFIG_DSU_ATRACE == 1)} then {
	set CONFIG_DSU_ASTAT [expr $CONFIG_DSU_ASTAT&15]} else {set CONFIG_DSU_ASTAT [expr $CONFIG_DSU_ASTAT|16]}
	global tmpvar_29
	global CONFIG_DSU_AHBWP2
	if {$tmpvar_29 == "Pipelined"} then {set CONFIG_DSU_AHBWP2 1} else {set CONFIG_DSU_AHBWP2 0}
	global CONFIG_DSU_AHBWP1
	if {$tmpvar_29 == "Enabled"} then {set CONFIG_DSU_AHBWP1 1} else {set CONFIG_DSU_AHBWP1 0}
	global CONFIG_DSU_AHBWP0
	if {$tmpvar_29 == "Disabled"} then {set CONFIG_DSU_AHBWP0 1} else {set CONFIG_DSU_AHBWP0 0}
	global CONFIG_STAT_ENABLE
	global CONFIG_STAT_CNT
	if {($CONFIG_STAT_ENABLE == 1)} then {validate_int CONFIG_STAT_CNT "$CONFIG_STAT_CNT" 4}
	global CONFIG_STAT_NMAX
	if {($CONFIG_STAT_ENABLE == 1)} then {validate_int CONFIG_STAT_NMAX "$CONFIG_STAT_NMAX" 0}
}


proc menu9 {w title} {
	set oldFocus [focus]
	catch {focus .menu3}
	catch {destroy $w; unregister_active 9}
	toplevel $w -class Dialog
	wm withdraw $w
	global active_menus
	set active_menus [lsort -integer [linsert $active_menus end 9]]
	message $w.m -width 400 -aspect 300 -text \
		"Fault-tolerance  "  -relief raised
	pack $w.m -pady 10 -side top -padx 10
	wm title $w "Fault-tolerance  " 

	bind $w <Escape> "catch {focus $oldFocus}; destroy $w; unregister_active 9; break"
	set nextscript "catch {focus $oldFocus}; destroy $w; unregister_active 9; menu10 .menu10 \"$title\""
	frame $w.f
	button $w.f.back -text "OK" \
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 9"
	button $w.f.next -text "Next" -underline 0\
		-width 15 -command $nextscript
	bind all <Alt-n> $nextscript
	button $w.f.prev -text "Prev" -underline 0\
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 9; menu8 .menu8 \"$title\""
	bind $w <Alt-p> "catch {focus $oldFocus}; destroy $w; unregister_active 9; menu8 .menu8 \"$title\";break"
	pack $w.f.back $w.f.next $w.f.prev -side left -expand on
	pack $w.f -pady 10 -side bottom -anchor w -fill x
	frame $w.topline -relief ridge -borderwidth 2 -height 2
	pack $w.topline -side top -fill x

	frame $w.botline -relief ridge -borderwidth 2 -height 2
	pack $w.botline -side bottom -fill x

	frame $w.config
	pack $w.config -fill y -expand on

	scrollbar $w.config.vscroll -command "$w.config.canvas yview"
	pack $w.config.vscroll -side right -fill y

	canvas $w.config.canvas -height 1\
		-relief flat -borderwidth 0 -yscrollcommand "$w.config.vscroll set" \
		-width [expr [winfo screenwidth .] * 1 / 2] 
	frame $w.config.f
	bind $w <Key-Down> "$w.config.canvas yview scroll  1 unit;break;"
	bind $w <Key-Up> "$w.config.canvas yview scroll  -1 unit;break;"
	bind $w <Key-Next> "$w.config.canvas yview scroll  1 page;break;"
	bind $w <Key-Prior> "$w.config.canvas yview scroll  -1 page;break;"
	bind $w <Key-Home> "$w.config.canvas yview moveto 0;break;"
	bind $w <Key-End> "$w.config.canvas yview moveto 1 ;break;"
	pack $w.config.canvas -side right -fill y


	global tmpvar_30
	minimenu $w.config.f 9 0 "IU Register file protection     " tmpvar_30 CONFIG_IUFT_NONE
	menu $w.config.f.x0.x.menu -tearoffcommand "menutitle \"IU Register file protection     \""
	$w.config.f.x0.x.menu add radiobutton -label "None" -variable tmpvar_30 -value "None" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "Parity" -variable tmpvar_30 -value "Parity" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "PDMR" -variable tmpvar_30 -value "PDMR" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "BCH" -variable tmpvar_30 -value "BCH" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "BCH-OTF" -variable tmpvar_30 -value "BCH-OTF" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "TechSpec" -variable tmpvar_30 -value "TechSpec" -command "update_active"
	$w.config.f.x0.x.menu add radiobutton -label "TMR" -variable tmpvar_30 -value "TMR" -command "update_active"
	menusplit $w $w.config.f.x0.x.menu 7
	global tmpvar_31
	minimenu $w.config.f 9 1 "FPU Register file protection     " tmpvar_31 CONFIG_FPUFT_NONE
	menu $w.config.f.x1.x.menu -tearoffcommand "menutitle \"FPU Register file protection     \""
	$w.config.f.x1.x.menu add radiobutton -label "None" -variable tmpvar_31 -value "None" -command "update_active"
	$w.config.f.x1.x.menu add radiobutton -label "Parity" -variable tmpvar_31 -value "Parity" -command "update_active"
	$w.config.f.x1.x.menu add radiobutton -label "PDMR" -variable tmpvar_31 -value "PDMR" -command "update_active"
	$w.config.f.x1.x.menu add radiobutton -label "TMR" -variable tmpvar_31 -value "TMR" -command "update_active"
	menusplit $w $w.config.f.x1.x.menu 4
	bool $w.config.f 9 2 "Register file error injection" CONFIG_RF_ERRINJ
	global tmpvar_32
	minimenu $w.config.f 9 3 "Cache memory protection     " tmpvar_32 CONFIG_CACHE_FT_NONE
	menu $w.config.f.x3.x.menu -tearoffcommand "menutitle \"Cache memory protection     \""
	$w.config.f.x3.x.menu add radiobutton -label "None" -variable tmpvar_32 -value "None" -command "update_active"
	$w.config.f.x3.x.menu add radiobutton -label "Parity" -variable tmpvar_32 -value "Parity" -command "update_active"
	$w.config.f.x3.x.menu add radiobutton -label "SECDEC-BCH" -variable tmpvar_32 -value "SECDEC-BCH" -command "update_active"
	$w.config.f.x3.x.menu add radiobutton -label "TechSpec" -variable tmpvar_32 -value "TechSpec" -command "update_active"
	menusplit $w $w.config.f.x3.x.menu 4
	int $w.config.f 9 4 "Cache memory error injection" CONFIG_CACHE_ERRINJ



	focus $w
	update_active
	global winx; global winy
	if {[winfo exists .menu3] == 0} then {menu3 .menu3 "Processor            "}
	set winx [expr [winfo x .menu3]+30]; set winy [expr [winfo y .menu3]+30]
	if {[winfo exists $w]} then {wm geometry $w +$winx+$winy}
	update idletasks
	if {[winfo exists $w]} then  {$w.config.canvas create window 0 0 -anchor nw -window $w.config.f

	$w.config.canvas configure \
		-width [expr [winfo reqwidth $w.config.f] + 1]\
		-scrollregion "-1 -1 [expr [winfo reqwidth $w.config.f] + 1] \
			 [expr [winfo reqheight $w.config.f] + 1]"

	set winy [expr [winfo reqh $w] - [winfo reqh $w.config.canvas]]
	set scry [expr [winfo screenh $w] / 2]
	set maxy [expr [winfo screenh $w] * 3 / 4]
	set canvtotal [expr [winfo reqh $w.config.f] + 2]
	if [expr $winy + $canvtotal < $maxy] {
		$w.config.canvas configure -height $canvtotal
	} else {
		$w.config.canvas configure -height [expr $scry - $winy]
		}
	}
	update idletasks
	if {[winfo exists $w]} then {
	wm maxsize $w [winfo width $w] [winfo screenheight $w]
	wm minsize $w [winfo width $w] 100

	wm deiconify $w
}
}

proc update_menu9 {} {
	global CONFIG_FPU_ENABLE
	if {($CONFIG_FPU_ENABLE == 1)} then {configure_entry .menu9.config.f.x1 normal {x l}} else {configure_entry .menu9.config.f.x1 disabled {x l}}
}


proc update_define_menu9 {} {
	update_define_mainmenu
	global CONFIG_MODULES
	global tmpvar_30
	global CONFIG_IUFT_NONE
	if {$tmpvar_30 == "None"} then {set CONFIG_IUFT_NONE 1} else {set CONFIG_IUFT_NONE 0}
	global CONFIG_IUFT_PAR
	if {$tmpvar_30 == "Parity"} then {set CONFIG_IUFT_PAR 1} else {set CONFIG_IUFT_PAR 0}
	global CONFIG_IUFT_DMR
	if {$tmpvar_30 == "PDMR"} then {set CONFIG_IUFT_DMR 1} else {set CONFIG_IUFT_DMR 0}
	global CONFIG_IUFT_BCH
	if {$tmpvar_30 == "BCH"} then {set CONFIG_IUFT_BCH 1} else {set CONFIG_IUFT_BCH 0}
	global CONFIG_IUFT_BCHOTF
	if {$tmpvar_30 == "BCH-OTF"} then {set CONFIG_IUFT_BCHOTF 1} else {set CONFIG_IUFT_BCHOTF 0}
	global CONFIG_IUFT_TECHSPEC
	if {$tmpvar_30 == "TechSpec"} then {set CONFIG_IUFT_TECHSPEC 1} else {set CONFIG_IUFT_TECHSPEC 0}
	global CONFIG_IUFT_TMR
	if {$tmpvar_30 == "TMR"} then {set CONFIG_IUFT_TMR 1} else {set CONFIG_IUFT_TMR 0}
	global tmpvar_31
	global CONFIG_FPUFT_NONE
	if {$tmpvar_31 == "None"} then {set CONFIG_FPUFT_NONE 1} else {set CONFIG_FPUFT_NONE 0}
	global CONFIG_FPUFT_PAR
	if {$tmpvar_31 == "Parity"} then {set CONFIG_FPUFT_PAR 1} else {set CONFIG_FPUFT_PAR 0}
	global CONFIG_FPUFT_DMR
	if {$tmpvar_31 == "PDMR"} then {set CONFIG_FPUFT_DMR 1} else {set CONFIG_FPUFT_DMR 0}
	global CONFIG_FPUFT_TMR
	if {$tmpvar_31 == "TMR"} then {set CONFIG_FPUFT_TMR 1} else {set CONFIG_FPUFT_TMR 0}
	global tmpvar_32
	global CONFIG_CACHE_FT_NONE
	if {$tmpvar_32 == "None"} then {set CONFIG_CACHE_FT_NONE 1} else {set CONFIG_CACHE_FT_NONE 0}
	global CONFIG_CACHE_FT_EN
	if {$tmpvar_32 == "Parity"} then {set CONFIG_CACHE_FT_EN 1} else {set CONFIG_CACHE_FT_EN 0}
	global CONFIG_CACHE_FT_BCH
	if {$tmpvar_32 == "SECDEC-BCH"} then {set CONFIG_CACHE_FT_BCH 1} else {set CONFIG_CACHE_FT_BCH 0}
	global CONFIG_CACHE_FT_TECH
	if {$tmpvar_32 == "TechSpec"} then {set CONFIG_CACHE_FT_TECH 1} else {set CONFIG_CACHE_FT_TECH 0}
}


proc menu10 {w title} {
	set oldFocus [focus]
	catch {focus .menu3}
	catch {destroy $w; unregister_active 10}
	toplevel $w -class Dialog
	wm withdraw $w
	global active_menus
	set active_menus [lsort -integer [linsert $active_menus end 10]]
	message $w.m -width 400 -aspect 300 -text \
		"VHDL debug settings       "  -relief raised
	pack $w.m -pady 10 -side top -padx 10
	wm title $w "VHDL debug settings       " 

	bind $w <Escape> "catch {focus $oldFocus}; destroy $w; unregister_active 10; break"
	set nextscript "catch {focus $oldFocus}; destroy $w; unregister_active 10; catch {destroy .menu3}; unregister_active 3; menu11 .menu11 \"$title\""
	frame $w.f
	button $w.f.back -text "OK" \
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 10"
	button $w.f.next -text "Next" -underline 0\
		-width 15 -command $nextscript
	bind all <Alt-n> $nextscript
	button $w.f.prev -text "Prev" -underline 0\
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 10; menu9 .menu9 \"$title\""
	bind $w <Alt-p> "catch {focus $oldFocus}; destroy $w; unregister_active 10; menu9 .menu9 \"$title\";break"
	pack $w.f.back $w.f.next $w.f.prev -side left -expand on
	pack $w.f -pady 10 -side bottom -anchor w -fill x
	frame $w.topline -relief ridge -borderwidth 2 -height 2
	pack $w.topline -side top -fill x

	frame $w.botline -relief ridge -borderwidth 2 -height 2
	pack $w.botline -side bottom -fill x

	frame $w.config
	pack $w.config -fill y -expand on

	scrollbar $w.config.vscroll -command "$w.config.canvas yview"
	pack $w.config.vscroll -side right -fill y

	canvas $w.config.canvas -height 1\
		-relief flat -borderwidth 0 -yscrollcommand "$w.config.vscroll set" \
		-width [expr [winfo screenwidth .] * 1 / 2] 
	frame $w.config.f
	bind $w <Key-Down> "$w.config.canvas yview scroll  1 unit;break;"
	bind $w <Key-Up> "$w.config.canvas yview scroll  -1 unit;break;"
	bind $w <Key-Next> "$w.config.canvas yview scroll  1 page;break;"
	bind $w <Key-Prior> "$w.config.canvas yview scroll  -1 page;break;"
	bind $w <Key-Home> "$w.config.canvas yview moveto 0;break;"
	bind $w <Key-End> "$w.config.canvas yview moveto 1 ;break;"
	pack $w.config.canvas -side right -fill y


	bool $w.config.f 10 0 "Processor disassembly to console         " CONFIG_IU_DISAS
	bool $w.config.f 10 1 "Processor disassembly in netlist         " CONFIG_IU_DISAS_NET
	bool $w.config.f 10 2 "32-bit program counters       " CONFIG_DEBUG_PC32



	focus $w
	update_active
	global winx; global winy
	if {[winfo exists .menu3] == 0} then {menu3 .menu3 "Processor            "}
	set winx [expr [winfo x .menu3]+30]; set winy [expr [winfo y .menu3]+30]
	if {[winfo exists $w]} then {wm geometry $w +$winx+$winy}
	update idletasks
	if {[winfo exists $w]} then  {$w.config.canvas create window 0 0 -anchor nw -window $w.config.f

	$w.config.canvas configure \
		-width [expr [winfo reqwidth $w.config.f] + 1]\
		-scrollregion "-1 -1 [expr [winfo reqwidth $w.config.f] + 1] \
			 [expr [winfo reqheight $w.config.f] + 1]"

	set winy [expr [winfo reqh $w] - [winfo reqh $w.config.canvas]]
	set scry [expr [winfo screenh $w] / 2]
	set maxy [expr [winfo screenh $w] * 3 / 4]
	set canvtotal [expr [winfo reqh $w.config.f] + 2]
	if [expr $winy + $canvtotal < $maxy] {
		$w.config.canvas configure -height $canvtotal
	} else {
		$w.config.canvas configure -height [expr $scry - $winy]
		}
	}
	update idletasks
	if {[winfo exists $w]} then {
	wm maxsize $w [winfo width $w] [winfo screenheight $w]
	wm minsize $w [winfo width $w] 100

	wm deiconify $w
}
}

proc update_menu10 {} {
	global CONFIG_IU_DISAS
	global CONFIG_IU_DISAS_NET
	if {($CONFIG_IU_DISAS == 1)} then {
	configure_entry .menu10.config.f.x1 normal {n l y}} else {configure_entry .menu10.config.f.x1 disabled {y n l}}
}


proc update_define_menu10 {} {
	update_define_mainmenu
	global CONFIG_MODULES
	global CONFIG_IU_DISAS
	global CONFIG_IU_DISAS_NET
	if {($CONFIG_IU_DISAS == 1)} then {
	set CONFIG_IU_DISAS_NET [expr $CONFIG_IU_DISAS_NET&15]} else {set CONFIG_IU_DISAS_NET [expr $CONFIG_IU_DISAS_NET|16]}
}


menu_option menu11 11 "L2 Cache"
proc menu11 {w title} {
	set oldFocus [focus]
	catch {destroy $w; unregister_active 11}
	toplevel $w -class Dialog
	wm withdraw $w
	global active_menus
	set active_menus [lsort -integer [linsert $active_menus end 11]]
	message $w.m -width 400 -aspect 300 -text \
		"L2 Cache"  -relief raised
	pack $w.m -pady 10 -side top -padx 10
	wm title $w "L2 Cache" 

	bind $w <Escape> "catch {focus $oldFocus}; destroy $w; unregister_active 11; break"
	set nextscript "catch {focus $oldFocus}; destroy $w; unregister_active 11; menu12 .menu12 \"$title\""
	frame $w.f
	button $w.f.back -text "Main Menu" \
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 11"
	button $w.f.next -text "Next" -underline 0\
		-width 15 -command $nextscript
	bind all <Alt-n> $nextscript
	button $w.f.prev -text "Prev" -underline 0\
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 11; menu10 .menu10 \"$title\""
	bind $w <Alt-p> "catch {focus $oldFocus}; destroy $w; unregister_active 11; menu10 .menu10 \"$title\";break"
	pack $w.f.back $w.f.next $w.f.prev -side left -expand on
	pack $w.f -pady 10 -side bottom -anchor w -fill x
	frame $w.topline -relief ridge -borderwidth 2 -height 2
	pack $w.topline -side top -fill x

	frame $w.botline -relief ridge -borderwidth 2 -height 2
	pack $w.botline -side bottom -fill x

	frame $w.config
	pack $w.config -fill y -expand on

	scrollbar $w.config.vscroll -command "$w.config.canvas yview"
	pack $w.config.vscroll -side right -fill y

	canvas $w.config.canvas -height 1\
		-relief flat -borderwidth 0 -yscrollcommand "$w.config.vscroll set" \
		-width [expr [winfo screenwidth .] * 1 / 2] 
	frame $w.config.f
	bind $w <Key-Down> "$w.config.canvas yview scroll  1 unit;break;"
	bind $w <Key-Up> "$w.config.canvas yview scroll  -1 unit;break;"
	bind $w <Key-Next> "$w.config.canvas yview scroll  1 page;break;"
	bind $w <Key-Prior> "$w.config.canvas yview scroll  -1 page;break;"
	bind $w <Key-Home> "$w.config.canvas yview moveto 0;break;"
	bind $w <Key-End> "$w.config.canvas yview moveto 1 ;break;"
	pack $w.config.canvas -side right -fill y


	bool $w.config.f 11 0 "Enable L2 Cache                      " CONFIG_L2_ENABLE
	global tmpvar_33
	minimenu $w.config.f 11 1 "Associativity (ways)            " tmpvar_33 CONFIG_L2_ASSO1
	menu $w.config.f.x1.x.menu -tearoffcommand "menutitle \"Associativity (ways)            \""
	$w.config.f.x1.x.menu add radiobutton -label "1" -variable tmpvar_33 -value "1" -command "update_active"
	$w.config.f.x1.x.menu add radiobutton -label "2" -variable tmpvar_33 -value "2" -command "update_active"
	$w.config.f.x1.x.menu add radiobutton -label "3" -variable tmpvar_33 -value "3" -command "update_active"
	$w.config.f.x1.x.menu add radiobutton -label "4" -variable tmpvar_33 -value "4" -command "update_active"
	menusplit $w $w.config.f.x1.x.menu 4
	global tmpvar_34
	minimenu $w.config.f 11 2 "Way size (kbytes/way)" tmpvar_34 CONFIG_L2_SZ1
	menu $w.config.f.x2.x.menu -tearoffcommand "menutitle \"Way size (kbytes/way)\""
	$w.config.f.x2.x.menu add radiobutton -label "1" -variable tmpvar_34 -value "1" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "2" -variable tmpvar_34 -value "2" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "4" -variable tmpvar_34 -value "4" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "8" -variable tmpvar_34 -value "8" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "16" -variable tmpvar_34 -value "16" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "32" -variable tmpvar_34 -value "32" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "64" -variable tmpvar_34 -value "64" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "128" -variable tmpvar_34 -value "128" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "256" -variable tmpvar_34 -value "256" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "512" -variable tmpvar_34 -value "512" -command "update_active"
	menusplit $w $w.config.f.x2.x.menu 10
	global tmpvar_35
	minimenu $w.config.f 11 3 "Line size (bytes)            " tmpvar_35 CONFIG_L2_LINE32
	menu $w.config.f.x3.x.menu -tearoffcommand "menutitle \"Line size (bytes)            \""
	$w.config.f.x3.x.menu add radiobutton -label "32" -variable tmpvar_35 -value "32" -command "update_active"
	$w.config.f.x3.x.menu add radiobutton -label "64" -variable tmpvar_35 -value "64" -command "update_active"
	menusplit $w $w.config.f.x3.x.menu 2
	bool $w.config.f 11 4 "Use HPROT information                " CONFIG_L2_HPROT
	bool $w.config.f 11 5 "Enable L2 cache at power-on          " CONFIG_L2_PEN
	bool $w.config.f 11 6 "Enable write-through at power-on     " CONFIG_L2_WT
	bool $w.config.f 11 7 "Random replacement (LRU default)     " CONFIG_L2_RAN
	bool $w.config.f 11 8 "Shared RAM for multi-way caches      " CONFIG_L2_SHARE
	hex $w.config.f 11 9 "Cacheability map                     " CONFIG_L2_MAP
	int $w.config.f 11 10 "Number of MTRR registers             " CONFIG_L2_MTRR
	bool $w.config.f 11 11 "Enable EDAC                          " CONFIG_L2_EDAC
	bool $w.config.f 11 12 "AXI backend interface                " CONFIG_L2_AXI



	focus $w
	update_active
	global winx; global winy
	set winx [expr [winfo x .]+30]; set winy [expr [winfo y .]+30]
	if {[winfo exists $w]} then {wm geometry $w +$winx+$winy}
	update idletasks
	if {[winfo exists $w]} then  {$w.config.canvas create window 0 0 -anchor nw -window $w.config.f

	$w.config.canvas configure \
		-width [expr [winfo reqwidth $w.config.f] + 1]\
		-scrollregion "-1 -1 [expr [winfo reqwidth $w.config.f] + 1] \
			 [expr [winfo reqheight $w.config.f] + 1]"

	set winy [expr [winfo reqh $w] - [winfo reqh $w.config.canvas]]
	set scry [expr [winfo screenh $w] / 2]
	set maxy [expr [winfo screenh $w] * 3 / 4]
	set canvtotal [expr [winfo reqh $w.config.f] + 2]
	if [expr $winy + $canvtotal < $maxy] {
		$w.config.canvas configure -height $canvtotal
	} else {
		$w.config.canvas configure -height [expr $scry - $winy]
		}
	}
	update idletasks
	if {[winfo exists $w]} then {
	wm maxsize $w [winfo width $w] [winfo screenheight $w]
	wm minsize $w [winfo width $w] 100

	wm deiconify $w
}
}

proc update_menu11 {} {
}


proc update_define_menu11 {} {
	update_define_mainmenu
	global CONFIG_MODULES
	global tmpvar_33
	global CONFIG_L2_ASSO1
	if {$tmpvar_33 == "1"} then {set CONFIG_L2_ASSO1 1} else {set CONFIG_L2_ASSO1 0}
	global CONFIG_L2_ASSO2
	if {$tmpvar_33 == "2"} then {set CONFIG_L2_ASSO2 1} else {set CONFIG_L2_ASSO2 0}
	global CONFIG_L2_ASSO3
	if {$tmpvar_33 == "3"} then {set CONFIG_L2_ASSO3 1} else {set CONFIG_L2_ASSO3 0}
	global CONFIG_L2_ASSO4
	if {$tmpvar_33 == "4"} then {set CONFIG_L2_ASSO4 1} else {set CONFIG_L2_ASSO4 0}
	global tmpvar_34
	global CONFIG_L2_SZ1
	if {$tmpvar_34 == "1"} then {set CONFIG_L2_SZ1 1} else {set CONFIG_L2_SZ1 0}
	global CONFIG_L2_SZ2
	if {$tmpvar_34 == "2"} then {set CONFIG_L2_SZ2 1} else {set CONFIG_L2_SZ2 0}
	global CONFIG_L2_SZ4
	if {$tmpvar_34 == "4"} then {set CONFIG_L2_SZ4 1} else {set CONFIG_L2_SZ4 0}
	global CONFIG_L2_SZ8
	if {$tmpvar_34 == "8"} then {set CONFIG_L2_SZ8 1} else {set CONFIG_L2_SZ8 0}
	global CONFIG_L2_SZ16
	if {$tmpvar_34 == "16"} then {set CONFIG_L2_SZ16 1} else {set CONFIG_L2_SZ16 0}
	global CONFIG_L2_SZ32
	if {$tmpvar_34 == "32"} then {set CONFIG_L2_SZ32 1} else {set CONFIG_L2_SZ32 0}
	global CONFIG_L2_SZ64
	if {$tmpvar_34 == "64"} then {set CONFIG_L2_SZ64 1} else {set CONFIG_L2_SZ64 0}
	global CONFIG_L2_SZ128
	if {$tmpvar_34 == "128"} then {set CONFIG_L2_SZ128 1} else {set CONFIG_L2_SZ128 0}
	global CONFIG_L2_SZ256
	if {$tmpvar_34 == "256"} then {set CONFIG_L2_SZ256 1} else {set CONFIG_L2_SZ256 0}
	global CONFIG_L2_SZ512
	if {$tmpvar_34 == "512"} then {set CONFIG_L2_SZ512 1} else {set CONFIG_L2_SZ512 0}
	global tmpvar_35
	global CONFIG_L2_LINE32
	if {$tmpvar_35 == "32"} then {set CONFIG_L2_LINE32 1} else {set CONFIG_L2_LINE32 0}
	global CONFIG_L2_LINE64
	if {$tmpvar_35 == "64"} then {set CONFIG_L2_LINE64 1} else {set CONFIG_L2_LINE64 0}
}


menu_option menu12 12 "AMBA configuration"
proc menu12 {w title} {
	set oldFocus [focus]
	catch {destroy $w; unregister_active 12}
	toplevel $w -class Dialog
	wm withdraw $w
	global active_menus
	set active_menus [lsort -integer [linsert $active_menus end 12]]
	message $w.m -width 400 -aspect 300 -text \
		"AMBA configuration"  -relief raised
	pack $w.m -pady 10 -side top -padx 10
	wm title $w "AMBA configuration" 

	bind $w <Escape> "catch {focus $oldFocus}; destroy $w; unregister_active 12; break"
	set nextscript "catch {focus $oldFocus}; destroy $w; unregister_active 12; menu13 .menu13 \"$title\""
	frame $w.f
	button $w.f.back -text "Main Menu" \
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 12"
	button $w.f.next -text "Next" -underline 0\
		-width 15 -command $nextscript
	bind all <Alt-n> $nextscript
	button $w.f.prev -text "Prev" -underline 0\
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 12; menu11 .menu11 \"$title\""
	bind $w <Alt-p> "catch {focus $oldFocus}; destroy $w; unregister_active 12; menu11 .menu11 \"$title\";break"
	pack $w.f.back $w.f.next $w.f.prev -side left -expand on
	pack $w.f -pady 10 -side bottom -anchor w -fill x
	frame $w.topline -relief ridge -borderwidth 2 -height 2
	pack $w.topline -side top -fill x

	frame $w.botline -relief ridge -borderwidth 2 -height 2
	pack $w.botline -side bottom -fill x

	frame $w.config
	pack $w.config -fill y -expand on

	scrollbar $w.config.vscroll -command "$w.config.canvas yview"
	pack $w.config.vscroll -side right -fill y

	canvas $w.config.canvas -height 1\
		-relief flat -borderwidth 0 -yscrollcommand "$w.config.vscroll set" \
		-width [expr [winfo screenwidth .] * 1 / 2] 
	frame $w.config.f
	bind $w <Key-Down> "$w.config.canvas yview scroll  1 unit;break;"
	bind $w <Key-Up> "$w.config.canvas yview scroll  -1 unit;break;"
	bind $w <Key-Next> "$w.config.canvas yview scroll  1 page;break;"
	bind $w <Key-Prior> "$w.config.canvas yview scroll  -1 page;break;"
	bind $w <Key-Home> "$w.config.canvas yview moveto 0;break;"
	bind $w <Key-End> "$w.config.canvas yview moveto 1 ;break;"
	pack $w.config.canvas -side right -fill y


	int $w.config.f 12 0 "Default AHB master" CONFIG_AHB_DEFMST
	bool $w.config.f 12 1 "Round-robin arbiter                       " CONFIG_AHB_RROBIN
	bool $w.config.f 12 2 "AHB split-transaction support             " CONFIG_AHB_SPLIT
	bool $w.config.f 12 3 "Enable full plug&play decoding            " CONFIG_AHB_FPNPEN
	hex $w.config.f 12 4 "I/O area start address (haddr\[31:20\]) " CONFIG_AHB_IOADDR
	hex $w.config.f 12 5 "AHB/APB bridge address (haddr\[31:20\]) " CONFIG_APB_HADDR
	bool $w.config.f 12 6 "Enable AMBA AHB monitor              " CONFIG_AHB_MON
	bool $w.config.f 12 7 "Report AHB errors                  " CONFIG_AHB_MONERR
	bool $w.config.f 12 8 "Report AHB warings                 " CONFIG_AHB_MONWAR
	bool $w.config.f 12 9 "Write trace to simulation console    " CONFIG_AHB_DTRACE



	focus $w
	update_active
	global winx; global winy
	set winx [expr [winfo x .]+30]; set winy [expr [winfo y .]+30]
	if {[winfo exists $w]} then {wm geometry $w +$winx+$winy}
	update idletasks
	if {[winfo exists $w]} then  {$w.config.canvas create window 0 0 -anchor nw -window $w.config.f

	$w.config.canvas configure \
		-width [expr [winfo reqwidth $w.config.f] + 1]\
		-scrollregion "-1 -1 [expr [winfo reqwidth $w.config.f] + 1] \
			 [expr [winfo reqheight $w.config.f] + 1]"

	set winy [expr [winfo reqh $w] - [winfo reqh $w.config.canvas]]
	set scry [expr [winfo screenh $w] / 2]
	set maxy [expr [winfo screenh $w] * 3 / 4]
	set canvtotal [expr [winfo reqh $w.config.f] + 2]
	if [expr $winy + $canvtotal < $maxy] {
		$w.config.canvas configure -height $canvtotal
	} else {
		$w.config.canvas configure -height [expr $scry - $winy]
		}
	}
	update idletasks
	if {[winfo exists $w]} then {
	wm maxsize $w [winfo width $w] [winfo screenheight $w]
	wm minsize $w [winfo width $w] 100

	wm deiconify $w
}
}

proc update_menu12 {} {
}


proc update_define_menu12 {} {
	update_define_mainmenu
	global CONFIG_MODULES
}


menu_option menu13 13 "Debug Link           "
proc menu13 {w title} {
	set oldFocus [focus]
	catch {destroy $w; unregister_active 13}
	toplevel $w -class Dialog
	wm withdraw $w
	global active_menus
	set active_menus [lsort -integer [linsert $active_menus end 13]]
	message $w.m -width 400 -aspect 300 -text \
		"Debug Link           "  -relief raised
	pack $w.m -pady 10 -side top -padx 10
	wm title $w "Debug Link           " 

	bind $w <Escape> "catch {focus $oldFocus}; destroy $w; unregister_active 13; break"
	set nextscript "catch {focus $oldFocus}; destroy $w; unregister_active 13; menu14 .menu14 \"$title\""
	frame $w.f
	button $w.f.back -text "Main Menu" \
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 13"
	button $w.f.next -text "Next" -underline 0\
		-width 15 -command $nextscript
	bind all <Alt-n> $nextscript
	button $w.f.prev -text "Prev" -underline 0\
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 13; menu12 .menu12 \"$title\""
	bind $w <Alt-p> "catch {focus $oldFocus}; destroy $w; unregister_active 13; menu12 .menu12 \"$title\";break"
	pack $w.f.back $w.f.next $w.f.prev -side left -expand on
	pack $w.f -pady 10 -side bottom -anchor w -fill x
	frame $w.topline -relief ridge -borderwidth 2 -height 2
	pack $w.topline -side top -fill x

	frame $w.botline -relief ridge -borderwidth 2 -height 2
	pack $w.botline -side bottom -fill x

	frame $w.config
	pack $w.config -fill y -expand on

	scrollbar $w.config.vscroll -command "$w.config.canvas yview"
	pack $w.config.vscroll -side right -fill y

	canvas $w.config.canvas -height 1\
		-relief flat -borderwidth 0 -yscrollcommand "$w.config.vscroll set" \
		-width [expr [winfo screenwidth .] * 1 / 2] 
	frame $w.config.f
	bind $w <Key-Down> "$w.config.canvas yview scroll  1 unit;break;"
	bind $w <Key-Up> "$w.config.canvas yview scroll  -1 unit;break;"
	bind $w <Key-Next> "$w.config.canvas yview scroll  1 page;break;"
	bind $w <Key-Prior> "$w.config.canvas yview scroll  -1 page;break;"
	bind $w <Key-Home> "$w.config.canvas yview moveto 0;break;"
	bind $w <Key-End> "$w.config.canvas yview moveto 1 ;break;"
	pack $w.config.canvas -side right -fill y


	bool $w.config.f 13 0 "Serial Debug Link (RS232)                " CONFIG_DSU_UART
	bool $w.config.f 13 1 "JTAG Debug Link" CONFIG_DSU_JTAG
	bool $w.config.f 13 2 "USB Debug Communication Link" CONFIG_GRUSB_DCL
	global tmpvar_36
	minimenu $w.config.f 13 3 "USB Transceiver Interface" tmpvar_36 CONFIG_GRUSB_DCL_ULPI
	menu $w.config.f.x3.x.menu -tearoffcommand "menutitle \"USB Transceiver Interface\""
	$w.config.f.x3.x.menu add radiobutton -label "ULPI" -variable tmpvar_36 -value "ULPI" -command "update_active"
	$w.config.f.x3.x.menu add radiobutton -label "UTMI/UTMI+8-bit" -variable tmpvar_36 -value "UTMI/UTMI+8-bit" -command "update_active"
	$w.config.f.x3.x.menu add radiobutton -label "UTMI/UTMI+16-bit" -variable tmpvar_36 -value "UTMI/UTMI+16-bit" -command "update_active"
	menusplit $w $w.config.f.x3.x.menu 3
	bool $w.config.f 13 4 "Ethernet Debug Communication Link (EDCL)" CONFIG_DSU_ETH
	global tmpvar_37
	minimenu $w.config.f 13 5 "Ethernet/AHB bridge buffer size (kbytes)" tmpvar_37 CONFIG_DSU_ETHSZ1
	menu $w.config.f.x5.x.menu -tearoffcommand "menutitle \"Ethernet/AHB bridge buffer size (kbytes)\""
	$w.config.f.x5.x.menu add radiobutton -label "1" -variable tmpvar_37 -value "1" -command "update_active"
	$w.config.f.x5.x.menu add radiobutton -label "2" -variable tmpvar_37 -value "2" -command "update_active"
	$w.config.f.x5.x.menu add radiobutton -label "4" -variable tmpvar_37 -value "4" -command "update_active"
	$w.config.f.x5.x.menu add radiobutton -label "8" -variable tmpvar_37 -value "8" -command "update_active"
	$w.config.f.x5.x.menu add radiobutton -label "16" -variable tmpvar_37 -value "16" -command "update_active"
	menusplit $w $w.config.f.x5.x.menu 5
	hex $w.config.f 13 6 "MSB 16 bits of IP address (hex)       " CONFIG_DSU_IPMSB
	hex $w.config.f 13 7 "LSB 16 bits of IP address (hex)       " CONFIG_DSU_IPLSB
	hex $w.config.f 13 8 "MSB 24 bits of ethern number (hex)    " CONFIG_DSU_ETHMSB
	hex $w.config.f 13 9 "LSB 24 bits of ethern number (hex)    " CONFIG_DSU_ETHLSB
	bool $w.config.f 13 10 "Programmable 4-bit LSB of MAC/IP address" CONFIG_DSU_ETH_PROG
	bool $w.config.f 13 11 "EDCL disable pin                     " CONFIG_DSU_ETH_DIS



	focus $w
	update_active
	global winx; global winy
	set winx [expr [winfo x .]+30]; set winy [expr [winfo y .]+30]
	if {[winfo exists $w]} then {wm geometry $w +$winx+$winy}
	update idletasks
	if {[winfo exists $w]} then  {$w.config.canvas create window 0 0 -anchor nw -window $w.config.f

	$w.config.canvas configure \
		-width [expr [winfo reqwidth $w.config.f] + 1]\
		-scrollregion "-1 -1 [expr [winfo reqwidth $w.config.f] + 1] \
			 [expr [winfo reqheight $w.config.f] + 1]"

	set winy [expr [winfo reqh $w] - [winfo reqh $w.config.canvas]]
	set scry [expr [winfo screenh $w] / 2]
	set maxy [expr [winfo screenh $w] * 3 / 4]
	set canvtotal [expr [winfo reqh $w.config.f] + 2]
	if [expr $winy + $canvtotal < $maxy] {
		$w.config.canvas configure -height $canvtotal
	} else {
		$w.config.canvas configure -height [expr $scry - $winy]
		}
	}
	update idletasks
	if {[winfo exists $w]} then {
	wm maxsize $w [winfo width $w] [winfo screenheight $w]
	wm minsize $w [winfo width $w] 100

	wm deiconify $w
}
}

proc update_menu13 {} {
	global CONFIG_DSU_ETH
	if {($CONFIG_DSU_ETH == 1)} then {configure_entry .menu13.config.f.x5 normal {x l}} else {configure_entry .menu13.config.f.x5 disabled {x l}}
	global CONFIG_DSU_IPMSB
	if {($CONFIG_DSU_ETH == 1)} then {.menu13.config.f.x6.x configure -state normal -foreground [ cget .ref -foreground ]; .menu13.config.f.x6.l configure -state normal; } else {.menu13.config.f.x6.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu13.config.f.x6.l configure -state disabled}
	global CONFIG_DSU_IPLSB
	if {($CONFIG_DSU_ETH == 1)} then {.menu13.config.f.x7.x configure -state normal -foreground [ cget .ref -foreground ]; .menu13.config.f.x7.l configure -state normal; } else {.menu13.config.f.x7.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu13.config.f.x7.l configure -state disabled}
	global CONFIG_DSU_ETHMSB
	if {($CONFIG_DSU_ETH == 1)} then {.menu13.config.f.x8.x configure -state normal -foreground [ cget .ref -foreground ]; .menu13.config.f.x8.l configure -state normal; } else {.menu13.config.f.x8.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu13.config.f.x8.l configure -state disabled}
	global CONFIG_DSU_ETHLSB
	if {($CONFIG_DSU_ETH == 1)} then {.menu13.config.f.x9.x configure -state normal -foreground [ cget .ref -foreground ]; .menu13.config.f.x9.l configure -state normal; } else {.menu13.config.f.x9.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu13.config.f.x9.l configure -state disabled}
	global CONFIG_DSU_ETH_PROG
	if {($CONFIG_DSU_ETH == 1)} then {
	configure_entry .menu13.config.f.x10 normal {n l y}} else {configure_entry .menu13.config.f.x10 disabled {y n l}}
	global CONFIG_DSU_ETH_DIS
	if {($CONFIG_DSU_ETH == 1) && ($CONFIG_DSU_ETH_PROG == 1)} then {
	configure_entry .menu13.config.f.x11 normal {n l y}} else {configure_entry .menu13.config.f.x11 disabled {y n l}}
}


proc update_define_menu13 {} {
	update_define_mainmenu
	global CONFIG_MODULES
	global tmpvar_36
	global CONFIG_GRUSB_DCL_ULPI
	if {$tmpvar_36 == "ULPI"} then {set CONFIG_GRUSB_DCL_ULPI 1} else {set CONFIG_GRUSB_DCL_ULPI 0}
	global CONFIG_GRUSB_DCL_UTMI8
	if {$tmpvar_36 == "UTMI/UTMI+8-bit"} then {set CONFIG_GRUSB_DCL_UTMI8 1} else {set CONFIG_GRUSB_DCL_UTMI8 0}
	global CONFIG_GRUSB_DCL_UTMI16
	if {$tmpvar_36 == "UTMI/UTMI+16-bit"} then {set CONFIG_GRUSB_DCL_UTMI16 1} else {set CONFIG_GRUSB_DCL_UTMI16 0}
	global tmpvar_37
	global CONFIG_DSU_ETHSZ1
	if {$tmpvar_37 == "1"} then {set CONFIG_DSU_ETHSZ1 1} else {set CONFIG_DSU_ETHSZ1 0}
	global CONFIG_DSU_ETHSZ2
	if {$tmpvar_37 == "2"} then {set CONFIG_DSU_ETHSZ2 1} else {set CONFIG_DSU_ETHSZ2 0}
	global CONFIG_DSU_ETHSZ4
	if {$tmpvar_37 == "4"} then {set CONFIG_DSU_ETHSZ4 1} else {set CONFIG_DSU_ETHSZ4 0}
	global CONFIG_DSU_ETHSZ8
	if {$tmpvar_37 == "8"} then {set CONFIG_DSU_ETHSZ8 1} else {set CONFIG_DSU_ETHSZ8 0}
	global CONFIG_DSU_ETHSZ16
	if {$tmpvar_37 == "16"} then {set CONFIG_DSU_ETHSZ16 1} else {set CONFIG_DSU_ETHSZ16 0}
	global CONFIG_DSU_ETH
	global CONFIG_DSU_IPMSB
	if {($CONFIG_DSU_ETH == 1)} then {validate_hex CONFIG_DSU_IPMSB "$CONFIG_DSU_IPMSB" C0A8}
	global CONFIG_DSU_IPLSB
	if {($CONFIG_DSU_ETH == 1)} then {validate_hex CONFIG_DSU_IPLSB "$CONFIG_DSU_IPLSB" 0033}
	global CONFIG_DSU_ETHMSB
	if {($CONFIG_DSU_ETH == 1)} then {validate_hex CONFIG_DSU_ETHMSB "$CONFIG_DSU_ETHMSB" 020000}
	global CONFIG_DSU_ETHLSB
	if {($CONFIG_DSU_ETH == 1)} then {validate_hex CONFIG_DSU_ETHLSB "$CONFIG_DSU_ETHLSB" 000000}
	global CONFIG_DSU_ETH_PROG
	if {($CONFIG_DSU_ETH == 1)} then {
	set CONFIG_DSU_ETH_PROG [expr $CONFIG_DSU_ETH_PROG&15]} else {set CONFIG_DSU_ETH_PROG [expr $CONFIG_DSU_ETH_PROG|16]}
	global CONFIG_DSU_ETH_DIS
	if {($CONFIG_DSU_ETH == 1) && ($CONFIG_DSU_ETH_PROG == 1)} then {
	set CONFIG_DSU_ETH_DIS [expr $CONFIG_DSU_ETH_DIS&15]} else {set CONFIG_DSU_ETH_DIS [expr $CONFIG_DSU_ETH_DIS|16]}
}


menu_option menu14 14 "Peripherals             "
proc menu14 {w title} {
	set oldFocus [focus]
	catch {destroy $w; unregister_active 14}
	toplevel $w -class Dialog
	wm withdraw $w
	global active_menus
	set active_menus [lsort -integer [linsert $active_menus end 14]]
	message $w.m -width 400 -aspect 300 -text \
		"Peripherals             "  -relief raised
	pack $w.m -pady 10 -side top -padx 10
	wm title $w "Peripherals             " 

	bind $w <Escape> "catch {focus $oldFocus}; destroy $w; unregister_active 14; break"
	set nextscript "catch {focus $oldFocus}; menu15 .menu15 \"$title\""
	frame $w.f
	button $w.f.back -text "Main Menu" \
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 14"
	button $w.f.next -text "Next" -underline 0\
		-width 15 -command $nextscript
	bind all <Alt-n> $nextscript
	button $w.f.prev -text "Prev" -underline 0\
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 14; menu13 .menu13 \"$title\""
	bind $w <Alt-p> "catch {focus $oldFocus}; destroy $w; unregister_active 14; menu13 .menu13 \"$title\";break"
	pack $w.f.back $w.f.next $w.f.prev -side left -expand on
	pack $w.f -pady 10 -side bottom -anchor w -fill x
	frame $w.topline -relief ridge -borderwidth 2 -height 2
	pack $w.topline -side top -fill x

	frame $w.botline -relief ridge -borderwidth 2 -height 2
	pack $w.botline -side bottom -fill x

	frame $w.config
	pack $w.config -fill y -expand on

	scrollbar $w.config.vscroll -command "$w.config.canvas yview"
	pack $w.config.vscroll -side right -fill y

	canvas $w.config.canvas -height 1\
		-relief flat -borderwidth 0 -yscrollcommand "$w.config.vscroll set" \
		-width [expr [winfo screenwidth .] * 1 / 2] 
	frame $w.config.f
	bind $w <Key-Down> "$w.config.canvas yview scroll  1 unit;break;"
	bind $w <Key-Up> "$w.config.canvas yview scroll  -1 unit;break;"
	bind $w <Key-Next> "$w.config.canvas yview scroll  1 page;break;"
	bind $w <Key-Prior> "$w.config.canvas yview scroll  -1 page;break;"
	bind $w <Key-Home> "$w.config.canvas yview moveto 0;break;"
	bind $w <Key-End> "$w.config.canvas yview moveto 1 ;break;"
	pack $w.config.canvas -side right -fill y


	submenu $w.config.f 14 0 "Memory controller             " 15
	submenu $w.config.f 14 1 "On-chip RAM/ROM                 " 18
	submenu $w.config.f 14 2 "Ethernet             " 19
	submenu $w.config.f 14 3 "USB 2.0 Host Controller      " 20
	submenu $w.config.f 14 4 "USB 2.0 Device Controller      " 21
	submenu $w.config.f 14 5 "CAN                     " 22
	submenu $w.config.f 14 6 "Spacewire " 23
	submenu $w.config.f 14 7 "UARTs, timers and irq control         " 24
	submenu $w.config.f 14 8 "Keybord and VGA interface" 25
	submenu $w.config.f 14 9 "SPI" 26
	submenu $w.config.f 14 10 "Partial Reconfiguration  " 29



	focus $w
	update_active
	global winx; global winy
	set winx [expr [winfo x .]+30]; set winy [expr [winfo y .]+30]
	if {[winfo exists $w]} then {wm geometry $w +$winx+$winy}
	update idletasks
	if {[winfo exists $w]} then  {$w.config.canvas create window 0 0 -anchor nw -window $w.config.f

	$w.config.canvas configure \
		-width [expr [winfo reqwidth $w.config.f] + 1]\
		-scrollregion "-1 -1 [expr [winfo reqwidth $w.config.f] + 1] \
			 [expr [winfo reqheight $w.config.f] + 1]"

	set winy [expr [winfo reqh $w] - [winfo reqh $w.config.canvas]]
	set scry [expr [winfo screenh $w] / 2]
	set maxy [expr [winfo screenh $w] * 3 / 4]
	set canvtotal [expr [winfo reqh $w.config.f] + 2]
	if [expr $winy + $canvtotal < $maxy] {
		$w.config.canvas configure -height $canvtotal
	} else {
		$w.config.canvas configure -height [expr $scry - $winy]
		}
	}
	update idletasks
	if {[winfo exists $w]} then {
	wm maxsize $w [winfo width $w] [winfo screenheight $w]
	wm minsize $w [winfo width $w] 100

	wm deiconify $w
}
}

proc update_menu14 {} {
}


proc update_define_menu14 {} {
	update_define_mainmenu
	global CONFIG_MODULES
}


proc menu15 {w title} {
	set oldFocus [focus]
	catch {focus .menu14}
	catch {destroy $w; unregister_active 15}
	toplevel $w -class Dialog
	wm withdraw $w
	global active_menus
	set active_menus [lsort -integer [linsert $active_menus end 15]]
	message $w.m -width 400 -aspect 300 -text \
		"Memory controller             "  -relief raised
	pack $w.m -pady 10 -side top -padx 10
	wm title $w "Memory controller             " 

	bind $w <Escape> "catch {focus $oldFocus}; destroy $w; unregister_active 15; break"
	set nextscript "catch {focus $oldFocus}; menu16 .menu16 \"$title\""
	frame $w.f
	button $w.f.back -text "OK" \
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 15"
	button $w.f.next -text "Next" -underline 0\
		-width 15 -command $nextscript
	bind all <Alt-n> $nextscript
	button $w.f.prev -text "Prev" -underline 0\
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 15; menu14 .menu14 \"$title\""
	bind $w <Alt-p> "catch {focus $oldFocus}; destroy $w; unregister_active 15; menu14 .menu14 \"$title\";break"
	pack $w.f.back $w.f.next $w.f.prev -side left -expand on
	pack $w.f -pady 10 -side bottom -anchor w -fill x
	frame $w.topline -relief ridge -borderwidth 2 -height 2
	pack $w.topline -side top -fill x

	frame $w.botline -relief ridge -borderwidth 2 -height 2
	pack $w.botline -side bottom -fill x

	frame $w.config
	pack $w.config -fill y -expand on

	scrollbar $w.config.vscroll -command "$w.config.canvas yview"
	pack $w.config.vscroll -side right -fill y

	canvas $w.config.canvas -height 1\
		-relief flat -borderwidth 0 -yscrollcommand "$w.config.vscroll set" \
		-width [expr [winfo screenwidth .] * 1 / 2] 
	frame $w.config.f
	bind $w <Key-Down> "$w.config.canvas yview scroll  1 unit;break;"
	bind $w <Key-Up> "$w.config.canvas yview scroll  -1 unit;break;"
	bind $w <Key-Next> "$w.config.canvas yview scroll  1 page;break;"
	bind $w <Key-Prior> "$w.config.canvas yview scroll  -1 page;break;"
	bind $w <Key-Home> "$w.config.canvas yview moveto 0;break;"
	bind $w <Key-End> "$w.config.canvas yview moveto 1 ;break;"
	pack $w.config.canvas -side right -fill y


	submenu $w.config.f 15 0 "Leon2 memory controller        " 16
	submenu $w.config.f 15 1 "MIG 7-Series memory controller   " 17
	bool $w.config.f 15 2 "Enable AHB Status Register  " CONFIG_AHBSTAT_ENABLE
	int $w.config.f 15 3 "Number of correctable-error slaves  " CONFIG_AHBSTAT_NFTSLV



	focus $w
	update_active
	global winx; global winy
	if {[winfo exists .menu14] == 0} then {menu14 .menu14 "Peripherals             "}
	set winx [expr [winfo x .menu14]+30]; set winy [expr [winfo y .menu14]+30]
	if {[winfo exists $w]} then {wm geometry $w +$winx+$winy}
	update idletasks
	if {[winfo exists $w]} then  {$w.config.canvas create window 0 0 -anchor nw -window $w.config.f

	$w.config.canvas configure \
		-width [expr [winfo reqwidth $w.config.f] + 1]\
		-scrollregion "-1 -1 [expr [winfo reqwidth $w.config.f] + 1] \
			 [expr [winfo reqheight $w.config.f] + 1]"

	set winy [expr [winfo reqh $w] - [winfo reqh $w.config.canvas]]
	set scry [expr [winfo screenh $w] / 2]
	set maxy [expr [winfo screenh $w] * 3 / 4]
	set canvtotal [expr [winfo reqh $w.config.f] + 2]
	if [expr $winy + $canvtotal < $maxy] {
		$w.config.canvas configure -height $canvtotal
	} else {
		$w.config.canvas configure -height [expr $scry - $winy]
		}
	}
	update idletasks
	if {[winfo exists $w]} then {
	wm maxsize $w [winfo width $w] [winfo screenheight $w]
	wm minsize $w [winfo width $w] 100

	wm deiconify $w
}
}

proc update_menu15 {} {
}


proc update_define_menu15 {} {
	update_define_mainmenu
	global CONFIG_MODULES
}


proc menu16 {w title} {
	set oldFocus [focus]
	catch {focus .menu15}
	catch {destroy $w; unregister_active 16}
	toplevel $w -class Dialog
	wm withdraw $w
	global active_menus
	set active_menus [lsort -integer [linsert $active_menus end 16]]
	message $w.m -width 400 -aspect 300 -text \
		"Leon2 memory controller        "  -relief raised
	pack $w.m -pady 10 -side top -padx 10
	wm title $w "Leon2 memory controller        " 

	bind $w <Escape> "catch {focus $oldFocus}; destroy $w; unregister_active 16; break"
	set nextscript "catch {focus $oldFocus}; destroy $w; unregister_active 16; menu17 .menu17 \"$title\""
	frame $w.f
	button $w.f.back -text "OK" \
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 16"
	button $w.f.next -text "Next" -underline 0\
		-width 15 -command $nextscript
	bind all <Alt-n> $nextscript
	button $w.f.prev -text "Prev" -underline 0\
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 16; menu15 .menu15 \"$title\""
	bind $w <Alt-p> "catch {focus $oldFocus}; destroy $w; unregister_active 16; menu15 .menu15 \"$title\";break"
	pack $w.f.back $w.f.next $w.f.prev -side left -expand on
	pack $w.f -pady 10 -side bottom -anchor w -fill x
	frame $w.topline -relief ridge -borderwidth 2 -height 2
	pack $w.topline -side top -fill x

	frame $w.botline -relief ridge -borderwidth 2 -height 2
	pack $w.botline -side bottom -fill x

	frame $w.config
	pack $w.config -fill y -expand on

	scrollbar $w.config.vscroll -command "$w.config.canvas yview"
	pack $w.config.vscroll -side right -fill y

	canvas $w.config.canvas -height 1\
		-relief flat -borderwidth 0 -yscrollcommand "$w.config.vscroll set" \
		-width [expr [winfo screenwidth .] * 1 / 2] 
	frame $w.config.f
	bind $w <Key-Down> "$w.config.canvas yview scroll  1 unit;break;"
	bind $w <Key-Up> "$w.config.canvas yview scroll  -1 unit;break;"
	bind $w <Key-Next> "$w.config.canvas yview scroll  1 page;break;"
	bind $w <Key-Prior> "$w.config.canvas yview scroll  -1 page;break;"
	bind $w <Key-Home> "$w.config.canvas yview moveto 0;break;"
	bind $w <Key-End> "$w.config.canvas yview moveto 1 ;break;"
	pack $w.config.canvas -side right -fill y


	bool $w.config.f 16 0 "Enable Leon2 memory controller  " CONFIG_MCTRL_LEON2
	bool $w.config.f 16 1 "8-bit PROM/SRAM bus support    " CONFIG_MCTRL_8BIT
	bool $w.config.f 16 2 "16-bit PROM/SRAM bus support    " CONFIG_MCTRL_16BIT
	bool $w.config.f 16 3 "5th SRAM chip-select  " CONFIG_MCTRL_5CS
	bool $w.config.f 16 4 "SDRAM controller       " CONFIG_MCTRL_SDRAM
	bool $w.config.f 16 5 "Separate address and data buses" CONFIG_MCTRL_SDRAM_SEPBUS
	bool $w.config.f 16 6 "64-bit SDRAM data bus" CONFIG_MCTRL_SDRAM_BUS64
	bool $w.config.f 16 7 "Unsynchronized sdclock" CONFIG_MCTRL_SDRAM_INVCLK
	bool $w.config.f 16 8 "Enable page burst operation     " CONFIG_MCTRL_PAGE
	bool $w.config.f 16 9 "Enable programmable page burst " CONFIG_MCTRL_PROGPAGE



	focus $w
	update_active
	global winx; global winy
	if {[winfo exists .menu15] == 0} then {menu15 .menu15 "Memory controller             "}
	set winx [expr [winfo x .menu15]+30]; set winy [expr [winfo y .menu15]+30]
	if {[winfo exists $w]} then {wm geometry $w +$winx+$winy}
	update idletasks
	if {[winfo exists $w]} then  {$w.config.canvas create window 0 0 -anchor nw -window $w.config.f

	$w.config.canvas configure \
		-width [expr [winfo reqwidth $w.config.f] + 1]\
		-scrollregion "-1 -1 [expr [winfo reqwidth $w.config.f] + 1] \
			 [expr [winfo reqheight $w.config.f] + 1]"

	set winy [expr [winfo reqh $w] - [winfo reqh $w.config.canvas]]
	set scry [expr [winfo screenh $w] / 2]
	set maxy [expr [winfo screenh $w] * 3 / 4]
	set canvtotal [expr [winfo reqh $w.config.f] + 2]
	if [expr $winy + $canvtotal < $maxy] {
		$w.config.canvas configure -height $canvtotal
	} else {
		$w.config.canvas configure -height [expr $scry - $winy]
		}
	}
	update idletasks
	if {[winfo exists $w]} then {
	wm maxsize $w [winfo width $w] [winfo screenheight $w]
	wm minsize $w [winfo width $w] 100

	wm deiconify $w
}
}

proc update_menu16 {} {
	global CONFIG_MCTRL_SDRAM
	global CONFIG_MCTRL_SDRAM_SEPBUS
	if {($CONFIG_MCTRL_SDRAM == 1)} then {
	configure_entry .menu16.config.f.x5 normal {n l y}} else {configure_entry .menu16.config.f.x5 disabled {y n l}}
	global CONFIG_MCTRL_SDRAM_BUS64
	if {($CONFIG_MCTRL_SDRAM == 1) && ($CONFIG_MCTRL_SDRAM_SEPBUS == 1)} then {
	configure_entry .menu16.config.f.x6 normal {n l y}} else {configure_entry .menu16.config.f.x6 disabled {y n l}}
	global CONFIG_MCTRL_SDRAM_INVCLK
	if {($CONFIG_MCTRL_SDRAM == 1) && ($CONFIG_MCTRL_SDRAM_SEPBUS == 1)} then {
	configure_entry .menu16.config.f.x7 normal {n l y}} else {configure_entry .menu16.config.f.x7 disabled {y n l}}
	global CONFIG_MCTRL_PAGE
	if {($CONFIG_MCTRL_SDRAM == 1)} then {
	configure_entry .menu16.config.f.x8 normal {n l y}} else {configure_entry .menu16.config.f.x8 disabled {y n l}}
	global CONFIG_MCTRL_PROGPAGE
	if {($CONFIG_MCTRL_SDRAM == 1) && ($CONFIG_MCTRL_PAGE == 1)} then {
	configure_entry .menu16.config.f.x9 normal {n l y}} else {configure_entry .menu16.config.f.x9 disabled {y n l}}
}


proc update_define_menu16 {} {
	update_define_mainmenu
	global CONFIG_MODULES
	global CONFIG_MCTRL_SDRAM
	global CONFIG_MCTRL_SDRAM_SEPBUS
	if {($CONFIG_MCTRL_SDRAM == 1)} then {
	set CONFIG_MCTRL_SDRAM_SEPBUS [expr $CONFIG_MCTRL_SDRAM_SEPBUS&15]} else {set CONFIG_MCTRL_SDRAM_SEPBUS [expr $CONFIG_MCTRL_SDRAM_SEPBUS|16]}
	global CONFIG_MCTRL_SDRAM_BUS64
	if {($CONFIG_MCTRL_SDRAM == 1) && ($CONFIG_MCTRL_SDRAM_SEPBUS == 1)} then {
	set CONFIG_MCTRL_SDRAM_BUS64 [expr $CONFIG_MCTRL_SDRAM_BUS64&15]} else {set CONFIG_MCTRL_SDRAM_BUS64 [expr $CONFIG_MCTRL_SDRAM_BUS64|16]}
	global CONFIG_MCTRL_SDRAM_INVCLK
	if {($CONFIG_MCTRL_SDRAM == 1) && ($CONFIG_MCTRL_SDRAM_SEPBUS == 1)} then {
	set CONFIG_MCTRL_SDRAM_INVCLK [expr $CONFIG_MCTRL_SDRAM_INVCLK&15]} else {set CONFIG_MCTRL_SDRAM_INVCLK [expr $CONFIG_MCTRL_SDRAM_INVCLK|16]}
	global CONFIG_MCTRL_PAGE
	if {($CONFIG_MCTRL_SDRAM == 1)} then {
	set CONFIG_MCTRL_PAGE [expr $CONFIG_MCTRL_PAGE&15]} else {set CONFIG_MCTRL_PAGE [expr $CONFIG_MCTRL_PAGE|16]}
	global CONFIG_MCTRL_PROGPAGE
	if {($CONFIG_MCTRL_SDRAM == 1) && ($CONFIG_MCTRL_PAGE == 1)} then {
	set CONFIG_MCTRL_PROGPAGE [expr $CONFIG_MCTRL_PROGPAGE&15]} else {set CONFIG_MCTRL_PROGPAGE [expr $CONFIG_MCTRL_PROGPAGE|16]}
}


proc menu17 {w title} {
	set oldFocus [focus]
	catch {focus .menu15}
	catch {destroy $w; unregister_active 17}
	toplevel $w -class Dialog
	wm withdraw $w
	global active_menus
	set active_menus [lsort -integer [linsert $active_menus end 17]]
	message $w.m -width 400 -aspect 300 -text \
		"MIG 7-Series memory controller   "  -relief raised
	pack $w.m -pady 10 -side top -padx 10
	wm title $w "MIG 7-Series memory controller   " 

	bind $w <Escape> "catch {focus $oldFocus}; destroy $w; unregister_active 17; break"
	set nextscript "catch {focus $oldFocus}; destroy $w; unregister_active 17; catch {destroy .menu15}; unregister_active 15; menu18 .menu18 \"$title\""
	frame $w.f
	button $w.f.back -text "OK" \
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 17"
	button $w.f.next -text "Next" -underline 0\
		-width 15 -command $nextscript
	bind all <Alt-n> $nextscript
	button $w.f.prev -text "Prev" -underline 0\
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 17; menu16 .menu16 \"$title\""
	bind $w <Alt-p> "catch {focus $oldFocus}; destroy $w; unregister_active 17; menu16 .menu16 \"$title\";break"
	pack $w.f.back $w.f.next $w.f.prev -side left -expand on
	pack $w.f -pady 10 -side bottom -anchor w -fill x
	frame $w.topline -relief ridge -borderwidth 2 -height 2
	pack $w.topline -side top -fill x

	frame $w.botline -relief ridge -borderwidth 2 -height 2
	pack $w.botline -side bottom -fill x

	frame $w.config
	pack $w.config -fill y -expand on

	scrollbar $w.config.vscroll -command "$w.config.canvas yview"
	pack $w.config.vscroll -side right -fill y

	canvas $w.config.canvas -height 1\
		-relief flat -borderwidth 0 -yscrollcommand "$w.config.vscroll set" \
		-width [expr [winfo screenwidth .] * 1 / 2] 
	frame $w.config.f
	bind $w <Key-Down> "$w.config.canvas yview scroll  1 unit;break;"
	bind $w <Key-Up> "$w.config.canvas yview scroll  -1 unit;break;"
	bind $w <Key-Next> "$w.config.canvas yview scroll  1 page;break;"
	bind $w <Key-Prior> "$w.config.canvas yview scroll  -1 page;break;"
	bind $w <Key-Home> "$w.config.canvas yview moveto 0;break;"
	bind $w <Key-End> "$w.config.canvas yview moveto 1 ;break;"
	pack $w.config.canvas -side right -fill y


	bool $w.config.f 17 0 "Enable Xilinx DDR3 MIG memory controller" CONFIG_MIG_7SERIES
	bool $w.config.f 17 1 "Enable fast simulation model  " CONFIG_MIG_7SERIES_MODEL



	focus $w
	update_active
	global winx; global winy
	if {[winfo exists .menu15] == 0} then {menu15 .menu15 "Memory controller             "}
	set winx [expr [winfo x .menu15]+30]; set winy [expr [winfo y .menu15]+30]
	if {[winfo exists $w]} then {wm geometry $w +$winx+$winy}
	update idletasks
	if {[winfo exists $w]} then  {$w.config.canvas create window 0 0 -anchor nw -window $w.config.f

	$w.config.canvas configure \
		-width [expr [winfo reqwidth $w.config.f] + 1]\
		-scrollregion "-1 -1 [expr [winfo reqwidth $w.config.f] + 1] \
			 [expr [winfo reqheight $w.config.f] + 1]"

	set winy [expr [winfo reqh $w] - [winfo reqh $w.config.canvas]]
	set scry [expr [winfo screenh $w] / 2]
	set maxy [expr [winfo screenh $w] * 3 / 4]
	set canvtotal [expr [winfo reqh $w.config.f] + 2]
	if [expr $winy + $canvtotal < $maxy] {
		$w.config.canvas configure -height $canvtotal
	} else {
		$w.config.canvas configure -height [expr $scry - $winy]
		}
	}
	update idletasks
	if {[winfo exists $w]} then {
	wm maxsize $w [winfo width $w] [winfo screenheight $w]
	wm minsize $w [winfo width $w] 100

	wm deiconify $w
}
}

proc update_menu17 {} {
}


proc update_define_menu17 {} {
	update_define_mainmenu
	global CONFIG_MODULES
}


proc menu18 {w title} {
	set oldFocus [focus]
	catch {focus .menu14}
	catch {destroy $w; unregister_active 18}
	toplevel $w -class Dialog
	wm withdraw $w
	global active_menus
	set active_menus [lsort -integer [linsert $active_menus end 18]]
	message $w.m -width 400 -aspect 300 -text \
		"On-chip RAM/ROM                 "  -relief raised
	pack $w.m -pady 10 -side top -padx 10
	wm title $w "On-chip RAM/ROM                 " 

	bind $w <Escape> "catch {focus $oldFocus}; destroy $w; unregister_active 18; break"
	set nextscript "catch {focus $oldFocus}; destroy $w; unregister_active 18; menu19 .menu19 \"$title\""
	frame $w.f
	button $w.f.back -text "OK" \
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 18"
	button $w.f.next -text "Next" -underline 0\
		-width 15 -command $nextscript
	bind all <Alt-n> $nextscript
	button $w.f.prev -text "Prev" -underline 0\
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 18; menu17 .menu17 \"$title\""
	bind $w <Alt-p> "catch {focus $oldFocus}; destroy $w; unregister_active 18; menu17 .menu17 \"$title\";break"
	pack $w.f.back $w.f.next $w.f.prev -side left -expand on
	pack $w.f -pady 10 -side bottom -anchor w -fill x
	frame $w.topline -relief ridge -borderwidth 2 -height 2
	pack $w.topline -side top -fill x

	frame $w.botline -relief ridge -borderwidth 2 -height 2
	pack $w.botline -side bottom -fill x

	frame $w.config
	pack $w.config -fill y -expand on

	scrollbar $w.config.vscroll -command "$w.config.canvas yview"
	pack $w.config.vscroll -side right -fill y

	canvas $w.config.canvas -height 1\
		-relief flat -borderwidth 0 -yscrollcommand "$w.config.vscroll set" \
		-width [expr [winfo screenwidth .] * 1 / 2] 
	frame $w.config.f
	bind $w <Key-Down> "$w.config.canvas yview scroll  1 unit;break;"
	bind $w <Key-Up> "$w.config.canvas yview scroll  -1 unit;break;"
	bind $w <Key-Next> "$w.config.canvas yview scroll  1 page;break;"
	bind $w <Key-Prior> "$w.config.canvas yview scroll  -1 page;break;"
	bind $w <Key-Home> "$w.config.canvas yview moveto 0;break;"
	bind $w <Key-End> "$w.config.canvas yview moveto 1 ;break;"
	pack $w.config.canvas -side right -fill y


	bool $w.config.f 18 0 "On-chip AHB ROM                   " CONFIG_AHBROM_ENABLE
	hex $w.config.f 18 1 "ROM start address (haddr\[31:20\]) " CONFIG_AHBROM_START
	bool $w.config.f 18 2 "Pipelined ROM access              " CONFIG_AHBROM_PIPE
	bool $w.config.f 18 3 "On-chip AHB RAM                   " CONFIG_AHBRAM_ENABLE
	global tmpvar_38
	minimenu $w.config.f 18 4 "AHB RAM size (Kbyte)" tmpvar_38 CONFIG_AHBRAM_SZ1
	menu $w.config.f.x4.x.menu -tearoffcommand "menutitle \"AHB RAM size (Kbyte)\""
	$w.config.f.x4.x.menu add radiobutton -label "1" -variable tmpvar_38 -value "1" -command "update_active"
	$w.config.f.x4.x.menu add radiobutton -label "2" -variable tmpvar_38 -value "2" -command "update_active"
	$w.config.f.x4.x.menu add radiobutton -label "4" -variable tmpvar_38 -value "4" -command "update_active"
	$w.config.f.x4.x.menu add radiobutton -label "8" -variable tmpvar_38 -value "8" -command "update_active"
	$w.config.f.x4.x.menu add radiobutton -label "16" -variable tmpvar_38 -value "16" -command "update_active"
	$w.config.f.x4.x.menu add radiobutton -label "32" -variable tmpvar_38 -value "32" -command "update_active"
	$w.config.f.x4.x.menu add radiobutton -label "64" -variable tmpvar_38 -value "64" -command "update_active"
	$w.config.f.x4.x.menu add radiobutton -label "128" -variable tmpvar_38 -value "128" -command "update_active"
	$w.config.f.x4.x.menu add radiobutton -label "256" -variable tmpvar_38 -value "256" -command "update_active"
	$w.config.f.x4.x.menu add radiobutton -label "512" -variable tmpvar_38 -value "512" -command "update_active"
	$w.config.f.x4.x.menu add radiobutton -label "1024" -variable tmpvar_38 -value "1024" -command "update_active"
	$w.config.f.x4.x.menu add radiobutton -label "2048" -variable tmpvar_38 -value "2048" -command "update_active"
	$w.config.f.x4.x.menu add radiobutton -label "4096" -variable tmpvar_38 -value "4096" -command "update_active"
	menusplit $w $w.config.f.x4.x.menu 13
	hex $w.config.f 18 5 "RAM start address (haddr\[31:20\]) " CONFIG_AHBRAM_START
	bool $w.config.f 18 6 "Extra pipeline stage             " CONFIG_AHBRAM_PIPE



	focus $w
	update_active
	global winx; global winy
	if {[winfo exists .menu14] == 0} then {menu14 .menu14 "Peripherals             "}
	set winx [expr [winfo x .menu14]+30]; set winy [expr [winfo y .menu14]+30]
	if {[winfo exists $w]} then {wm geometry $w +$winx+$winy}
	update idletasks
	if {[winfo exists $w]} then  {$w.config.canvas create window 0 0 -anchor nw -window $w.config.f

	$w.config.canvas configure \
		-width [expr [winfo reqwidth $w.config.f] + 1]\
		-scrollregion "-1 -1 [expr [winfo reqwidth $w.config.f] + 1] \
			 [expr [winfo reqheight $w.config.f] + 1]"

	set winy [expr [winfo reqh $w] - [winfo reqh $w.config.canvas]]
	set scry [expr [winfo screenh $w] / 2]
	set maxy [expr [winfo screenh $w] * 3 / 4]
	set canvtotal [expr [winfo reqh $w.config.f] + 2]
	if [expr $winy + $canvtotal < $maxy] {
		$w.config.canvas configure -height $canvtotal
	} else {
		$w.config.canvas configure -height [expr $scry - $winy]
		}
	}
	update idletasks
	if {[winfo exists $w]} then {
	wm maxsize $w [winfo width $w] [winfo screenheight $w]
	wm minsize $w [winfo width $w] 100

	wm deiconify $w
}
}

proc update_menu18 {} {
}


proc update_define_menu18 {} {
	update_define_mainmenu
	global CONFIG_MODULES
	global tmpvar_38
	global CONFIG_AHBRAM_SZ1
	if {$tmpvar_38 == "1"} then {set CONFIG_AHBRAM_SZ1 1} else {set CONFIG_AHBRAM_SZ1 0}
	global CONFIG_AHBRAM_SZ2
	if {$tmpvar_38 == "2"} then {set CONFIG_AHBRAM_SZ2 1} else {set CONFIG_AHBRAM_SZ2 0}
	global CONFIG_AHBRAM_SZ4
	if {$tmpvar_38 == "4"} then {set CONFIG_AHBRAM_SZ4 1} else {set CONFIG_AHBRAM_SZ4 0}
	global CONFIG_AHBRAM_SZ8
	if {$tmpvar_38 == "8"} then {set CONFIG_AHBRAM_SZ8 1} else {set CONFIG_AHBRAM_SZ8 0}
	global CONFIG_AHBRAM_SZ16
	if {$tmpvar_38 == "16"} then {set CONFIG_AHBRAM_SZ16 1} else {set CONFIG_AHBRAM_SZ16 0}
	global CONFIG_AHBRAM_SZ32
	if {$tmpvar_38 == "32"} then {set CONFIG_AHBRAM_SZ32 1} else {set CONFIG_AHBRAM_SZ32 0}
	global CONFIG_AHBRAM_SZ64
	if {$tmpvar_38 == "64"} then {set CONFIG_AHBRAM_SZ64 1} else {set CONFIG_AHBRAM_SZ64 0}
	global CONFIG_AHBRAM_SZ128
	if {$tmpvar_38 == "128"} then {set CONFIG_AHBRAM_SZ128 1} else {set CONFIG_AHBRAM_SZ128 0}
	global CONFIG_AHBRAM_SZ256
	if {$tmpvar_38 == "256"} then {set CONFIG_AHBRAM_SZ256 1} else {set CONFIG_AHBRAM_SZ256 0}
	global CONFIG_AHBRAM_SZ512
	if {$tmpvar_38 == "512"} then {set CONFIG_AHBRAM_SZ512 1} else {set CONFIG_AHBRAM_SZ512 0}
	global CONFIG_AHBRAM_SZ1024
	if {$tmpvar_38 == "1024"} then {set CONFIG_AHBRAM_SZ1024 1} else {set CONFIG_AHBRAM_SZ1024 0}
	global CONFIG_AHBRAM_SZ2048
	if {$tmpvar_38 == "2048"} then {set CONFIG_AHBRAM_SZ2048 1} else {set CONFIG_AHBRAM_SZ2048 0}
	global CONFIG_AHBRAM_SZ4096
	if {$tmpvar_38 == "4096"} then {set CONFIG_AHBRAM_SZ4096 1} else {set CONFIG_AHBRAM_SZ4096 0}
}


proc menu19 {w title} {
	set oldFocus [focus]
	catch {focus .menu14}
	catch {destroy $w; unregister_active 19}
	toplevel $w -class Dialog
	wm withdraw $w
	global active_menus
	set active_menus [lsort -integer [linsert $active_menus end 19]]
	message $w.m -width 400 -aspect 300 -text \
		"Ethernet             "  -relief raised
	pack $w.m -pady 10 -side top -padx 10
	wm title $w "Ethernet             " 

	bind $w <Escape> "catch {focus $oldFocus}; destroy $w; unregister_active 19; break"
	set nextscript "catch {focus $oldFocus}; destroy $w; unregister_active 19; menu20 .menu20 \"$title\""
	frame $w.f
	button $w.f.back -text "OK" \
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 19"
	button $w.f.next -text "Next" -underline 0\
		-width 15 -command $nextscript
	bind all <Alt-n> $nextscript
	button $w.f.prev -text "Prev" -underline 0\
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 19; menu18 .menu18 \"$title\""
	bind $w <Alt-p> "catch {focus $oldFocus}; destroy $w; unregister_active 19; menu18 .menu18 \"$title\";break"
	pack $w.f.back $w.f.next $w.f.prev -side left -expand on
	pack $w.f -pady 10 -side bottom -anchor w -fill x
	frame $w.topline -relief ridge -borderwidth 2 -height 2
	pack $w.topline -side top -fill x

	frame $w.botline -relief ridge -borderwidth 2 -height 2
	pack $w.botline -side bottom -fill x

	frame $w.config
	pack $w.config -fill y -expand on

	scrollbar $w.config.vscroll -command "$w.config.canvas yview"
	pack $w.config.vscroll -side right -fill y

	canvas $w.config.canvas -height 1\
		-relief flat -borderwidth 0 -yscrollcommand "$w.config.vscroll set" \
		-width [expr [winfo screenwidth .] * 1 / 2] 
	frame $w.config.f
	bind $w <Key-Down> "$w.config.canvas yview scroll  1 unit;break;"
	bind $w <Key-Up> "$w.config.canvas yview scroll  -1 unit;break;"
	bind $w <Key-Next> "$w.config.canvas yview scroll  1 page;break;"
	bind $w <Key-Prior> "$w.config.canvas yview scroll  -1 page;break;"
	bind $w <Key-Home> "$w.config.canvas yview moveto 0;break;"
	bind $w <Key-End> "$w.config.canvas yview moveto 1 ;break;"
	pack $w.config.canvas -side right -fill y


	bool $w.config.f 19 0 "Gaisler Research 10/100/1000 Mbit Ethernet MAC " CONFIG_GRETH_ENABLE
	bool $w.config.f 19 1 "Enable 1000 Mbit support    " CONFIG_GRETH_GIGA
	global tmpvar_39
	minimenu $w.config.f 19 2 "AHB FIFO size (words)            " tmpvar_39 CONFIG_GRETH_FIFO4
	menu $w.config.f.x2.x.menu -tearoffcommand "menutitle \"AHB FIFO size (words)            \""
	$w.config.f.x2.x.menu add radiobutton -label "4" -variable tmpvar_39 -value "4" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "8" -variable tmpvar_39 -value "8" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "16" -variable tmpvar_39 -value "16" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "32" -variable tmpvar_39 -value "32" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "64" -variable tmpvar_39 -value "64" -command "update_active"
	menusplit $w $w.config.f.x2.x.menu 5
	bool $w.config.f 19 3 "Enable fault-tolerance" CONFIG_GRETH_FT
	bool $w.config.f 19 4 "Enable fault tolerance for EDCL buffer " CONFIG_GRETH_EDCLFT



	focus $w
	update_active
	global winx; global winy
	if {[winfo exists .menu14] == 0} then {menu14 .menu14 "Peripherals             "}
	set winx [expr [winfo x .menu14]+30]; set winy [expr [winfo y .menu14]+30]
	if {[winfo exists $w]} then {wm geometry $w +$winx+$winy}
	update idletasks
	if {[winfo exists $w]} then  {$w.config.canvas create window 0 0 -anchor nw -window $w.config.f

	$w.config.canvas configure \
		-width [expr [winfo reqwidth $w.config.f] + 1]\
		-scrollregion "-1 -1 [expr [winfo reqwidth $w.config.f] + 1] \
			 [expr [winfo reqheight $w.config.f] + 1]"

	set winy [expr [winfo reqh $w] - [winfo reqh $w.config.canvas]]
	set scry [expr [winfo screenh $w] / 2]
	set maxy [expr [winfo screenh $w] * 3 / 4]
	set canvtotal [expr [winfo reqh $w.config.f] + 2]
	if [expr $winy + $canvtotal < $maxy] {
		$w.config.canvas configure -height $canvtotal
	} else {
		$w.config.canvas configure -height [expr $scry - $winy]
		}
	}
	update idletasks
	if {[winfo exists $w]} then {
	wm maxsize $w [winfo width $w] [winfo screenheight $w]
	wm minsize $w [winfo width $w] 100

	wm deiconify $w
}
}

proc update_menu19 {} {
	global CONFIG_GRETH_GIGA
	if {($CONFIG_GRETH_GIGA == 0)} then {configure_entry .menu19.config.f.x2 normal {x l}} else {configure_entry .menu19.config.f.x2 disabled {x l}}
	global CONFIG_LEON3FT_PRESENT
	global CONFIG_GRETH_FT
	if {($CONFIG_LEON3FT_PRESENT == 1)} then {
	configure_entry .menu19.config.f.x3 normal {n l y}} else {configure_entry .menu19.config.f.x3 disabled {y n l}}
	global CONFIG_GRETH_EDCLFT
	if {($CONFIG_LEON3FT_PRESENT == 1) && ($CONFIG_GRETH_FT == 1)} then {
	configure_entry .menu19.config.f.x4 normal {n l y}} else {configure_entry .menu19.config.f.x4 disabled {y n l}}
}


proc update_define_menu19 {} {
	update_define_mainmenu
	global CONFIG_MODULES
	global tmpvar_39
	global CONFIG_GRETH_FIFO4
	if {$tmpvar_39 == "4"} then {set CONFIG_GRETH_FIFO4 1} else {set CONFIG_GRETH_FIFO4 0}
	global CONFIG_GRETH_FIFO8
	if {$tmpvar_39 == "8"} then {set CONFIG_GRETH_FIFO8 1} else {set CONFIG_GRETH_FIFO8 0}
	global CONFIG_GRETH_FIFO16
	if {$tmpvar_39 == "16"} then {set CONFIG_GRETH_FIFO16 1} else {set CONFIG_GRETH_FIFO16 0}
	global CONFIG_GRETH_FIFO32
	if {$tmpvar_39 == "32"} then {set CONFIG_GRETH_FIFO32 1} else {set CONFIG_GRETH_FIFO32 0}
	global CONFIG_GRETH_FIFO64
	if {$tmpvar_39 == "64"} then {set CONFIG_GRETH_FIFO64 1} else {set CONFIG_GRETH_FIFO64 0}
	global CONFIG_LEON3FT_PRESENT
	global CONFIG_GRETH_FT
	if {($CONFIG_LEON3FT_PRESENT == 1)} then {
	set CONFIG_GRETH_FT [expr $CONFIG_GRETH_FT&15]} else {set CONFIG_GRETH_FT [expr $CONFIG_GRETH_FT|16]}
	global CONFIG_GRETH_EDCLFT
	if {($CONFIG_LEON3FT_PRESENT == 1) && ($CONFIG_GRETH_FT == 1)} then {
	set CONFIG_GRETH_EDCLFT [expr $CONFIG_GRETH_EDCLFT&15]} else {set CONFIG_GRETH_EDCLFT [expr $CONFIG_GRETH_EDCLFT|16]}
}


proc menu20 {w title} {
	set oldFocus [focus]
	catch {focus .menu14}
	catch {destroy $w; unregister_active 20}
	toplevel $w -class Dialog
	wm withdraw $w
	global active_menus
	set active_menus [lsort -integer [linsert $active_menus end 20]]
	message $w.m -width 400 -aspect 300 -text \
		"USB 2.0 Host Controller      "  -relief raised
	pack $w.m -pady 10 -side top -padx 10
	wm title $w "USB 2.0 Host Controller      " 

	bind $w <Escape> "catch {focus $oldFocus}; destroy $w; unregister_active 20; break"
	set nextscript "catch {focus $oldFocus}; destroy $w; unregister_active 20; menu21 .menu21 \"$title\""
	frame $w.f
	button $w.f.back -text "OK" \
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 20"
	button $w.f.next -text "Next" -underline 0\
		-width 15 -command $nextscript
	bind all <Alt-n> $nextscript
	button $w.f.prev -text "Prev" -underline 0\
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 20; menu19 .menu19 \"$title\""
	bind $w <Alt-p> "catch {focus $oldFocus}; destroy $w; unregister_active 20; menu19 .menu19 \"$title\";break"
	pack $w.f.back $w.f.next $w.f.prev -side left -expand on
	pack $w.f -pady 10 -side bottom -anchor w -fill x
	frame $w.topline -relief ridge -borderwidth 2 -height 2
	pack $w.topline -side top -fill x

	frame $w.botline -relief ridge -borderwidth 2 -height 2
	pack $w.botline -side bottom -fill x

	frame $w.config
	pack $w.config -fill y -expand on

	scrollbar $w.config.vscroll -command "$w.config.canvas yview"
	pack $w.config.vscroll -side right -fill y

	canvas $w.config.canvas -height 1\
		-relief flat -borderwidth 0 -yscrollcommand "$w.config.vscroll set" \
		-width [expr [winfo screenwidth .] * 1 / 2] 
	frame $w.config.f
	bind $w <Key-Down> "$w.config.canvas yview scroll  1 unit;break;"
	bind $w <Key-Up> "$w.config.canvas yview scroll  -1 unit;break;"
	bind $w <Key-Next> "$w.config.canvas yview scroll  1 page;break;"
	bind $w <Key-Prior> "$w.config.canvas yview scroll  -1 page;break;"
	bind $w <Key-Home> "$w.config.canvas yview moveto 0;break;"
	bind $w <Key-End> "$w.config.canvas yview moveto 1 ;break;"
	pack $w.config.canvas -side right -fill y


	bool $w.config.f 20 0 "Gaisler Research USB 2.0 Host Controller " CONFIG_GRUSBHC_ENABLE
	bool $w.config.f 20 1 "Enable Enhanced Host Controller " CONFIG_GRUSBHC_EHC
	bool $w.config.f 20 2 "Enable Universal Host Controller " CONFIG_GRUSBHC_UHC
	int $w.config.f 20 3 "Number of Universal Host Controllers (1-15)" CONFIG_GRUSBHC_NCC
	int $w.config.f 20 4 "Total number of ports  (1-15)" CONFIG_GRUSBHC_NPORTS
	global tmpvar_40
	minimenu $w.config.f 20 5 "Transceiver interface" tmpvar_40 CONFIG_GRUSBHC_ULPI
	menu $w.config.f.x5.x.menu -tearoffcommand "menutitle \"Transceiver interface\""
	$w.config.f.x5.x.menu add radiobutton -label "ULPI" -variable tmpvar_40 -value "ULPI" -command "update_active"
	$w.config.f.x5.x.menu add radiobutton -label "UTMI+16-bit" -variable tmpvar_40 -value "UTMI+16-bit" -command "update_active"
	$w.config.f.x5.x.menu add radiobutton -label "UTMI+8-bit" -variable tmpvar_40 -value "UTMI+8-bit" -command "update_active"
	menusplit $w $w.config.f.x5.x.menu 3
	global tmpvar_41
	minimenu $w.config.f 20 6 "Bus power generation" tmpvar_41 CONFIG_GRUSBHC_VBUSEXT
	menu $w.config.f.x6.x.menu -tearoffcommand "menutitle \"Bus power generation\""
	$w.config.f.x6.x.menu add radiobutton -label "External" -variable tmpvar_41 -value "External" -command "update_active"
	$w.config.f.x6.x.menu add radiobutton -label "Internal" -variable tmpvar_41 -value "Internal" -command "update_active"
	menusplit $w $w.config.f.x6.x.menu 2
	global tmpvar_42
	minimenu $w.config.f 20 7 "External bus fault indicator" tmpvar_42 CONFIG_GRUSBHC_FAULTL
	menu $w.config.f.x7.x.menu -tearoffcommand "menutitle \"External bus fault indicator\""
	$w.config.f.x7.x.menu add radiobutton -label "ActiveLow" -variable tmpvar_42 -value "ActiveLow" -command "update_active"
	$w.config.f.x7.x.menu add radiobutton -label "ActiveHigh" -variable tmpvar_42 -value "ActiveHigh" -command "update_active"
	$w.config.f.x7.x.menu add radiobutton -label "None" -variable tmpvar_42 -value "None" -command "update_active"
	menusplit $w $w.config.f.x7.x.menu 3
	global tmpvar_43
	minimenu $w.config.f 20 8 "Bus power enable signal" tmpvar_43 CONFIG_GRUSBHC_ENABLEH
	menu $w.config.f.x8.x.menu -tearoffcommand "menutitle \"Bus power enable signal\""
	$w.config.f.x8.x.menu add radiobutton -label "ActiveHigh" -variable tmpvar_43 -value "ActiveHigh" -command "update_active"
	$w.config.f.x8.x.menu add radiobutton -label "ActiveLow" -variable tmpvar_43 -value "ActiveLow" -command "update_active"
	menusplit $w $w.config.f.x8.x.menu 2
	global tmpvar_44
	minimenu $w.config.f 20 9 "Bus power fault indicator" tmpvar_44 CONFIG_GRUSBHC_FAULT2H
	menu $w.config.f.x9.x.menu -tearoffcommand "menutitle \"Bus power fault indicator\""
	$w.config.f.x9.x.menu add radiobutton -label "ActiveHigh" -variable tmpvar_44 -value "ActiveHigh" -command "update_active"
	$w.config.f.x9.x.menu add radiobutton -label "ActiveLow" -variable tmpvar_44 -value "ActiveLow" -command "update_active"
	menusplit $w $w.config.f.x9.x.menu 2
	comment $w.config.f 20 10 "Memory interface"
	bool $w.config.f 20 11 "Enable big endian register interface" CONFIG_GRUSBHC_BEREGS
	bool $w.config.f 20 12 "Enable big endian descriptors" CONFIG_GRUSBHC_BEDESC
	int $w.config.f 20 13 "Maximum burst length in words (1-256)" CONFIG_GRUSBHC_BWRD
	comment $w.config.f 20 14 "Port routing"
	bool $w.config.f 20 15 "Port routing rules" CONFIG_GRUSBHC_PRR
	int $w.config.f 20 16 "Number of ports per companion controller (1-15)" CONFIG_GRUSBHC_NPCC
	int $w.config.f 20 17 "Route port 1 to companion controller " CONFIG_GRUSBHC_PR1
	int $w.config.f 20 18 "Route port 2 to companion controller " CONFIG_GRUSBHC_PR2
	int $w.config.f 20 19 "Route port 3 to companion controller " CONFIG_GRUSBHC_PR3
	int $w.config.f 20 20 "Route port 4 to companion controller " CONFIG_GRUSBHC_PR4
	int $w.config.f 20 21 "Route port 5 to companion controller " CONFIG_GRUSBHC_PR5
	int $w.config.f 20 22 "Route port 6 to companion controller " CONFIG_GRUSBHC_PR6
	int $w.config.f 20 23 "Route port 7 to companion controller " CONFIG_GRUSBHC_PR7
	int $w.config.f 20 24 "Route port 8 to companion controller " CONFIG_GRUSBHC_PR8
	int $w.config.f 20 25 "Route port 9 to companion controller " CONFIG_GRUSBHC_PR9
	int $w.config.f 20 26 "Route port 10 to companion controller " CONFIG_GRUSBHC_PR10
	int $w.config.f 20 27 "Route port 11 to companion controller " CONFIG_GRUSBHC_PR11
	int $w.config.f 20 28 "Route port 12 to companion controller " CONFIG_GRUSBHC_PR12
	int $w.config.f 20 29 "Route port 13 to companion controller " CONFIG_GRUSBHC_PR13
	int $w.config.f 20 30 "Route port 14 to companion controller " CONFIG_GRUSBHC_PR14
	int $w.config.f 20 31 "Route port 15 to companion controller " CONFIG_GRUSBHC_PR15



	focus $w
	update_active
	global winx; global winy
	if {[winfo exists .menu14] == 0} then {menu14 .menu14 "Peripherals             "}
	set winx [expr [winfo x .menu14]+30]; set winy [expr [winfo y .menu14]+30]
	if {[winfo exists $w]} then {wm geometry $w +$winx+$winy}
	update idletasks
	if {[winfo exists $w]} then  {$w.config.canvas create window 0 0 -anchor nw -window $w.config.f

	$w.config.canvas configure \
		-width [expr [winfo reqwidth $w.config.f] + 1]\
		-scrollregion "-1 -1 [expr [winfo reqwidth $w.config.f] + 1] \
			 [expr [winfo reqheight $w.config.f] + 1]"

	set winy [expr [winfo reqh $w] - [winfo reqh $w.config.canvas]]
	set scry [expr [winfo screenh $w] / 2]
	set maxy [expr [winfo screenh $w] * 3 / 4]
	set canvtotal [expr [winfo reqh $w.config.f] + 2]
	if [expr $winy + $canvtotal < $maxy] {
		$w.config.canvas configure -height $canvtotal
	} else {
		$w.config.canvas configure -height [expr $scry - $winy]
		}
	}
	update idletasks
	if {[winfo exists $w]} then {
	wm maxsize $w [winfo width $w] [winfo screenheight $w]
	wm minsize $w [winfo width $w] 100

	wm deiconify $w
}
}

proc update_menu20 {} {
	global CONFIG_GRUSBHC_UHC
	global CONFIG_GRUSBHC_NCC
	if {($CONFIG_GRUSBHC_UHC == 1)} then {.menu20.config.f.x3.x configure -state normal -foreground [ cget .ref -foreground ]; .menu20.config.f.x3.l configure -state normal; } else {.menu20.config.f.x3.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu20.config.f.x3.l configure -state disabled}
	global CONFIG_GRUSBHC_ULPI
	if {($CONFIG_GRUSBHC_ULPI == 1)} then {configure_entry .menu20.config.f.x6 normal {x l}} else {configure_entry .menu20.config.f.x6 disabled {x l}}
	global CONFIG_GRUSBHC_VBUSEXT
	if {($CONFIG_GRUSBHC_ULPI == 1) && ($CONFIG_GRUSBHC_VBUSEXT == 1)} then {configure_entry .menu20.config.f.x7 normal {x l}} else {configure_entry .menu20.config.f.x7 disabled {x l}}
	if {($CONFIG_GRUSBHC_ULPI != 1)} then {configure_entry .menu20.config.f.x8 normal {x l}} else {configure_entry .menu20.config.f.x8 disabled {x l}}
	if {($CONFIG_GRUSBHC_ULPI != 1)} then {configure_entry .menu20.config.f.x9 normal {x l}} else {configure_entry .menu20.config.f.x9 disabled {x l}}
	global CONFIG_GRUSBHC_PRR
	global CONFIG_GRUSBHC_NPCC
	if {($CONFIG_GRUSBHC_PRR == 0)} then {.menu20.config.f.x16.x configure -state normal -foreground [ cget .ref -foreground ]; .menu20.config.f.x16.l configure -state normal; } else {.menu20.config.f.x16.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu20.config.f.x16.l configure -state disabled}
	global CONFIG_GRUSBHC_PR1
	if {($CONFIG_GRUSBHC_PRR != 0)} then {.menu20.config.f.x17.x configure -state normal -foreground [ cget .ref -foreground ]; .menu20.config.f.x17.l configure -state normal; } else {.menu20.config.f.x17.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu20.config.f.x17.l configure -state disabled}
	global CONFIG_GRUSBHC_PR2
	if {($CONFIG_GRUSBHC_PRR != 0)} then {.menu20.config.f.x18.x configure -state normal -foreground [ cget .ref -foreground ]; .menu20.config.f.x18.l configure -state normal; } else {.menu20.config.f.x18.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu20.config.f.x18.l configure -state disabled}
	global CONFIG_GRUSBHC_PR3
	if {($CONFIG_GRUSBHC_PRR != 0)} then {.menu20.config.f.x19.x configure -state normal -foreground [ cget .ref -foreground ]; .menu20.config.f.x19.l configure -state normal; } else {.menu20.config.f.x19.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu20.config.f.x19.l configure -state disabled}
	global CONFIG_GRUSBHC_PR4
	if {($CONFIG_GRUSBHC_PRR != 0)} then {.menu20.config.f.x20.x configure -state normal -foreground [ cget .ref -foreground ]; .menu20.config.f.x20.l configure -state normal; } else {.menu20.config.f.x20.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu20.config.f.x20.l configure -state disabled}
	global CONFIG_GRUSBHC_PR5
	if {($CONFIG_GRUSBHC_PRR != 0)} then {.menu20.config.f.x21.x configure -state normal -foreground [ cget .ref -foreground ]; .menu20.config.f.x21.l configure -state normal; } else {.menu20.config.f.x21.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu20.config.f.x21.l configure -state disabled}
	global CONFIG_GRUSBHC_PR6
	if {($CONFIG_GRUSBHC_PRR != 0)} then {.menu20.config.f.x22.x configure -state normal -foreground [ cget .ref -foreground ]; .menu20.config.f.x22.l configure -state normal; } else {.menu20.config.f.x22.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu20.config.f.x22.l configure -state disabled}
	global CONFIG_GRUSBHC_PR7
	if {($CONFIG_GRUSBHC_PRR != 0)} then {.menu20.config.f.x23.x configure -state normal -foreground [ cget .ref -foreground ]; .menu20.config.f.x23.l configure -state normal; } else {.menu20.config.f.x23.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu20.config.f.x23.l configure -state disabled}
	global CONFIG_GRUSBHC_PR8
	if {($CONFIG_GRUSBHC_PRR != 0)} then {.menu20.config.f.x24.x configure -state normal -foreground [ cget .ref -foreground ]; .menu20.config.f.x24.l configure -state normal; } else {.menu20.config.f.x24.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu20.config.f.x24.l configure -state disabled}
	global CONFIG_GRUSBHC_PR9
	if {($CONFIG_GRUSBHC_PRR != 0)} then {.menu20.config.f.x25.x configure -state normal -foreground [ cget .ref -foreground ]; .menu20.config.f.x25.l configure -state normal; } else {.menu20.config.f.x25.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu20.config.f.x25.l configure -state disabled}
	global CONFIG_GRUSBHC_PR10
	if {($CONFIG_GRUSBHC_PRR != 0)} then {.menu20.config.f.x26.x configure -state normal -foreground [ cget .ref -foreground ]; .menu20.config.f.x26.l configure -state normal; } else {.menu20.config.f.x26.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu20.config.f.x26.l configure -state disabled}
	global CONFIG_GRUSBHC_PR11
	if {($CONFIG_GRUSBHC_PRR != 0)} then {.menu20.config.f.x27.x configure -state normal -foreground [ cget .ref -foreground ]; .menu20.config.f.x27.l configure -state normal; } else {.menu20.config.f.x27.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu20.config.f.x27.l configure -state disabled}
	global CONFIG_GRUSBHC_PR12
	if {($CONFIG_GRUSBHC_PRR != 0)} then {.menu20.config.f.x28.x configure -state normal -foreground [ cget .ref -foreground ]; .menu20.config.f.x28.l configure -state normal; } else {.menu20.config.f.x28.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu20.config.f.x28.l configure -state disabled}
	global CONFIG_GRUSBHC_PR13
	if {($CONFIG_GRUSBHC_PRR != 0)} then {.menu20.config.f.x29.x configure -state normal -foreground [ cget .ref -foreground ]; .menu20.config.f.x29.l configure -state normal; } else {.menu20.config.f.x29.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu20.config.f.x29.l configure -state disabled}
	global CONFIG_GRUSBHC_PR14
	if {($CONFIG_GRUSBHC_PRR != 0)} then {.menu20.config.f.x30.x configure -state normal -foreground [ cget .ref -foreground ]; .menu20.config.f.x30.l configure -state normal; } else {.menu20.config.f.x30.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu20.config.f.x30.l configure -state disabled}
	global CONFIG_GRUSBHC_PR15
	if {($CONFIG_GRUSBHC_PRR != 0)} then {.menu20.config.f.x31.x configure -state normal -foreground [ cget .ref -foreground ]; .menu20.config.f.x31.l configure -state normal; } else {.menu20.config.f.x31.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu20.config.f.x31.l configure -state disabled}
}


proc update_define_menu20 {} {
	update_define_mainmenu
	global CONFIG_MODULES
	global CONFIG_GRUSBHC_UHC
	global CONFIG_GRUSBHC_NCC
	if {($CONFIG_GRUSBHC_UHC == 1)} then {validate_int CONFIG_GRUSBHC_NCC "$CONFIG_GRUSBHC_NCC" 1}
	global tmpvar_40
	global CONFIG_GRUSBHC_ULPI
	if {$tmpvar_40 == "ULPI"} then {set CONFIG_GRUSBHC_ULPI 1} else {set CONFIG_GRUSBHC_ULPI 0}
	global CONFIG_GRUSBHC_UTMI16
	if {$tmpvar_40 == "UTMI+16-bit"} then {set CONFIG_GRUSBHC_UTMI16 1} else {set CONFIG_GRUSBHC_UTMI16 0}
	global CONFIG_GRUSBHC_UTMI8
	if {$tmpvar_40 == "UTMI+8-bit"} then {set CONFIG_GRUSBHC_UTMI8 1} else {set CONFIG_GRUSBHC_UTMI8 0}
	global tmpvar_41
	global CONFIG_GRUSBHC_VBUSEXT
	if {$tmpvar_41 == "External"} then {set CONFIG_GRUSBHC_VBUSEXT 1} else {set CONFIG_GRUSBHC_VBUSEXT 0}
	global CONFIG_GRUSBHC_VBUSINT
	if {$tmpvar_41 == "Internal"} then {set CONFIG_GRUSBHC_VBUSINT 1} else {set CONFIG_GRUSBHC_VBUSINT 0}
	global tmpvar_42
	global CONFIG_GRUSBHC_FAULTL
	if {$tmpvar_42 == "ActiveLow"} then {set CONFIG_GRUSBHC_FAULTL 1} else {set CONFIG_GRUSBHC_FAULTL 0}
	global CONFIG_GRUSBHC_FAULTH
	if {$tmpvar_42 == "ActiveHigh"} then {set CONFIG_GRUSBHC_FAULTH 1} else {set CONFIG_GRUSBHC_FAULTH 0}
	global CONFIG_GRUSBHC_FAULTN
	if {$tmpvar_42 == "None"} then {set CONFIG_GRUSBHC_FAULTN 1} else {set CONFIG_GRUSBHC_FAULTN 0}
	global tmpvar_43
	global CONFIG_GRUSBHC_ENABLEH
	if {$tmpvar_43 == "ActiveHigh"} then {set CONFIG_GRUSBHC_ENABLEH 1} else {set CONFIG_GRUSBHC_ENABLEH 0}
	global CONFIG_GRUSBHC_ENABLEL
	if {$tmpvar_43 == "ActiveLow"} then {set CONFIG_GRUSBHC_ENABLEL 1} else {set CONFIG_GRUSBHC_ENABLEL 0}
	global tmpvar_44
	global CONFIG_GRUSBHC_FAULT2H
	if {$tmpvar_44 == "ActiveHigh"} then {set CONFIG_GRUSBHC_FAULT2H 1} else {set CONFIG_GRUSBHC_FAULT2H 0}
	global CONFIG_GRUSBHC_FAULT2L
	if {$tmpvar_44 == "ActiveLow"} then {set CONFIG_GRUSBHC_FAULT2L 1} else {set CONFIG_GRUSBHC_FAULT2L 0}
	global CONFIG_GRUSBHC_PRR
	global CONFIG_GRUSBHC_NPCC
	if {($CONFIG_GRUSBHC_PRR == 0)} then {validate_int CONFIG_GRUSBHC_NPCC "$CONFIG_GRUSBHC_NPCC" 1}
	global CONFIG_GRUSBHC_PR1
	if {($CONFIG_GRUSBHC_PRR != 0)} then {validate_int CONFIG_GRUSBHC_PR1 "$CONFIG_GRUSBHC_PR1" 0}
	global CONFIG_GRUSBHC_PR2
	if {($CONFIG_GRUSBHC_PRR != 0)} then {validate_int CONFIG_GRUSBHC_PR2 "$CONFIG_GRUSBHC_PR2" 0}
	global CONFIG_GRUSBHC_PR3
	if {($CONFIG_GRUSBHC_PRR != 0)} then {validate_int CONFIG_GRUSBHC_PR3 "$CONFIG_GRUSBHC_PR3" 0}
	global CONFIG_GRUSBHC_PR4
	if {($CONFIG_GRUSBHC_PRR != 0)} then {validate_int CONFIG_GRUSBHC_PR4 "$CONFIG_GRUSBHC_PR4" 0}
	global CONFIG_GRUSBHC_PR5
	if {($CONFIG_GRUSBHC_PRR != 0)} then {validate_int CONFIG_GRUSBHC_PR5 "$CONFIG_GRUSBHC_PR5" 0}
	global CONFIG_GRUSBHC_PR6
	if {($CONFIG_GRUSBHC_PRR != 0)} then {validate_int CONFIG_GRUSBHC_PR6 "$CONFIG_GRUSBHC_PR6" 0}
	global CONFIG_GRUSBHC_PR7
	if {($CONFIG_GRUSBHC_PRR != 0)} then {validate_int CONFIG_GRUSBHC_PR7 "$CONFIG_GRUSBHC_PR7" 0}
	global CONFIG_GRUSBHC_PR8
	if {($CONFIG_GRUSBHC_PRR != 0)} then {validate_int CONFIG_GRUSBHC_PR8 "$CONFIG_GRUSBHC_PR8" 0}
	global CONFIG_GRUSBHC_PR9
	if {($CONFIG_GRUSBHC_PRR != 0)} then {validate_int CONFIG_GRUSBHC_PR9 "$CONFIG_GRUSBHC_PR9" 0}
	global CONFIG_GRUSBHC_PR10
	if {($CONFIG_GRUSBHC_PRR != 0)} then {validate_int CONFIG_GRUSBHC_PR10 "$CONFIG_GRUSBHC_PR10" 0}
	global CONFIG_GRUSBHC_PR11
	if {($CONFIG_GRUSBHC_PRR != 0)} then {validate_int CONFIG_GRUSBHC_PR11 "$CONFIG_GRUSBHC_PR11" 0}
	global CONFIG_GRUSBHC_PR12
	if {($CONFIG_GRUSBHC_PRR != 0)} then {validate_int CONFIG_GRUSBHC_PR12 "$CONFIG_GRUSBHC_PR12" 0}
	global CONFIG_GRUSBHC_PR13
	if {($CONFIG_GRUSBHC_PRR != 0)} then {validate_int CONFIG_GRUSBHC_PR13 "$CONFIG_GRUSBHC_PR13" 0}
	global CONFIG_GRUSBHC_PR14
	if {($CONFIG_GRUSBHC_PRR != 0)} then {validate_int CONFIG_GRUSBHC_PR14 "$CONFIG_GRUSBHC_PR14" 0}
	global CONFIG_GRUSBHC_PR15
	if {($CONFIG_GRUSBHC_PRR != 0)} then {validate_int CONFIG_GRUSBHC_PR15 "$CONFIG_GRUSBHC_PR15" 0}
}


proc menu21 {w title} {
	set oldFocus [focus]
	catch {focus .menu14}
	catch {destroy $w; unregister_active 21}
	toplevel $w -class Dialog
	wm withdraw $w
	global active_menus
	set active_menus [lsort -integer [linsert $active_menus end 21]]
	message $w.m -width 400 -aspect 300 -text \
		"USB 2.0 Device Controller      "  -relief raised
	pack $w.m -pady 10 -side top -padx 10
	wm title $w "USB 2.0 Device Controller      " 

	bind $w <Escape> "catch {focus $oldFocus}; destroy $w; unregister_active 21; break"
	set nextscript "catch {focus $oldFocus}; destroy $w; unregister_active 21; menu22 .menu22 \"$title\""
	frame $w.f
	button $w.f.back -text "OK" \
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 21"
	button $w.f.next -text "Next" -underline 0\
		-width 15 -command $nextscript
	bind all <Alt-n> $nextscript
	button $w.f.prev -text "Prev" -underline 0\
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 21; menu20 .menu20 \"$title\""
	bind $w <Alt-p> "catch {focus $oldFocus}; destroy $w; unregister_active 21; menu20 .menu20 \"$title\";break"
	pack $w.f.back $w.f.next $w.f.prev -side left -expand on
	pack $w.f -pady 10 -side bottom -anchor w -fill x
	frame $w.topline -relief ridge -borderwidth 2 -height 2
	pack $w.topline -side top -fill x

	frame $w.botline -relief ridge -borderwidth 2 -height 2
	pack $w.botline -side bottom -fill x

	frame $w.config
	pack $w.config -fill y -expand on

	scrollbar $w.config.vscroll -command "$w.config.canvas yview"
	pack $w.config.vscroll -side right -fill y

	canvas $w.config.canvas -height 1\
		-relief flat -borderwidth 0 -yscrollcommand "$w.config.vscroll set" \
		-width [expr [winfo screenwidth .] * 1 / 2] 
	frame $w.config.f
	bind $w <Key-Down> "$w.config.canvas yview scroll  1 unit;break;"
	bind $w <Key-Up> "$w.config.canvas yview scroll  -1 unit;break;"
	bind $w <Key-Next> "$w.config.canvas yview scroll  1 page;break;"
	bind $w <Key-Prior> "$w.config.canvas yview scroll  -1 page;break;"
	bind $w <Key-Home> "$w.config.canvas yview moveto 0;break;"
	bind $w <Key-End> "$w.config.canvas yview moveto 1 ;break;"
	pack $w.config.canvas -side right -fill y


	bool $w.config.f 21 0 "Gaisler Research USB 2.0 Device Controller " CONFIG_GRUSBDC_ENABLE
	bool $w.config.f 21 1 "AHB Master Interface" CONFIG_GRUSBDC_AIFACE
	global tmpvar_45
	minimenu $w.config.f 21 2 "USB Transceiver Interface" tmpvar_45 CONFIG_GRUSBDC_ULPI
	menu $w.config.f.x2.x.menu -tearoffcommand "menutitle \"USB Transceiver Interface\""
	$w.config.f.x2.x.menu add radiobutton -label "ULPI" -variable tmpvar_45 -value "ULPI" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "UTMI/UTMI+8-bit" -variable tmpvar_45 -value "UTMI/UTMI+8-bit" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "UTMI/UTMI+16-bit" -variable tmpvar_45 -value "UTMI/UTMI+16-bit" -command "update_active"
	menusplit $w $w.config.f.x2.x.menu 3
	int $w.config.f 21 3 "Number of IN endpoints " CONFIG_GRUSBDC_NEPI
	int $w.config.f 21 4 "Number of OUT endpoints" CONFIG_GRUSBDC_NEPO
	int $w.config.f 21 5 "Buffer size for IN endpoint 0 " CONFIG_GRUSBDC_I0
	int $w.config.f 21 6 "Buffer size for IN endpoint 1 " CONFIG_GRUSBDC_I1
	int $w.config.f 21 7 "Buffer size for IN endpoint 2 " CONFIG_GRUSBDC_I2
	int $w.config.f 21 8 "Buffer size for IN endpoint 3 " CONFIG_GRUSBDC_I3
	int $w.config.f 21 9 "Buffer size for IN endpoint 4 " CONFIG_GRUSBDC_I4
	int $w.config.f 21 10 "Buffer size for IN endpoint 5 " CONFIG_GRUSBDC_I5
	int $w.config.f 21 11 "Buffer size for IN endpoint 6 " CONFIG_GRUSBDC_I6
	int $w.config.f 21 12 "Buffer size for IN endpoint 7 " CONFIG_GRUSBDC_I7
	int $w.config.f 21 13 "Buffer size for IN endpoint 8 " CONFIG_GRUSBDC_I8
	int $w.config.f 21 14 "Buffer size for IN endpoint 9 " CONFIG_GRUSBDC_I9
	int $w.config.f 21 15 "Buffer size for IN endpoint 10 " CONFIG_GRUSBDC_I10
	int $w.config.f 21 16 "Buffer size for IN endpoint 11 " CONFIG_GRUSBDC_I11
	int $w.config.f 21 17 "Buffer size for IN endpoint 12 " CONFIG_GRUSBDC_I12
	int $w.config.f 21 18 "Buffer size for IN endpoint 13 " CONFIG_GRUSBDC_I13
	int $w.config.f 21 19 "Buffer size for IN endpoint 14 " CONFIG_GRUSBDC_I14
	int $w.config.f 21 20 "Buffer size for IN endpoint 15 " CONFIG_GRUSBDC_I15
	int $w.config.f 21 21 "Buffer size for OUT endpoint 0" CONFIG_GRUSBDC_O0
	int $w.config.f 21 22 "Buffer size for OUT endpoint 1" CONFIG_GRUSBDC_O1
	int $w.config.f 21 23 "Buffer size for OUT endpoint 2" CONFIG_GRUSBDC_O2
	int $w.config.f 21 24 "Buffer size for OUT endpoint 3" CONFIG_GRUSBDC_O3
	int $w.config.f 21 25 "Buffer size for OUT endpoint 4" CONFIG_GRUSBDC_O4
	int $w.config.f 21 26 "Buffer size for OUT endpoint 5" CONFIG_GRUSBDC_O5
	int $w.config.f 21 27 "Buffer size for OUT endpoint 6" CONFIG_GRUSBDC_O6
	int $w.config.f 21 28 "Buffer size for OUT endpoint 7" CONFIG_GRUSBDC_O7
	int $w.config.f 21 29 "Buffer size for OUT endpoint 8" CONFIG_GRUSBDC_O8
	int $w.config.f 21 30 "Buffer size for OUT endpoint 9" CONFIG_GRUSBDC_O9
	int $w.config.f 21 31 "Buffer size for OUT endpoint 10" CONFIG_GRUSBDC_O10
	int $w.config.f 21 32 "Buffer size for OUT endpoint 11" CONFIG_GRUSBDC_O11
	int $w.config.f 21 33 "Buffer size for OUT endpoint 12" CONFIG_GRUSBDC_O12
	int $w.config.f 21 34 "Buffer size for OUT endpoint 13" CONFIG_GRUSBDC_O13
	int $w.config.f 21 35 "Buffer size for OUT endpoint 14" CONFIG_GRUSBDC_O14
	int $w.config.f 21 36 "Buffer size for OUT endpoint 15" CONFIG_GRUSBDC_O15



	focus $w
	update_active
	global winx; global winy
	if {[winfo exists .menu14] == 0} then {menu14 .menu14 "Peripherals             "}
	set winx [expr [winfo x .menu14]+30]; set winy [expr [winfo y .menu14]+30]
	if {[winfo exists $w]} then {wm geometry $w +$winx+$winy}
	update idletasks
	if {[winfo exists $w]} then  {$w.config.canvas create window 0 0 -anchor nw -window $w.config.f

	$w.config.canvas configure \
		-width [expr [winfo reqwidth $w.config.f] + 1]\
		-scrollregion "-1 -1 [expr [winfo reqwidth $w.config.f] + 1] \
			 [expr [winfo reqheight $w.config.f] + 1]"

	set winy [expr [winfo reqh $w] - [winfo reqh $w.config.canvas]]
	set scry [expr [winfo screenh $w] / 2]
	set maxy [expr [winfo screenh $w] * 3 / 4]
	set canvtotal [expr [winfo reqh $w.config.f] + 2]
	if [expr $winy + $canvtotal < $maxy] {
		$w.config.canvas configure -height $canvtotal
	} else {
		$w.config.canvas configure -height [expr $scry - $winy]
		}
	}
	update idletasks
	if {[winfo exists $w]} then {
	wm maxsize $w [winfo width $w] [winfo screenheight $w]
	wm minsize $w [winfo width $w] 100

	wm deiconify $w
}
}

proc update_menu21 {} {
}


proc update_define_menu21 {} {
	update_define_mainmenu
	global CONFIG_MODULES
	global tmpvar_45
	global CONFIG_GRUSBDC_ULPI
	if {$tmpvar_45 == "ULPI"} then {set CONFIG_GRUSBDC_ULPI 1} else {set CONFIG_GRUSBDC_ULPI 0}
	global CONFIG_GRUSBDC_UTMI8
	if {$tmpvar_45 == "UTMI/UTMI+8-bit"} then {set CONFIG_GRUSBDC_UTMI8 1} else {set CONFIG_GRUSBDC_UTMI8 0}
	global CONFIG_GRUSBDC_UTMI16
	if {$tmpvar_45 == "UTMI/UTMI+16-bit"} then {set CONFIG_GRUSBDC_UTMI16 1} else {set CONFIG_GRUSBDC_UTMI16 0}
}


proc menu22 {w title} {
	set oldFocus [focus]
	catch {focus .menu14}
	catch {destroy $w; unregister_active 22}
	toplevel $w -class Dialog
	wm withdraw $w
	global active_menus
	set active_menus [lsort -integer [linsert $active_menus end 22]]
	message $w.m -width 400 -aspect 300 -text \
		"CAN                     "  -relief raised
	pack $w.m -pady 10 -side top -padx 10
	wm title $w "CAN                     " 

	bind $w <Escape> "catch {focus $oldFocus}; destroy $w; unregister_active 22; break"
	set nextscript "catch {focus $oldFocus}; destroy $w; unregister_active 22; menu23 .menu23 \"$title\""
	frame $w.f
	button $w.f.back -text "OK" \
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 22"
	button $w.f.next -text "Next" -underline 0\
		-width 15 -command $nextscript
	bind all <Alt-n> $nextscript
	button $w.f.prev -text "Prev" -underline 0\
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 22; menu21 .menu21 \"$title\""
	bind $w <Alt-p> "catch {focus $oldFocus}; destroy $w; unregister_active 22; menu21 .menu21 \"$title\";break"
	pack $w.f.back $w.f.next $w.f.prev -side left -expand on
	pack $w.f -pady 10 -side bottom -anchor w -fill x
	frame $w.topline -relief ridge -borderwidth 2 -height 2
	pack $w.topline -side top -fill x

	frame $w.botline -relief ridge -borderwidth 2 -height 2
	pack $w.botline -side bottom -fill x

	frame $w.config
	pack $w.config -fill y -expand on

	scrollbar $w.config.vscroll -command "$w.config.canvas yview"
	pack $w.config.vscroll -side right -fill y

	canvas $w.config.canvas -height 1\
		-relief flat -borderwidth 0 -yscrollcommand "$w.config.vscroll set" \
		-width [expr [winfo screenwidth .] * 1 / 2] 
	frame $w.config.f
	bind $w <Key-Down> "$w.config.canvas yview scroll  1 unit;break;"
	bind $w <Key-Up> "$w.config.canvas yview scroll  -1 unit;break;"
	bind $w <Key-Next> "$w.config.canvas yview scroll  1 page;break;"
	bind $w <Key-Prior> "$w.config.canvas yview scroll  -1 page;break;"
	bind $w <Key-Home> "$w.config.canvas yview moveto 0;break;"
	bind $w <Key-End> "$w.config.canvas yview moveto 1 ;break;"
	pack $w.config.canvas -side right -fill y


	bool $w.config.f 22 0 "Enable multi-core CAN interface                 " CONFIG_CAN_ENABLE
	int $w.config.f 22 1 "Number of CAN cores                      " CONFIG_CAN_NUM
	hex $w.config.f 22 2 "CAN I/O area start address (haddr\[19:8\]) " CONFIG_CANIO
	int $w.config.f 22 3 "Interrupt number                      " CONFIG_CANIRQ
	bool $w.config.f 22 4 "Enable separate interrupts           " CONFIG_CANSEPIRQ
	bool $w.config.f 22 5 "Enable synchronous reset             " CONFIG_CAN_SYNCRST
	bool $w.config.f 22 6 "Enable FT FIFO memory                " CONFIG_CAN_FT



	focus $w
	update_active
	global winx; global winy
	if {[winfo exists .menu14] == 0} then {menu14 .menu14 "Peripherals             "}
	set winx [expr [winfo x .menu14]+30]; set winy [expr [winfo y .menu14]+30]
	if {[winfo exists $w]} then {wm geometry $w +$winx+$winy}
	update idletasks
	if {[winfo exists $w]} then  {$w.config.canvas create window 0 0 -anchor nw -window $w.config.f

	$w.config.canvas configure \
		-width [expr [winfo reqwidth $w.config.f] + 1]\
		-scrollregion "-1 -1 [expr [winfo reqwidth $w.config.f] + 1] \
			 [expr [winfo reqheight $w.config.f] + 1]"

	set winy [expr [winfo reqh $w] - [winfo reqh $w.config.canvas]]
	set scry [expr [winfo screenh $w] / 2]
	set maxy [expr [winfo screenh $w] * 3 / 4]
	set canvtotal [expr [winfo reqh $w.config.f] + 2]
	if [expr $winy + $canvtotal < $maxy] {
		$w.config.canvas configure -height $canvtotal
	} else {
		$w.config.canvas configure -height [expr $scry - $winy]
		}
	}
	update idletasks
	if {[winfo exists $w]} then {
	wm maxsize $w [winfo width $w] [winfo screenheight $w]
	wm minsize $w [winfo width $w] 100

	wm deiconify $w
}
}

proc update_menu22 {} {
}


proc update_define_menu22 {} {
	update_define_mainmenu
	global CONFIG_MODULES
}


proc menu23 {w title} {
	set oldFocus [focus]
	catch {focus .menu14}
	catch {destroy $w; unregister_active 23}
	toplevel $w -class Dialog
	wm withdraw $w
	global active_menus
	set active_menus [lsort -integer [linsert $active_menus end 23]]
	message $w.m -width 400 -aspect 300 -text \
		"Spacewire "  -relief raised
	pack $w.m -pady 10 -side top -padx 10
	wm title $w "Spacewire " 

	bind $w <Escape> "catch {focus $oldFocus}; destroy $w; unregister_active 23; break"
	set nextscript "catch {focus $oldFocus}; destroy $w; unregister_active 23; menu24 .menu24 \"$title\""
	frame $w.f
	button $w.f.back -text "OK" \
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 23"
	button $w.f.next -text "Next" -underline 0\
		-width 15 -command $nextscript
	bind all <Alt-n> $nextscript
	button $w.f.prev -text "Prev" -underline 0\
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 23; menu22 .menu22 \"$title\""
	bind $w <Alt-p> "catch {focus $oldFocus}; destroy $w; unregister_active 23; menu22 .menu22 \"$title\";break"
	pack $w.f.back $w.f.next $w.f.prev -side left -expand on
	pack $w.f -pady 10 -side bottom -anchor w -fill x
	frame $w.topline -relief ridge -borderwidth 2 -height 2
	pack $w.topline -side top -fill x

	frame $w.botline -relief ridge -borderwidth 2 -height 2
	pack $w.botline -side bottom -fill x

	frame $w.config
	pack $w.config -fill y -expand on

	scrollbar $w.config.vscroll -command "$w.config.canvas yview"
	pack $w.config.vscroll -side right -fill y

	canvas $w.config.canvas -height 1\
		-relief flat -borderwidth 0 -yscrollcommand "$w.config.vscroll set" \
		-width [expr [winfo screenwidth .] * 1 / 2] 
	frame $w.config.f
	bind $w <Key-Down> "$w.config.canvas yview scroll  1 unit;break;"
	bind $w <Key-Up> "$w.config.canvas yview scroll  -1 unit;break;"
	bind $w <Key-Next> "$w.config.canvas yview scroll  1 page;break;"
	bind $w <Key-Prior> "$w.config.canvas yview scroll  -1 page;break;"
	bind $w <Key-Home> "$w.config.canvas yview moveto 0;break;"
	bind $w <Key-End> "$w.config.canvas yview moveto 1 ;break;"
	pack $w.config.canvas -side right -fill y


	bool $w.config.f 23 0 "Enable Spacewire links              " CONFIG_SPW_ENABLE
	int $w.config.f 23 1 "Number of links (1 - 3)" CONFIG_SPW_NUM
	global tmpvar_46
	minimenu $w.config.f 23 2 "AHB RX/TX FIFO size (32-bit words)     " tmpvar_46 CONFIG_SPW_AHBFIFO4
	menu $w.config.f.x2.x.menu -tearoffcommand "menutitle \"AHB RX/TX FIFO size (32-bit words)     \""
	$w.config.f.x2.x.menu add radiobutton -label "4" -variable tmpvar_46 -value "4" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "8" -variable tmpvar_46 -value "8" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "16" -variable tmpvar_46 -value "16" -command "update_active"
	$w.config.f.x2.x.menu add radiobutton -label "32" -variable tmpvar_46 -value "32" -command "update_active"
	menusplit $w $w.config.f.x2.x.menu 4
	global tmpvar_47
	minimenu $w.config.f 23 3 "Receiver FIFO size (bytes)        " tmpvar_47 CONFIG_SPW_RXFIFO16
	menu $w.config.f.x3.x.menu -tearoffcommand "menutitle \"Receiver FIFO size (bytes)        \""
	$w.config.f.x3.x.menu add radiobutton -label "16" -variable tmpvar_47 -value "16" -command "update_active"
	$w.config.f.x3.x.menu add radiobutton -label "32" -variable tmpvar_47 -value "32" -command "update_active"
	$w.config.f.x3.x.menu add radiobutton -label "64" -variable tmpvar_47 -value "64" -command "update_active"
	menusplit $w $w.config.f.x3.x.menu 3
	bool $w.config.f 23 4 "Enable RMAP protocol   " CONFIG_SPW_RMAP
	global tmpvar_48
	minimenu $w.config.f 23 5 "RMAP buffer size (bytes)    " tmpvar_48 CONFIG_SPW_RMAPBUF2
	menu $w.config.f.x5.x.menu -tearoffcommand "menutitle \"RMAP buffer size (bytes)    \""
	$w.config.f.x5.x.menu add radiobutton -label "64" -variable tmpvar_48 -value "64" -command "update_active"
	$w.config.f.x5.x.menu add radiobutton -label "128" -variable tmpvar_48 -value "128" -command "update_active"
	$w.config.f.x5.x.menu add radiobutton -label "192" -variable tmpvar_48 -value "192" -command "update_active"
	$w.config.f.x5.x.menu add radiobutton -label "256" -variable tmpvar_48 -value "256" -command "update_active"
	menusplit $w $w.config.f.x5.x.menu 4
	bool $w.config.f 23 6 "Enable RMAP CRC check  " CONFIG_SPW_RMAPCRC
	bool $w.config.f 23 7 "Enable Rx unaligned transfers " CONFIG_SPW_RXUNAL
	bool $w.config.f 23 8 "Spacewire FIFO protection           " CONFIG_SPW_FT
	bool $w.config.f 23 9 "Use GRSPWC netlist     " CONFIG_SPW_NETLIST
	int $w.config.f 23 10 "Number of ports (1 - 2)" CONFIG_SPW_PORTS
	global tmpvar_49
	minimenu $w.config.f 23 11 "Select GRSPW core (GRSPW1/GRSPW2) " tmpvar_49 CONFIG_SPW_GRSPW1
	menu $w.config.f.x11.x.menu -tearoffcommand "menutitle \"Select GRSPW core (GRSPW1/GRSPW2) \""
	$w.config.f.x11.x.menu add radiobutton -label "1" -variable tmpvar_49 -value "1" -command "update_active"
	$w.config.f.x11.x.menu add radiobutton -label "2" -variable tmpvar_49 -value "2" -command "update_active"
	menusplit $w $w.config.f.x11.x.menu 2
	int $w.config.f 23 12 "Number of DMA channels (1 - 4)" CONFIG_SPW_DMACHAN
	bool $w.config.f 23 13 "Receiver and transmitter uses same clock  " CONFIG_SPW_RTSAME
	global tmpvar_50
	minimenu $w.config.f 23 14 "Select receiver clock type " tmpvar_50 CONFIG_SPW_RX_SDR
	menu $w.config.f.x14.x.menu -tearoffcommand "menutitle \"Select receiver clock type \""
	$w.config.f.x14.x.menu add radiobutton -label "SDR" -variable tmpvar_50 -value "SDR" -command "update_active"
	$w.config.f.x14.x.menu add radiobutton -label "DDR" -variable tmpvar_50 -value "DDR" -command "update_active"
	$w.config.f.x14.x.menu add radiobutton -label "PAD" -variable tmpvar_50 -value "PAD" -command "update_active"
	$w.config.f.x14.x.menu add radiobutton -label "Xor" -variable tmpvar_50 -value "Xor" -command "update_active"
	$w.config.f.x14.x.menu add radiobutton -label "Aeroflex" -variable tmpvar_50 -value "Aeroflex" -command "update_active"
	menusplit $w $w.config.f.x14.x.menu 5
	global tmpvar_51
	minimenu $w.config.f 23 15 "Select transmitter clock type " tmpvar_51 CONFIG_SPW_TX_SDR
	menu $w.config.f.x15.x.menu -tearoffcommand "menutitle \"Select transmitter clock type \""
	$w.config.f.x15.x.menu add radiobutton -label "SDR" -variable tmpvar_51 -value "SDR" -command "update_active"
	$w.config.f.x15.x.menu add radiobutton -label "DDR" -variable tmpvar_51 -value "DDR" -command "update_active"
	$w.config.f.x15.x.menu add radiobutton -label "Aeroflex" -variable tmpvar_51 -value "Aeroflex" -command "update_active"
	menusplit $w $w.config.f.x15.x.menu 3



	focus $w
	update_active
	global winx; global winy
	if {[winfo exists .menu14] == 0} then {menu14 .menu14 "Peripherals             "}
	set winx [expr [winfo x .menu14]+30]; set winy [expr [winfo y .menu14]+30]
	if {[winfo exists $w]} then {wm geometry $w +$winx+$winy}
	update idletasks
	if {[winfo exists $w]} then  {$w.config.canvas create window 0 0 -anchor nw -window $w.config.f

	$w.config.canvas configure \
		-width [expr [winfo reqwidth $w.config.f] + 1]\
		-scrollregion "-1 -1 [expr [winfo reqwidth $w.config.f] + 1] \
			 [expr [winfo reqheight $w.config.f] + 1]"

	set winy [expr [winfo reqh $w] - [winfo reqh $w.config.canvas]]
	set scry [expr [winfo screenh $w] / 2]
	set maxy [expr [winfo screenh $w] * 3 / 4]
	set canvtotal [expr [winfo reqh $w.config.f] + 2]
	if [expr $winy + $canvtotal < $maxy] {
		$w.config.canvas configure -height $canvtotal
	} else {
		$w.config.canvas configure -height [expr $scry - $winy]
		}
	}
	update idletasks
	if {[winfo exists $w]} then {
	wm maxsize $w [winfo width $w] [winfo screenheight $w]
	wm minsize $w [winfo width $w] 100

	wm deiconify $w
}
}

proc update_menu23 {} {
	global CONFIG_SPW_RMAP
	if {($CONFIG_SPW_RMAP == 1)} then {configure_entry .menu23.config.f.x5 normal {x l}} else {configure_entry .menu23.config.f.x5 disabled {x l}}
	global CONFIG_SPW_GRSPW2
	global CONFIG_SPW_DMACHAN
	if {($CONFIG_SPW_GRSPW2 == 1)} then {.menu23.config.f.x12.x configure -state normal -foreground [ cget .ref -foreground ]; .menu23.config.f.x12.l configure -state normal; } else {.menu23.config.f.x12.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu23.config.f.x12.l configure -state disabled}
	global CONFIG_SPW_RTSAME
	if {($CONFIG_SPW_GRSPW2 == 1)} then {
	configure_entry .menu23.config.f.x13 normal {n l y}} else {configure_entry .menu23.config.f.x13 disabled {y n l}}
	if {($CONFIG_SPW_GRSPW2 == 1)} then {configure_entry .menu23.config.f.x14 normal {x l}} else {configure_entry .menu23.config.f.x14 disabled {x l}}
	if {($CONFIG_SPW_GRSPW2 == 1)} then {configure_entry .menu23.config.f.x15 normal {x l}} else {configure_entry .menu23.config.f.x15 disabled {x l}}
}


proc update_define_menu23 {} {
	update_define_mainmenu
	global CONFIG_MODULES
	global tmpvar_46
	global CONFIG_SPW_AHBFIFO4
	if {$tmpvar_46 == "4"} then {set CONFIG_SPW_AHBFIFO4 1} else {set CONFIG_SPW_AHBFIFO4 0}
	global CONFIG_SPW_AHBFIFO8
	if {$tmpvar_46 == "8"} then {set CONFIG_SPW_AHBFIFO8 1} else {set CONFIG_SPW_AHBFIFO8 0}
	global CONFIG_SPW_AHBFIFO16
	if {$tmpvar_46 == "16"} then {set CONFIG_SPW_AHBFIFO16 1} else {set CONFIG_SPW_AHBFIFO16 0}
	global CONFIG_SPW_AHBFIFO32
	if {$tmpvar_46 == "32"} then {set CONFIG_SPW_AHBFIFO32 1} else {set CONFIG_SPW_AHBFIFO32 0}
	global tmpvar_47
	global CONFIG_SPW_RXFIFO16
	if {$tmpvar_47 == "16"} then {set CONFIG_SPW_RXFIFO16 1} else {set CONFIG_SPW_RXFIFO16 0}
	global CONFIG_SPW_RXFIFO32
	if {$tmpvar_47 == "32"} then {set CONFIG_SPW_RXFIFO32 1} else {set CONFIG_SPW_RXFIFO32 0}
	global CONFIG_SPW_RXFIFO64
	if {$tmpvar_47 == "64"} then {set CONFIG_SPW_RXFIFO64 1} else {set CONFIG_SPW_RXFIFO64 0}
	global tmpvar_48
	global CONFIG_SPW_RMAPBUF2
	if {$tmpvar_48 == "64"} then {set CONFIG_SPW_RMAPBUF2 1} else {set CONFIG_SPW_RMAPBUF2 0}
	global CONFIG_SPW_RMAPBUF4
	if {$tmpvar_48 == "128"} then {set CONFIG_SPW_RMAPBUF4 1} else {set CONFIG_SPW_RMAPBUF4 0}
	global CONFIG_SPW_RMAPBUF6
	if {$tmpvar_48 == "192"} then {set CONFIG_SPW_RMAPBUF6 1} else {set CONFIG_SPW_RMAPBUF6 0}
	global CONFIG_SPW_RMAPBUF8
	if {$tmpvar_48 == "256"} then {set CONFIG_SPW_RMAPBUF8 1} else {set CONFIG_SPW_RMAPBUF8 0}
	global tmpvar_49
	global CONFIG_SPW_GRSPW1
	if {$tmpvar_49 == "1"} then {set CONFIG_SPW_GRSPW1 1} else {set CONFIG_SPW_GRSPW1 0}
	global CONFIG_SPW_GRSPW2
	if {$tmpvar_49 == "2"} then {set CONFIG_SPW_GRSPW2 1} else {set CONFIG_SPW_GRSPW2 0}
	global CONFIG_SPW_DMACHAN
	if {($CONFIG_SPW_GRSPW2 == 1)} then {validate_int CONFIG_SPW_DMACHAN "$CONFIG_SPW_DMACHAN" 1}
	global CONFIG_SPW_RTSAME
	if {($CONFIG_SPW_GRSPW2 == 1)} then {
	set CONFIG_SPW_RTSAME [expr $CONFIG_SPW_RTSAME&15]} else {set CONFIG_SPW_RTSAME [expr $CONFIG_SPW_RTSAME|16]}
	global tmpvar_50
	global CONFIG_SPW_RX_SDR
	if {$tmpvar_50 == "SDR"} then {set CONFIG_SPW_RX_SDR 1} else {set CONFIG_SPW_RX_SDR 0}
	global CONFIG_SPW_RX_DDR
	if {$tmpvar_50 == "DDR"} then {set CONFIG_SPW_RX_DDR 1} else {set CONFIG_SPW_RX_DDR 0}
	global CONFIG_SPW_RX_PAD
	if {$tmpvar_50 == "PAD"} then {set CONFIG_SPW_RX_PAD 1} else {set CONFIG_SPW_RX_PAD 0}
	global CONFIG_SPW_RX_XOR
	if {$tmpvar_50 == "Xor"} then {set CONFIG_SPW_RX_XOR 1} else {set CONFIG_SPW_RX_XOR 0}
	global CONFIG_SPW_RX_AFLEX
	if {$tmpvar_50 == "Aeroflex"} then {set CONFIG_SPW_RX_AFLEX 1} else {set CONFIG_SPW_RX_AFLEX 0}
	global tmpvar_51
	global CONFIG_SPW_TX_SDR
	if {$tmpvar_51 == "SDR"} then {set CONFIG_SPW_TX_SDR 1} else {set CONFIG_SPW_TX_SDR 0}
	global CONFIG_SPW_TX_DDR
	if {$tmpvar_51 == "DDR"} then {set CONFIG_SPW_TX_DDR 1} else {set CONFIG_SPW_TX_DDR 0}
	global CONFIG_SPW_TX_AFLEX
	if {$tmpvar_51 == "Aeroflex"} then {set CONFIG_SPW_TX_AFLEX 1} else {set CONFIG_SPW_TX_AFLEX 0}
}


proc menu24 {w title} {
	set oldFocus [focus]
	catch {focus .menu14}
	catch {destroy $w; unregister_active 24}
	toplevel $w -class Dialog
	wm withdraw $w
	global active_menus
	set active_menus [lsort -integer [linsert $active_menus end 24]]
	message $w.m -width 400 -aspect 300 -text \
		"UARTs, timers and irq control         "  -relief raised
	pack $w.m -pady 10 -side top -padx 10
	wm title $w "UARTs, timers and irq control         " 

	bind $w <Escape> "catch {focus $oldFocus}; destroy $w; unregister_active 24; break"
	set nextscript "catch {focus $oldFocus}; destroy $w; unregister_active 24; menu25 .menu25 \"$title\""
	frame $w.f
	button $w.f.back -text "OK" \
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 24"
	button $w.f.next -text "Next" -underline 0\
		-width 15 -command $nextscript
	bind all <Alt-n> $nextscript
	button $w.f.prev -text "Prev" -underline 0\
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 24; menu23 .menu23 \"$title\""
	bind $w <Alt-p> "catch {focus $oldFocus}; destroy $w; unregister_active 24; menu23 .menu23 \"$title\";break"
	pack $w.f.back $w.f.next $w.f.prev -side left -expand on
	pack $w.f -pady 10 -side bottom -anchor w -fill x
	frame $w.topline -relief ridge -borderwidth 2 -height 2
	pack $w.topline -side top -fill x

	frame $w.botline -relief ridge -borderwidth 2 -height 2
	pack $w.botline -side bottom -fill x

	frame $w.config
	pack $w.config -fill y -expand on

	scrollbar $w.config.vscroll -command "$w.config.canvas yview"
	pack $w.config.vscroll -side right -fill y

	canvas $w.config.canvas -height 1\
		-relief flat -borderwidth 0 -yscrollcommand "$w.config.vscroll set" \
		-width [expr [winfo screenwidth .] * 1 / 2] 
	frame $w.config.f
	bind $w <Key-Down> "$w.config.canvas yview scroll  1 unit;break;"
	bind $w <Key-Up> "$w.config.canvas yview scroll  -1 unit;break;"
	bind $w <Key-Next> "$w.config.canvas yview scroll  1 page;break;"
	bind $w <Key-Prior> "$w.config.canvas yview scroll  -1 page;break;"
	bind $w <Key-Home> "$w.config.canvas yview moveto 0;break;"
	bind $w <Key-End> "$w.config.canvas yview moveto 1 ;break;"
	pack $w.config.canvas -side right -fill y


	bool $w.config.f 24 0 "Enable console UART                  " CONFIG_UART1_ENABLE
	global tmpvar_52
	minimenu $w.config.f 24 1 "UART1 FIFO depth" tmpvar_52 CONFIG_UA1_FIFO1
	menu $w.config.f.x1.x.menu -tearoffcommand "menutitle \"UART1 FIFO depth\""
	$w.config.f.x1.x.menu add radiobutton -label "1" -variable tmpvar_52 -value "1" -command "update_active"
	$w.config.f.x1.x.menu add radiobutton -label "2" -variable tmpvar_52 -value "2" -command "update_active"
	$w.config.f.x1.x.menu add radiobutton -label "4" -variable tmpvar_52 -value "4" -command "update_active"
	$w.config.f.x1.x.menu add radiobutton -label "8" -variable tmpvar_52 -value "8" -command "update_active"
	$w.config.f.x1.x.menu add radiobutton -label "16" -variable tmpvar_52 -value "16" -command "update_active"
	$w.config.f.x1.x.menu add radiobutton -label "32" -variable tmpvar_52 -value "32" -command "update_active"
	menusplit $w $w.config.f.x1.x.menu 6
	bool $w.config.f 24 2 "Enable LEON3 interrupt controller    " CONFIG_IRQ3_ENABLE
	bool $w.config.f 24 3 "Enable secondary interrupts           " CONFIG_IRQ3_SEC
	int $w.config.f 24 4 "Secondary interrupt number (1 - 15)    " CONFIG_IRQ3_NSEC
	bool $w.config.f 24 5 "Enable Timer Unit                    " CONFIG_GPT_ENABLE
	int $w.config.f 24 6 "Number of timers (1 - 7)              " CONFIG_GPT_NTIM
	int $w.config.f 24 7 "Scaler width (2 - 16)                 " CONFIG_GPT_SW
	int $w.config.f 24 8 "Timer width (2 - 32)                  " CONFIG_GPT_TW
	int $w.config.f 24 9 "Timer unit interrupt                  " CONFIG_GPT_IRQ
	bool $w.config.f 24 10 "Separate interrupts                  " CONFIG_GPT_SEPIRQ
	bool $w.config.f 24 11 "Watchdog enable                      " CONFIG_GPT_WDOGEN
	hex $w.config.f 24 12 "Initial watchdog time-out value       " CONFIG_GPT_WDOG
	bool $w.config.f 24 13 "Enable generic GPIO port              " CONFIG_GRGPIO_ENABLE
	int $w.config.f 24 14 "GPIO width            " CONFIG_GRGPIO_WIDTH
	hex $w.config.f 24 15 "GPIO interrupt mask   " CONFIG_GRGPIO_IMASK
	bool $w.config.f 24 16 "Enable I2C master " CONFIG_I2C_ENABLE



	focus $w
	update_active
	global winx; global winy
	if {[winfo exists .menu14] == 0} then {menu14 .menu14 "Peripherals             "}
	set winx [expr [winfo x .menu14]+30]; set winy [expr [winfo y .menu14]+30]
	if {[winfo exists $w]} then {wm geometry $w +$winx+$winy}
	update idletasks
	if {[winfo exists $w]} then  {$w.config.canvas create window 0 0 -anchor nw -window $w.config.f

	$w.config.canvas configure \
		-width [expr [winfo reqwidth $w.config.f] + 1]\
		-scrollregion "-1 -1 [expr [winfo reqwidth $w.config.f] + 1] \
			 [expr [winfo reqheight $w.config.f] + 1]"

	set winy [expr [winfo reqh $w] - [winfo reqh $w.config.canvas]]
	set scry [expr [winfo screenh $w] / 2]
	set maxy [expr [winfo screenh $w] * 3 / 4]
	set canvtotal [expr [winfo reqh $w.config.f] + 2]
	if [expr $winy + $canvtotal < $maxy] {
		$w.config.canvas configure -height $canvtotal
	} else {
		$w.config.canvas configure -height [expr $scry - $winy]
		}
	}
	update idletasks
	if {[winfo exists $w]} then {
	wm maxsize $w [winfo width $w] [winfo screenheight $w]
	wm minsize $w [winfo width $w] 100

	wm deiconify $w
}
}

proc update_menu24 {} {
	global CONFIG_IRQ3_SEC
	global CONFIG_IRQ3_NSEC
	if {($CONFIG_IRQ3_SEC == 1)} then {.menu24.config.f.x4.x configure -state normal -foreground [ cget .ref -foreground ]; .menu24.config.f.x4.l configure -state normal; } else {.menu24.config.f.x4.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu24.config.f.x4.l configure -state disabled}
	global CONFIG_GPT_WDOGEN
	global CONFIG_GPT_WDOG
	if {($CONFIG_GPT_WDOGEN == 1)} then {.menu24.config.f.x12.x configure -state normal -foreground [ cget .ref -foreground ]; .menu24.config.f.x12.l configure -state normal; } else {.menu24.config.f.x12.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu24.config.f.x12.l configure -state disabled}
}


proc update_define_menu24 {} {
	update_define_mainmenu
	global CONFIG_MODULES
	global tmpvar_52
	global CONFIG_UA1_FIFO1
	if {$tmpvar_52 == "1"} then {set CONFIG_UA1_FIFO1 1} else {set CONFIG_UA1_FIFO1 0}
	global CONFIG_UA1_FIFO2
	if {$tmpvar_52 == "2"} then {set CONFIG_UA1_FIFO2 1} else {set CONFIG_UA1_FIFO2 0}
	global CONFIG_UA1_FIFO4
	if {$tmpvar_52 == "4"} then {set CONFIG_UA1_FIFO4 1} else {set CONFIG_UA1_FIFO4 0}
	global CONFIG_UA1_FIFO8
	if {$tmpvar_52 == "8"} then {set CONFIG_UA1_FIFO8 1} else {set CONFIG_UA1_FIFO8 0}
	global CONFIG_UA1_FIFO16
	if {$tmpvar_52 == "16"} then {set CONFIG_UA1_FIFO16 1} else {set CONFIG_UA1_FIFO16 0}
	global CONFIG_UA1_FIFO32
	if {$tmpvar_52 == "32"} then {set CONFIG_UA1_FIFO32 1} else {set CONFIG_UA1_FIFO32 0}
	global CONFIG_IRQ3_SEC
	global CONFIG_IRQ3_NSEC
	if {($CONFIG_IRQ3_SEC == 1)} then {validate_int CONFIG_IRQ3_NSEC "$CONFIG_IRQ3_NSEC" 12}
	global CONFIG_GPT_WDOGEN
	global CONFIG_GPT_WDOG
	if {($CONFIG_GPT_WDOGEN == 1)} then {validate_hex CONFIG_GPT_WDOG "$CONFIG_GPT_WDOG" FFFF}
}


proc menu25 {w title} {
	set oldFocus [focus]
	catch {focus .menu14}
	catch {destroy $w; unregister_active 25}
	toplevel $w -class Dialog
	wm withdraw $w
	global active_menus
	set active_menus [lsort -integer [linsert $active_menus end 25]]
	message $w.m -width 400 -aspect 300 -text \
		"Keybord and VGA interface"  -relief raised
	pack $w.m -pady 10 -side top -padx 10
	wm title $w "Keybord and VGA interface" 

	bind $w <Escape> "catch {focus $oldFocus}; destroy $w; unregister_active 25; break"
	set nextscript "catch {focus $oldFocus}; destroy $w; unregister_active 25; menu26 .menu26 \"$title\""
	frame $w.f
	button $w.f.back -text "OK" \
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 25"
	button $w.f.next -text "Next" -underline 0\
		-width 15 -command $nextscript
	bind all <Alt-n> $nextscript
	button $w.f.prev -text "Prev" -underline 0\
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 25; menu24 .menu24 \"$title\""
	bind $w <Alt-p> "catch {focus $oldFocus}; destroy $w; unregister_active 25; menu24 .menu24 \"$title\";break"
	pack $w.f.back $w.f.next $w.f.prev -side left -expand on
	pack $w.f -pady 10 -side bottom -anchor w -fill x
	frame $w.topline -relief ridge -borderwidth 2 -height 2
	pack $w.topline -side top -fill x

	frame $w.botline -relief ridge -borderwidth 2 -height 2
	pack $w.botline -side bottom -fill x

	frame $w.config
	pack $w.config -fill y -expand on

	scrollbar $w.config.vscroll -command "$w.config.canvas yview"
	pack $w.config.vscroll -side right -fill y

	canvas $w.config.canvas -height 1\
		-relief flat -borderwidth 0 -yscrollcommand "$w.config.vscroll set" \
		-width [expr [winfo screenwidth .] * 1 / 2] 
	frame $w.config.f
	bind $w <Key-Down> "$w.config.canvas yview scroll  1 unit;break;"
	bind $w <Key-Up> "$w.config.canvas yview scroll  -1 unit;break;"
	bind $w <Key-Next> "$w.config.canvas yview scroll  1 page;break;"
	bind $w <Key-Prior> "$w.config.canvas yview scroll  -1 page;break;"
	bind $w <Key-Home> "$w.config.canvas yview moveto 0;break;"
	bind $w <Key-End> "$w.config.canvas yview moveto 1 ;break;"
	pack $w.config.canvas -side right -fill y


	bool $w.config.f 25 0 "Keyboard/mouse (PS2) interface  " CONFIG_KBD_ENABLE
	bool $w.config.f 25 1 "Text-based VGA interface  " CONFIG_VGA_ENABLE
	bool $w.config.f 25 2 "SVGA graphical frame buffer  " CONFIG_SVGA_ENABLE



	focus $w
	update_active
	global winx; global winy
	if {[winfo exists .menu14] == 0} then {menu14 .menu14 "Peripherals             "}
	set winx [expr [winfo x .menu14]+30]; set winy [expr [winfo y .menu14]+30]
	if {[winfo exists $w]} then {wm geometry $w +$winx+$winy}
	update idletasks
	if {[winfo exists $w]} then  {$w.config.canvas create window 0 0 -anchor nw -window $w.config.f

	$w.config.canvas configure \
		-width [expr [winfo reqwidth $w.config.f] + 1]\
		-scrollregion "-1 -1 [expr [winfo reqwidth $w.config.f] + 1] \
			 [expr [winfo reqheight $w.config.f] + 1]"

	set winy [expr [winfo reqh $w] - [winfo reqh $w.config.canvas]]
	set scry [expr [winfo screenh $w] / 2]
	set maxy [expr [winfo screenh $w] * 3 / 4]
	set canvtotal [expr [winfo reqh $w.config.f] + 2]
	if [expr $winy + $canvtotal < $maxy] {
		$w.config.canvas configure -height $canvtotal
	} else {
		$w.config.canvas configure -height [expr $scry - $winy]
		}
	}
	update idletasks
	if {[winfo exists $w]} then {
	wm maxsize $w [winfo width $w] [winfo screenheight $w]
	wm minsize $w [winfo width $w] 100

	wm deiconify $w
}
}

proc update_menu25 {} {
}


proc update_define_menu25 {} {
	update_define_mainmenu
	global CONFIG_MODULES
}


proc menu26 {w title} {
	set oldFocus [focus]
	catch {focus .menu14}
	catch {destroy $w; unregister_active 26}
	toplevel $w -class Dialog
	wm withdraw $w
	global active_menus
	set active_menus [lsort -integer [linsert $active_menus end 26]]
	message $w.m -width 400 -aspect 300 -text \
		"SPI"  -relief raised
	pack $w.m -pady 10 -side top -padx 10
	wm title $w "SPI" 

	bind $w <Escape> "catch {focus $oldFocus}; destroy $w; unregister_active 26; break"
	set nextscript "catch {focus $oldFocus}; menu27 .menu27 \"$title\""
	frame $w.f
	button $w.f.back -text "OK" \
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 26"
	button $w.f.next -text "Next" -underline 0\
		-width 15 -command $nextscript
	bind all <Alt-n> $nextscript
	button $w.f.prev -text "Prev" -underline 0\
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 26; menu25 .menu25 \"$title\""
	bind $w <Alt-p> "catch {focus $oldFocus}; destroy $w; unregister_active 26; menu25 .menu25 \"$title\";break"
	pack $w.f.back $w.f.next $w.f.prev -side left -expand on
	pack $w.f -pady 10 -side bottom -anchor w -fill x
	frame $w.topline -relief ridge -borderwidth 2 -height 2
	pack $w.topline -side top -fill x

	frame $w.botline -relief ridge -borderwidth 2 -height 2
	pack $w.botline -side bottom -fill x

	frame $w.config
	pack $w.config -fill y -expand on

	scrollbar $w.config.vscroll -command "$w.config.canvas yview"
	pack $w.config.vscroll -side right -fill y

	canvas $w.config.canvas -height 1\
		-relief flat -borderwidth 0 -yscrollcommand "$w.config.vscroll set" \
		-width [expr [winfo screenwidth .] * 1 / 2] 
	frame $w.config.f
	bind $w <Key-Down> "$w.config.canvas yview scroll  1 unit;break;"
	bind $w <Key-Up> "$w.config.canvas yview scroll  -1 unit;break;"
	bind $w <Key-Next> "$w.config.canvas yview scroll  1 page;break;"
	bind $w <Key-Prior> "$w.config.canvas yview scroll  -1 page;break;"
	bind $w <Key-Home> "$w.config.canvas yview moveto 0;break;"
	bind $w <Key-End> "$w.config.canvas yview moveto 1 ;break;"
	pack $w.config.canvas -side right -fill y


	submenu $w.config.f 26 0 "SPI memory controller " 27
	submenu $w.config.f 26 1 "SPI controller(s) " 28



	focus $w
	update_active
	global winx; global winy
	if {[winfo exists .menu14] == 0} then {menu14 .menu14 "Peripherals             "}
	set winx [expr [winfo x .menu14]+30]; set winy [expr [winfo y .menu14]+30]
	if {[winfo exists $w]} then {wm geometry $w +$winx+$winy}
	update idletasks
	if {[winfo exists $w]} then  {$w.config.canvas create window 0 0 -anchor nw -window $w.config.f

	$w.config.canvas configure \
		-width [expr [winfo reqwidth $w.config.f] + 1]\
		-scrollregion "-1 -1 [expr [winfo reqwidth $w.config.f] + 1] \
			 [expr [winfo reqheight $w.config.f] + 1]"

	set winy [expr [winfo reqh $w] - [winfo reqh $w.config.canvas]]
	set scry [expr [winfo screenh $w] / 2]
	set maxy [expr [winfo screenh $w] * 3 / 4]
	set canvtotal [expr [winfo reqh $w.config.f] + 2]
	if [expr $winy + $canvtotal < $maxy] {
		$w.config.canvas configure -height $canvtotal
	} else {
		$w.config.canvas configure -height [expr $scry - $winy]
		}
	}
	update idletasks
	if {[winfo exists $w]} then {
	wm maxsize $w [winfo width $w] [winfo screenheight $w]
	wm minsize $w [winfo width $w] 100

	wm deiconify $w
}
}

proc update_menu26 {} {
}


proc update_define_menu26 {} {
	update_define_mainmenu
	global CONFIG_MODULES
}


proc menu27 {w title} {
	set oldFocus [focus]
	catch {focus .menu26}
	catch {destroy $w; unregister_active 27}
	toplevel $w -class Dialog
	wm withdraw $w
	global active_menus
	set active_menus [lsort -integer [linsert $active_menus end 27]]
	message $w.m -width 400 -aspect 300 -text \
		"SPI memory controller "  -relief raised
	pack $w.m -pady 10 -side top -padx 10
	wm title $w "SPI memory controller " 

	bind $w <Escape> "catch {focus $oldFocus}; destroy $w; unregister_active 27; break"
	set nextscript "catch {focus $oldFocus}; destroy $w; unregister_active 27; menu28 .menu28 \"$title\""
	frame $w.f
	button $w.f.back -text "OK" \
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 27"
	button $w.f.next -text "Next" -underline 0\
		-width 15 -command $nextscript
	bind all <Alt-n> $nextscript
	button $w.f.prev -text "Prev" -underline 0\
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 27; menu26 .menu26 \"$title\""
	bind $w <Alt-p> "catch {focus $oldFocus}; destroy $w; unregister_active 27; menu26 .menu26 \"$title\";break"
	pack $w.f.back $w.f.next $w.f.prev -side left -expand on
	pack $w.f -pady 10 -side bottom -anchor w -fill x
	frame $w.topline -relief ridge -borderwidth 2 -height 2
	pack $w.topline -side top -fill x

	frame $w.botline -relief ridge -borderwidth 2 -height 2
	pack $w.botline -side bottom -fill x

	frame $w.config
	pack $w.config -fill y -expand on

	scrollbar $w.config.vscroll -command "$w.config.canvas yview"
	pack $w.config.vscroll -side right -fill y

	canvas $w.config.canvas -height 1\
		-relief flat -borderwidth 0 -yscrollcommand "$w.config.vscroll set" \
		-width [expr [winfo screenwidth .] * 1 / 2] 
	frame $w.config.f
	bind $w <Key-Down> "$w.config.canvas yview scroll  1 unit;break;"
	bind $w <Key-Up> "$w.config.canvas yview scroll  -1 unit;break;"
	bind $w <Key-Next> "$w.config.canvas yview scroll  1 page;break;"
	bind $w <Key-Prior> "$w.config.canvas yview scroll  -1 page;break;"
	bind $w <Key-Home> "$w.config.canvas yview moveto 0;break;"
	bind $w <Key-End> "$w.config.canvas yview moveto 1 ;break;"
	pack $w.config.canvas -side right -fill y


	bool $w.config.f 27 0 "Enable SPI memory controller    " CONFIG_SPIMCTRL
	hex $w.config.f 27 1 "Read instruction    " CONFIG_SPIMCTRL_READCMD
	bool $w.config.f 27 2 "Read instruction requires dummy byte  " CONFIG_SPIMCTRL_DUMMYBYTE
	bool $w.config.f 27 3 "Enable dual output for reads  " CONFIG_SPIMCTRL_DUALOUTPUT
	hex $w.config.f 27 4 "Address offset     " CONFIG_SPIMCTRL_OFFSET
	int $w.config.f 27 5 "Clock divisor for device clock" CONFIG_SPIMCTRL_SCALER
	int $w.config.f 27 6 "Clock divisor for alt. device clock" CONFIG_SPIMCTRL_ASCALER
	int $w.config.f 27 7 "Number of clock cycles to idle after power up  " CONFIG_SPIMCTRL_PWRUPCNT



	focus $w
	update_active
	global winx; global winy
	if {[winfo exists .menu26] == 0} then {menu26 .menu26 "SPI"}
	set winx [expr [winfo x .menu26]+30]; set winy [expr [winfo y .menu26]+30]
	if {[winfo exists $w]} then {wm geometry $w +$winx+$winy}
	update idletasks
	if {[winfo exists $w]} then  {$w.config.canvas create window 0 0 -anchor nw -window $w.config.f

	$w.config.canvas configure \
		-width [expr [winfo reqwidth $w.config.f] + 1]\
		-scrollregion "-1 -1 [expr [winfo reqwidth $w.config.f] + 1] \
			 [expr [winfo reqheight $w.config.f] + 1]"

	set winy [expr [winfo reqh $w] - [winfo reqh $w.config.canvas]]
	set scry [expr [winfo screenh $w] / 2]
	set maxy [expr [winfo screenh $w] * 3 / 4]
	set canvtotal [expr [winfo reqh $w.config.f] + 2]
	if [expr $winy + $canvtotal < $maxy] {
		$w.config.canvas configure -height $canvtotal
	} else {
		$w.config.canvas configure -height [expr $scry - $winy]
		}
	}
	update idletasks
	if {[winfo exists $w]} then {
	wm maxsize $w [winfo width $w] [winfo screenheight $w]
	wm minsize $w [winfo width $w] 100

	wm deiconify $w
}
}

proc update_menu27 {} {
}


proc update_define_menu27 {} {
	update_define_mainmenu
	global CONFIG_MODULES
}


proc menu28 {w title} {
	set oldFocus [focus]
	catch {focus .menu26}
	catch {destroy $w; unregister_active 28}
	toplevel $w -class Dialog
	wm withdraw $w
	global active_menus
	set active_menus [lsort -integer [linsert $active_menus end 28]]
	message $w.m -width 400 -aspect 300 -text \
		"SPI controller(s) "  -relief raised
	pack $w.m -pady 10 -side top -padx 10
	wm title $w "SPI controller(s) " 

	bind $w <Escape> "catch {focus $oldFocus}; destroy $w; unregister_active 28; break"
	set nextscript "catch {focus $oldFocus}; destroy $w; unregister_active 28; catch {destroy .menu26}; unregister_active 26; menu29 .menu29 \"$title\""
	frame $w.f
	button $w.f.back -text "OK" \
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 28"
	button $w.f.next -text "Next" -underline 0\
		-width 15 -command $nextscript
	bind all <Alt-n> $nextscript
	button $w.f.prev -text "Prev" -underline 0\
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 28; menu27 .menu27 \"$title\""
	bind $w <Alt-p> "catch {focus $oldFocus}; destroy $w; unregister_active 28; menu27 .menu27 \"$title\";break"
	pack $w.f.back $w.f.next $w.f.prev -side left -expand on
	pack $w.f -pady 10 -side bottom -anchor w -fill x
	frame $w.topline -relief ridge -borderwidth 2 -height 2
	pack $w.topline -side top -fill x

	frame $w.botline -relief ridge -borderwidth 2 -height 2
	pack $w.botline -side bottom -fill x

	frame $w.config
	pack $w.config -fill y -expand on

	scrollbar $w.config.vscroll -command "$w.config.canvas yview"
	pack $w.config.vscroll -side right -fill y

	canvas $w.config.canvas -height 1\
		-relief flat -borderwidth 0 -yscrollcommand "$w.config.vscroll set" \
		-width [expr [winfo screenwidth .] * 1 / 2] 
	frame $w.config.f
	bind $w <Key-Down> "$w.config.canvas yview scroll  1 unit;break;"
	bind $w <Key-Up> "$w.config.canvas yview scroll  -1 unit;break;"
	bind $w <Key-Next> "$w.config.canvas yview scroll  1 page;break;"
	bind $w <Key-Prior> "$w.config.canvas yview scroll  -1 page;break;"
	bind $w <Key-Home> "$w.config.canvas yview moveto 0;break;"
	bind $w <Key-End> "$w.config.canvas yview moveto 1 ;break;"
	pack $w.config.canvas -side right -fill y


	bool $w.config.f 28 0 "Enable SPI controller(s) " CONFIG_SPICTRL_ENABLE
	int $w.config.f 28 1 "Number of SPI controllers   " CONFIG_SPICTRL_NUM
	int $w.config.f 28 2 "Slave select lines    " CONFIG_SPICTRL_SLVS
	int $w.config.f 28 3 "FIFO depth (2^N)      " CONFIG_SPICTRL_FIFO
	bool $w.config.f 28 4 "Enable slave select registers" CONFIG_SPICTRL_SLVREG
	bool $w.config.f 28 5 "Enable automatic slave select" CONFIG_SPICTRL_ASEL
	bool $w.config.f 28 6 "Support automated transfers  " CONFIG_SPICTRL_AM
	bool $w.config.f 28 7 "Support open drain mode      " CONFIG_SPICTRL_ODMODE
	bool $w.config.f 28 8 "Support three-wire protocol  " CONFIG_SPICTRL_TWEN
	int $w.config.f 28 9 "Maximum supported word length (see help!) " CONFIG_SPICTRL_MAXWLEN
	bool $w.config.f 28 10 "Use SYNCRAM for rx and tx queues " CONFIG_SPICTRL_SYNCRAM
	global tmpvar_53
	minimenu $w.config.f 28 11 "Fault-tolerance" tmpvar_53 CONFIG_SPICTRL_NOFT
	menu $w.config.f.x11.x.menu -tearoffcommand "menutitle \"Fault-tolerance\""
	$w.config.f.x11.x.menu add radiobutton -label "None" -variable tmpvar_53 -value "None" -command "update_active"
	$w.config.f.x11.x.menu add radiobutton -label "Parity-DMR" -variable tmpvar_53 -value "Parity-DMR" -command "update_active"
	$w.config.f.x11.x.menu add radiobutton -label "TMR" -variable tmpvar_53 -value "TMR" -command "update_active"
	menusplit $w $w.config.f.x11.x.menu 3
	global tmpvar_54
	minimenu $w.config.f 28 12 "SPI protocols" tmpvar_54 CONFIG_SPICTRL_PROT0
	menu $w.config.f.x12.x.menu -tearoffcommand "menutitle \"SPI protocols\""
	$w.config.f.x12.x.menu add radiobutton -label "Standard" -variable tmpvar_54 -value "Standard" -command "update_active"
	$w.config.f.x12.x.menu add radiobutton -label "Dual" -variable tmpvar_54 -value "Dual" -command "update_active"
	$w.config.f.x12.x.menu add radiobutton -label "Quad" -variable tmpvar_54 -value "Quad" -command "update_active"
	menusplit $w $w.config.f.x12.x.menu 3



	focus $w
	update_active
	global winx; global winy
	if {[winfo exists .menu26] == 0} then {menu26 .menu26 "SPI"}
	set winx [expr [winfo x .menu26]+30]; set winy [expr [winfo y .menu26]+30]
	if {[winfo exists $w]} then {wm geometry $w +$winx+$winy}
	update idletasks
	if {[winfo exists $w]} then  {$w.config.canvas create window 0 0 -anchor nw -window $w.config.f

	$w.config.canvas configure \
		-width [expr [winfo reqwidth $w.config.f] + 1]\
		-scrollregion "-1 -1 [expr [winfo reqwidth $w.config.f] + 1] \
			 [expr [winfo reqheight $w.config.f] + 1]"

	set winy [expr [winfo reqh $w] - [winfo reqh $w.config.canvas]]
	set scry [expr [winfo screenh $w] / 2]
	set maxy [expr [winfo screenh $w] * 3 / 4]
	set canvtotal [expr [winfo reqh $w.config.f] + 2]
	if [expr $winy + $canvtotal < $maxy] {
		$w.config.canvas configure -height $canvtotal
	} else {
		$w.config.canvas configure -height [expr $scry - $winy]
		}
	}
	update idletasks
	if {[winfo exists $w]} then {
	wm maxsize $w [winfo width $w] [winfo screenheight $w]
	wm minsize $w [winfo width $w] 100

	wm deiconify $w
}
}

proc update_menu28 {} {
	global CONFIG_SPICTRL_SYNCRAM
	if {($CONFIG_SPICTRL_SYNCRAM == 1)} then {configure_entry .menu28.config.f.x11 normal {x l}} else {configure_entry .menu28.config.f.x11 disabled {x l}}
}


proc update_define_menu28 {} {
	update_define_mainmenu
	global CONFIG_MODULES
	global tmpvar_53
	global CONFIG_SPICTRL_NOFT
	if {$tmpvar_53 == "None"} then {set CONFIG_SPICTRL_NOFT 1} else {set CONFIG_SPICTRL_NOFT 0}
	global CONFIG_SPICTRL_DMRFT
	if {$tmpvar_53 == "Parity-DMR"} then {set CONFIG_SPICTRL_DMRFT 1} else {set CONFIG_SPICTRL_DMRFT 0}
	global CONFIG_SPICTRL_TMRFT
	if {$tmpvar_53 == "TMR"} then {set CONFIG_SPICTRL_TMRFT 1} else {set CONFIG_SPICTRL_TMRFT 0}
	global tmpvar_54
	global CONFIG_SPICTRL_PROT0
	if {$tmpvar_54 == "Standard"} then {set CONFIG_SPICTRL_PROT0 1} else {set CONFIG_SPICTRL_PROT0 0}
	global CONFIG_SPICTRL_PROT1
	if {$tmpvar_54 == "Dual"} then {set CONFIG_SPICTRL_PROT1 1} else {set CONFIG_SPICTRL_PROT1 0}
	global CONFIG_SPICTRL_PROT2
	if {$tmpvar_54 == "Quad"} then {set CONFIG_SPICTRL_PROT2 1} else {set CONFIG_SPICTRL_PROT2 0}
}


proc menu29 {w title} {
	set oldFocus [focus]
	catch {focus .menu14}
	catch {destroy $w; unregister_active 29}
	toplevel $w -class Dialog
	wm withdraw $w
	global active_menus
	set active_menus [lsort -integer [linsert $active_menus end 29]]
	message $w.m -width 400 -aspect 300 -text \
		"Partial Reconfiguration  "  -relief raised
	pack $w.m -pady 10 -side top -padx 10
	wm title $w "Partial Reconfiguration  " 

	bind $w <Escape> "catch {focus $oldFocus}; destroy $w; unregister_active 29; break"
	set nextscript "catch {focus $oldFocus}; destroy $w; unregister_active 29; catch {destroy .menu14}; unregister_active 14; menu30 .menu30 \"$title\""
	frame $w.f
	button $w.f.back -text "OK" \
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 29"
	button $w.f.next -text "Next" -underline 0\
		-width 15 -command $nextscript
	bind all <Alt-n> $nextscript
	button $w.f.prev -text "Prev" -underline 0\
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 29; menu28 .menu28 \"$title\""
	bind $w <Alt-p> "catch {focus $oldFocus}; destroy $w; unregister_active 29; menu28 .menu28 \"$title\";break"
	pack $w.f.back $w.f.next $w.f.prev -side left -expand on
	pack $w.f -pady 10 -side bottom -anchor w -fill x
	frame $w.topline -relief ridge -borderwidth 2 -height 2
	pack $w.topline -side top -fill x

	frame $w.botline -relief ridge -borderwidth 2 -height 2
	pack $w.botline -side bottom -fill x

	frame $w.config
	pack $w.config -fill y -expand on

	scrollbar $w.config.vscroll -command "$w.config.canvas yview"
	pack $w.config.vscroll -side right -fill y

	canvas $w.config.canvas -height 1\
		-relief flat -borderwidth 0 -yscrollcommand "$w.config.vscroll set" \
		-width [expr [winfo screenwidth .] * 1 / 2] 
	frame $w.config.f
	bind $w <Key-Down> "$w.config.canvas yview scroll  1 unit;break;"
	bind $w <Key-Up> "$w.config.canvas yview scroll  -1 unit;break;"
	bind $w <Key-Next> "$w.config.canvas yview scroll  1 page;break;"
	bind $w <Key-Prior> "$w.config.canvas yview scroll  -1 page;break;"
	bind $w <Key-Home> "$w.config.canvas yview moveto 0;break;"
	bind $w <Key-End> "$w.config.canvas yview moveto 1 ;break;"
	pack $w.config.canvas -side right -fill y


	bool $w.config.f 29 0 "Enable Partial Reconfiguration  " CONFIG_PARTIAL
	bool $w.config.f 29 1 "Enable Bitstream Verification (D2PRC-CRC mode)" CONFIG_CRC
	int $w.config.f 29 2 "CRC block size " CONFIG_BLOCK
	bool $w.config.f 29 3 "Enable Bitstream EDAC (D2PRC-SECDED mode)" CONFIG_EDAC
	bool $w.config.f 29 4 "Async Mode " CONFIG_DCM_FIFO
	global tmpvar_55
	minimenu $w.config.f 29 5 "FIFO depth" tmpvar_55 CONFIG_DPR_FIFO64
	menu $w.config.f.x5.x.menu -tearoffcommand "menutitle \"FIFO depth\""
	$w.config.f.x5.x.menu add radiobutton -label "64" -variable tmpvar_55 -value "64" -command "update_active"
	$w.config.f.x5.x.menu add radiobutton -label "128" -variable tmpvar_55 -value "128" -command "update_active"
	$w.config.f.x5.x.menu add radiobutton -label "256" -variable tmpvar_55 -value "256" -command "update_active"
	$w.config.f.x5.x.menu add radiobutton -label "512" -variable tmpvar_55 -value "512" -command "update_active"
	menusplit $w $w.config.f.x5.x.menu 4



	focus $w
	update_active
	global winx; global winy
	if {[winfo exists .menu14] == 0} then {menu14 .menu14 "Peripherals             "}
	set winx [expr [winfo x .menu14]+30]; set winy [expr [winfo y .menu14]+30]
	if {[winfo exists $w]} then {wm geometry $w +$winx+$winy}
	update idletasks
	if {[winfo exists $w]} then  {$w.config.canvas create window 0 0 -anchor nw -window $w.config.f

	$w.config.canvas configure \
		-width [expr [winfo reqwidth $w.config.f] + 1]\
		-scrollregion "-1 -1 [expr [winfo reqwidth $w.config.f] + 1] \
			 [expr [winfo reqheight $w.config.f] + 1]"

	set winy [expr [winfo reqh $w] - [winfo reqh $w.config.canvas]]
	set scry [expr [winfo screenh $w] / 2]
	set maxy [expr [winfo screenh $w] * 3 / 4]
	set canvtotal [expr [winfo reqh $w.config.f] + 2]
	if [expr $winy + $canvtotal < $maxy] {
		$w.config.canvas configure -height $canvtotal
	} else {
		$w.config.canvas configure -height [expr $scry - $winy]
		}
	}
	update idletasks
	if {[winfo exists $w]} then {
	wm maxsize $w [winfo width $w] [winfo screenheight $w]
	wm minsize $w [winfo width $w] 100

	wm deiconify $w
}
}

proc update_menu29 {} {
	global CONFIG_CRC
	global CONFIG_BLOCK
	if {($CONFIG_CRC == 1)} then {.menu29.config.f.x2.x configure -state normal -foreground [ cget .ref -foreground ]; .menu29.config.f.x2.l configure -state normal; } else {.menu29.config.f.x2.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; .menu29.config.f.x2.l configure -state disabled}
	global CONFIG_EDAC
	if {($CONFIG_CRC == 0)} then {
	configure_entry .menu29.config.f.x3 normal {n l y}} else {configure_entry .menu29.config.f.x3 disabled {y n l}}
	global CONFIG_DCM_FIFO
	if {($CONFIG_CRC == 0) && ($CONFIG_EDAC == 0)} then {
	configure_entry .menu29.config.f.x4 normal {n l y}} else {configure_entry .menu29.config.f.x4 disabled {y n l}}
	if {($CONFIG_DCM_FIFO == 1 || $CONFIG_CRC == 1 || $CONFIG_EDAC == 1)} then {configure_entry .menu29.config.f.x5 normal {x l}} else {configure_entry .menu29.config.f.x5 disabled {x l}}
}


proc update_define_menu29 {} {
	update_define_mainmenu
	global CONFIG_MODULES
	global CONFIG_CRC
	global CONFIG_BLOCK
	if {($CONFIG_CRC == 1)} then {validate_int CONFIG_BLOCK "$CONFIG_BLOCK" 100}
	global CONFIG_EDAC
	if {($CONFIG_CRC == 0)} then {
	set CONFIG_EDAC [expr $CONFIG_EDAC&15]} else {set CONFIG_EDAC [expr $CONFIG_EDAC|16]}
	global CONFIG_DCM_FIFO
	if {($CONFIG_CRC == 0) && ($CONFIG_EDAC == 0)} then {
	set CONFIG_DCM_FIFO [expr $CONFIG_DCM_FIFO&15]} else {set CONFIG_DCM_FIFO [expr $CONFIG_DCM_FIFO|16]}
	global tmpvar_55
	global CONFIG_DPR_FIFO64
	if {$tmpvar_55 == "64"} then {set CONFIG_DPR_FIFO64 1} else {set CONFIG_DPR_FIFO64 0}
	global CONFIG_DPR_FIFO128
	if {$tmpvar_55 == "128"} then {set CONFIG_DPR_FIFO128 1} else {set CONFIG_DPR_FIFO128 0}
	global CONFIG_DPR_FIFO256
	if {$tmpvar_55 == "256"} then {set CONFIG_DPR_FIFO256 1} else {set CONFIG_DPR_FIFO256 0}
	global CONFIG_DPR_FIFO512
	if {$tmpvar_55 == "512"} then {set CONFIG_DPR_FIFO512 1} else {set CONFIG_DPR_FIFO512 0}
}


menu_option menu30 30 "VHDL Debugging        "
proc menu30 {w title} {
	set oldFocus [focus]
	catch {destroy $w; unregister_active 30}
	toplevel $w -class Dialog
	wm withdraw $w
	global active_menus
	set active_menus [lsort -integer [linsert $active_menus end 30]]
	message $w.m -width 400 -aspect 300 -text \
		"VHDL Debugging        "  -relief raised
	pack $w.m -pady 10 -side top -padx 10
	wm title $w "VHDL Debugging        " 

	bind $w <Escape> "catch {focus $oldFocus}; destroy $w; unregister_active 30; break"
	set nextscript "catch {focus $oldFocus}; menu31 .menu31 \"$title\""
	frame $w.f
	button $w.f.back -text "Main Menu" \
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 30"
	button $w.f.next -text "Next" -underline 0\
		-width 15 -command $nextscript
	$w.f.next configure -state disabled
	bind all <Alt-n> "puts \"no more menus\" "
	button $w.f.prev -text "Prev" -underline 0\
		-width 15 -command "catch {focus $oldFocus}; destroy $w; unregister_active 30; menu29 .menu29 \"$title\""
	bind $w <Alt-p> "catch {focus $oldFocus}; destroy $w; unregister_active 30; menu29 .menu29 \"$title\";break"
	pack $w.f.back $w.f.next $w.f.prev -side left -expand on
	pack $w.f -pady 10 -side bottom -anchor w -fill x
	frame $w.topline -relief ridge -borderwidth 2 -height 2
	pack $w.topline -side top -fill x

	frame $w.botline -relief ridge -borderwidth 2 -height 2
	pack $w.botline -side bottom -fill x

	frame $w.config
	pack $w.config -fill y -expand on

	scrollbar $w.config.vscroll -command "$w.config.canvas yview"
	pack $w.config.vscroll -side right -fill y

	canvas $w.config.canvas -height 1\
		-relief flat -borderwidth 0 -yscrollcommand "$w.config.vscroll set" \
		-width [expr [winfo screenwidth .] * 1 / 2] 
	frame $w.config.f
	bind $w <Key-Down> "$w.config.canvas yview scroll  1 unit;break;"
	bind $w <Key-Up> "$w.config.canvas yview scroll  -1 unit;break;"
	bind $w <Key-Next> "$w.config.canvas yview scroll  1 page;break;"
	bind $w <Key-Prior> "$w.config.canvas yview scroll  -1 page;break;"
	bind $w <Key-Home> "$w.config.canvas yview moveto 0;break;"
	bind $w <Key-End> "$w.config.canvas yview moveto 1 ;break;"
	pack $w.config.canvas -side right -fill y


	bool $w.config.f 30 0 "Accelerated UART tracing       " CONFIG_DEBUG_UART



	focus $w
	update_active
	global winx; global winy
	set winx [expr [winfo x .]+30]; set winy [expr [winfo y .]+30]
	if {[winfo exists $w]} then {wm geometry $w +$winx+$winy}
	update idletasks
	if {[winfo exists $w]} then  {$w.config.canvas create window 0 0 -anchor nw -window $w.config.f

	$w.config.canvas configure \
		-width [expr [winfo reqwidth $w.config.f] + 1]\
		-scrollregion "-1 -1 [expr [winfo reqwidth $w.config.f] + 1] \
			 [expr [winfo reqheight $w.config.f] + 1]"

	set winy [expr [winfo reqh $w] - [winfo reqh $w.config.canvas]]
	set scry [expr [winfo screenh $w] / 2]
	set maxy [expr [winfo screenh $w] * 3 / 4]
	set canvtotal [expr [winfo reqh $w.config.f] + 2]
	if [expr $winy + $canvtotal < $maxy] {
		$w.config.canvas configure -height $canvtotal
	} else {
		$w.config.canvas configure -height [expr $scry - $winy]
		}
	}
	update idletasks
	if {[winfo exists $w]} then {
	wm maxsize $w [winfo width $w] [winfo screenheight $w]
	wm minsize $w [winfo width $w] 100

	wm deiconify $w
}
}

proc update_menu30 {} {
}


proc update_define_menu30 {} {
	update_define_mainmenu
	global CONFIG_MODULES
}


proc update_mainmenu {}  {
}


set tmpvar_0 "(not set)"
set CONFIG_SYN_INFERRED 0
set CONFIG_SYN_AXCEL 0
set CONFIG_SYN_AXDSP 0
set CONFIG_SYN_PROASIC 0
set CONFIG_SYN_PROASICPLUS 0
set CONFIG_SYN_PROASIC3 0
set CONFIG_SYN_PROASIC3E 0
set CONFIG_SYN_PROASIC3L 0
set CONFIG_SYN_IGLOO 0
set CONFIG_SYN_IGLOO2 0
set CONFIG_SYN_SF2 0
set CONFIG_SYN_RTG4 0
set CONFIG_SYN_FUSION 0
set CONFIG_SYN_UT025CRH 0
set CONFIG_SYN_UT130HBD 0
set CONFIG_SYN_UT90NHBD 0
set CONFIG_SYN_CYCLONEIII 0
set CONFIG_SYN_STRATIX 0
set CONFIG_SYN_STRATIXII 0
set CONFIG_SYN_STRATIXIII 0
set CONFIG_SYN_STRATIXIV 0
set CONFIG_SYN_STRATIXV 0
set CONFIG_SYN_ALTERA 0
set CONFIG_SYN_ATC18 0
set CONFIG_SYN_ATC18RHA 0
set CONFIG_SYN_CUSTOM1 0
set CONFIG_SYN_DARE 0
set CONFIG_SYN_CMOS9SF 0
set CONFIG_SYN_LATTICE 0
set CONFIG_SYN_ECLIPSE 0
set CONFIG_SYN_RH_LIB18T 0
set CONFIG_SYN_RHUMC 0
set CONFIG_SYN_RHS65 0
set CONFIG_SYN_SAED32 0
set CONFIG_SYN_SMIC13 0
set CONFIG_SYN_TM65GPLUS 0
set CONFIG_SYN_TSMC90 0
set CONFIG_SYN_UMC 0
set CONFIG_SYN_ARTIX7 0
set CONFIG_SYN_KINTEX7 0
set CONFIG_SYN_SPARTAN3 0
set CONFIG_SYN_SPARTAN3E 0
set CONFIG_SYN_SPARTAN6 0
set CONFIG_SYN_VIRTEX2 0
set CONFIG_SYN_VIRTEX4 0
set CONFIG_SYN_VIRTEX5 0
set CONFIG_SYN_VIRTEX6 0
set CONFIG_SYN_VIRTEX7 0
set CONFIG_SYN_ZYNQ7000 0
set tmpvar_1 "(not set)"
set CONFIG_MEM_INFERRED 0
set CONFIG_MEM_UMC 0
set CONFIG_MEM_RHUMC 0
set CONFIG_MEM_SAED32 0
set CONFIG_MEM_DARE 0
set CONFIG_MEM_RHS65 0
set CONFIG_MEM_ARTISAN 0
set CONFIG_MEM_CUSTOM1 0
set CONFIG_MEM_VIRAGE 0
set CONFIG_MEM_VIRAGE90 0
set tmpvar_2 "(not set)"
set CONFIG_TRANS_GTP0 0
set CONFIG_TRANS_GTP1 0
set CONFIG_TRANS_GTX0 0
set CONFIG_TRANS_GTX1 0
set CONFIG_TRANS_GTH0 0
set CONFIG_TRANS_GTH1 0
set CONFIG_SYN_INFER_RAM 0
set CONFIG_SYN_INFER_PADS 0
set CONFIG_SYN_NO_ASYNC 0
set CONFIG_SYN_SCAN 0
set tmpvar_3 "(not set)"
set CONFIG_CLK_INFERRED 0
set CONFIG_CLK_HCLKBUF 0
set CONFIG_CLK_UT130HBD 0
set CONFIG_CLK_ALTDLL 0
set CONFIG_CLK_LATDLL 0
set CONFIG_CLK_PRO3PLL 0
set CONFIG_CLK_PRO3EPLL 0
set CONFIG_CLK_PRO3LPLL 0
set CONFIG_CLK_FUSPLL 0
set CONFIG_CLK_LIB18T 0
set CONFIG_CLK_RHUMC 0
set CONFIG_CLK_DARE 0
set CONFIG_CLK_SAED32 0
set CONFIG_CLK_EASIC45 0
set CONFIG_CLK_RHS65 0
set CONFIG_CLK_CLKPLLE2 0
set CONFIG_CLK_CLKDLL 0
set CONFIG_CLK_DCM 0
set CONFIG_CLK_MUL 2
set CONFIG_CLK_DIV 2
set CONFIG_OCLK_DIV 1
set CONFIG_OCLKB_DIV 0
set CONFIG_OCLKC_DIV 0
set CONFIG_PCI_CLKDLL 0
set CONFIG_CLK_NOFB 0
set CONFIG_PCI_SYSCLK 0
set tmpvar_4 "(not set)"
set CONFIG_LEON3 0
set CONFIG_LEON4 0
set CONFIG_PROC_NUM 1
set tmpvar_5 "(not set)"
set CONFIG_LEON_MIN 0
set CONFIG_LEON_GP 0
set CONFIG_LEON_HP 0
set CONFIG_LEON_CUSTOM 0
set CONFIG_IU_NWINDOWS 8
set CONFIG_IU_V8MULDIV 0
set tmpvar_6 "(not set)"
set CONFIG_IU_MUL_LATENCY_2 0
set CONFIG_IU_MUL_LATENCY_4 0
set CONFIG_IU_MUL_LATENCY_5 0
set CONFIG_IU_MUL_MAC 0
set tmpvar_7 "(not set)"
set CONFIG_IU_MUL_INFERRED 0
set CONFIG_IU_MUL_MODGEN 0
set CONFIG_IU_MUL_TECHSPEC 0
set CONFIG_IU_MUL_DW 0
set CONFIG_IU_SVT 0
set CONFIG_IU_LDELAY 1
set CONFIG_IU_WATCHPOINTS 0
set CONFIG_PWD 0
set CONFIG_IU_RSTADDR 00000
set CONFIG_NP_ASI 0
set CONFIG_WRPSR 0
set CONFIG_ALTWIN 0
set CONFIG_REX 0
set CONFIG_FPU_ENABLE 0
set tmpvar_8 "(not set)"
set CONFIG_FPU_GRFPU 0
set CONFIG_FPU_GRFPULITE 0
set tmpvar_9 "(not set)"
set CONFIG_FPU_GRFPU_INFMUL 0
set CONFIG_FPU_GRFPU_DWMUL 0
set CONFIG_FPU_GRFPU_MODGEN 0
set CONFIG_FPU_GRFPU_TECHSPEC 0
set CONFIG_FPU_GRFPU_SH 0
set tmpvar_10 "(not set)"
set CONFIG_FPU_GRFPC0 0
set CONFIG_FPU_GRFPC1 0
set CONFIG_FPU_GRFPC2 0
set CONFIG_FPU_NETLIST 0
set CONFIG_ICACHE_ENABLE 0
set tmpvar_11 "(not set)"
set CONFIG_ICACHE_ASSO1 0
set CONFIG_ICACHE_ASSO2 0
set CONFIG_ICACHE_ASSO3 0
set CONFIG_ICACHE_ASSO4 0
set tmpvar_12 "(not set)"
set CONFIG_ICACHE_SZ1 0
set CONFIG_ICACHE_SZ2 0
set CONFIG_ICACHE_SZ4 0
set CONFIG_ICACHE_SZ8 0
set CONFIG_ICACHE_SZ16 0
set CONFIG_ICACHE_SZ32 0
set CONFIG_ICACHE_SZ64 0
set CONFIG_ICACHE_SZ128 0
set CONFIG_ICACHE_SZ256 0
set tmpvar_13 "(not set)"
set CONFIG_ICACHE_LZ16 0
set CONFIG_ICACHE_LZ32 0
set tmpvar_14 "(not set)"
set CONFIG_ICACHE_ALGORND 0
set CONFIG_ICACHE_ALGOLRU 0
set CONFIG_ICACHE_LOCK 0
set CONFIG_ICACHE_LRAM 0
set tmpvar_15 "(not set)"
set CONFIG_ICACHE_LRAM_SZ1 0
set CONFIG_ICACHE_LRAM_SZ2 0
set CONFIG_ICACHE_LRAM_SZ4 0
set CONFIG_ICACHE_LRAM_SZ8 0
set CONFIG_ICACHE_LRAM_SZ16 0
set CONFIG_ICACHE_LRAM_SZ32 0
set CONFIG_ICACHE_LRAM_SZ64 0
set CONFIG_ICACHE_LRAM_SZ128 0
set CONFIG_ICACHE_LRAM_SZ256 0
set CONFIG_ICACHE_LRSTART 8e
set CONFIG_DCACHE_ENABLE 0
set tmpvar_16 "(not set)"
set CONFIG_DCACHE_ASSO1 0
set CONFIG_DCACHE_ASSO2 0
set CONFIG_DCACHE_ASSO3 0
set CONFIG_DCACHE_ASSO4 0
set tmpvar_17 "(not set)"
set CONFIG_DCACHE_SZ1 0
set CONFIG_DCACHE_SZ2 0
set CONFIG_DCACHE_SZ4 0
set CONFIG_DCACHE_SZ8 0
set CONFIG_DCACHE_SZ16 0
set CONFIG_DCACHE_SZ32 0
set CONFIG_DCACHE_SZ64 0
set CONFIG_DCACHE_SZ128 0
set CONFIG_DCACHE_SZ256 0
set tmpvar_18 "(not set)"
set CONFIG_DCACHE_LZ16 0
set CONFIG_DCACHE_LZ32 0
set tmpvar_19 "(not set)"
set CONFIG_DCACHE_ALGORND 0
set CONFIG_DCACHE_ALGOLRU 0
set CONFIG_DCACHE_LOCK 0
set CONFIG_DCACHE_SNOOP 0
set CONFIG_DCACHE_SNOOP_SEPTAG 0
set CONFIG_DCACHE_SNOOP_SP 0
set CONFIG_CACHE_FIXED 0
set CONFIG_BWMASK 0000
set tmpvar_20 "(not set)"
set CONFIG_CACHE_64BIT 0
set CONFIG_CACHE_128BIT 0
set CONFIG_DCACHE_LRAM 0
set tmpvar_21 "(not set)"
set CONFIG_DCACHE_LRAM_SZ1 0
set CONFIG_DCACHE_LRAM_SZ2 0
set CONFIG_DCACHE_LRAM_SZ4 0
set CONFIG_DCACHE_LRAM_SZ8 0
set CONFIG_DCACHE_LRAM_SZ16 0
set CONFIG_DCACHE_LRAM_SZ32 0
set CONFIG_DCACHE_LRAM_SZ64 0
set CONFIG_DCACHE_LRAM_SZ128 0
set CONFIG_DCACHE_LRAM_SZ256 0
set CONFIG_DCACHE_LRSTART 8f
set CONFIG_MMU_ENABLE 0
set tmpvar_22 "(not set)"
set CONFIG_MMU_COMBINED 0
set CONFIG_MMU_SPLIT 0
set tmpvar_23 "(not set)"
set CONFIG_MMU_REPARRAY 0
set CONFIG_MMU_REPINCREMENT 0
set tmpvar_24 "(not set)"
set CONFIG_MMU_I2 0
set CONFIG_MMU_I4 0
set CONFIG_MMU_I8 0
set CONFIG_MMU_I16 0
set CONFIG_MMU_I32 0
set CONFIG_MMU_I64 0
set tmpvar_25 "(not set)"
set CONFIG_MMU_D2 0
set CONFIG_MMU_D4 0
set CONFIG_MMU_D8 0
set CONFIG_MMU_D16 0
set CONFIG_MMU_D32 0
set CONFIG_MMU_D64 0
set CONFIG_MMU_FASTWB 0
set tmpvar_26 "(not set)"
set CONFIG_MMU_PAGE_4K 0
set CONFIG_MMU_PAGE_8K 0
set CONFIG_MMU_PAGE_16K 0
set CONFIG_MMU_PAGE_32K 0
set CONFIG_MMU_PAGE_PROG 0
set CONFIG_DSU_ENABLE 0
set CONFIG_DSU_ITRACE 0
set tmpvar_27 "(not set)"
set CONFIG_DSU_ITRACESZ1 0
set CONFIG_DSU_ITRACESZ2 0
set CONFIG_DSU_ITRACESZ4 0
set CONFIG_DSU_ITRACESZ8 0
set CONFIG_DSU_ITRACESZ16 0
set CONFIG_DSU_ITRACE_2P 0
set CONFIG_DSU_ATRACE 0
set tmpvar_28 "(not set)"
set CONFIG_DSU_ATRACESZ1 0
set CONFIG_DSU_ATRACESZ2 0
set CONFIG_DSU_ATRACESZ4 0
set CONFIG_DSU_ATRACESZ8 0
set CONFIG_DSU_ATRACESZ16 0
set CONFIG_DSU_AFILT 0
set CONFIG_DSU_ASTAT 0
set tmpvar_29 "(not set)"
set CONFIG_DSU_AHBWP2 0
set CONFIG_DSU_AHBWP1 0
set CONFIG_DSU_AHBWP0 0
set CONFIG_STAT_ENABLE 0
set CONFIG_STAT_CNT 4
set CONFIG_STAT_NMAX 0
set tmpvar_30 "(not set)"
set CONFIG_IUFT_NONE 0
set CONFIG_IUFT_PAR 0
set CONFIG_IUFT_DMR 0
set CONFIG_IUFT_BCH 0
set CONFIG_IUFT_BCHOTF 0
set CONFIG_IUFT_TECHSPEC 0
set CONFIG_IUFT_TMR 0
set tmpvar_31 "(not set)"
set CONFIG_FPUFT_NONE 0
set CONFIG_FPUFT_PAR 0
set CONFIG_FPUFT_DMR 0
set CONFIG_FPUFT_TMR 0
set CONFIG_RF_ERRINJ 0
set tmpvar_32 "(not set)"
set CONFIG_CACHE_FT_NONE 0
set CONFIG_CACHE_FT_EN 0
set CONFIG_CACHE_FT_BCH 0
set CONFIG_CACHE_FT_TECH 0
set CONFIG_CACHE_ERRINJ 0
set CONFIG_IU_DISAS 0
set CONFIG_IU_DISAS_NET 0
set CONFIG_DEBUG_PC32 0
set CONFIG_L2_ENABLE 0
set tmpvar_33 "(not set)"
set CONFIG_L2_ASSO1 0
set CONFIG_L2_ASSO2 0
set CONFIG_L2_ASSO3 0
set CONFIG_L2_ASSO4 0
set tmpvar_34 "(not set)"
set CONFIG_L2_SZ1 0
set CONFIG_L2_SZ2 0
set CONFIG_L2_SZ4 0
set CONFIG_L2_SZ8 0
set CONFIG_L2_SZ16 0
set CONFIG_L2_SZ32 0
set CONFIG_L2_SZ64 0
set CONFIG_L2_SZ128 0
set CONFIG_L2_SZ256 0
set CONFIG_L2_SZ512 0
set tmpvar_35 "(not set)"
set CONFIG_L2_LINE32 0
set CONFIG_L2_LINE64 0
set CONFIG_L2_HPROT 0
set CONFIG_L2_PEN 0
set CONFIG_L2_WT 0
set CONFIG_L2_RAN 0
set CONFIG_L2_SHARE 0
set CONFIG_L2_MAP 00F0
set CONFIG_L2_MTRR 0
set CONFIG_L2_EDAC 0
set CONFIG_L2_AXI 0
set CONFIG_AHB_DEFMST 0
set CONFIG_AHB_RROBIN 0
set CONFIG_AHB_SPLIT 0
set CONFIG_AHB_FPNPEN 0
set CONFIG_AHB_IOADDR FFF
set CONFIG_APB_HADDR 800
set CONFIG_AHB_MON 0
set CONFIG_AHB_MONERR 0
set CONFIG_AHB_MONWAR 0
set CONFIG_AHB_DTRACE 0
set CONFIG_DSU_UART 0
set CONFIG_DSU_JTAG 0
set CONFIG_GRUSB_DCL 0
set tmpvar_36 "(not set)"
set CONFIG_GRUSB_DCL_ULPI 0
set CONFIG_GRUSB_DCL_UTMI8 0
set CONFIG_GRUSB_DCL_UTMI16 0
set CONFIG_DSU_ETH 0
set tmpvar_37 "(not set)"
set CONFIG_DSU_ETHSZ1 0
set CONFIG_DSU_ETHSZ2 0
set CONFIG_DSU_ETHSZ4 0
set CONFIG_DSU_ETHSZ8 0
set CONFIG_DSU_ETHSZ16 0
set CONFIG_DSU_IPMSB C0A8
set CONFIG_DSU_IPLSB 0033
set CONFIG_DSU_ETHMSB 020000
set CONFIG_DSU_ETHLSB 000000
set CONFIG_DSU_ETH_PROG 0
set CONFIG_DSU_ETH_DIS 0
set CONFIG_MCTRL_LEON2 0
set CONFIG_MCTRL_8BIT 0
set CONFIG_MCTRL_16BIT 0
set CONFIG_MCTRL_5CS 0
set CONFIG_MCTRL_SDRAM 0
set CONFIG_MCTRL_SDRAM_SEPBUS 0
set CONFIG_MCTRL_SDRAM_BUS64 0
set CONFIG_MCTRL_SDRAM_INVCLK 0
set CONFIG_MCTRL_PAGE 0
set CONFIG_MCTRL_PROGPAGE 0
set CONFIG_MIG_7SERIES 0
set CONFIG_MIG_7SERIES_MODEL 0
set CONFIG_AHBSTAT_ENABLE 0
set CONFIG_AHBSTAT_NFTSLV 1
set CONFIG_AHBROM_ENABLE 0
set CONFIG_AHBROM_START 000
set CONFIG_AHBROM_PIPE 0
set CONFIG_AHBRAM_ENABLE 0
set tmpvar_38 "(not set)"
set CONFIG_AHBRAM_SZ1 0
set CONFIG_AHBRAM_SZ2 0
set CONFIG_AHBRAM_SZ4 0
set CONFIG_AHBRAM_SZ8 0
set CONFIG_AHBRAM_SZ16 0
set CONFIG_AHBRAM_SZ32 0
set CONFIG_AHBRAM_SZ64 0
set CONFIG_AHBRAM_SZ128 0
set CONFIG_AHBRAM_SZ256 0
set CONFIG_AHBRAM_SZ512 0
set CONFIG_AHBRAM_SZ1024 0
set CONFIG_AHBRAM_SZ2048 0
set CONFIG_AHBRAM_SZ4096 0
set CONFIG_AHBRAM_START A00
set CONFIG_AHBRAM_PIPE 0
set CONFIG_GRETH_ENABLE 0
set CONFIG_GRETH_GIGA 0
set tmpvar_39 "(not set)"
set CONFIG_GRETH_FIFO4 0
set CONFIG_GRETH_FIFO8 0
set CONFIG_GRETH_FIFO16 0
set CONFIG_GRETH_FIFO32 0
set CONFIG_GRETH_FIFO64 0
set CONFIG_GRETH_FT 0
set CONFIG_GRETH_EDCLFT 0
set CONFIG_GRUSBHC_ENABLE 0
set CONFIG_GRUSBHC_EHC 0
set CONFIG_GRUSBHC_UHC 0
set CONFIG_GRUSBHC_NCC 1
set CONFIG_GRUSBHC_NPORTS 1
set tmpvar_40 "(not set)"
set CONFIG_GRUSBHC_ULPI 0
set CONFIG_GRUSBHC_UTMI16 0
set CONFIG_GRUSBHC_UTMI8 0
set tmpvar_41 "(not set)"
set CONFIG_GRUSBHC_VBUSEXT 0
set CONFIG_GRUSBHC_VBUSINT 0
set tmpvar_42 "(not set)"
set CONFIG_GRUSBHC_FAULTL 0
set CONFIG_GRUSBHC_FAULTH 0
set CONFIG_GRUSBHC_FAULTN 0
set tmpvar_43 "(not set)"
set CONFIG_GRUSBHC_ENABLEH 0
set CONFIG_GRUSBHC_ENABLEL 0
set tmpvar_44 "(not set)"
set CONFIG_GRUSBHC_FAULT2H 0
set CONFIG_GRUSBHC_FAULT2L 0
set CONFIG_GRUSBHC_BEREGS 0
set CONFIG_GRUSBHC_BEDESC 0
set CONFIG_GRUSBHC_BWRD 16
set CONFIG_GRUSBHC_PRR 0
set CONFIG_GRUSBHC_NPCC 1
set CONFIG_GRUSBHC_PR1 0
set CONFIG_GRUSBHC_PR2 0
set CONFIG_GRUSBHC_PR3 0
set CONFIG_GRUSBHC_PR4 0
set CONFIG_GRUSBHC_PR5 0
set CONFIG_GRUSBHC_PR6 0
set CONFIG_GRUSBHC_PR7 0
set CONFIG_GRUSBHC_PR8 0
set CONFIG_GRUSBHC_PR9 0
set CONFIG_GRUSBHC_PR10 0
set CONFIG_GRUSBHC_PR11 0
set CONFIG_GRUSBHC_PR12 0
set CONFIG_GRUSBHC_PR13 0
set CONFIG_GRUSBHC_PR14 0
set CONFIG_GRUSBHC_PR15 0
set CONFIG_GRUSBDC_ENABLE 0
set CONFIG_GRUSBDC_AIFACE 0
set tmpvar_45 "(not set)"
set CONFIG_GRUSBDC_ULPI 0
set CONFIG_GRUSBDC_UTMI8 0
set CONFIG_GRUSBDC_UTMI16 0
set CONFIG_GRUSBDC_NEPI 1
set CONFIG_GRUSBDC_NEPO 1
set CONFIG_GRUSBDC_I0 1024
set CONFIG_GRUSBDC_I1 1024
set CONFIG_GRUSBDC_I2 1024
set CONFIG_GRUSBDC_I3 1024
set CONFIG_GRUSBDC_I4 1024
set CONFIG_GRUSBDC_I5 1024
set CONFIG_GRUSBDC_I6 1024
set CONFIG_GRUSBDC_I7 1024
set CONFIG_GRUSBDC_I8 1024
set CONFIG_GRUSBDC_I9 1024
set CONFIG_GRUSBDC_I10 1024
set CONFIG_GRUSBDC_I11 1024
set CONFIG_GRUSBDC_I12 1024
set CONFIG_GRUSBDC_I13 1024
set CONFIG_GRUSBDC_I14 1024
set CONFIG_GRUSBDC_I15 1024
set CONFIG_GRUSBDC_O0 1024
set CONFIG_GRUSBDC_O1 1024
set CONFIG_GRUSBDC_O2 1024
set CONFIG_GRUSBDC_O3 1024
set CONFIG_GRUSBDC_O4 1024
set CONFIG_GRUSBDC_O5 1024
set CONFIG_GRUSBDC_O6 1024
set CONFIG_GRUSBDC_O7 1024
set CONFIG_GRUSBDC_O8 1024
set CONFIG_GRUSBDC_O9 1024
set CONFIG_GRUSBDC_O10 1024
set CONFIG_GRUSBDC_O11 1024
set CONFIG_GRUSBDC_O12 1024
set CONFIG_GRUSBDC_O13 1024
set CONFIG_GRUSBDC_O14 1024
set CONFIG_GRUSBDC_O15 1024
set CONFIG_CAN_ENABLE 0
set CONFIG_CAN_NUM 1
set CONFIG_CANIO C00
set CONFIG_CANIRQ 13
set CONFIG_CANSEPIRQ 0
set CONFIG_CAN_SYNCRST 0
set CONFIG_CAN_FT 0
set CONFIG_SPW_ENABLE 0
set CONFIG_SPW_NUM 1
set tmpvar_46 "(not set)"
set CONFIG_SPW_AHBFIFO4 0
set CONFIG_SPW_AHBFIFO8 0
set CONFIG_SPW_AHBFIFO16 0
set CONFIG_SPW_AHBFIFO32 0
set tmpvar_47 "(not set)"
set CONFIG_SPW_RXFIFO16 0
set CONFIG_SPW_RXFIFO32 0
set CONFIG_SPW_RXFIFO64 0
set CONFIG_SPW_RMAP 0
set tmpvar_48 "(not set)"
set CONFIG_SPW_RMAPBUF2 0
set CONFIG_SPW_RMAPBUF4 0
set CONFIG_SPW_RMAPBUF6 0
set CONFIG_SPW_RMAPBUF8 0
set CONFIG_SPW_RMAPCRC 0
set CONFIG_SPW_RXUNAL 0
set CONFIG_SPW_FT 0
set CONFIG_SPW_NETLIST 0
set CONFIG_SPW_PORTS 1
set tmpvar_49 "(not set)"
set CONFIG_SPW_GRSPW1 0
set CONFIG_SPW_GRSPW2 0
set CONFIG_SPW_DMACHAN 1
set CONFIG_SPW_RTSAME 0
set tmpvar_50 "(not set)"
set CONFIG_SPW_RX_SDR 0
set CONFIG_SPW_RX_DDR 0
set CONFIG_SPW_RX_PAD 0
set CONFIG_SPW_RX_XOR 0
set CONFIG_SPW_RX_AFLEX 0
set tmpvar_51 "(not set)"
set CONFIG_SPW_TX_SDR 0
set CONFIG_SPW_TX_DDR 0
set CONFIG_SPW_TX_AFLEX 0
set CONFIG_UART1_ENABLE 0
set tmpvar_52 "(not set)"
set CONFIG_UA1_FIFO1 0
set CONFIG_UA1_FIFO2 0
set CONFIG_UA1_FIFO4 0
set CONFIG_UA1_FIFO8 0
set CONFIG_UA1_FIFO16 0
set CONFIG_UA1_FIFO32 0
set CONFIG_IRQ3_ENABLE 0
set CONFIG_IRQ3_SEC 0
set CONFIG_IRQ3_NSEC 12
set CONFIG_GPT_ENABLE 0
set CONFIG_GPT_NTIM 2
set CONFIG_GPT_SW 8
set CONFIG_GPT_TW 32
set CONFIG_GPT_IRQ 8
set CONFIG_GPT_SEPIRQ 0
set CONFIG_GPT_WDOGEN 0
set CONFIG_GPT_WDOG FFFF
set CONFIG_GRGPIO_ENABLE 0
set CONFIG_GRGPIO_WIDTH 8
set CONFIG_GRGPIO_IMASK 0000
set CONFIG_I2C_ENABLE 0
set CONFIG_KBD_ENABLE 0
set CONFIG_VGA_ENABLE 0
set CONFIG_SVGA_ENABLE 0
set CONFIG_SPIMCTRL 0
set CONFIG_SPIMCTRL_READCMD 0B
set CONFIG_SPIMCTRL_DUMMYBYTE 0
set CONFIG_SPIMCTRL_DUALOUTPUT 0
set CONFIG_SPIMCTRL_OFFSET 0
set CONFIG_SPIMCTRL_SCALER 1
set CONFIG_SPIMCTRL_ASCALER 8
set CONFIG_SPIMCTRL_PWRUPCNT 0
set CONFIG_SPICTRL_ENABLE 0
set CONFIG_SPICTRL_NUM 1
set CONFIG_SPICTRL_SLVS 1
set CONFIG_SPICTRL_FIFO 1
set CONFIG_SPICTRL_SLVREG 0
set CONFIG_SPICTRL_ASEL 0
set CONFIG_SPICTRL_AM 0
set CONFIG_SPICTRL_ODMODE 0
set CONFIG_SPICTRL_TWEN 0
set CONFIG_SPICTRL_MAXWLEN 0
set CONFIG_SPICTRL_SYNCRAM 0
set tmpvar_53 "(not set)"
set CONFIG_SPICTRL_NOFT 0
set CONFIG_SPICTRL_DMRFT 0
set CONFIG_SPICTRL_TMRFT 0
set tmpvar_54 "(not set)"
set CONFIG_SPICTRL_PROT0 0
set CONFIG_SPICTRL_PROT1 0
set CONFIG_SPICTRL_PROT2 0
set CONFIG_PARTIAL 0
set CONFIG_CRC 0
set CONFIG_BLOCK 100
set CONFIG_EDAC 0
set CONFIG_DCM_FIFO 0
set tmpvar_55 "(not set)"
set CONFIG_DPR_FIFO64 0
set CONFIG_DPR_FIFO128 0
set CONFIG_DPR_FIFO256 0
set CONFIG_DPR_FIFO512 0
set CONFIG_DEBUG_UART 0
set CONFIG_LEON3FT_PRESENT 4
set CONFIG_HAS_SHARED_GRFPU 4
set CONFIG_SYN_ARTISAN 4
set CONFIG_PCI_ENABLE 4
set CONFIG_IU_BP 4
set CONFIG_PWRPSR 4
set CONFIG_GRETH_SGMII_PRESENT 4
set CONFIG_GRETH_SGMII_MODE 4
set CONFIG_MODULES 4
proc writeconfig {file1 file2} {
	set cfg [open $file1 w]
	set autocfg [open $file2 w]
	set notmod 1
	set notset 0
	puts $cfg "#"
	puts $cfg "# Automatically generated make config: don't edit"
	puts $cfg "#"
	puts $autocfg "/*"
	puts $autocfg " * Automatically generated C config: don't edit"
	puts $autocfg " */"
	puts $autocfg "#define AUTOCONF_INCLUDED"
	global CONFIG_LEON3FT_PRESENT
	global CONSTANT_Y
	write_tristate $cfg $autocfg CONFIG_LEON3FT_PRESENT $CONFIG_LEON3FT_PRESENT [list $notmod] 2
	global CONFIG_HAS_SHARED_GRFPU
	write_tristate $cfg $autocfg CONFIG_HAS_SHARED_GRFPU $CONFIG_HAS_SHARED_GRFPU [list $notmod] 2
	write_comment $cfg $autocfg "Synthesis      "
	global tmpvar_0
	
	if { $tmpvar_0 == "Inferred" } then { write_tristate $cfg $autocfg CONFIG_SYN_INFERRED 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_INFERRED 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Actel-Axcelerator" } then { write_tristate $cfg $autocfg CONFIG_SYN_AXCEL 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_AXCEL 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Actel-Axcelerator-DSP" } then { write_tristate $cfg $autocfg CONFIG_SYN_AXDSP 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_AXDSP 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Actel-Proasic" } then { write_tristate $cfg $autocfg CONFIG_SYN_PROASIC 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_PROASIC 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Actel-ProasicPlus" } then { write_tristate $cfg $autocfg CONFIG_SYN_PROASICPLUS 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_PROASICPLUS 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Actel-Proasic3" } then { write_tristate $cfg $autocfg CONFIG_SYN_PROASIC3 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_PROASIC3 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Actel-Proasic3E" } then { write_tristate $cfg $autocfg CONFIG_SYN_PROASIC3E 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_PROASIC3E 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Actel-Proasic3L" } then { write_tristate $cfg $autocfg CONFIG_SYN_PROASIC3L 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_PROASIC3L 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Actel-IGLOO/p/L" } then { write_tristate $cfg $autocfg CONFIG_SYN_IGLOO 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_IGLOO 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Actel-IGLOO2" } then { write_tristate $cfg $autocfg CONFIG_SYN_IGLOO2 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_IGLOO2 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Actel-SmartFusion2" } then { write_tristate $cfg $autocfg CONFIG_SYN_SF2 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_SF2 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Actel-RTG4" } then { write_tristate $cfg $autocfg CONFIG_SYN_RTG4 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_RTG4 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Actel-Fusion" } then { write_tristate $cfg $autocfg CONFIG_SYN_FUSION 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_FUSION 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Aeroflex-UT025CRH" } then { write_tristate $cfg $autocfg CONFIG_SYN_UT025CRH 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_UT025CRH 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Aeroflex-UT130HBD" } then { write_tristate $cfg $autocfg CONFIG_SYN_UT130HBD 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_UT130HBD 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Aeroflex-UT90NHBD" } then { write_tristate $cfg $autocfg CONFIG_SYN_UT90NHBD 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_UT90NHBD 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Altera-CycloneIII" } then { write_tristate $cfg $autocfg CONFIG_SYN_CYCLONEIII 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_CYCLONEIII 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Altera-Stratix" } then { write_tristate $cfg $autocfg CONFIG_SYN_STRATIX 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_STRATIX 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Altera-StratixII" } then { write_tristate $cfg $autocfg CONFIG_SYN_STRATIXII 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_STRATIXII 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Altera-StratixIII" } then { write_tristate $cfg $autocfg CONFIG_SYN_STRATIXIII 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_STRATIXIII 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Altera-StratixIV" } then { write_tristate $cfg $autocfg CONFIG_SYN_STRATIXIV 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_STRATIXIV 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Altera-StratixV" } then { write_tristate $cfg $autocfg CONFIG_SYN_STRATIXV 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_STRATIXV 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Altera-Others" } then { write_tristate $cfg $autocfg CONFIG_SYN_ALTERA 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_ALTERA 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Atmel-ATC18" } then { write_tristate $cfg $autocfg CONFIG_SYN_ATC18 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_ATC18 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Atmel-ATC18RHA" } then { write_tristate $cfg $autocfg CONFIG_SYN_ATC18RHA 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_ATC18RHA 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Custom1" } then { write_tristate $cfg $autocfg CONFIG_SYN_CUSTOM1 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_CUSTOM1 0 [list $notmod] 2 }
	if { $tmpvar_0 == "DARE" } then { write_tristate $cfg $autocfg CONFIG_SYN_DARE 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_DARE 0 [list $notmod] 2 }
	if { $tmpvar_0 == "IBM-CMOS9SF" } then { write_tristate $cfg $autocfg CONFIG_SYN_CMOS9SF 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_CMOS9SF 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Lattice-EC/ECP/XP" } then { write_tristate $cfg $autocfg CONFIG_SYN_LATTICE 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_LATTICE 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Quicklogic-Eclipse" } then { write_tristate $cfg $autocfg CONFIG_SYN_ECLIPSE 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_ECLIPSE 0 [list $notmod] 2 }
	if { $tmpvar_0 == "RH-LIB18T" } then { write_tristate $cfg $autocfg CONFIG_SYN_RH_LIB18T 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_RH_LIB18T 0 [list $notmod] 2 }
	if { $tmpvar_0 == "RH-UMC" } then { write_tristate $cfg $autocfg CONFIG_SYN_RHUMC 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_RHUMC 0 [list $notmod] 2 }
	if { $tmpvar_0 == "RHS65" } then { write_tristate $cfg $autocfg CONFIG_SYN_RHS65 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_RHS65 0 [list $notmod] 2 }
	if { $tmpvar_0 == "SAED32" } then { write_tristate $cfg $autocfg CONFIG_SYN_SAED32 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_SAED32 0 [list $notmod] 2 }
	if { $tmpvar_0 == "SMIC130" } then { write_tristate $cfg $autocfg CONFIG_SYN_SMIC13 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_SMIC13 0 [list $notmod] 2 }
	if { $tmpvar_0 == "TM65Gplus" } then { write_tristate $cfg $autocfg CONFIG_SYN_TM65GPLUS 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_TM65GPLUS 0 [list $notmod] 2 }
	if { $tmpvar_0 == "TSMC90" } then { write_tristate $cfg $autocfg CONFIG_SYN_TSMC90 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_TSMC90 0 [list $notmod] 2 }
	if { $tmpvar_0 == "UMC180" } then { write_tristate $cfg $autocfg CONFIG_SYN_UMC 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_UMC 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Xilinx-Artix7" } then { write_tristate $cfg $autocfg CONFIG_SYN_ARTIX7 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_ARTIX7 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Xilinx-Kintex7" } then { write_tristate $cfg $autocfg CONFIG_SYN_KINTEX7 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_KINTEX7 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Xilinx-Spartan3" } then { write_tristate $cfg $autocfg CONFIG_SYN_SPARTAN3 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_SPARTAN3 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Xilinx-Spartan3E" } then { write_tristate $cfg $autocfg CONFIG_SYN_SPARTAN3E 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_SPARTAN3E 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Xilinx-Spartan6" } then { write_tristate $cfg $autocfg CONFIG_SYN_SPARTAN6 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_SPARTAN6 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Xilinx-Virtex2" } then { write_tristate $cfg $autocfg CONFIG_SYN_VIRTEX2 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_VIRTEX2 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Xilinx-Virtex4" } then { write_tristate $cfg $autocfg CONFIG_SYN_VIRTEX4 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_VIRTEX4 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Xilinx-Virtex5" } then { write_tristate $cfg $autocfg CONFIG_SYN_VIRTEX5 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_VIRTEX5 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Xilinx-Virtex6" } then { write_tristate $cfg $autocfg CONFIG_SYN_VIRTEX6 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_VIRTEX6 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Xilinx-Virtex7" } then { write_tristate $cfg $autocfg CONFIG_SYN_VIRTEX7 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_VIRTEX7 0 [list $notmod] 2 }
	if { $tmpvar_0 == "Xilinx-Zynq7000" } then { write_tristate $cfg $autocfg CONFIG_SYN_ZYNQ7000 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SYN_ZYNQ7000 0 [list $notmod] 2 }
	global tmpvar_1
	global CONFIG_SYN_INFERRED
	global CONFIG_SYN_CUSTOM1
	global CONFIG_SYN_ATC18
	global CONFIG_SYN_TSMC90
	global CONFIG_SYN_UMC
	global CONFIG_SYN_RHUMC
	global CONFIG_SYN_DARE
	global CONFIG_SYN_SAED32
	global CONFIG_SYN_RHS65
	global CONFIG_SYN_ARTISAN
	if {($CONFIG_SYN_INFERRED == 1 || $CONFIG_SYN_CUSTOM1 == 1 || $CONFIG_SYN_ATC18 == 1 || $CONFIG_SYN_TSMC90 == 1 || $CONFIG_SYN_UMC == 1 || $CONFIG_SYN_RHUMC == 1 || $CONFIG_SYN_DARE == 1 || $CONFIG_SYN_SAED32 == 1 || $CONFIG_SYN_RHS65 == 1 || $CONFIG_SYN_ARTISAN == 1)} then {
	if { $tmpvar_1 == "Inferred" } then { write_tristate $cfg $autocfg CONFIG_MEM_INFERRED 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_MEM_INFERRED 0 [list $notmod] 2 }
	if { $tmpvar_1 == "UMC18" } then { write_tristate $cfg $autocfg CONFIG_MEM_UMC 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_MEM_UMC 0 [list $notmod] 2 }
	if { $tmpvar_1 == "RH-UMC" } then { write_tristate $cfg $autocfg CONFIG_MEM_RHUMC 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_MEM_RHUMC 0 [list $notmod] 2 }
	if { $tmpvar_1 == "SAED32" } then { write_tristate $cfg $autocfg CONFIG_MEM_SAED32 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_MEM_SAED32 0 [list $notmod] 2 }
	if { $tmpvar_1 == "DARE" } then { write_tristate $cfg $autocfg CONFIG_MEM_DARE 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_MEM_DARE 0 [list $notmod] 2 }
	if { $tmpvar_1 == "RHS65" } then { write_tristate $cfg $autocfg CONFIG_MEM_RHS65 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_MEM_RHS65 0 [list $notmod] 2 }
	if { $tmpvar_1 == "Artisan" } then { write_tristate $cfg $autocfg CONFIG_MEM_ARTISAN 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_MEM_ARTISAN 0 [list $notmod] 2 }
	if { $tmpvar_1 == "Custom1" } then { write_tristate $cfg $autocfg CONFIG_MEM_CUSTOM1 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_MEM_CUSTOM1 0 [list $notmod] 2 }
	if { $tmpvar_1 == "Virage" } then { write_tristate $cfg $autocfg CONFIG_MEM_VIRAGE 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_MEM_VIRAGE 0 [list $notmod] 2 }
	if { $tmpvar_1 == "Virage-TSMC90" } then { write_tristate $cfg $autocfg CONFIG_MEM_VIRAGE90 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_MEM_VIRAGE90 0 [list $notmod] 2 }}
	global tmpvar_2
	global CONFIG_SYN_VIRTEX5
	global CONFIG_SYN_VIRTEX6
	global CONFIG_SYN_VIRTEX7
	if {($CONFIG_SYN_VIRTEX5 == 1 || $CONFIG_SYN_VIRTEX6 == 1 || $CONFIG_SYN_VIRTEX7 == 1)} then {
	if { $tmpvar_2 == "GTP0" } then { write_tristate $cfg $autocfg CONFIG_TRANS_GTP0 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_TRANS_GTP0 0 [list $notmod] 2 }
	if { $tmpvar_2 == "GTP1" } then { write_tristate $cfg $autocfg CONFIG_TRANS_GTP1 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_TRANS_GTP1 0 [list $notmod] 2 }
	if { $tmpvar_2 == "GTX0" } then { write_tristate $cfg $autocfg CONFIG_TRANS_GTX0 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_TRANS_GTX0 0 [list $notmod] 2 }
	if { $tmpvar_2 == "GTX1" } then { write_tristate $cfg $autocfg CONFIG_TRANS_GTX1 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_TRANS_GTX1 0 [list $notmod] 2 }
	if { $tmpvar_2 == "GTH0" } then { write_tristate $cfg $autocfg CONFIG_TRANS_GTH0 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_TRANS_GTH0 0 [list $notmod] 2 }
	if { $tmpvar_2 == "GTH1" } then { write_tristate $cfg $autocfg CONFIG_TRANS_GTH1 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_TRANS_GTH1 0 [list $notmod] 2 }}
	global CONFIG_SYN_INFER_RAM
	if {($CONFIG_SYN_INFERRED != 1)} then {write_tristate $cfg $autocfg CONFIG_SYN_INFER_RAM $CONFIG_SYN_INFER_RAM [list $notmod] 2 }
	global CONFIG_SYN_INFER_PADS
	if {($CONFIG_SYN_INFERRED != 1)} then {write_tristate $cfg $autocfg CONFIG_SYN_INFER_PADS $CONFIG_SYN_INFER_PADS [list $notmod] 2 }
	global CONFIG_SYN_NO_ASYNC
	write_tristate $cfg $autocfg CONFIG_SYN_NO_ASYNC $CONFIG_SYN_NO_ASYNC [list $notmod] 2
	global CONFIG_SYN_SCAN
	write_tristate $cfg $autocfg CONFIG_SYN_SCAN $CONFIG_SYN_SCAN [list $notmod] 2
	write_comment $cfg $autocfg "Clock generation"
	global tmpvar_3
	
	if { $tmpvar_3 == "Inferred" } then { write_tristate $cfg $autocfg CONFIG_CLK_INFERRED 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_CLK_INFERRED 0 [list $notmod] 2 }
	if { $tmpvar_3 == "Actel-HCLKBUF" } then { write_tristate $cfg $autocfg CONFIG_CLK_HCLKBUF 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_CLK_HCLKBUF 0 [list $notmod] 2 }
	if { $tmpvar_3 == "Aeroflex-UT130HBD" } then { write_tristate $cfg $autocfg CONFIG_CLK_UT130HBD 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_CLK_UT130HBD 0 [list $notmod] 2 }
	if { $tmpvar_3 == "Altera-ALTPLL" } then { write_tristate $cfg $autocfg CONFIG_CLK_ALTDLL 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_CLK_ALTDLL 0 [list $notmod] 2 }
	if { $tmpvar_3 == "Lattice-EXPLL" } then { write_tristate $cfg $autocfg CONFIG_CLK_LATDLL 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_CLK_LATDLL 0 [list $notmod] 2 }
	if { $tmpvar_3 == "Proasic3-PLL" } then { write_tristate $cfg $autocfg CONFIG_CLK_PRO3PLL 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_CLK_PRO3PLL 0 [list $notmod] 2 }
	if { $tmpvar_3 == "Proasic3E-PLL" } then { write_tristate $cfg $autocfg CONFIG_CLK_PRO3EPLL 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_CLK_PRO3EPLL 0 [list $notmod] 2 }
	if { $tmpvar_3 == "Proasic3L-PLL" } then { write_tristate $cfg $autocfg CONFIG_CLK_PRO3LPLL 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_CLK_PRO3LPLL 0 [list $notmod] 2 }
	if { $tmpvar_3 == "Fusion-PLL" } then { write_tristate $cfg $autocfg CONFIG_CLK_FUSPLL 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_CLK_FUSPLL 0 [list $notmod] 2 }
	if { $tmpvar_3 == "RH-LIB18T-PLL" } then { write_tristate $cfg $autocfg CONFIG_CLK_LIB18T 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_CLK_LIB18T 0 [list $notmod] 2 }
	if { $tmpvar_3 == "RHUMC-PLL" } then { write_tristate $cfg $autocfg CONFIG_CLK_RHUMC 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_CLK_RHUMC 0 [list $notmod] 2 }
	if { $tmpvar_3 == "DARE-PLL" } then { write_tristate $cfg $autocfg CONFIG_CLK_DARE 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_CLK_DARE 0 [list $notmod] 2 }
	if { $tmpvar_3 == "SAED32-PLL" } then { write_tristate $cfg $autocfg CONFIG_CLK_SAED32 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_CLK_SAED32 0 [list $notmod] 2 }
	if { $tmpvar_3 == "EASIC45-PLL" } then { write_tristate $cfg $autocfg CONFIG_CLK_EASIC45 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_CLK_EASIC45 0 [list $notmod] 2 }
	if { $tmpvar_3 == "RHS65-PLL" } then { write_tristate $cfg $autocfg CONFIG_CLK_RHS65 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_CLK_RHS65 0 [list $notmod] 2 }
	if { $tmpvar_3 == "Xilinx-PLLE2" } then { write_tristate $cfg $autocfg CONFIG_CLK_CLKPLLE2 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_CLK_CLKPLLE2 0 [list $notmod] 2 }
	if { $tmpvar_3 == "Xilinx-CLKDLL" } then { write_tristate $cfg $autocfg CONFIG_CLK_CLKDLL 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_CLK_CLKDLL 0 [list $notmod] 2 }
	if { $tmpvar_3 == "Xilinx-DCM" } then { write_tristate $cfg $autocfg CONFIG_CLK_DCM 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_CLK_DCM 0 [list $notmod] 2 }
	global CONFIG_CLK_MUL
	global CONFIG_CLK_DCM
	global CONFIG_CLK_ALTDLL
	global CONFIG_CLK_LATDLL
	global CONFIG_CLK_PRO3PLL
	global CONFIG_CLK_PRO3EPLL
	global CONFIG_CLK_PRO3LPLL
	global CONFIG_CLK_CLKDLL
	global CONFIG_CLK_LIB18T
	global CONFIG_CLK_FUSPLL
	global CONFIG_CLK_CLKPLLE2
	if {($CONFIG_CLK_DCM == 1 || $CONFIG_CLK_ALTDLL == 1 || $CONFIG_CLK_LATDLL == 1 || $CONFIG_CLK_PRO3PLL == 1 || $CONFIG_CLK_PRO3EPLL == 1 || $CONFIG_CLK_PRO3LPLL == 1 || $CONFIG_CLK_CLKDLL == 1 || $CONFIG_CLK_LIB18T == 1 || $CONFIG_CLK_FUSPLL == 1 || $CONFIG_CLK_CLKPLLE2 == 1)} then {write_int $cfg $autocfg CONFIG_CLK_MUL $CONFIG_CLK_MUL $notmod }
	global CONFIG_CLK_DIV
	if {($CONFIG_CLK_DCM == 1 || $CONFIG_CLK_ALTDLL == 1 || $CONFIG_CLK_LATDLL == 1 || $CONFIG_CLK_PRO3PLL == 1 || $CONFIG_CLK_PRO3EPLL == 1 || $CONFIG_CLK_PRO3LPLL == 1 || $CONFIG_CLK_CLKDLL == 1 || $CONFIG_CLK_LIB18T == 1 || $CONFIG_CLK_FUSPLL == 1 || $CONFIG_CLK_CLKPLLE2 == 1)} then {write_int $cfg $autocfg CONFIG_CLK_DIV $CONFIG_CLK_DIV $notmod }
	global CONFIG_OCLK_DIV
	if {($CONFIG_CLK_PRO3PLL == 1 || $CONFIG_CLK_PRO3EPLL == 1 || $CONFIG_CLK_PRO3LPLL == 1 || $CONFIG_CLK_FUSPLL == 1)} then {write_int $cfg $autocfg CONFIG_OCLK_DIV $CONFIG_OCLK_DIV $notmod }
	global CONFIG_OCLKB_DIV
	if {($CONFIG_CLK_PRO3PLL == 1 || $CONFIG_CLK_PRO3EPLL == 1 || $CONFIG_CLK_PRO3LPLL == 1 || $CONFIG_CLK_FUSPLL == 1)} then {write_int $cfg $autocfg CONFIG_OCLKB_DIV $CONFIG_OCLKB_DIV $notmod }
	global CONFIG_OCLKC_DIV
	if {($CONFIG_CLK_PRO3PLL == 1 || $CONFIG_CLK_PRO3EPLL == 1 || $CONFIG_CLK_PRO3LPLL == 1 || $CONFIG_CLK_FUSPLL == 1)} then {write_int $cfg $autocfg CONFIG_OCLKC_DIV $CONFIG_OCLKC_DIV $notmod }
	global CONFIG_PCI_CLKDLL
	if {($CONFIG_CLK_CLKDLL == 1 || $CONFIG_CLK_DCM == 1)} then {write_tristate $cfg $autocfg CONFIG_PCI_CLKDLL $CONFIG_PCI_CLKDLL [list $notmod] 2 }
	global CONFIG_CLK_NOFB
	if {($CONFIG_CLK_DCM == 1)} then {write_tristate $cfg $autocfg CONFIG_CLK_NOFB $CONFIG_CLK_NOFB [list $notmod] 2 }
	global CONFIG_PCI_SYSCLK
	global CONFIG_PCI_ENABLE
	if {($CONFIG_PCI_ENABLE != 1)} then {write_tristate $cfg $autocfg CONFIG_PCI_SYSCLK $CONFIG_PCI_SYSCLK [list $notmod] 2 }
	write_comment $cfg $autocfg "Processor            "
	global tmpvar_4
	
	if { $tmpvar_4 == "LEON3" } then { write_tristate $cfg $autocfg CONFIG_LEON3 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_LEON3 0 [list $notmod] 2 }
	if { $tmpvar_4 == "LEON4" } then { write_tristate $cfg $autocfg CONFIG_LEON4 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_LEON4 0 [list $notmod] 2 }
	global CONFIG_PROC_NUM
	write_int $cfg $autocfg CONFIG_PROC_NUM $CONFIG_PROC_NUM $notmod
	global tmpvar_5
	
	if { $tmpvar_5 == "Minimal-configuration" } then { write_tristate $cfg $autocfg CONFIG_LEON_MIN 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_LEON_MIN 0 [list $notmod] 2 }
	if { $tmpvar_5 == "General-purpose-cfg" } then { write_tristate $cfg $autocfg CONFIG_LEON_GP 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_LEON_GP 0 [list $notmod] 2 }
	if { $tmpvar_5 == "High-Performance-cfg" } then { write_tristate $cfg $autocfg CONFIG_LEON_HP 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_LEON_HP 0 [list $notmod] 2 }
	if { $tmpvar_5 == "Custom-configuration" } then { write_tristate $cfg $autocfg CONFIG_LEON_CUSTOM 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_LEON_CUSTOM 0 [list $notmod] 2 }
	global CONFIG_IU_NWINDOWS
	global CONFIG_LEON_MIN
	if {($CONFIG_LEON_MIN == 1)} then {write_int $cfg $autocfg CONFIG_IU_NWINDOWS 8 $notmod }
	global CONFIG_IU_V8MULDIV
	global CONSTANT_N
	if {($CONFIG_LEON_MIN == 1)} then {write_tristate $cfg $autocfg CONFIG_IU_V8MULDIV $CONSTANT_N [list $notmod] 2 }
	global CONFIG_IU_BP
	if {($CONFIG_LEON_MIN == 1)} then {write_tristate $cfg $autocfg CONFIG_IU_BP $CONSTANT_N [list $notmod] 2 }
	global CONFIG_IU_SVT
	if {($CONFIG_LEON_MIN == 1)} then {write_tristate $cfg $autocfg CONFIG_IU_SVT $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_IU_LDELAY
	if {($CONFIG_LEON_MIN == 1)} then {write_int $cfg $autocfg CONFIG_IU_LDELAY 1 $notmod }
	global CONFIG_IU_WATCHPOINTS
	if {($CONFIG_LEON_MIN == 1)} then {write_int $cfg $autocfg CONFIG_IU_WATCHPOINTS 0 $notmod }
	global CONFIG_PWD
	if {($CONFIG_LEON_MIN == 1)} then {write_tristate $cfg $autocfg CONFIG_PWD $CONSTANT_N [list $notmod] 2 }
	global CONFIG_IU_RSTADDR
	if {($CONFIG_LEON_MIN == 1)} then {write_hex $cfg $autocfg CONFIG_IU_RSTADDR 00000 $notmod }
	global CONFIG_FPU_ENABLE
	if {($CONFIG_LEON_MIN == 1)} then {write_tristate $cfg $autocfg CONFIG_FPU_ENABLE $CONSTANT_N [list $notmod] 2 }
	global CONFIG_ICACHE_ENABLE
	if {($CONFIG_LEON_MIN == 1)} then {write_tristate $cfg $autocfg CONFIG_ICACHE_ENABLE $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_ICACHE_ASSO1
	if {($CONFIG_LEON_MIN == 1)} then {write_tristate $cfg $autocfg CONFIG_ICACHE_ASSO1 $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_ICACHE_SZ2
	if {($CONFIG_LEON_MIN == 1)} then {write_tristate $cfg $autocfg CONFIG_ICACHE_SZ2 $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_ICACHE_LZ16
	if {($CONFIG_LEON_MIN == 1)} then {write_tristate $cfg $autocfg CONFIG_ICACHE_LZ16 $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_ICACHE_ALGORND
	if {($CONFIG_LEON_MIN == 1)} then {write_tristate $cfg $autocfg CONFIG_ICACHE_ALGORND $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_ICACHE_LOCK
	if {($CONFIG_LEON_MIN == 1)} then {write_tristate $cfg $autocfg CONFIG_ICACHE_LOCK $CONSTANT_N [list $notmod] 2 }
	global CONFIG_DCACHE_ENABLE
	if {($CONFIG_LEON_MIN == 1)} then {write_tristate $cfg $autocfg CONFIG_DCACHE_ENABLE $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_DCACHE_ASSO1
	if {($CONFIG_LEON_MIN == 1)} then {write_tristate $cfg $autocfg CONFIG_DCACHE_ASSO1 $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_DCACHE_SZ2
	if {($CONFIG_LEON_MIN == 1)} then {write_tristate $cfg $autocfg CONFIG_DCACHE_SZ2 $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_DCACHE_LZ16
	if {($CONFIG_LEON_MIN == 1)} then {write_tristate $cfg $autocfg CONFIG_DCACHE_LZ16 $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_DCACHE_ALGORND
	if {($CONFIG_LEON_MIN == 1)} then {write_tristate $cfg $autocfg CONFIG_DCACHE_ALGORND $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_DCACHE_LOCK
	if {($CONFIG_LEON_MIN == 1)} then {write_tristate $cfg $autocfg CONFIG_DCACHE_LOCK $CONSTANT_N [list $notmod] 2 }
	global CONFIG_DCACHE_SNOOP
	if {($CONFIG_LEON_MIN == 1)} then {write_tristate $cfg $autocfg CONFIG_DCACHE_SNOOP $CONSTANT_N [list $notmod] 2 }
	global CONFIG_MMU_ENABLE
	if {($CONFIG_LEON_MIN == 1)} then {write_tristate $cfg $autocfg CONFIG_MMU_ENABLE $CONSTANT_N [list $notmod] 2 }
	global CONFIG_DSU_ENABLE
	if {($CONFIG_LEON_MIN == 1)} then {write_tristate $cfg $autocfg CONFIG_DSU_ENABLE $CONSTANT_N [list $notmod] 2 }
	global CONFIG_NP_ASI
	if {($CONFIG_LEON_MIN == 1)} then {write_tristate $cfg $autocfg CONFIG_NP_ASI $CONSTANT_N [list $notmod] 2 }
	global CONFIG_PWRPSR
	if {($CONFIG_LEON_MIN == 1)} then {write_tristate $cfg $autocfg CONFIG_PWRPSR $CONSTANT_N [list $notmod] 2 }
	global CONFIG_LEON_GP
	if {($CONFIG_LEON_GP == 1)} then {write_int $cfg $autocfg CONFIG_IU_NWINDOWS 8 $notmod }
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_IU_V8MULDIV $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_IU_MUL_LATENCY_5
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_IU_MUL_LATENCY_5 $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_IU_MUL_MAC
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_IU_MUL_MAC $CONSTANT_N [list $notmod] 2 }
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_IU_BP $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_IU_SVT $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_GP == 1)} then {write_int $cfg $autocfg CONFIG_IU_LDELAY 1 $notmod }
	if {($CONFIG_LEON_GP == 1)} then {write_int $cfg $autocfg CONFIG_IU_WATCHPOINTS 2 $notmod }
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_PWD $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_GP == 1)} then {write_hex $cfg $autocfg CONFIG_IU_RSTADDR 00000 $notmod }
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_FPU_ENABLE $CONSTANT_N [list $notmod] 2 }
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_ICACHE_ENABLE $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_ICACHE_ASSO2
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_ICACHE_ASSO2 $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_ICACHE_SZ4
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_ICACHE_SZ4 $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_ICACHE_LZ16 $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_ICACHE_ALGORND $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_ICACHE_LOCK $CONSTANT_N [list $notmod] 2 }
	global CONFIG_ICACHE_LRAM
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_ICACHE_LRAM $CONSTANT_N [list $notmod] 2 }
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_DCACHE_ENABLE $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_DCACHE_ASSO2
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_DCACHE_ASSO2 $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_DCACHE_SZ4
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_DCACHE_SZ4 $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_DCACHE_LZ16 $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_DCACHE_ALGORND $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_DCACHE_LOCK $CONSTANT_N [list $notmod] 2 }
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_DCACHE_SNOOP $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_DCACHE_SNOOP_SEPTAG
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_DCACHE_SNOOP_SEPTAG $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_DCACHE_SNOOP_SP
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_DCACHE_SNOOP_SP $CONSTANT_N [list $notmod] 2 }
	global CONFIG_DCACHE_LRAM
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_DCACHE_LRAM $CONSTANT_N [list $notmod] 2 }
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_MMU_ENABLE $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_MMU_SPLIT
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_MMU_SPLIT $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_MMU_REPARRAY
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_MMU_REPARRAY $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_MMU_I8
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_MMU_I8 $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_MMU_D8
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_MMU_D8 $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_MMU_FASTWB
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_MMU_FASTWB $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_MMU_PAGE_4K
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_MMU_PAGE_4K $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_DSU_ENABLE $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_DSU_ITRACE
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_DSU_ITRACE $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_DSU_ITRACESZ4
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_DSU_ITRACESZ4 $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_DSU_ATRACESZ4
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_DSU_ATRACESZ4 $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_NP_ASI $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_GP == 1)} then {write_tristate $cfg $autocfg CONFIG_PWRPSR $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_LEON_HP
	if {($CONFIG_LEON_HP == 1)} then {write_int $cfg $autocfg CONFIG_IU_NWINDOWS 8 $notmod }
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_IU_V8MULDIV $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_IU_MUL_LATENCY_2
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_IU_MUL_LATENCY_2 $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_IU_MUL_MAC $CONSTANT_N [list $notmod] 2 }
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_IU_BP $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_IU_SVT $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_HP == 1)} then {write_int $cfg $autocfg CONFIG_IU_LDELAY 1 $notmod }
	if {($CONFIG_LEON_HP == 1)} then {write_int $cfg $autocfg CONFIG_IU_WATCHPOINTS 4 $notmod }
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_PWD $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_HP == 1)} then {write_hex $cfg $autocfg CONFIG_IU_RSTADDR 00000 $notmod }
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_FPU_ENABLE $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_FPU_GRFPU
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_FPU_GRFPU $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_FPU_GRFPU_INFMUL
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_FPU_GRFPU_INFMUL $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_ICACHE_ENABLE $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_ICACHE_ASSO2 $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_ICACHE_SZ4 $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_ICACHE_LZ16 $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_ICACHE_ALGOLRU
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_ICACHE_ALGOLRU $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_ICACHE_LOCK $CONSTANT_N [list $notmod] 2 }
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_ICACHE_LRAM $CONSTANT_N [list $notmod] 2 }
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_DCACHE_ENABLE $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_DCACHE_ASSO2 $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_DCACHE_SZ4 $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_DCACHE_LZ16 $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_DCACHE_ALGOLRU
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_DCACHE_ALGOLRU $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_DCACHE_LOCK $CONSTANT_N [list $notmod] 2 }
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_DCACHE_SNOOP $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_DCACHE_SNOOP_SEPTAG $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_DCACHE_SNOOP_SP $CONSTANT_N [list $notmod] 2 }
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_DCACHE_LRAM $CONSTANT_N [list $notmod] 2 }
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_MMU_ENABLE $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_MMU_SPLIT $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_MMU_REPARRAY $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_MMU_I16
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_MMU_I16 $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_MMU_D16
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_MMU_D16 $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_MMU_FASTWB $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_MMU_PAGE_4K $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_DSU_ENABLE $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_DSU_ITRACE $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_DSU_ITRACESZ4 $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_DSU_ATRACESZ4 $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_NP_ASI $CONSTANT_Y [list $notmod] 2 }
	if {($CONFIG_LEON_HP == 1)} then {write_tristate $cfg $autocfg CONFIG_PWRPSR $CONSTANT_Y [list $notmod] 2 }
	global CONFIG_LEON_CUSTOM
	if {($CONFIG_LEON_CUSTOM == 1)} then {write_comment $cfg $autocfg "Integer unit                                           "}
	if {($CONFIG_LEON_CUSTOM == 1)} then {write_int $cfg $autocfg CONFIG_IU_NWINDOWS $CONFIG_IU_NWINDOWS $notmod }
	if {($CONFIG_LEON_CUSTOM == 1)} then {write_tristate $cfg $autocfg CONFIG_IU_V8MULDIV $CONFIG_IU_V8MULDIV [list $notmod] 2 }
	global tmpvar_6
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_IU_V8MULDIV == 1)} then {
	if { $tmpvar_6 == "2-cycles" } then { write_tristate $cfg $autocfg CONFIG_IU_MUL_LATENCY_2 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_IU_MUL_LATENCY_2 0 [list $notmod] 2 }
	if { $tmpvar_6 == "4-cycles" } then { write_tristate $cfg $autocfg CONFIG_IU_MUL_LATENCY_4 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_IU_MUL_LATENCY_4 0 [list $notmod] 2 }
	if { $tmpvar_6 == "5-cycles" } then { write_tristate $cfg $autocfg CONFIG_IU_MUL_LATENCY_5 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_IU_MUL_LATENCY_5 0 [list $notmod] 2 }}
	global CONFIG_IU_MUL_LATENCY_4
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_IU_V8MULDIV == 1) && ($CONFIG_IU_MUL_LATENCY_4 == 1 || $CONFIG_IU_MUL_LATENCY_5 == 1)} then {write_tristate $cfg $autocfg CONFIG_IU_MUL_MAC $CONFIG_IU_MUL_MAC [list $notmod] 2 }
	global tmpvar_7
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_IU_V8MULDIV == 1)} then {
	if { $tmpvar_7 == "Inferred" } then { write_tristate $cfg $autocfg CONFIG_IU_MUL_INFERRED 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_IU_MUL_INFERRED 0 [list $notmod] 2 }
	if { $tmpvar_7 == "NTNU_Modgen" } then { write_tristate $cfg $autocfg CONFIG_IU_MUL_MODGEN 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_IU_MUL_MODGEN 0 [list $notmod] 2 }
	if { $tmpvar_7 == "TechSpec" } then { write_tristate $cfg $autocfg CONFIG_IU_MUL_TECHSPEC 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_IU_MUL_TECHSPEC 0 [list $notmod] 2 }
	if { $tmpvar_7 == "Designware" } then { write_tristate $cfg $autocfg CONFIG_IU_MUL_DW 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_IU_MUL_DW 0 [list $notmod] 2 }}
	if {($CONFIG_LEON_CUSTOM == 1)} then {write_tristate $cfg $autocfg CONFIG_IU_SVT $CONFIG_IU_SVT [list $notmod] 2 }
	if {($CONFIG_LEON_CUSTOM == 1)} then {write_int $cfg $autocfg CONFIG_IU_LDELAY $CONFIG_IU_LDELAY $notmod }
	if {($CONFIG_LEON_CUSTOM == 1)} then {write_int $cfg $autocfg CONFIG_IU_WATCHPOINTS $CONFIG_IU_WATCHPOINTS $notmod }
	if {($CONFIG_LEON_CUSTOM == 1)} then {write_tristate $cfg $autocfg CONFIG_PWD $CONFIG_PWD [list $notmod] 2 }
	if {($CONFIG_LEON_CUSTOM == 1)} then {write_hex $cfg $autocfg CONFIG_IU_RSTADDR $CONFIG_IU_RSTADDR $notmod }
	if {($CONFIG_LEON_CUSTOM == 1)} then {write_tristate $cfg $autocfg CONFIG_NP_ASI $CONFIG_NP_ASI [list $notmod] 2 }
	global CONFIG_WRPSR
	if {($CONFIG_LEON_CUSTOM == 1)} then {write_tristate $cfg $autocfg CONFIG_WRPSR $CONFIG_WRPSR [list $notmod] 2 }
	global CONFIG_ALTWIN
	global CONFIG_LEON3
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_LEON3 == 1)} then {write_tristate $cfg $autocfg CONFIG_ALTWIN $CONFIG_ALTWIN [list $notmod] 2 }
	global CONFIG_REX
	if {($CONFIG_LEON_CUSTOM == 1)} then {write_tristate $cfg $autocfg CONFIG_REX $CONFIG_REX [list $notmod] 2 }
	if {($CONFIG_LEON_CUSTOM == 1)} then {write_comment $cfg $autocfg "Floating-point unit"}
	if {($CONFIG_LEON_CUSTOM == 1)} then {write_tristate $cfg $autocfg CONFIG_FPU_ENABLE $CONFIG_FPU_ENABLE [list $notmod] 2 }
	global tmpvar_8
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_FPU_ENABLE == 1)} then {
	if { $tmpvar_8 == "GRFPU" } then { write_tristate $cfg $autocfg CONFIG_FPU_GRFPU 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_FPU_GRFPU 0 [list $notmod] 2 }
	if { $tmpvar_8 == "GRFPU-LITE" } then { write_tristate $cfg $autocfg CONFIG_FPU_GRFPULITE 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_FPU_GRFPULITE 0 [list $notmod] 2 }}
	global tmpvar_9
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_FPU_ENABLE == 1) && ($CONFIG_FPU_GRFPU == 1)} then {
	if { $tmpvar_9 == "Inferred" } then { write_tristate $cfg $autocfg CONFIG_FPU_GRFPU_INFMUL 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_FPU_GRFPU_INFMUL 0 [list $notmod] 2 }
	if { $tmpvar_9 == "DW" } then { write_tristate $cfg $autocfg CONFIG_FPU_GRFPU_DWMUL 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_FPU_GRFPU_DWMUL 0 [list $notmod] 2 }
	if { $tmpvar_9 == "ModGen" } then { write_tristate $cfg $autocfg CONFIG_FPU_GRFPU_MODGEN 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_FPU_GRFPU_MODGEN 0 [list $notmod] 2 }
	if { $tmpvar_9 == "TechSpec" } then { write_tristate $cfg $autocfg CONFIG_FPU_GRFPU_TECHSPEC 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_FPU_GRFPU_TECHSPEC 0 [list $notmod] 2 }}
	global CONFIG_FPU_GRFPU_SH
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_FPU_ENABLE == 1)} then {write_tristate $cfg $autocfg CONFIG_FPU_GRFPU_SH $CONFIG_FPU_GRFPU_SH [list $notmod] 2 }
	global tmpvar_10
	global CONFIG_FPU_GRFPULITE
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_FPU_ENABLE == 1) && ($CONFIG_FPU_GRFPULITE == 1)} then {
	if { $tmpvar_10 == "Simple" } then { write_tristate $cfg $autocfg CONFIG_FPU_GRFPC0 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_FPU_GRFPC0 0 [list $notmod] 2 }
	if { $tmpvar_10 == "Data-forwarding" } then { write_tristate $cfg $autocfg CONFIG_FPU_GRFPC1 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_FPU_GRFPC1 0 [list $notmod] 2 }
	if { $tmpvar_10 == "Non-blocking" } then { write_tristate $cfg $autocfg CONFIG_FPU_GRFPC2 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_FPU_GRFPC2 0 [list $notmod] 2 }}
	global CONFIG_FPU_NETLIST
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_FPU_ENABLE == 1)} then {write_tristate $cfg $autocfg CONFIG_FPU_NETLIST $CONFIG_FPU_NETLIST [list $notmod] 2 }
	write_comment $cfg $autocfg "Cache system"
	if {($CONFIG_LEON_CUSTOM == 1)} then {write_tristate $cfg $autocfg CONFIG_ICACHE_ENABLE $CONFIG_ICACHE_ENABLE [list $notmod] 2 }
	global tmpvar_11
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_ICACHE_ENABLE == 1)} then {
	if { $tmpvar_11 == "1" } then { write_tristate $cfg $autocfg CONFIG_ICACHE_ASSO1 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_ICACHE_ASSO1 0 [list $notmod] 2 }
	if { $tmpvar_11 == "2" } then { write_tristate $cfg $autocfg CONFIG_ICACHE_ASSO2 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_ICACHE_ASSO2 0 [list $notmod] 2 }
	if { $tmpvar_11 == "3" } then { write_tristate $cfg $autocfg CONFIG_ICACHE_ASSO3 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_ICACHE_ASSO3 0 [list $notmod] 2 }
	if { $tmpvar_11 == "4" } then { write_tristate $cfg $autocfg CONFIG_ICACHE_ASSO4 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_ICACHE_ASSO4 0 [list $notmod] 2 }}
	global tmpvar_12
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_ICACHE_ENABLE == 1)} then {
	if { $tmpvar_12 == "1" } then { write_tristate $cfg $autocfg CONFIG_ICACHE_SZ1 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_ICACHE_SZ1 0 [list $notmod] 2 }
	if { $tmpvar_12 == "2" } then { write_tristate $cfg $autocfg CONFIG_ICACHE_SZ2 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_ICACHE_SZ2 0 [list $notmod] 2 }
	if { $tmpvar_12 == "4" } then { write_tristate $cfg $autocfg CONFIG_ICACHE_SZ4 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_ICACHE_SZ4 0 [list $notmod] 2 }
	if { $tmpvar_12 == "8" } then { write_tristate $cfg $autocfg CONFIG_ICACHE_SZ8 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_ICACHE_SZ8 0 [list $notmod] 2 }
	if { $tmpvar_12 == "16" } then { write_tristate $cfg $autocfg CONFIG_ICACHE_SZ16 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_ICACHE_SZ16 0 [list $notmod] 2 }
	if { $tmpvar_12 == "32" } then { write_tristate $cfg $autocfg CONFIG_ICACHE_SZ32 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_ICACHE_SZ32 0 [list $notmod] 2 }
	if { $tmpvar_12 == "64" } then { write_tristate $cfg $autocfg CONFIG_ICACHE_SZ64 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_ICACHE_SZ64 0 [list $notmod] 2 }
	if { $tmpvar_12 == "128" } then { write_tristate $cfg $autocfg CONFIG_ICACHE_SZ128 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_ICACHE_SZ128 0 [list $notmod] 2 }
	if { $tmpvar_12 == "256" } then { write_tristate $cfg $autocfg CONFIG_ICACHE_SZ256 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_ICACHE_SZ256 0 [list $notmod] 2 }}
	global tmpvar_13
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_ICACHE_ENABLE == 1)} then {
	if { $tmpvar_13 == "16" } then { write_tristate $cfg $autocfg CONFIG_ICACHE_LZ16 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_ICACHE_LZ16 0 [list $notmod] 2 }
	if { $tmpvar_13 == "32" } then { write_tristate $cfg $autocfg CONFIG_ICACHE_LZ32 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_ICACHE_LZ32 0 [list $notmod] 2 }}
	global tmpvar_14
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_ICACHE_ENABLE == 1) && ($CONFIG_ICACHE_ASSO1 != 1)} then {
	if { $tmpvar_14 == "Random" } then { write_tristate $cfg $autocfg CONFIG_ICACHE_ALGORND 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_ICACHE_ALGORND 0 [list $notmod] 2 }
	if { $tmpvar_14 == "LRU/Dynamic" } then { write_tristate $cfg $autocfg CONFIG_ICACHE_ALGOLRU 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_ICACHE_ALGOLRU 0 [list $notmod] 2 }}
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_ICACHE_ENABLE == 1) && ($CONFIG_ICACHE_ASSO1 != 1) && ($CONFIG_LEON3 == 1)} then {write_tristate $cfg $autocfg CONFIG_ICACHE_LOCK $CONFIG_ICACHE_LOCK [list $notmod] 2 }
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_LEON3 == 1) && ($CONFIG_MMU_ENABLE != 1)} then {write_tristate $cfg $autocfg CONFIG_ICACHE_LRAM $CONFIG_ICACHE_LRAM [list $notmod] 2 }
	global tmpvar_15
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_LEON3 == 1) && ($CONFIG_ICACHE_LRAM == 1)} then {
	if { $tmpvar_15 == "1" } then { write_tristate $cfg $autocfg CONFIG_ICACHE_LRAM_SZ1 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_ICACHE_LRAM_SZ1 0 [list $notmod] 2 }
	if { $tmpvar_15 == "2" } then { write_tristate $cfg $autocfg CONFIG_ICACHE_LRAM_SZ2 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_ICACHE_LRAM_SZ2 0 [list $notmod] 2 }
	if { $tmpvar_15 == "4" } then { write_tristate $cfg $autocfg CONFIG_ICACHE_LRAM_SZ4 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_ICACHE_LRAM_SZ4 0 [list $notmod] 2 }
	if { $tmpvar_15 == "8" } then { write_tristate $cfg $autocfg CONFIG_ICACHE_LRAM_SZ8 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_ICACHE_LRAM_SZ8 0 [list $notmod] 2 }
	if { $tmpvar_15 == "16" } then { write_tristate $cfg $autocfg CONFIG_ICACHE_LRAM_SZ16 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_ICACHE_LRAM_SZ16 0 [list $notmod] 2 }
	if { $tmpvar_15 == "32" } then { write_tristate $cfg $autocfg CONFIG_ICACHE_LRAM_SZ32 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_ICACHE_LRAM_SZ32 0 [list $notmod] 2 }
	if { $tmpvar_15 == "64" } then { write_tristate $cfg $autocfg CONFIG_ICACHE_LRAM_SZ64 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_ICACHE_LRAM_SZ64 0 [list $notmod] 2 }
	if { $tmpvar_15 == "128" } then { write_tristate $cfg $autocfg CONFIG_ICACHE_LRAM_SZ128 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_ICACHE_LRAM_SZ128 0 [list $notmod] 2 }
	if { $tmpvar_15 == "256" } then { write_tristate $cfg $autocfg CONFIG_ICACHE_LRAM_SZ256 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_ICACHE_LRAM_SZ256 0 [list $notmod] 2 }}
	global CONFIG_ICACHE_LRSTART
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_LEON3 == 1) && ($CONFIG_ICACHE_LRAM == 1)} then {write_hex $cfg $autocfg CONFIG_ICACHE_LRSTART $CONFIG_ICACHE_LRSTART $notmod }
	if {($CONFIG_LEON_CUSTOM == 1)} then {write_tristate $cfg $autocfg CONFIG_DCACHE_ENABLE $CONFIG_DCACHE_ENABLE [list $notmod] 2 }
	global tmpvar_16
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_DCACHE_ENABLE == 1)} then {
	if { $tmpvar_16 == "1" } then { write_tristate $cfg $autocfg CONFIG_DCACHE_ASSO1 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DCACHE_ASSO1 0 [list $notmod] 2 }
	if { $tmpvar_16 == "2" } then { write_tristate $cfg $autocfg CONFIG_DCACHE_ASSO2 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DCACHE_ASSO2 0 [list $notmod] 2 }
	if { $tmpvar_16 == "3" } then { write_tristate $cfg $autocfg CONFIG_DCACHE_ASSO3 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DCACHE_ASSO3 0 [list $notmod] 2 }
	if { $tmpvar_16 == "4" } then { write_tristate $cfg $autocfg CONFIG_DCACHE_ASSO4 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DCACHE_ASSO4 0 [list $notmod] 2 }}
	global tmpvar_17
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_DCACHE_ENABLE == 1)} then {
	if { $tmpvar_17 == "1" } then { write_tristate $cfg $autocfg CONFIG_DCACHE_SZ1 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DCACHE_SZ1 0 [list $notmod] 2 }
	if { $tmpvar_17 == "2" } then { write_tristate $cfg $autocfg CONFIG_DCACHE_SZ2 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DCACHE_SZ2 0 [list $notmod] 2 }
	if { $tmpvar_17 == "4" } then { write_tristate $cfg $autocfg CONFIG_DCACHE_SZ4 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DCACHE_SZ4 0 [list $notmod] 2 }
	if { $tmpvar_17 == "8" } then { write_tristate $cfg $autocfg CONFIG_DCACHE_SZ8 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DCACHE_SZ8 0 [list $notmod] 2 }
	if { $tmpvar_17 == "16" } then { write_tristate $cfg $autocfg CONFIG_DCACHE_SZ16 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DCACHE_SZ16 0 [list $notmod] 2 }
	if { $tmpvar_17 == "32" } then { write_tristate $cfg $autocfg CONFIG_DCACHE_SZ32 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DCACHE_SZ32 0 [list $notmod] 2 }
	if { $tmpvar_17 == "64" } then { write_tristate $cfg $autocfg CONFIG_DCACHE_SZ64 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DCACHE_SZ64 0 [list $notmod] 2 }
	if { $tmpvar_17 == "128" } then { write_tristate $cfg $autocfg CONFIG_DCACHE_SZ128 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DCACHE_SZ128 0 [list $notmod] 2 }
	if { $tmpvar_17 == "256" } then { write_tristate $cfg $autocfg CONFIG_DCACHE_SZ256 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DCACHE_SZ256 0 [list $notmod] 2 }}
	global tmpvar_18
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_DCACHE_ENABLE == 1)} then {
	if { $tmpvar_18 == "16" } then { write_tristate $cfg $autocfg CONFIG_DCACHE_LZ16 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DCACHE_LZ16 0 [list $notmod] 2 }
	if { $tmpvar_18 == "32" } then { write_tristate $cfg $autocfg CONFIG_DCACHE_LZ32 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DCACHE_LZ32 0 [list $notmod] 2 }}
	global tmpvar_19
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_DCACHE_ENABLE == 1) && ($CONFIG_DCACHE_ASSO1 != 1)} then {
	if { $tmpvar_19 == "Random" } then { write_tristate $cfg $autocfg CONFIG_DCACHE_ALGORND 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DCACHE_ALGORND 0 [list $notmod] 2 }
	if { $tmpvar_19 == "LRU/Dynamic" } then { write_tristate $cfg $autocfg CONFIG_DCACHE_ALGOLRU 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DCACHE_ALGOLRU 0 [list $notmod] 2 }}
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_DCACHE_ENABLE == 1) && ($CONFIG_DCACHE_ASSO1 != 1)} then {write_tristate $cfg $autocfg CONFIG_DCACHE_LOCK $CONFIG_DCACHE_LOCK [list $notmod] 2 }
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_DCACHE_ENABLE == 1)} then {write_tristate $cfg $autocfg CONFIG_DCACHE_SNOOP $CONFIG_DCACHE_SNOOP [list $notmod] 2 }
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_DCACHE_ENABLE == 1) && ($CONFIG_DCACHE_SNOOP == 1)} then {write_tristate $cfg $autocfg CONFIG_DCACHE_SNOOP_SEPTAG $CONFIG_DCACHE_SNOOP_SEPTAG [list $notmod] 2 }
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_DCACHE_ENABLE == 1) && ($CONFIG_DCACHE_SNOOP == 1) && ($CONFIG_LEON3 == 1) && ($CONFIG_DCACHE_SNOOP_SEPTAG == 1)} then {write_tristate $cfg $autocfg CONFIG_DCACHE_SNOOP_SP $CONFIG_DCACHE_SNOOP_SP [list $notmod] 2 }
	global CONFIG_CACHE_FIXED
	write_hex $cfg $autocfg CONFIG_CACHE_FIXED $CONFIG_CACHE_FIXED $notmod
	global CONFIG_BWMASK
	write_hex $cfg $autocfg CONFIG_BWMASK $CONFIG_BWMASK $notmod
	global tmpvar_20
	
	if { $tmpvar_20 == "64-bit" } then { write_tristate $cfg $autocfg CONFIG_CACHE_64BIT 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_CACHE_64BIT 0 [list $notmod] 2 }
	if { $tmpvar_20 == "128-bit" } then { write_tristate $cfg $autocfg CONFIG_CACHE_128BIT 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_CACHE_128BIT 0 [list $notmod] 2 }
	if {($CONFIG_LEON3 == 1) && ($CONFIG_MMU_ENABLE != 1)} then {write_tristate $cfg $autocfg CONFIG_DCACHE_LRAM $CONFIG_DCACHE_LRAM [list $notmod] 2 }
	global tmpvar_21
	if {($CONFIG_LEON3 == 1) && ($CONFIG_DCACHE_LRAM == 1)} then {
	if { $tmpvar_21 == "1" } then { write_tristate $cfg $autocfg CONFIG_DCACHE_LRAM_SZ1 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DCACHE_LRAM_SZ1 0 [list $notmod] 2 }
	if { $tmpvar_21 == "2" } then { write_tristate $cfg $autocfg CONFIG_DCACHE_LRAM_SZ2 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DCACHE_LRAM_SZ2 0 [list $notmod] 2 }
	if { $tmpvar_21 == "4" } then { write_tristate $cfg $autocfg CONFIG_DCACHE_LRAM_SZ4 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DCACHE_LRAM_SZ4 0 [list $notmod] 2 }
	if { $tmpvar_21 == "8" } then { write_tristate $cfg $autocfg CONFIG_DCACHE_LRAM_SZ8 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DCACHE_LRAM_SZ8 0 [list $notmod] 2 }
	if { $tmpvar_21 == "16" } then { write_tristate $cfg $autocfg CONFIG_DCACHE_LRAM_SZ16 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DCACHE_LRAM_SZ16 0 [list $notmod] 2 }
	if { $tmpvar_21 == "32" } then { write_tristate $cfg $autocfg CONFIG_DCACHE_LRAM_SZ32 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DCACHE_LRAM_SZ32 0 [list $notmod] 2 }
	if { $tmpvar_21 == "64" } then { write_tristate $cfg $autocfg CONFIG_DCACHE_LRAM_SZ64 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DCACHE_LRAM_SZ64 0 [list $notmod] 2 }
	if { $tmpvar_21 == "128" } then { write_tristate $cfg $autocfg CONFIG_DCACHE_LRAM_SZ128 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DCACHE_LRAM_SZ128 0 [list $notmod] 2 }
	if { $tmpvar_21 == "256" } then { write_tristate $cfg $autocfg CONFIG_DCACHE_LRAM_SZ256 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DCACHE_LRAM_SZ256 0 [list $notmod] 2 }}
	global CONFIG_DCACHE_LRSTART
	if {($CONFIG_LEON3 == 1) && ($CONFIG_DCACHE_LRAM == 1)} then {write_hex $cfg $autocfg CONFIG_DCACHE_LRSTART $CONFIG_DCACHE_LRSTART $notmod }
	if {($CONFIG_LEON_CUSTOM == 1)} then {write_comment $cfg $autocfg "MMU"}
	if {($CONFIG_LEON_CUSTOM == 1)} then {write_tristate $cfg $autocfg CONFIG_MMU_ENABLE $CONFIG_MMU_ENABLE [list $notmod] 2 }
	global tmpvar_22
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_MMU_ENABLE == 1)} then {
	if { $tmpvar_22 == "combined" } then { write_tristate $cfg $autocfg CONFIG_MMU_COMBINED 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_MMU_COMBINED 0 [list $notmod] 2 }
	if { $tmpvar_22 == "split" } then { write_tristate $cfg $autocfg CONFIG_MMU_SPLIT 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_MMU_SPLIT 0 [list $notmod] 2 }}
	global tmpvar_23
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_MMU_ENABLE == 1)} then {
	if { $tmpvar_23 == "LRU" } then { write_tristate $cfg $autocfg CONFIG_MMU_REPARRAY 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_MMU_REPARRAY 0 [list $notmod] 2 }
	if { $tmpvar_23 == "Increment" } then { write_tristate $cfg $autocfg CONFIG_MMU_REPINCREMENT 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_MMU_REPINCREMENT 0 [list $notmod] 2 }}
	global tmpvar_24
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_MMU_ENABLE == 1)} then {
	if { $tmpvar_24 == "2" } then { write_tristate $cfg $autocfg CONFIG_MMU_I2 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_MMU_I2 0 [list $notmod] 2 }
	if { $tmpvar_24 == "4" } then { write_tristate $cfg $autocfg CONFIG_MMU_I4 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_MMU_I4 0 [list $notmod] 2 }
	if { $tmpvar_24 == "8" } then { write_tristate $cfg $autocfg CONFIG_MMU_I8 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_MMU_I8 0 [list $notmod] 2 }
	if { $tmpvar_24 == "16" } then { write_tristate $cfg $autocfg CONFIG_MMU_I16 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_MMU_I16 0 [list $notmod] 2 }
	if { $tmpvar_24 == "32" } then { write_tristate $cfg $autocfg CONFIG_MMU_I32 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_MMU_I32 0 [list $notmod] 2 }
	if { $tmpvar_24 == "64" } then { write_tristate $cfg $autocfg CONFIG_MMU_I64 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_MMU_I64 0 [list $notmod] 2 }}
	global tmpvar_25
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_MMU_ENABLE == 1) && ($CONFIG_MMU_SPLIT == 1)} then {
	if { $tmpvar_25 == "2" } then { write_tristate $cfg $autocfg CONFIG_MMU_D2 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_MMU_D2 0 [list $notmod] 2 }
	if { $tmpvar_25 == "4" } then { write_tristate $cfg $autocfg CONFIG_MMU_D4 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_MMU_D4 0 [list $notmod] 2 }
	if { $tmpvar_25 == "8" } then { write_tristate $cfg $autocfg CONFIG_MMU_D8 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_MMU_D8 0 [list $notmod] 2 }
	if { $tmpvar_25 == "16" } then { write_tristate $cfg $autocfg CONFIG_MMU_D16 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_MMU_D16 0 [list $notmod] 2 }
	if { $tmpvar_25 == "32" } then { write_tristate $cfg $autocfg CONFIG_MMU_D32 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_MMU_D32 0 [list $notmod] 2 }
	if { $tmpvar_25 == "64" } then { write_tristate $cfg $autocfg CONFIG_MMU_D64 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_MMU_D64 0 [list $notmod] 2 }}
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_MMU_ENABLE == 1) && ($CONFIG_MMU_SPLIT == 1)} then {write_tristate $cfg $autocfg CONFIG_MMU_FASTWB $CONFIG_MMU_FASTWB [list $notmod] 2 }
	global tmpvar_26
	if {($CONFIG_LEON_CUSTOM == 1) && ($CONFIG_MMU_ENABLE == 1)} then {
	if { $tmpvar_26 == "4K" } then { write_tristate $cfg $autocfg CONFIG_MMU_PAGE_4K 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_MMU_PAGE_4K 0 [list $notmod] 2 }
	if { $tmpvar_26 == "8K" } then { write_tristate $cfg $autocfg CONFIG_MMU_PAGE_8K 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_MMU_PAGE_8K 0 [list $notmod] 2 }
	if { $tmpvar_26 == "16K" } then { write_tristate $cfg $autocfg CONFIG_MMU_PAGE_16K 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_MMU_PAGE_16K 0 [list $notmod] 2 }
	if { $tmpvar_26 == "32K" } then { write_tristate $cfg $autocfg CONFIG_MMU_PAGE_32K 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_MMU_PAGE_32K 0 [list $notmod] 2 }
	if { $tmpvar_26 == "Programmable" } then { write_tristate $cfg $autocfg CONFIG_MMU_PAGE_PROG 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_MMU_PAGE_PROG 0 [list $notmod] 2 }}
	write_comment $cfg $autocfg "Debug Support Unit        "
	write_tristate $cfg $autocfg CONFIG_DSU_ENABLE $CONFIG_DSU_ENABLE [list $notmod] 2
	if {($CONFIG_DSU_ENABLE == 1)} then {write_tristate $cfg $autocfg CONFIG_DSU_ITRACE $CONFIG_DSU_ITRACE [list $notmod] 2 }
	global tmpvar_27
	if {($CONFIG_DSU_ENABLE == 1) && ($CONFIG_DSU_ITRACE == 1)} then {
	if { $tmpvar_27 == "1" } then { write_tristate $cfg $autocfg CONFIG_DSU_ITRACESZ1 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DSU_ITRACESZ1 0 [list $notmod] 2 }
	if { $tmpvar_27 == "2" } then { write_tristate $cfg $autocfg CONFIG_DSU_ITRACESZ2 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DSU_ITRACESZ2 0 [list $notmod] 2 }
	if { $tmpvar_27 == "4" } then { write_tristate $cfg $autocfg CONFIG_DSU_ITRACESZ4 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DSU_ITRACESZ4 0 [list $notmod] 2 }
	if { $tmpvar_27 == "8" } then { write_tristate $cfg $autocfg CONFIG_DSU_ITRACESZ8 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DSU_ITRACESZ8 0 [list $notmod] 2 }
	if { $tmpvar_27 == "16" } then { write_tristate $cfg $autocfg CONFIG_DSU_ITRACESZ16 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DSU_ITRACESZ16 0 [list $notmod] 2 }}
	global CONFIG_DSU_ITRACE_2P
	if {($CONFIG_DSU_ENABLE == 1) && ($CONFIG_DSU_ITRACE == 1)} then {write_tristate $cfg $autocfg CONFIG_DSU_ITRACE_2P $CONFIG_DSU_ITRACE_2P [list $notmod] 2 }
	global CONFIG_DSU_ATRACE
	if {($CONFIG_DSU_ENABLE == 1)} then {write_tristate $cfg $autocfg CONFIG_DSU_ATRACE $CONFIG_DSU_ATRACE [list $notmod] 2 }
	global tmpvar_28
	if {($CONFIG_DSU_ENABLE == 1) && ($CONFIG_DSU_ATRACE == 1)} then {
	if { $tmpvar_28 == "1" } then { write_tristate $cfg $autocfg CONFIG_DSU_ATRACESZ1 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DSU_ATRACESZ1 0 [list $notmod] 2 }
	if { $tmpvar_28 == "2" } then { write_tristate $cfg $autocfg CONFIG_DSU_ATRACESZ2 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DSU_ATRACESZ2 0 [list $notmod] 2 }
	if { $tmpvar_28 == "4" } then { write_tristate $cfg $autocfg CONFIG_DSU_ATRACESZ4 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DSU_ATRACESZ4 0 [list $notmod] 2 }
	if { $tmpvar_28 == "8" } then { write_tristate $cfg $autocfg CONFIG_DSU_ATRACESZ8 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DSU_ATRACESZ8 0 [list $notmod] 2 }
	if { $tmpvar_28 == "16" } then { write_tristate $cfg $autocfg CONFIG_DSU_ATRACESZ16 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DSU_ATRACESZ16 0 [list $notmod] 2 }}
	global CONFIG_DSU_AFILT
	if {($CONFIG_DSU_ENABLE == 1) && ($CONFIG_DSU_ATRACE == 1)} then {write_tristate $cfg $autocfg CONFIG_DSU_AFILT $CONFIG_DSU_AFILT [list $notmod] 2 }
	global CONFIG_DSU_ASTAT
	if {($CONFIG_DSU_ENABLE == 1) && ($CONFIG_DSU_ATRACE == 1)} then {write_tristate $cfg $autocfg CONFIG_DSU_ASTAT $CONFIG_DSU_ASTAT [list $notmod] 2 }
	global tmpvar_29
	if {($CONFIG_DSU_ENABLE == 1) && ($CONFIG_DSU_ATRACE == 1)} then {
	if { $tmpvar_29 == "Pipelined" } then { write_tristate $cfg $autocfg CONFIG_DSU_AHBWP2 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DSU_AHBWP2 0 [list $notmod] 2 }
	if { $tmpvar_29 == "Enabled" } then { write_tristate $cfg $autocfg CONFIG_DSU_AHBWP1 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DSU_AHBWP1 0 [list $notmod] 2 }
	if { $tmpvar_29 == "Disabled" } then { write_tristate $cfg $autocfg CONFIG_DSU_AHBWP0 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DSU_AHBWP0 0 [list $notmod] 2 }}
	global CONFIG_STAT_ENABLE
	write_tristate $cfg $autocfg CONFIG_STAT_ENABLE $CONFIG_STAT_ENABLE [list $notmod] 2
	global CONFIG_STAT_CNT
	if {($CONFIG_STAT_ENABLE == 1)} then {write_int $cfg $autocfg CONFIG_STAT_CNT $CONFIG_STAT_CNT $notmod }
	global CONFIG_STAT_NMAX
	if {($CONFIG_STAT_ENABLE == 1)} then {write_int $cfg $autocfg CONFIG_STAT_NMAX $CONFIG_STAT_NMAX $notmod }
	write_comment $cfg $autocfg "Fault-tolerance  "
	global tmpvar_30
	
	if { $tmpvar_30 == "None" } then { write_tristate $cfg $autocfg CONFIG_IUFT_NONE 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_IUFT_NONE 0 [list $notmod] 2 }
	if { $tmpvar_30 == "Parity" } then { write_tristate $cfg $autocfg CONFIG_IUFT_PAR 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_IUFT_PAR 0 [list $notmod] 2 }
	if { $tmpvar_30 == "PDMR" } then { write_tristate $cfg $autocfg CONFIG_IUFT_DMR 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_IUFT_DMR 0 [list $notmod] 2 }
	if { $tmpvar_30 == "BCH" } then { write_tristate $cfg $autocfg CONFIG_IUFT_BCH 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_IUFT_BCH 0 [list $notmod] 2 }
	if { $tmpvar_30 == "BCH-OTF" } then { write_tristate $cfg $autocfg CONFIG_IUFT_BCHOTF 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_IUFT_BCHOTF 0 [list $notmod] 2 }
	if { $tmpvar_30 == "TechSpec" } then { write_tristate $cfg $autocfg CONFIG_IUFT_TECHSPEC 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_IUFT_TECHSPEC 0 [list $notmod] 2 }
	if { $tmpvar_30 == "TMR" } then { write_tristate $cfg $autocfg CONFIG_IUFT_TMR 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_IUFT_TMR 0 [list $notmod] 2 }
	global tmpvar_31
	if {($CONFIG_FPU_ENABLE == 1)} then {
	if { $tmpvar_31 == "None" } then { write_tristate $cfg $autocfg CONFIG_FPUFT_NONE 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_FPUFT_NONE 0 [list $notmod] 2 }
	if { $tmpvar_31 == "Parity" } then { write_tristate $cfg $autocfg CONFIG_FPUFT_PAR 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_FPUFT_PAR 0 [list $notmod] 2 }
	if { $tmpvar_31 == "PDMR" } then { write_tristate $cfg $autocfg CONFIG_FPUFT_DMR 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_FPUFT_DMR 0 [list $notmod] 2 }
	if { $tmpvar_31 == "TMR" } then { write_tristate $cfg $autocfg CONFIG_FPUFT_TMR 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_FPUFT_TMR 0 [list $notmod] 2 }}
	global CONFIG_RF_ERRINJ
	write_tristate $cfg $autocfg CONFIG_RF_ERRINJ $CONFIG_RF_ERRINJ [list $notmod] 2
	global tmpvar_32
	
	if { $tmpvar_32 == "None" } then { write_tristate $cfg $autocfg CONFIG_CACHE_FT_NONE 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_CACHE_FT_NONE 0 [list $notmod] 2 }
	if { $tmpvar_32 == "Parity" } then { write_tristate $cfg $autocfg CONFIG_CACHE_FT_EN 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_CACHE_FT_EN 0 [list $notmod] 2 }
	if { $tmpvar_32 == "SECDEC-BCH" } then { write_tristate $cfg $autocfg CONFIG_CACHE_FT_BCH 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_CACHE_FT_BCH 0 [list $notmod] 2 }
	if { $tmpvar_32 == "TechSpec" } then { write_tristate $cfg $autocfg CONFIG_CACHE_FT_TECH 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_CACHE_FT_TECH 0 [list $notmod] 2 }
	global CONFIG_CACHE_ERRINJ
	write_int $cfg $autocfg CONFIG_CACHE_ERRINJ $CONFIG_CACHE_ERRINJ $notmod
	write_comment $cfg $autocfg "VHDL debug settings       "
	global CONFIG_IU_DISAS
	write_tristate $cfg $autocfg CONFIG_IU_DISAS $CONFIG_IU_DISAS [list $notmod] 2
	global CONFIG_IU_DISAS_NET
	if {($CONFIG_IU_DISAS == 1)} then {write_tristate $cfg $autocfg CONFIG_IU_DISAS_NET $CONFIG_IU_DISAS_NET [list $notmod] 2 }
	global CONFIG_DEBUG_PC32
	write_tristate $cfg $autocfg CONFIG_DEBUG_PC32 $CONFIG_DEBUG_PC32 [list $notmod] 2
	write_comment $cfg $autocfg "L2 Cache"
	global CONFIG_L2_ENABLE
	write_tristate $cfg $autocfg CONFIG_L2_ENABLE $CONFIG_L2_ENABLE [list $notmod] 2
	global tmpvar_33
	
	if { $tmpvar_33 == "1" } then { write_tristate $cfg $autocfg CONFIG_L2_ASSO1 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_L2_ASSO1 0 [list $notmod] 2 }
	if { $tmpvar_33 == "2" } then { write_tristate $cfg $autocfg CONFIG_L2_ASSO2 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_L2_ASSO2 0 [list $notmod] 2 }
	if { $tmpvar_33 == "3" } then { write_tristate $cfg $autocfg CONFIG_L2_ASSO3 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_L2_ASSO3 0 [list $notmod] 2 }
	if { $tmpvar_33 == "4" } then { write_tristate $cfg $autocfg CONFIG_L2_ASSO4 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_L2_ASSO4 0 [list $notmod] 2 }
	global tmpvar_34
	
	if { $tmpvar_34 == "1" } then { write_tristate $cfg $autocfg CONFIG_L2_SZ1 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_L2_SZ1 0 [list $notmod] 2 }
	if { $tmpvar_34 == "2" } then { write_tristate $cfg $autocfg CONFIG_L2_SZ2 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_L2_SZ2 0 [list $notmod] 2 }
	if { $tmpvar_34 == "4" } then { write_tristate $cfg $autocfg CONFIG_L2_SZ4 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_L2_SZ4 0 [list $notmod] 2 }
	if { $tmpvar_34 == "8" } then { write_tristate $cfg $autocfg CONFIG_L2_SZ8 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_L2_SZ8 0 [list $notmod] 2 }
	if { $tmpvar_34 == "16" } then { write_tristate $cfg $autocfg CONFIG_L2_SZ16 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_L2_SZ16 0 [list $notmod] 2 }
	if { $tmpvar_34 == "32" } then { write_tristate $cfg $autocfg CONFIG_L2_SZ32 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_L2_SZ32 0 [list $notmod] 2 }
	if { $tmpvar_34 == "64" } then { write_tristate $cfg $autocfg CONFIG_L2_SZ64 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_L2_SZ64 0 [list $notmod] 2 }
	if { $tmpvar_34 == "128" } then { write_tristate $cfg $autocfg CONFIG_L2_SZ128 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_L2_SZ128 0 [list $notmod] 2 }
	if { $tmpvar_34 == "256" } then { write_tristate $cfg $autocfg CONFIG_L2_SZ256 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_L2_SZ256 0 [list $notmod] 2 }
	if { $tmpvar_34 == "512" } then { write_tristate $cfg $autocfg CONFIG_L2_SZ512 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_L2_SZ512 0 [list $notmod] 2 }
	global tmpvar_35
	
	if { $tmpvar_35 == "32" } then { write_tristate $cfg $autocfg CONFIG_L2_LINE32 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_L2_LINE32 0 [list $notmod] 2 }
	if { $tmpvar_35 == "64" } then { write_tristate $cfg $autocfg CONFIG_L2_LINE64 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_L2_LINE64 0 [list $notmod] 2 }
	global CONFIG_L2_HPROT
	write_tristate $cfg $autocfg CONFIG_L2_HPROT $CONFIG_L2_HPROT [list $notmod] 2
	global CONFIG_L2_PEN
	write_tristate $cfg $autocfg CONFIG_L2_PEN $CONFIG_L2_PEN [list $notmod] 2
	global CONFIG_L2_WT
	write_tristate $cfg $autocfg CONFIG_L2_WT $CONFIG_L2_WT [list $notmod] 2
	global CONFIG_L2_RAN
	write_tristate $cfg $autocfg CONFIG_L2_RAN $CONFIG_L2_RAN [list $notmod] 2
	global CONFIG_L2_SHARE
	write_tristate $cfg $autocfg CONFIG_L2_SHARE $CONFIG_L2_SHARE [list $notmod] 2
	global CONFIG_L2_MAP
	write_hex $cfg $autocfg CONFIG_L2_MAP $CONFIG_L2_MAP $notmod
	global CONFIG_L2_MTRR
	write_int $cfg $autocfg CONFIG_L2_MTRR $CONFIG_L2_MTRR $notmod
	global CONFIG_L2_EDAC
	write_tristate $cfg $autocfg CONFIG_L2_EDAC $CONFIG_L2_EDAC [list $notmod] 2
	global CONFIG_L2_AXI
	write_tristate $cfg $autocfg CONFIG_L2_AXI $CONFIG_L2_AXI [list $notmod] 2
	write_comment $cfg $autocfg "AMBA configuration"
	global CONFIG_AHB_DEFMST
	write_int $cfg $autocfg CONFIG_AHB_DEFMST $CONFIG_AHB_DEFMST $notmod
	global CONFIG_AHB_RROBIN
	write_tristate $cfg $autocfg CONFIG_AHB_RROBIN $CONFIG_AHB_RROBIN [list $notmod] 2
	global CONFIG_AHB_SPLIT
	write_tristate $cfg $autocfg CONFIG_AHB_SPLIT $CONFIG_AHB_SPLIT [list $notmod] 2
	global CONFIG_AHB_FPNPEN
	write_tristate $cfg $autocfg CONFIG_AHB_FPNPEN $CONFIG_AHB_FPNPEN [list $notmod] 2
	global CONFIG_AHB_IOADDR
	write_hex $cfg $autocfg CONFIG_AHB_IOADDR $CONFIG_AHB_IOADDR $notmod
	global CONFIG_APB_HADDR
	write_hex $cfg $autocfg CONFIG_APB_HADDR $CONFIG_APB_HADDR $notmod
	global CONFIG_AHB_MON
	write_tristate $cfg $autocfg CONFIG_AHB_MON $CONFIG_AHB_MON [list $notmod] 2
	global CONFIG_AHB_MONERR
	write_tristate $cfg $autocfg CONFIG_AHB_MONERR $CONFIG_AHB_MONERR [list $notmod] 2
	global CONFIG_AHB_MONWAR
	write_tristate $cfg $autocfg CONFIG_AHB_MONWAR $CONFIG_AHB_MONWAR [list $notmod] 2
	global CONFIG_AHB_DTRACE
	write_tristate $cfg $autocfg CONFIG_AHB_DTRACE $CONFIG_AHB_DTRACE [list $notmod] 2
	write_comment $cfg $autocfg "Debug Link           "
	global CONFIG_DSU_UART
	write_tristate $cfg $autocfg CONFIG_DSU_UART $CONFIG_DSU_UART [list $notmod] 2
	global CONFIG_DSU_JTAG
	write_tristate $cfg $autocfg CONFIG_DSU_JTAG $CONFIG_DSU_JTAG [list $notmod] 2
	global CONFIG_GRUSB_DCL
	write_tristate $cfg $autocfg CONFIG_GRUSB_DCL $CONFIG_GRUSB_DCL [list $notmod] 2
	global tmpvar_36
	
	if { $tmpvar_36 == "ULPI" } then { write_tristate $cfg $autocfg CONFIG_GRUSB_DCL_ULPI 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_GRUSB_DCL_ULPI 0 [list $notmod] 2 }
	if { $tmpvar_36 == "UTMI/UTMI+8-bit" } then { write_tristate $cfg $autocfg CONFIG_GRUSB_DCL_UTMI8 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_GRUSB_DCL_UTMI8 0 [list $notmod] 2 }
	if { $tmpvar_36 == "UTMI/UTMI+16-bit" } then { write_tristate $cfg $autocfg CONFIG_GRUSB_DCL_UTMI16 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_GRUSB_DCL_UTMI16 0 [list $notmod] 2 }
	global CONFIG_DSU_ETH
	write_tristate $cfg $autocfg CONFIG_DSU_ETH $CONFIG_DSU_ETH [list $notmod] 2
	global tmpvar_37
	if {($CONFIG_DSU_ETH == 1)} then {
	if { $tmpvar_37 == "1" } then { write_tristate $cfg $autocfg CONFIG_DSU_ETHSZ1 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DSU_ETHSZ1 0 [list $notmod] 2 }
	if { $tmpvar_37 == "2" } then { write_tristate $cfg $autocfg CONFIG_DSU_ETHSZ2 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DSU_ETHSZ2 0 [list $notmod] 2 }
	if { $tmpvar_37 == "4" } then { write_tristate $cfg $autocfg CONFIG_DSU_ETHSZ4 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DSU_ETHSZ4 0 [list $notmod] 2 }
	if { $tmpvar_37 == "8" } then { write_tristate $cfg $autocfg CONFIG_DSU_ETHSZ8 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DSU_ETHSZ8 0 [list $notmod] 2 }
	if { $tmpvar_37 == "16" } then { write_tristate $cfg $autocfg CONFIG_DSU_ETHSZ16 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DSU_ETHSZ16 0 [list $notmod] 2 }}
	global CONFIG_DSU_IPMSB
	if {($CONFIG_DSU_ETH == 1)} then {write_hex $cfg $autocfg CONFIG_DSU_IPMSB $CONFIG_DSU_IPMSB $notmod }
	global CONFIG_DSU_IPLSB
	if {($CONFIG_DSU_ETH == 1)} then {write_hex $cfg $autocfg CONFIG_DSU_IPLSB $CONFIG_DSU_IPLSB $notmod }
	global CONFIG_DSU_ETHMSB
	if {($CONFIG_DSU_ETH == 1)} then {write_hex $cfg $autocfg CONFIG_DSU_ETHMSB $CONFIG_DSU_ETHMSB $notmod }
	global CONFIG_DSU_ETHLSB
	if {($CONFIG_DSU_ETH == 1)} then {write_hex $cfg $autocfg CONFIG_DSU_ETHLSB $CONFIG_DSU_ETHLSB $notmod }
	global CONFIG_DSU_ETH_PROG
	if {($CONFIG_DSU_ETH == 1)} then {write_tristate $cfg $autocfg CONFIG_DSU_ETH_PROG $CONFIG_DSU_ETH_PROG [list $notmod] 2 }
	global CONFIG_DSU_ETH_DIS
	if {($CONFIG_DSU_ETH == 1) && ($CONFIG_DSU_ETH_PROG == 1)} then {write_tristate $cfg $autocfg CONFIG_DSU_ETH_DIS $CONFIG_DSU_ETH_DIS [list $notmod] 2 }
	write_comment $cfg $autocfg "Peripherals             "
	write_comment $cfg $autocfg "Memory controller             "
	write_comment $cfg $autocfg "Leon2 memory controller        "
	global CONFIG_MCTRL_LEON2
	write_tristate $cfg $autocfg CONFIG_MCTRL_LEON2 $CONFIG_MCTRL_LEON2 [list $notmod] 2
	global CONFIG_MCTRL_8BIT
	write_tristate $cfg $autocfg CONFIG_MCTRL_8BIT $CONFIG_MCTRL_8BIT [list $notmod] 2
	global CONFIG_MCTRL_16BIT
	write_tristate $cfg $autocfg CONFIG_MCTRL_16BIT $CONFIG_MCTRL_16BIT [list $notmod] 2
	global CONFIG_MCTRL_5CS
	write_tristate $cfg $autocfg CONFIG_MCTRL_5CS $CONFIG_MCTRL_5CS [list $notmod] 2
	global CONFIG_MCTRL_SDRAM
	write_tristate $cfg $autocfg CONFIG_MCTRL_SDRAM $CONFIG_MCTRL_SDRAM [list $notmod] 2
	global CONFIG_MCTRL_SDRAM_SEPBUS
	if {($CONFIG_MCTRL_SDRAM == 1)} then {write_tristate $cfg $autocfg CONFIG_MCTRL_SDRAM_SEPBUS $CONFIG_MCTRL_SDRAM_SEPBUS [list $notmod] 2 }
	global CONFIG_MCTRL_SDRAM_BUS64
	if {($CONFIG_MCTRL_SDRAM == 1) && ($CONFIG_MCTRL_SDRAM_SEPBUS == 1)} then {write_tristate $cfg $autocfg CONFIG_MCTRL_SDRAM_BUS64 $CONFIG_MCTRL_SDRAM_BUS64 [list $notmod] 2 }
	global CONFIG_MCTRL_SDRAM_INVCLK
	if {($CONFIG_MCTRL_SDRAM == 1) && ($CONFIG_MCTRL_SDRAM_SEPBUS == 1)} then {write_tristate $cfg $autocfg CONFIG_MCTRL_SDRAM_INVCLK $CONFIG_MCTRL_SDRAM_INVCLK [list $notmod] 2 }
	global CONFIG_MCTRL_PAGE
	if {($CONFIG_MCTRL_SDRAM == 1)} then {write_tristate $cfg $autocfg CONFIG_MCTRL_PAGE $CONFIG_MCTRL_PAGE [list $notmod] 2 }
	global CONFIG_MCTRL_PROGPAGE
	if {($CONFIG_MCTRL_SDRAM == 1) && ($CONFIG_MCTRL_PAGE == 1)} then {write_tristate $cfg $autocfg CONFIG_MCTRL_PROGPAGE $CONFIG_MCTRL_PROGPAGE [list $notmod] 2 }
	write_comment $cfg $autocfg "MIG 7-Series memory controller   "
	global CONFIG_MIG_7SERIES
	write_tristate $cfg $autocfg CONFIG_MIG_7SERIES $CONFIG_MIG_7SERIES [list $notmod] 2
	global CONFIG_MIG_7SERIES_MODEL
	write_tristate $cfg $autocfg CONFIG_MIG_7SERIES_MODEL $CONFIG_MIG_7SERIES_MODEL [list $notmod] 2
	global CONFIG_AHBSTAT_ENABLE
	write_tristate $cfg $autocfg CONFIG_AHBSTAT_ENABLE $CONFIG_AHBSTAT_ENABLE [list $notmod] 2
	global CONFIG_AHBSTAT_NFTSLV
	write_int $cfg $autocfg CONFIG_AHBSTAT_NFTSLV $CONFIG_AHBSTAT_NFTSLV $notmod
	write_comment $cfg $autocfg "On-chip RAM/ROM                 "
	global CONFIG_AHBROM_ENABLE
	write_tristate $cfg $autocfg CONFIG_AHBROM_ENABLE $CONFIG_AHBROM_ENABLE [list $notmod] 2
	global CONFIG_AHBROM_START
	write_hex $cfg $autocfg CONFIG_AHBROM_START $CONFIG_AHBROM_START $notmod
	global CONFIG_AHBROM_PIPE
	write_tristate $cfg $autocfg CONFIG_AHBROM_PIPE $CONFIG_AHBROM_PIPE [list $notmod] 2
	global CONFIG_AHBRAM_ENABLE
	write_tristate $cfg $autocfg CONFIG_AHBRAM_ENABLE $CONFIG_AHBRAM_ENABLE [list $notmod] 2
	global tmpvar_38
	
	if { $tmpvar_38 == "1" } then { write_tristate $cfg $autocfg CONFIG_AHBRAM_SZ1 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_AHBRAM_SZ1 0 [list $notmod] 2 }
	if { $tmpvar_38 == "2" } then { write_tristate $cfg $autocfg CONFIG_AHBRAM_SZ2 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_AHBRAM_SZ2 0 [list $notmod] 2 }
	if { $tmpvar_38 == "4" } then { write_tristate $cfg $autocfg CONFIG_AHBRAM_SZ4 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_AHBRAM_SZ4 0 [list $notmod] 2 }
	if { $tmpvar_38 == "8" } then { write_tristate $cfg $autocfg CONFIG_AHBRAM_SZ8 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_AHBRAM_SZ8 0 [list $notmod] 2 }
	if { $tmpvar_38 == "16" } then { write_tristate $cfg $autocfg CONFIG_AHBRAM_SZ16 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_AHBRAM_SZ16 0 [list $notmod] 2 }
	if { $tmpvar_38 == "32" } then { write_tristate $cfg $autocfg CONFIG_AHBRAM_SZ32 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_AHBRAM_SZ32 0 [list $notmod] 2 }
	if { $tmpvar_38 == "64" } then { write_tristate $cfg $autocfg CONFIG_AHBRAM_SZ64 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_AHBRAM_SZ64 0 [list $notmod] 2 }
	if { $tmpvar_38 == "128" } then { write_tristate $cfg $autocfg CONFIG_AHBRAM_SZ128 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_AHBRAM_SZ128 0 [list $notmod] 2 }
	if { $tmpvar_38 == "256" } then { write_tristate $cfg $autocfg CONFIG_AHBRAM_SZ256 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_AHBRAM_SZ256 0 [list $notmod] 2 }
	if { $tmpvar_38 == "512" } then { write_tristate $cfg $autocfg CONFIG_AHBRAM_SZ512 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_AHBRAM_SZ512 0 [list $notmod] 2 }
	if { $tmpvar_38 == "1024" } then { write_tristate $cfg $autocfg CONFIG_AHBRAM_SZ1024 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_AHBRAM_SZ1024 0 [list $notmod] 2 }
	if { $tmpvar_38 == "2048" } then { write_tristate $cfg $autocfg CONFIG_AHBRAM_SZ2048 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_AHBRAM_SZ2048 0 [list $notmod] 2 }
	if { $tmpvar_38 == "4096" } then { write_tristate $cfg $autocfg CONFIG_AHBRAM_SZ4096 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_AHBRAM_SZ4096 0 [list $notmod] 2 }
	global CONFIG_AHBRAM_START
	write_hex $cfg $autocfg CONFIG_AHBRAM_START $CONFIG_AHBRAM_START $notmod
	global CONFIG_AHBRAM_PIPE
	write_tristate $cfg $autocfg CONFIG_AHBRAM_PIPE $CONFIG_AHBRAM_PIPE [list $notmod] 2
	write_comment $cfg $autocfg "Ethernet             "
	global CONFIG_GRETH_ENABLE
	write_tristate $cfg $autocfg CONFIG_GRETH_ENABLE $CONFIG_GRETH_ENABLE [list $notmod] 2
	global CONFIG_GRETH_GIGA
	write_tristate $cfg $autocfg CONFIG_GRETH_GIGA $CONFIG_GRETH_GIGA [list $notmod] 2
	global tmpvar_39
	if {($CONFIG_GRETH_GIGA == 0)} then {
	if { $tmpvar_39 == "4" } then { write_tristate $cfg $autocfg CONFIG_GRETH_FIFO4 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_GRETH_FIFO4 0 [list $notmod] 2 }
	if { $tmpvar_39 == "8" } then { write_tristate $cfg $autocfg CONFIG_GRETH_FIFO8 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_GRETH_FIFO8 0 [list $notmod] 2 }
	if { $tmpvar_39 == "16" } then { write_tristate $cfg $autocfg CONFIG_GRETH_FIFO16 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_GRETH_FIFO16 0 [list $notmod] 2 }
	if { $tmpvar_39 == "32" } then { write_tristate $cfg $autocfg CONFIG_GRETH_FIFO32 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_GRETH_FIFO32 0 [list $notmod] 2 }
	if { $tmpvar_39 == "64" } then { write_tristate $cfg $autocfg CONFIG_GRETH_FIFO64 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_GRETH_FIFO64 0 [list $notmod] 2 }}
	global CONFIG_GRETH_FT
	if {($CONFIG_LEON3FT_PRESENT == 1)} then {write_tristate $cfg $autocfg CONFIG_GRETH_FT $CONFIG_GRETH_FT [list $notmod] 2 }
	global CONFIG_GRETH_EDCLFT
	if {($CONFIG_LEON3FT_PRESENT == 1) && ($CONFIG_GRETH_FT == 1)} then {write_tristate $cfg $autocfg CONFIG_GRETH_EDCLFT $CONFIG_GRETH_EDCLFT [list $notmod] 2 }
	write_comment $cfg $autocfg "USB 2.0 Host Controller      "
	global CONFIG_GRUSBHC_ENABLE
	write_tristate $cfg $autocfg CONFIG_GRUSBHC_ENABLE $CONFIG_GRUSBHC_ENABLE [list $notmod] 2
	global CONFIG_GRUSBHC_EHC
	write_tristate $cfg $autocfg CONFIG_GRUSBHC_EHC $CONFIG_GRUSBHC_EHC [list $notmod] 2
	global CONFIG_GRUSBHC_UHC
	write_tristate $cfg $autocfg CONFIG_GRUSBHC_UHC $CONFIG_GRUSBHC_UHC [list $notmod] 2
	global CONFIG_GRUSBHC_NCC
	if {($CONFIG_GRUSBHC_UHC == 1)} then {write_int $cfg $autocfg CONFIG_GRUSBHC_NCC $CONFIG_GRUSBHC_NCC $notmod }
	global CONFIG_GRUSBHC_NPORTS
	write_int $cfg $autocfg CONFIG_GRUSBHC_NPORTS $CONFIG_GRUSBHC_NPORTS $notmod
	global tmpvar_40
	
	if { $tmpvar_40 == "ULPI" } then { write_tristate $cfg $autocfg CONFIG_GRUSBHC_ULPI 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_GRUSBHC_ULPI 0 [list $notmod] 2 }
	if { $tmpvar_40 == "UTMI+16-bit" } then { write_tristate $cfg $autocfg CONFIG_GRUSBHC_UTMI16 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_GRUSBHC_UTMI16 0 [list $notmod] 2 }
	if { $tmpvar_40 == "UTMI+8-bit" } then { write_tristate $cfg $autocfg CONFIG_GRUSBHC_UTMI8 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_GRUSBHC_UTMI8 0 [list $notmod] 2 }
	global tmpvar_41
	global CONFIG_GRUSBHC_ULPI
	if {($CONFIG_GRUSBHC_ULPI == 1)} then {
	if { $tmpvar_41 == "External" } then { write_tristate $cfg $autocfg CONFIG_GRUSBHC_VBUSEXT 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_GRUSBHC_VBUSEXT 0 [list $notmod] 2 }
	if { $tmpvar_41 == "Internal" } then { write_tristate $cfg $autocfg CONFIG_GRUSBHC_VBUSINT 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_GRUSBHC_VBUSINT 0 [list $notmod] 2 }}
	global tmpvar_42
	global CONFIG_GRUSBHC_VBUSEXT
	if {($CONFIG_GRUSBHC_ULPI == 1) && ($CONFIG_GRUSBHC_VBUSEXT == 1)} then {
	if { $tmpvar_42 == "ActiveLow" } then { write_tristate $cfg $autocfg CONFIG_GRUSBHC_FAULTL 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_GRUSBHC_FAULTL 0 [list $notmod] 2 }
	if { $tmpvar_42 == "ActiveHigh" } then { write_tristate $cfg $autocfg CONFIG_GRUSBHC_FAULTH 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_GRUSBHC_FAULTH 0 [list $notmod] 2 }
	if { $tmpvar_42 == "None" } then { write_tristate $cfg $autocfg CONFIG_GRUSBHC_FAULTN 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_GRUSBHC_FAULTN 0 [list $notmod] 2 }}
	global tmpvar_43
	if {($CONFIG_GRUSBHC_ULPI != 1)} then {
	if { $tmpvar_43 == "ActiveHigh" } then { write_tristate $cfg $autocfg CONFIG_GRUSBHC_ENABLEH 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_GRUSBHC_ENABLEH 0 [list $notmod] 2 }
	if { $tmpvar_43 == "ActiveLow" } then { write_tristate $cfg $autocfg CONFIG_GRUSBHC_ENABLEL 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_GRUSBHC_ENABLEL 0 [list $notmod] 2 }}
	global tmpvar_44
	if {($CONFIG_GRUSBHC_ULPI != 1)} then {
	if { $tmpvar_44 == "ActiveHigh" } then { write_tristate $cfg $autocfg CONFIG_GRUSBHC_FAULT2H 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_GRUSBHC_FAULT2H 0 [list $notmod] 2 }
	if { $tmpvar_44 == "ActiveLow" } then { write_tristate $cfg $autocfg CONFIG_GRUSBHC_FAULT2L 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_GRUSBHC_FAULT2L 0 [list $notmod] 2 }}
	write_comment $cfg $autocfg "Memory interface"
	global CONFIG_GRUSBHC_BEREGS
	write_tristate $cfg $autocfg CONFIG_GRUSBHC_BEREGS $CONFIG_GRUSBHC_BEREGS [list $notmod] 2
	global CONFIG_GRUSBHC_BEDESC
	write_tristate $cfg $autocfg CONFIG_GRUSBHC_BEDESC $CONFIG_GRUSBHC_BEDESC [list $notmod] 2
	global CONFIG_GRUSBHC_BWRD
	write_int $cfg $autocfg CONFIG_GRUSBHC_BWRD $CONFIG_GRUSBHC_BWRD $notmod
	write_comment $cfg $autocfg "Port routing"
	global CONFIG_GRUSBHC_PRR
	write_tristate $cfg $autocfg CONFIG_GRUSBHC_PRR $CONFIG_GRUSBHC_PRR [list $notmod] 2
	global CONFIG_GRUSBHC_NPCC
	if {($CONFIG_GRUSBHC_PRR == 0)} then {write_int $cfg $autocfg CONFIG_GRUSBHC_NPCC $CONFIG_GRUSBHC_NPCC $notmod }
	global CONFIG_GRUSBHC_PR1
	if {($CONFIG_GRUSBHC_PRR != 0)} then {write_int $cfg $autocfg CONFIG_GRUSBHC_PR1 $CONFIG_GRUSBHC_PR1 $notmod }
	global CONFIG_GRUSBHC_PR2
	if {($CONFIG_GRUSBHC_PRR != 0)} then {write_int $cfg $autocfg CONFIG_GRUSBHC_PR2 $CONFIG_GRUSBHC_PR2 $notmod }
	global CONFIG_GRUSBHC_PR3
	if {($CONFIG_GRUSBHC_PRR != 0)} then {write_int $cfg $autocfg CONFIG_GRUSBHC_PR3 $CONFIG_GRUSBHC_PR3 $notmod }
	global CONFIG_GRUSBHC_PR4
	if {($CONFIG_GRUSBHC_PRR != 0)} then {write_int $cfg $autocfg CONFIG_GRUSBHC_PR4 $CONFIG_GRUSBHC_PR4 $notmod }
	global CONFIG_GRUSBHC_PR5
	if {($CONFIG_GRUSBHC_PRR != 0)} then {write_int $cfg $autocfg CONFIG_GRUSBHC_PR5 $CONFIG_GRUSBHC_PR5 $notmod }
	global CONFIG_GRUSBHC_PR6
	if {($CONFIG_GRUSBHC_PRR != 0)} then {write_int $cfg $autocfg CONFIG_GRUSBHC_PR6 $CONFIG_GRUSBHC_PR6 $notmod }
	global CONFIG_GRUSBHC_PR7
	if {($CONFIG_GRUSBHC_PRR != 0)} then {write_int $cfg $autocfg CONFIG_GRUSBHC_PR7 $CONFIG_GRUSBHC_PR7 $notmod }
	global CONFIG_GRUSBHC_PR8
	if {($CONFIG_GRUSBHC_PRR != 0)} then {write_int $cfg $autocfg CONFIG_GRUSBHC_PR8 $CONFIG_GRUSBHC_PR8 $notmod }
	global CONFIG_GRUSBHC_PR9
	if {($CONFIG_GRUSBHC_PRR != 0)} then {write_int $cfg $autocfg CONFIG_GRUSBHC_PR9 $CONFIG_GRUSBHC_PR9 $notmod }
	global CONFIG_GRUSBHC_PR10
	if {($CONFIG_GRUSBHC_PRR != 0)} then {write_int $cfg $autocfg CONFIG_GRUSBHC_PR10 $CONFIG_GRUSBHC_PR10 $notmod }
	global CONFIG_GRUSBHC_PR11
	if {($CONFIG_GRUSBHC_PRR != 0)} then {write_int $cfg $autocfg CONFIG_GRUSBHC_PR11 $CONFIG_GRUSBHC_PR11 $notmod }
	global CONFIG_GRUSBHC_PR12
	if {($CONFIG_GRUSBHC_PRR != 0)} then {write_int $cfg $autocfg CONFIG_GRUSBHC_PR12 $CONFIG_GRUSBHC_PR12 $notmod }
	global CONFIG_GRUSBHC_PR13
	if {($CONFIG_GRUSBHC_PRR != 0)} then {write_int $cfg $autocfg CONFIG_GRUSBHC_PR13 $CONFIG_GRUSBHC_PR13 $notmod }
	global CONFIG_GRUSBHC_PR14
	if {($CONFIG_GRUSBHC_PRR != 0)} then {write_int $cfg $autocfg CONFIG_GRUSBHC_PR14 $CONFIG_GRUSBHC_PR14 $notmod }
	global CONFIG_GRUSBHC_PR15
	if {($CONFIG_GRUSBHC_PRR != 0)} then {write_int $cfg $autocfg CONFIG_GRUSBHC_PR15 $CONFIG_GRUSBHC_PR15 $notmod }
	write_comment $cfg $autocfg "USB 2.0 Device Controller      "
	global CONFIG_GRUSBDC_ENABLE
	write_tristate $cfg $autocfg CONFIG_GRUSBDC_ENABLE $CONFIG_GRUSBDC_ENABLE [list $notmod] 2
	global CONFIG_GRUSBDC_AIFACE
	write_tristate $cfg $autocfg CONFIG_GRUSBDC_AIFACE $CONFIG_GRUSBDC_AIFACE [list $notmod] 2
	global tmpvar_45
	
	if { $tmpvar_45 == "ULPI" } then { write_tristate $cfg $autocfg CONFIG_GRUSBDC_ULPI 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_GRUSBDC_ULPI 0 [list $notmod] 2 }
	if { $tmpvar_45 == "UTMI/UTMI+8-bit" } then { write_tristate $cfg $autocfg CONFIG_GRUSBDC_UTMI8 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_GRUSBDC_UTMI8 0 [list $notmod] 2 }
	if { $tmpvar_45 == "UTMI/UTMI+16-bit" } then { write_tristate $cfg $autocfg CONFIG_GRUSBDC_UTMI16 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_GRUSBDC_UTMI16 0 [list $notmod] 2 }
	global CONFIG_GRUSBDC_NEPI
	write_int $cfg $autocfg CONFIG_GRUSBDC_NEPI $CONFIG_GRUSBDC_NEPI $notmod
	global CONFIG_GRUSBDC_NEPO
	write_int $cfg $autocfg CONFIG_GRUSBDC_NEPO $CONFIG_GRUSBDC_NEPO $notmod
	global CONFIG_GRUSBDC_I0
	write_int $cfg $autocfg CONFIG_GRUSBDC_I0 $CONFIG_GRUSBDC_I0 $notmod
	global CONFIG_GRUSBDC_I1
	write_int $cfg $autocfg CONFIG_GRUSBDC_I1 $CONFIG_GRUSBDC_I1 $notmod
	global CONFIG_GRUSBDC_I2
	write_int $cfg $autocfg CONFIG_GRUSBDC_I2 $CONFIG_GRUSBDC_I2 $notmod
	global CONFIG_GRUSBDC_I3
	write_int $cfg $autocfg CONFIG_GRUSBDC_I3 $CONFIG_GRUSBDC_I3 $notmod
	global CONFIG_GRUSBDC_I4
	write_int $cfg $autocfg CONFIG_GRUSBDC_I4 $CONFIG_GRUSBDC_I4 $notmod
	global CONFIG_GRUSBDC_I5
	write_int $cfg $autocfg CONFIG_GRUSBDC_I5 $CONFIG_GRUSBDC_I5 $notmod
	global CONFIG_GRUSBDC_I6
	write_int $cfg $autocfg CONFIG_GRUSBDC_I6 $CONFIG_GRUSBDC_I6 $notmod
	global CONFIG_GRUSBDC_I7
	write_int $cfg $autocfg CONFIG_GRUSBDC_I7 $CONFIG_GRUSBDC_I7 $notmod
	global CONFIG_GRUSBDC_I8
	write_int $cfg $autocfg CONFIG_GRUSBDC_I8 $CONFIG_GRUSBDC_I8 $notmod
	global CONFIG_GRUSBDC_I9
	write_int $cfg $autocfg CONFIG_GRUSBDC_I9 $CONFIG_GRUSBDC_I9 $notmod
	global CONFIG_GRUSBDC_I10
	write_int $cfg $autocfg CONFIG_GRUSBDC_I10 $CONFIG_GRUSBDC_I10 $notmod
	global CONFIG_GRUSBDC_I11
	write_int $cfg $autocfg CONFIG_GRUSBDC_I11 $CONFIG_GRUSBDC_I11 $notmod
	global CONFIG_GRUSBDC_I12
	write_int $cfg $autocfg CONFIG_GRUSBDC_I12 $CONFIG_GRUSBDC_I12 $notmod
	global CONFIG_GRUSBDC_I13
	write_int $cfg $autocfg CONFIG_GRUSBDC_I13 $CONFIG_GRUSBDC_I13 $notmod
	global CONFIG_GRUSBDC_I14
	write_int $cfg $autocfg CONFIG_GRUSBDC_I14 $CONFIG_GRUSBDC_I14 $notmod
	global CONFIG_GRUSBDC_I15
	write_int $cfg $autocfg CONFIG_GRUSBDC_I15 $CONFIG_GRUSBDC_I15 $notmod
	global CONFIG_GRUSBDC_O0
	write_int $cfg $autocfg CONFIG_GRUSBDC_O0 $CONFIG_GRUSBDC_O0 $notmod
	global CONFIG_GRUSBDC_O1
	write_int $cfg $autocfg CONFIG_GRUSBDC_O1 $CONFIG_GRUSBDC_O1 $notmod
	global CONFIG_GRUSBDC_O2
	write_int $cfg $autocfg CONFIG_GRUSBDC_O2 $CONFIG_GRUSBDC_O2 $notmod
	global CONFIG_GRUSBDC_O3
	write_int $cfg $autocfg CONFIG_GRUSBDC_O3 $CONFIG_GRUSBDC_O3 $notmod
	global CONFIG_GRUSBDC_O4
	write_int $cfg $autocfg CONFIG_GRUSBDC_O4 $CONFIG_GRUSBDC_O4 $notmod
	global CONFIG_GRUSBDC_O5
	write_int $cfg $autocfg CONFIG_GRUSBDC_O5 $CONFIG_GRUSBDC_O5 $notmod
	global CONFIG_GRUSBDC_O6
	write_int $cfg $autocfg CONFIG_GRUSBDC_O6 $CONFIG_GRUSBDC_O6 $notmod
	global CONFIG_GRUSBDC_O7
	write_int $cfg $autocfg CONFIG_GRUSBDC_O7 $CONFIG_GRUSBDC_O7 $notmod
	global CONFIG_GRUSBDC_O8
	write_int $cfg $autocfg CONFIG_GRUSBDC_O8 $CONFIG_GRUSBDC_O8 $notmod
	global CONFIG_GRUSBDC_O9
	write_int $cfg $autocfg CONFIG_GRUSBDC_O9 $CONFIG_GRUSBDC_O9 $notmod
	global CONFIG_GRUSBDC_O10
	write_int $cfg $autocfg CONFIG_GRUSBDC_O10 $CONFIG_GRUSBDC_O10 $notmod
	global CONFIG_GRUSBDC_O11
	write_int $cfg $autocfg CONFIG_GRUSBDC_O11 $CONFIG_GRUSBDC_O11 $notmod
	global CONFIG_GRUSBDC_O12
	write_int $cfg $autocfg CONFIG_GRUSBDC_O12 $CONFIG_GRUSBDC_O12 $notmod
	global CONFIG_GRUSBDC_O13
	write_int $cfg $autocfg CONFIG_GRUSBDC_O13 $CONFIG_GRUSBDC_O13 $notmod
	global CONFIG_GRUSBDC_O14
	write_int $cfg $autocfg CONFIG_GRUSBDC_O14 $CONFIG_GRUSBDC_O14 $notmod
	global CONFIG_GRUSBDC_O15
	write_int $cfg $autocfg CONFIG_GRUSBDC_O15 $CONFIG_GRUSBDC_O15 $notmod
	write_comment $cfg $autocfg "CAN                     "
	global CONFIG_CAN_ENABLE
	write_tristate $cfg $autocfg CONFIG_CAN_ENABLE $CONFIG_CAN_ENABLE [list $notmod] 2
	global CONFIG_CAN_NUM
	write_int $cfg $autocfg CONFIG_CAN_NUM $CONFIG_CAN_NUM $notmod
	global CONFIG_CANIO
	write_hex $cfg $autocfg CONFIG_CANIO $CONFIG_CANIO $notmod
	global CONFIG_CANIRQ
	write_int $cfg $autocfg CONFIG_CANIRQ $CONFIG_CANIRQ $notmod
	global CONFIG_CANSEPIRQ
	write_tristate $cfg $autocfg CONFIG_CANSEPIRQ $CONFIG_CANSEPIRQ [list $notmod] 2
	global CONFIG_CAN_SYNCRST
	write_tristate $cfg $autocfg CONFIG_CAN_SYNCRST $CONFIG_CAN_SYNCRST [list $notmod] 2
	global CONFIG_CAN_FT
	write_tristate $cfg $autocfg CONFIG_CAN_FT $CONFIG_CAN_FT [list $notmod] 2
	write_comment $cfg $autocfg "Spacewire "
	global CONFIG_SPW_ENABLE
	write_tristate $cfg $autocfg CONFIG_SPW_ENABLE $CONFIG_SPW_ENABLE [list $notmod] 2
	global CONFIG_SPW_NUM
	write_int $cfg $autocfg CONFIG_SPW_NUM $CONFIG_SPW_NUM $notmod
	global tmpvar_46
	
	if { $tmpvar_46 == "4" } then { write_tristate $cfg $autocfg CONFIG_SPW_AHBFIFO4 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SPW_AHBFIFO4 0 [list $notmod] 2 }
	if { $tmpvar_46 == "8" } then { write_tristate $cfg $autocfg CONFIG_SPW_AHBFIFO8 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SPW_AHBFIFO8 0 [list $notmod] 2 }
	if { $tmpvar_46 == "16" } then { write_tristate $cfg $autocfg CONFIG_SPW_AHBFIFO16 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SPW_AHBFIFO16 0 [list $notmod] 2 }
	if { $tmpvar_46 == "32" } then { write_tristate $cfg $autocfg CONFIG_SPW_AHBFIFO32 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SPW_AHBFIFO32 0 [list $notmod] 2 }
	global tmpvar_47
	
	if { $tmpvar_47 == "16" } then { write_tristate $cfg $autocfg CONFIG_SPW_RXFIFO16 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SPW_RXFIFO16 0 [list $notmod] 2 }
	if { $tmpvar_47 == "32" } then { write_tristate $cfg $autocfg CONFIG_SPW_RXFIFO32 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SPW_RXFIFO32 0 [list $notmod] 2 }
	if { $tmpvar_47 == "64" } then { write_tristate $cfg $autocfg CONFIG_SPW_RXFIFO64 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SPW_RXFIFO64 0 [list $notmod] 2 }
	global CONFIG_SPW_RMAP
	write_tristate $cfg $autocfg CONFIG_SPW_RMAP $CONFIG_SPW_RMAP [list $notmod] 2
	global tmpvar_48
	if {($CONFIG_SPW_RMAP == 1)} then {
	if { $tmpvar_48 == "64" } then { write_tristate $cfg $autocfg CONFIG_SPW_RMAPBUF2 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SPW_RMAPBUF2 0 [list $notmod] 2 }
	if { $tmpvar_48 == "128" } then { write_tristate $cfg $autocfg CONFIG_SPW_RMAPBUF4 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SPW_RMAPBUF4 0 [list $notmod] 2 }
	if { $tmpvar_48 == "192" } then { write_tristate $cfg $autocfg CONFIG_SPW_RMAPBUF6 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SPW_RMAPBUF6 0 [list $notmod] 2 }
	if { $tmpvar_48 == "256" } then { write_tristate $cfg $autocfg CONFIG_SPW_RMAPBUF8 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SPW_RMAPBUF8 0 [list $notmod] 2 }}
	global CONFIG_SPW_RMAPCRC
	write_tristate $cfg $autocfg CONFIG_SPW_RMAPCRC $CONFIG_SPW_RMAPCRC [list $notmod] 2
	global CONFIG_SPW_RXUNAL
	write_tristate $cfg $autocfg CONFIG_SPW_RXUNAL $CONFIG_SPW_RXUNAL [list $notmod] 2
	global CONFIG_SPW_FT
	write_tristate $cfg $autocfg CONFIG_SPW_FT $CONFIG_SPW_FT [list $notmod] 2
	global CONFIG_SPW_NETLIST
	write_tristate $cfg $autocfg CONFIG_SPW_NETLIST $CONFIG_SPW_NETLIST [list $notmod] 2
	global CONFIG_SPW_PORTS
	write_int $cfg $autocfg CONFIG_SPW_PORTS $CONFIG_SPW_PORTS $notmod
	global tmpvar_49
	
	if { $tmpvar_49 == "1" } then { write_tristate $cfg $autocfg CONFIG_SPW_GRSPW1 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SPW_GRSPW1 0 [list $notmod] 2 }
	if { $tmpvar_49 == "2" } then { write_tristate $cfg $autocfg CONFIG_SPW_GRSPW2 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SPW_GRSPW2 0 [list $notmod] 2 }
	global CONFIG_SPW_DMACHAN
	global CONFIG_SPW_GRSPW2
	if {($CONFIG_SPW_GRSPW2 == 1)} then {write_int $cfg $autocfg CONFIG_SPW_DMACHAN $CONFIG_SPW_DMACHAN $notmod }
	global CONFIG_SPW_RTSAME
	if {($CONFIG_SPW_GRSPW2 == 1)} then {write_tristate $cfg $autocfg CONFIG_SPW_RTSAME $CONFIG_SPW_RTSAME [list $notmod] 2 }
	global tmpvar_50
	if {($CONFIG_SPW_GRSPW2 == 1)} then {
	if { $tmpvar_50 == "SDR" } then { write_tristate $cfg $autocfg CONFIG_SPW_RX_SDR 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SPW_RX_SDR 0 [list $notmod] 2 }
	if { $tmpvar_50 == "DDR" } then { write_tristate $cfg $autocfg CONFIG_SPW_RX_DDR 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SPW_RX_DDR 0 [list $notmod] 2 }
	if { $tmpvar_50 == "PAD" } then { write_tristate $cfg $autocfg CONFIG_SPW_RX_PAD 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SPW_RX_PAD 0 [list $notmod] 2 }
	if { $tmpvar_50 == "Xor" } then { write_tristate $cfg $autocfg CONFIG_SPW_RX_XOR 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SPW_RX_XOR 0 [list $notmod] 2 }
	if { $tmpvar_50 == "Aeroflex" } then { write_tristate $cfg $autocfg CONFIG_SPW_RX_AFLEX 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SPW_RX_AFLEX 0 [list $notmod] 2 }}
	global tmpvar_51
	if {($CONFIG_SPW_GRSPW2 == 1)} then {
	if { $tmpvar_51 == "SDR" } then { write_tristate $cfg $autocfg CONFIG_SPW_TX_SDR 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SPW_TX_SDR 0 [list $notmod] 2 }
	if { $tmpvar_51 == "DDR" } then { write_tristate $cfg $autocfg CONFIG_SPW_TX_DDR 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SPW_TX_DDR 0 [list $notmod] 2 }
	if { $tmpvar_51 == "Aeroflex" } then { write_tristate $cfg $autocfg CONFIG_SPW_TX_AFLEX 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SPW_TX_AFLEX 0 [list $notmod] 2 }}
	write_comment $cfg $autocfg "UARTs, timers and irq control         "
	global CONFIG_UART1_ENABLE
	write_tristate $cfg $autocfg CONFIG_UART1_ENABLE $CONFIG_UART1_ENABLE [list $notmod] 2
	global tmpvar_52
	
	if { $tmpvar_52 == "1" } then { write_tristate $cfg $autocfg CONFIG_UA1_FIFO1 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_UA1_FIFO1 0 [list $notmod] 2 }
	if { $tmpvar_52 == "2" } then { write_tristate $cfg $autocfg CONFIG_UA1_FIFO2 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_UA1_FIFO2 0 [list $notmod] 2 }
	if { $tmpvar_52 == "4" } then { write_tristate $cfg $autocfg CONFIG_UA1_FIFO4 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_UA1_FIFO4 0 [list $notmod] 2 }
	if { $tmpvar_52 == "8" } then { write_tristate $cfg $autocfg CONFIG_UA1_FIFO8 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_UA1_FIFO8 0 [list $notmod] 2 }
	if { $tmpvar_52 == "16" } then { write_tristate $cfg $autocfg CONFIG_UA1_FIFO16 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_UA1_FIFO16 0 [list $notmod] 2 }
	if { $tmpvar_52 == "32" } then { write_tristate $cfg $autocfg CONFIG_UA1_FIFO32 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_UA1_FIFO32 0 [list $notmod] 2 }
	global CONFIG_IRQ3_ENABLE
	write_tristate $cfg $autocfg CONFIG_IRQ3_ENABLE $CONFIG_IRQ3_ENABLE [list $notmod] 2
	global CONFIG_IRQ3_SEC
	write_tristate $cfg $autocfg CONFIG_IRQ3_SEC $CONFIG_IRQ3_SEC [list $notmod] 2
	global CONFIG_IRQ3_NSEC
	if {($CONFIG_IRQ3_SEC == 1)} then {write_int $cfg $autocfg CONFIG_IRQ3_NSEC $CONFIG_IRQ3_NSEC $notmod }
	global CONFIG_GPT_ENABLE
	write_tristate $cfg $autocfg CONFIG_GPT_ENABLE $CONFIG_GPT_ENABLE [list $notmod] 2
	global CONFIG_GPT_NTIM
	write_int $cfg $autocfg CONFIG_GPT_NTIM $CONFIG_GPT_NTIM $notmod
	global CONFIG_GPT_SW
	write_int $cfg $autocfg CONFIG_GPT_SW $CONFIG_GPT_SW $notmod
	global CONFIG_GPT_TW
	write_int $cfg $autocfg CONFIG_GPT_TW $CONFIG_GPT_TW $notmod
	global CONFIG_GPT_IRQ
	write_int $cfg $autocfg CONFIG_GPT_IRQ $CONFIG_GPT_IRQ $notmod
	global CONFIG_GPT_SEPIRQ
	write_tristate $cfg $autocfg CONFIG_GPT_SEPIRQ $CONFIG_GPT_SEPIRQ [list $notmod] 2
	global CONFIG_GPT_WDOGEN
	write_tristate $cfg $autocfg CONFIG_GPT_WDOGEN $CONFIG_GPT_WDOGEN [list $notmod] 2
	global CONFIG_GPT_WDOG
	if {($CONFIG_GPT_WDOGEN == 1)} then {write_hex $cfg $autocfg CONFIG_GPT_WDOG $CONFIG_GPT_WDOG $notmod }
	global CONFIG_GRGPIO_ENABLE
	write_tristate $cfg $autocfg CONFIG_GRGPIO_ENABLE $CONFIG_GRGPIO_ENABLE [list $notmod] 2
	global CONFIG_GRGPIO_WIDTH
	write_int $cfg $autocfg CONFIG_GRGPIO_WIDTH $CONFIG_GRGPIO_WIDTH $notmod
	global CONFIG_GRGPIO_IMASK
	write_hex $cfg $autocfg CONFIG_GRGPIO_IMASK $CONFIG_GRGPIO_IMASK $notmod
	global CONFIG_I2C_ENABLE
	write_tristate $cfg $autocfg CONFIG_I2C_ENABLE $CONFIG_I2C_ENABLE [list $notmod] 2
	write_comment $cfg $autocfg "Keybord and VGA interface"
	global CONFIG_KBD_ENABLE
	write_tristate $cfg $autocfg CONFIG_KBD_ENABLE $CONFIG_KBD_ENABLE [list $notmod] 2
	global CONFIG_VGA_ENABLE
	write_tristate $cfg $autocfg CONFIG_VGA_ENABLE $CONFIG_VGA_ENABLE [list $notmod] 2
	global CONFIG_SVGA_ENABLE
	write_tristate $cfg $autocfg CONFIG_SVGA_ENABLE $CONFIG_SVGA_ENABLE [list $notmod] 2
	write_comment $cfg $autocfg "SPI"
	write_comment $cfg $autocfg "SPI memory controller "
	global CONFIG_SPIMCTRL
	write_tristate $cfg $autocfg CONFIG_SPIMCTRL $CONFIG_SPIMCTRL [list $notmod] 2
	global CONFIG_SPIMCTRL_READCMD
	write_hex $cfg $autocfg CONFIG_SPIMCTRL_READCMD $CONFIG_SPIMCTRL_READCMD $notmod
	global CONFIG_SPIMCTRL_DUMMYBYTE
	write_tristate $cfg $autocfg CONFIG_SPIMCTRL_DUMMYBYTE $CONFIG_SPIMCTRL_DUMMYBYTE [list $notmod] 2
	global CONFIG_SPIMCTRL_DUALOUTPUT
	write_tristate $cfg $autocfg CONFIG_SPIMCTRL_DUALOUTPUT $CONFIG_SPIMCTRL_DUALOUTPUT [list $notmod] 2
	global CONFIG_SPIMCTRL_OFFSET
	write_hex $cfg $autocfg CONFIG_SPIMCTRL_OFFSET $CONFIG_SPIMCTRL_OFFSET $notmod
	global CONFIG_SPIMCTRL_SCALER
	write_int $cfg $autocfg CONFIG_SPIMCTRL_SCALER $CONFIG_SPIMCTRL_SCALER $notmod
	global CONFIG_SPIMCTRL_ASCALER
	write_int $cfg $autocfg CONFIG_SPIMCTRL_ASCALER $CONFIG_SPIMCTRL_ASCALER $notmod
	global CONFIG_SPIMCTRL_PWRUPCNT
	write_int $cfg $autocfg CONFIG_SPIMCTRL_PWRUPCNT $CONFIG_SPIMCTRL_PWRUPCNT $notmod
	write_comment $cfg $autocfg "SPI controller(s) "
	global CONFIG_SPICTRL_ENABLE
	write_tristate $cfg $autocfg CONFIG_SPICTRL_ENABLE $CONFIG_SPICTRL_ENABLE [list $notmod] 2
	global CONFIG_SPICTRL_NUM
	write_int $cfg $autocfg CONFIG_SPICTRL_NUM $CONFIG_SPICTRL_NUM $notmod
	global CONFIG_SPICTRL_SLVS
	write_int $cfg $autocfg CONFIG_SPICTRL_SLVS $CONFIG_SPICTRL_SLVS $notmod
	global CONFIG_SPICTRL_FIFO
	write_int $cfg $autocfg CONFIG_SPICTRL_FIFO $CONFIG_SPICTRL_FIFO $notmod
	global CONFIG_SPICTRL_SLVREG
	write_tristate $cfg $autocfg CONFIG_SPICTRL_SLVREG $CONFIG_SPICTRL_SLVREG [list $notmod] 2
	global CONFIG_SPICTRL_ASEL
	write_tristate $cfg $autocfg CONFIG_SPICTRL_ASEL $CONFIG_SPICTRL_ASEL [list $notmod] 2
	global CONFIG_SPICTRL_AM
	write_tristate $cfg $autocfg CONFIG_SPICTRL_AM $CONFIG_SPICTRL_AM [list $notmod] 2
	global CONFIG_SPICTRL_ODMODE
	write_tristate $cfg $autocfg CONFIG_SPICTRL_ODMODE $CONFIG_SPICTRL_ODMODE [list $notmod] 2
	global CONFIG_SPICTRL_TWEN
	write_tristate $cfg $autocfg CONFIG_SPICTRL_TWEN $CONFIG_SPICTRL_TWEN [list $notmod] 2
	global CONFIG_SPICTRL_MAXWLEN
	write_int $cfg $autocfg CONFIG_SPICTRL_MAXWLEN $CONFIG_SPICTRL_MAXWLEN $notmod
	global CONFIG_SPICTRL_SYNCRAM
	write_tristate $cfg $autocfg CONFIG_SPICTRL_SYNCRAM $CONFIG_SPICTRL_SYNCRAM [list $notmod] 2
	global tmpvar_53
	if {($CONFIG_SPICTRL_SYNCRAM == 1)} then {
	if { $tmpvar_53 == "None" } then { write_tristate $cfg $autocfg CONFIG_SPICTRL_NOFT 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SPICTRL_NOFT 0 [list $notmod] 2 }
	if { $tmpvar_53 == "Parity-DMR" } then { write_tristate $cfg $autocfg CONFIG_SPICTRL_DMRFT 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SPICTRL_DMRFT 0 [list $notmod] 2 }
	if { $tmpvar_53 == "TMR" } then { write_tristate $cfg $autocfg CONFIG_SPICTRL_TMRFT 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SPICTRL_TMRFT 0 [list $notmod] 2 }}
	global tmpvar_54
	
	if { $tmpvar_54 == "Standard" } then { write_tristate $cfg $autocfg CONFIG_SPICTRL_PROT0 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SPICTRL_PROT0 0 [list $notmod] 2 }
	if { $tmpvar_54 == "Dual" } then { write_tristate $cfg $autocfg CONFIG_SPICTRL_PROT1 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SPICTRL_PROT1 0 [list $notmod] 2 }
	if { $tmpvar_54 == "Quad" } then { write_tristate $cfg $autocfg CONFIG_SPICTRL_PROT2 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_SPICTRL_PROT2 0 [list $notmod] 2 }
	write_comment $cfg $autocfg "Partial Reconfiguration  "
	global CONFIG_PARTIAL
	write_tristate $cfg $autocfg CONFIG_PARTIAL $CONFIG_PARTIAL [list $notmod] 2
	global CONFIG_CRC
	write_tristate $cfg $autocfg CONFIG_CRC $CONFIG_CRC [list $notmod] 2
	global CONFIG_BLOCK
	if {($CONFIG_CRC == 1)} then {write_int $cfg $autocfg CONFIG_BLOCK $CONFIG_BLOCK $notmod }
	global CONFIG_EDAC
	if {($CONFIG_CRC == 0)} then {write_tristate $cfg $autocfg CONFIG_EDAC $CONFIG_EDAC [list $notmod] 2 }
	global CONFIG_DCM_FIFO
	if {($CONFIG_CRC == 0) && ($CONFIG_EDAC == 0)} then {write_tristate $cfg $autocfg CONFIG_DCM_FIFO $CONFIG_DCM_FIFO [list $notmod] 2 }
	global tmpvar_55
	if {($CONFIG_DCM_FIFO == 1 || $CONFIG_CRC == 1 || $CONFIG_EDAC == 1)} then {
	if { $tmpvar_55 == "64" } then { write_tristate $cfg $autocfg CONFIG_DPR_FIFO64 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DPR_FIFO64 0 [list $notmod] 2 }
	if { $tmpvar_55 == "128" } then { write_tristate $cfg $autocfg CONFIG_DPR_FIFO128 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DPR_FIFO128 0 [list $notmod] 2 }
	if { $tmpvar_55 == "256" } then { write_tristate $cfg $autocfg CONFIG_DPR_FIFO256 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DPR_FIFO256 0 [list $notmod] 2 }
	if { $tmpvar_55 == "512" } then { write_tristate $cfg $autocfg CONFIG_DPR_FIFO512 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg CONFIG_DPR_FIFO512 0 [list $notmod] 2 }}
	write_comment $cfg $autocfg "VHDL Debugging        "
	global CONFIG_DEBUG_UART
	write_tristate $cfg $autocfg CONFIG_DEBUG_UART $CONFIG_DEBUG_UART [list $notmod] 2
	close $cfg
	close $autocfg
}


proc clear_choices { } {
	global CONFIG_SYN_INFERRED; set CONFIG_SYN_INFERRED 0
	global CONFIG_SYN_AXCEL; set CONFIG_SYN_AXCEL 0
	global CONFIG_SYN_AXDSP; set CONFIG_SYN_AXDSP 0
	global CONFIG_SYN_PROASIC; set CONFIG_SYN_PROASIC 0
	global CONFIG_SYN_PROASICPLUS; set CONFIG_SYN_PROASICPLUS 0
	global CONFIG_SYN_PROASIC3; set CONFIG_SYN_PROASIC3 0
	global CONFIG_SYN_PROASIC3E; set CONFIG_SYN_PROASIC3E 0
	global CONFIG_SYN_PROASIC3L; set CONFIG_SYN_PROASIC3L 0
	global CONFIG_SYN_IGLOO; set CONFIG_SYN_IGLOO 0
	global CONFIG_SYN_IGLOO2; set CONFIG_SYN_IGLOO2 0
	global CONFIG_SYN_SF2; set CONFIG_SYN_SF2 0
	global CONFIG_SYN_RTG4; set CONFIG_SYN_RTG4 0
	global CONFIG_SYN_FUSION; set CONFIG_SYN_FUSION 0
	global CONFIG_SYN_UT025CRH; set CONFIG_SYN_UT025CRH 0
	global CONFIG_SYN_UT130HBD; set CONFIG_SYN_UT130HBD 0
	global CONFIG_SYN_UT90NHBD; set CONFIG_SYN_UT90NHBD 0
	global CONFIG_SYN_CYCLONEIII; set CONFIG_SYN_CYCLONEIII 0
	global CONFIG_SYN_STRATIX; set CONFIG_SYN_STRATIX 0
	global CONFIG_SYN_STRATIXII; set CONFIG_SYN_STRATIXII 0
	global CONFIG_SYN_STRATIXIII; set CONFIG_SYN_STRATIXIII 0
	global CONFIG_SYN_STRATIXIV; set CONFIG_SYN_STRATIXIV 0
	global CONFIG_SYN_STRATIXV; set CONFIG_SYN_STRATIXV 0
	global CONFIG_SYN_ALTERA; set CONFIG_SYN_ALTERA 0
	global CONFIG_SYN_ATC18; set CONFIG_SYN_ATC18 0
	global CONFIG_SYN_ATC18RHA; set CONFIG_SYN_ATC18RHA 0
	global CONFIG_SYN_CUSTOM1; set CONFIG_SYN_CUSTOM1 0
	global CONFIG_SYN_DARE; set CONFIG_SYN_DARE 0
	global CONFIG_SYN_CMOS9SF; set CONFIG_SYN_CMOS9SF 0
	global CONFIG_SYN_LATTICE; set CONFIG_SYN_LATTICE 0
	global CONFIG_SYN_ECLIPSE; set CONFIG_SYN_ECLIPSE 0
	global CONFIG_SYN_RH_LIB18T; set CONFIG_SYN_RH_LIB18T 0
	global CONFIG_SYN_RHUMC; set CONFIG_SYN_RHUMC 0
	global CONFIG_SYN_RHS65; set CONFIG_SYN_RHS65 0
	global CONFIG_SYN_SAED32; set CONFIG_SYN_SAED32 0
	global CONFIG_SYN_SMIC13; set CONFIG_SYN_SMIC13 0
	global CONFIG_SYN_TM65GPLUS; set CONFIG_SYN_TM65GPLUS 0
	global CONFIG_SYN_TSMC90; set CONFIG_SYN_TSMC90 0
	global CONFIG_SYN_UMC; set CONFIG_SYN_UMC 0
	global CONFIG_SYN_ARTIX7; set CONFIG_SYN_ARTIX7 0
	global CONFIG_SYN_KINTEX7; set CONFIG_SYN_KINTEX7 0
	global CONFIG_SYN_SPARTAN3; set CONFIG_SYN_SPARTAN3 0
	global CONFIG_SYN_SPARTAN3E; set CONFIG_SYN_SPARTAN3E 0
	global CONFIG_SYN_SPARTAN6; set CONFIG_SYN_SPARTAN6 0
	global CONFIG_SYN_VIRTEX2; set CONFIG_SYN_VIRTEX2 0
	global CONFIG_SYN_VIRTEX4; set CONFIG_SYN_VIRTEX4 0
	global CONFIG_SYN_VIRTEX5; set CONFIG_SYN_VIRTEX5 0
	global CONFIG_SYN_VIRTEX6; set CONFIG_SYN_VIRTEX6 0
	global CONFIG_SYN_VIRTEX7; set CONFIG_SYN_VIRTEX7 0
	global CONFIG_SYN_ZYNQ7000; set CONFIG_SYN_ZYNQ7000 0
	global CONFIG_MEM_INFERRED; set CONFIG_MEM_INFERRED 0
	global CONFIG_MEM_UMC; set CONFIG_MEM_UMC 0
	global CONFIG_MEM_RHUMC; set CONFIG_MEM_RHUMC 0
	global CONFIG_MEM_SAED32; set CONFIG_MEM_SAED32 0
	global CONFIG_MEM_DARE; set CONFIG_MEM_DARE 0
	global CONFIG_MEM_RHS65; set CONFIG_MEM_RHS65 0
	global CONFIG_MEM_ARTISAN; set CONFIG_MEM_ARTISAN 0
	global CONFIG_MEM_CUSTOM1; set CONFIG_MEM_CUSTOM1 0
	global CONFIG_MEM_VIRAGE; set CONFIG_MEM_VIRAGE 0
	global CONFIG_MEM_VIRAGE90; set CONFIG_MEM_VIRAGE90 0
	global CONFIG_TRANS_GTP0; set CONFIG_TRANS_GTP0 0
	global CONFIG_TRANS_GTP1; set CONFIG_TRANS_GTP1 0
	global CONFIG_TRANS_GTX0; set CONFIG_TRANS_GTX0 0
	global CONFIG_TRANS_GTX1; set CONFIG_TRANS_GTX1 0
	global CONFIG_TRANS_GTH0; set CONFIG_TRANS_GTH0 0
	global CONFIG_TRANS_GTH1; set CONFIG_TRANS_GTH1 0
	global CONFIG_CLK_INFERRED; set CONFIG_CLK_INFERRED 0
	global CONFIG_CLK_HCLKBUF; set CONFIG_CLK_HCLKBUF 0
	global CONFIG_CLK_UT130HBD; set CONFIG_CLK_UT130HBD 0
	global CONFIG_CLK_ALTDLL; set CONFIG_CLK_ALTDLL 0
	global CONFIG_CLK_LATDLL; set CONFIG_CLK_LATDLL 0
	global CONFIG_CLK_PRO3PLL; set CONFIG_CLK_PRO3PLL 0
	global CONFIG_CLK_PRO3EPLL; set CONFIG_CLK_PRO3EPLL 0
	global CONFIG_CLK_PRO3LPLL; set CONFIG_CLK_PRO3LPLL 0
	global CONFIG_CLK_FUSPLL; set CONFIG_CLK_FUSPLL 0
	global CONFIG_CLK_LIB18T; set CONFIG_CLK_LIB18T 0
	global CONFIG_CLK_RHUMC; set CONFIG_CLK_RHUMC 0
	global CONFIG_CLK_DARE; set CONFIG_CLK_DARE 0
	global CONFIG_CLK_SAED32; set CONFIG_CLK_SAED32 0
	global CONFIG_CLK_EASIC45; set CONFIG_CLK_EASIC45 0
	global CONFIG_CLK_RHS65; set CONFIG_CLK_RHS65 0
	global CONFIG_CLK_CLKPLLE2; set CONFIG_CLK_CLKPLLE2 0
	global CONFIG_CLK_CLKDLL; set CONFIG_CLK_CLKDLL 0
	global CONFIG_CLK_DCM; set CONFIG_CLK_DCM 0
	global CONFIG_LEON3; set CONFIG_LEON3 0
	global CONFIG_LEON4; set CONFIG_LEON4 0
	global CONFIG_LEON_MIN; set CONFIG_LEON_MIN 0
	global CONFIG_LEON_GP; set CONFIG_LEON_GP 0
	global CONFIG_LEON_HP; set CONFIG_LEON_HP 0
	global CONFIG_LEON_CUSTOM; set CONFIG_LEON_CUSTOM 0
	global CONFIG_IU_MUL_LATENCY_2; set CONFIG_IU_MUL_LATENCY_2 0
	global CONFIG_IU_MUL_LATENCY_4; set CONFIG_IU_MUL_LATENCY_4 0
	global CONFIG_IU_MUL_LATENCY_5; set CONFIG_IU_MUL_LATENCY_5 0
	global CONFIG_IU_MUL_INFERRED; set CONFIG_IU_MUL_INFERRED 0
	global CONFIG_IU_MUL_MODGEN; set CONFIG_IU_MUL_MODGEN 0
	global CONFIG_IU_MUL_TECHSPEC; set CONFIG_IU_MUL_TECHSPEC 0
	global CONFIG_IU_MUL_DW; set CONFIG_IU_MUL_DW 0
	global CONFIG_FPU_GRFPU; set CONFIG_FPU_GRFPU 0
	global CONFIG_FPU_GRFPULITE; set CONFIG_FPU_GRFPULITE 0
	global CONFIG_FPU_GRFPU_INFMUL; set CONFIG_FPU_GRFPU_INFMUL 0
	global CONFIG_FPU_GRFPU_DWMUL; set CONFIG_FPU_GRFPU_DWMUL 0
	global CONFIG_FPU_GRFPU_MODGEN; set CONFIG_FPU_GRFPU_MODGEN 0
	global CONFIG_FPU_GRFPU_TECHSPEC; set CONFIG_FPU_GRFPU_TECHSPEC 0
	global CONFIG_FPU_GRFPC0; set CONFIG_FPU_GRFPC0 0
	global CONFIG_FPU_GRFPC1; set CONFIG_FPU_GRFPC1 0
	global CONFIG_FPU_GRFPC2; set CONFIG_FPU_GRFPC2 0
	global CONFIG_ICACHE_ASSO1; set CONFIG_ICACHE_ASSO1 0
	global CONFIG_ICACHE_ASSO2; set CONFIG_ICACHE_ASSO2 0
	global CONFIG_ICACHE_ASSO3; set CONFIG_ICACHE_ASSO3 0
	global CONFIG_ICACHE_ASSO4; set CONFIG_ICACHE_ASSO4 0
	global CONFIG_ICACHE_SZ1; set CONFIG_ICACHE_SZ1 0
	global CONFIG_ICACHE_SZ2; set CONFIG_ICACHE_SZ2 0
	global CONFIG_ICACHE_SZ4; set CONFIG_ICACHE_SZ4 0
	global CONFIG_ICACHE_SZ8; set CONFIG_ICACHE_SZ8 0
	global CONFIG_ICACHE_SZ16; set CONFIG_ICACHE_SZ16 0
	global CONFIG_ICACHE_SZ32; set CONFIG_ICACHE_SZ32 0
	global CONFIG_ICACHE_SZ64; set CONFIG_ICACHE_SZ64 0
	global CONFIG_ICACHE_SZ128; set CONFIG_ICACHE_SZ128 0
	global CONFIG_ICACHE_SZ256; set CONFIG_ICACHE_SZ256 0
	global CONFIG_ICACHE_LZ16; set CONFIG_ICACHE_LZ16 0
	global CONFIG_ICACHE_LZ32; set CONFIG_ICACHE_LZ32 0
	global CONFIG_ICACHE_ALGORND; set CONFIG_ICACHE_ALGORND 0
	global CONFIG_ICACHE_ALGOLRU; set CONFIG_ICACHE_ALGOLRU 0
	global CONFIG_ICACHE_LRAM_SZ1; set CONFIG_ICACHE_LRAM_SZ1 0
	global CONFIG_ICACHE_LRAM_SZ2; set CONFIG_ICACHE_LRAM_SZ2 0
	global CONFIG_ICACHE_LRAM_SZ4; set CONFIG_ICACHE_LRAM_SZ4 0
	global CONFIG_ICACHE_LRAM_SZ8; set CONFIG_ICACHE_LRAM_SZ8 0
	global CONFIG_ICACHE_LRAM_SZ16; set CONFIG_ICACHE_LRAM_SZ16 0
	global CONFIG_ICACHE_LRAM_SZ32; set CONFIG_ICACHE_LRAM_SZ32 0
	global CONFIG_ICACHE_LRAM_SZ64; set CONFIG_ICACHE_LRAM_SZ64 0
	global CONFIG_ICACHE_LRAM_SZ128; set CONFIG_ICACHE_LRAM_SZ128 0
	global CONFIG_ICACHE_LRAM_SZ256; set CONFIG_ICACHE_LRAM_SZ256 0
	global CONFIG_DCACHE_ASSO1; set CONFIG_DCACHE_ASSO1 0
	global CONFIG_DCACHE_ASSO2; set CONFIG_DCACHE_ASSO2 0
	global CONFIG_DCACHE_ASSO3; set CONFIG_DCACHE_ASSO3 0
	global CONFIG_DCACHE_ASSO4; set CONFIG_DCACHE_ASSO4 0
	global CONFIG_DCACHE_SZ1; set CONFIG_DCACHE_SZ1 0
	global CONFIG_DCACHE_SZ2; set CONFIG_DCACHE_SZ2 0
	global CONFIG_DCACHE_SZ4; set CONFIG_DCACHE_SZ4 0
	global CONFIG_DCACHE_SZ8; set CONFIG_DCACHE_SZ8 0
	global CONFIG_DCACHE_SZ16; set CONFIG_DCACHE_SZ16 0
	global CONFIG_DCACHE_SZ32; set CONFIG_DCACHE_SZ32 0
	global CONFIG_DCACHE_SZ64; set CONFIG_DCACHE_SZ64 0
	global CONFIG_DCACHE_SZ128; set CONFIG_DCACHE_SZ128 0
	global CONFIG_DCACHE_SZ256; set CONFIG_DCACHE_SZ256 0
	global CONFIG_DCACHE_LZ16; set CONFIG_DCACHE_LZ16 0
	global CONFIG_DCACHE_LZ32; set CONFIG_DCACHE_LZ32 0
	global CONFIG_DCACHE_ALGORND; set CONFIG_DCACHE_ALGORND 0
	global CONFIG_DCACHE_ALGOLRU; set CONFIG_DCACHE_ALGOLRU 0
	global CONFIG_CACHE_64BIT; set CONFIG_CACHE_64BIT 0
	global CONFIG_CACHE_128BIT; set CONFIG_CACHE_128BIT 0
	global CONFIG_DCACHE_LRAM_SZ1; set CONFIG_DCACHE_LRAM_SZ1 0
	global CONFIG_DCACHE_LRAM_SZ2; set CONFIG_DCACHE_LRAM_SZ2 0
	global CONFIG_DCACHE_LRAM_SZ4; set CONFIG_DCACHE_LRAM_SZ4 0
	global CONFIG_DCACHE_LRAM_SZ8; set CONFIG_DCACHE_LRAM_SZ8 0
	global CONFIG_DCACHE_LRAM_SZ16; set CONFIG_DCACHE_LRAM_SZ16 0
	global CONFIG_DCACHE_LRAM_SZ32; set CONFIG_DCACHE_LRAM_SZ32 0
	global CONFIG_DCACHE_LRAM_SZ64; set CONFIG_DCACHE_LRAM_SZ64 0
	global CONFIG_DCACHE_LRAM_SZ128; set CONFIG_DCACHE_LRAM_SZ128 0
	global CONFIG_DCACHE_LRAM_SZ256; set CONFIG_DCACHE_LRAM_SZ256 0
	global CONFIG_MMU_COMBINED; set CONFIG_MMU_COMBINED 0
	global CONFIG_MMU_SPLIT; set CONFIG_MMU_SPLIT 0
	global CONFIG_MMU_REPARRAY; set CONFIG_MMU_REPARRAY 0
	global CONFIG_MMU_REPINCREMENT; set CONFIG_MMU_REPINCREMENT 0
	global CONFIG_MMU_I2; set CONFIG_MMU_I2 0
	global CONFIG_MMU_I4; set CONFIG_MMU_I4 0
	global CONFIG_MMU_I8; set CONFIG_MMU_I8 0
	global CONFIG_MMU_I16; set CONFIG_MMU_I16 0
	global CONFIG_MMU_I32; set CONFIG_MMU_I32 0
	global CONFIG_MMU_I64; set CONFIG_MMU_I64 0
	global CONFIG_MMU_D2; set CONFIG_MMU_D2 0
	global CONFIG_MMU_D4; set CONFIG_MMU_D4 0
	global CONFIG_MMU_D8; set CONFIG_MMU_D8 0
	global CONFIG_MMU_D16; set CONFIG_MMU_D16 0
	global CONFIG_MMU_D32; set CONFIG_MMU_D32 0
	global CONFIG_MMU_D64; set CONFIG_MMU_D64 0
	global CONFIG_MMU_PAGE_4K; set CONFIG_MMU_PAGE_4K 0
	global CONFIG_MMU_PAGE_8K; set CONFIG_MMU_PAGE_8K 0
	global CONFIG_MMU_PAGE_16K; set CONFIG_MMU_PAGE_16K 0
	global CONFIG_MMU_PAGE_32K; set CONFIG_MMU_PAGE_32K 0
	global CONFIG_MMU_PAGE_PROG; set CONFIG_MMU_PAGE_PROG 0
	global CONFIG_DSU_ITRACESZ1; set CONFIG_DSU_ITRACESZ1 0
	global CONFIG_DSU_ITRACESZ2; set CONFIG_DSU_ITRACESZ2 0
	global CONFIG_DSU_ITRACESZ4; set CONFIG_DSU_ITRACESZ4 0
	global CONFIG_DSU_ITRACESZ8; set CONFIG_DSU_ITRACESZ8 0
	global CONFIG_DSU_ITRACESZ16; set CONFIG_DSU_ITRACESZ16 0
	global CONFIG_DSU_ATRACESZ1; set CONFIG_DSU_ATRACESZ1 0
	global CONFIG_DSU_ATRACESZ2; set CONFIG_DSU_ATRACESZ2 0
	global CONFIG_DSU_ATRACESZ4; set CONFIG_DSU_ATRACESZ4 0
	global CONFIG_DSU_ATRACESZ8; set CONFIG_DSU_ATRACESZ8 0
	global CONFIG_DSU_ATRACESZ16; set CONFIG_DSU_ATRACESZ16 0
	global CONFIG_DSU_AHBWP2; set CONFIG_DSU_AHBWP2 0
	global CONFIG_DSU_AHBWP1; set CONFIG_DSU_AHBWP1 0
	global CONFIG_DSU_AHBWP0; set CONFIG_DSU_AHBWP0 0
	global CONFIG_IUFT_NONE; set CONFIG_IUFT_NONE 0
	global CONFIG_IUFT_PAR; set CONFIG_IUFT_PAR 0
	global CONFIG_IUFT_DMR; set CONFIG_IUFT_DMR 0
	global CONFIG_IUFT_BCH; set CONFIG_IUFT_BCH 0
	global CONFIG_IUFT_BCHOTF; set CONFIG_IUFT_BCHOTF 0
	global CONFIG_IUFT_TECHSPEC; set CONFIG_IUFT_TECHSPEC 0
	global CONFIG_IUFT_TMR; set CONFIG_IUFT_TMR 0
	global CONFIG_FPUFT_NONE; set CONFIG_FPUFT_NONE 0
	global CONFIG_FPUFT_PAR; set CONFIG_FPUFT_PAR 0
	global CONFIG_FPUFT_DMR; set CONFIG_FPUFT_DMR 0
	global CONFIG_FPUFT_TMR; set CONFIG_FPUFT_TMR 0
	global CONFIG_CACHE_FT_NONE; set CONFIG_CACHE_FT_NONE 0
	global CONFIG_CACHE_FT_EN; set CONFIG_CACHE_FT_EN 0
	global CONFIG_CACHE_FT_BCH; set CONFIG_CACHE_FT_BCH 0
	global CONFIG_CACHE_FT_TECH; set CONFIG_CACHE_FT_TECH 0
	global CONFIG_L2_ASSO1; set CONFIG_L2_ASSO1 0
	global CONFIG_L2_ASSO2; set CONFIG_L2_ASSO2 0
	global CONFIG_L2_ASSO3; set CONFIG_L2_ASSO3 0
	global CONFIG_L2_ASSO4; set CONFIG_L2_ASSO4 0
	global CONFIG_L2_SZ1; set CONFIG_L2_SZ1 0
	global CONFIG_L2_SZ2; set CONFIG_L2_SZ2 0
	global CONFIG_L2_SZ4; set CONFIG_L2_SZ4 0
	global CONFIG_L2_SZ8; set CONFIG_L2_SZ8 0
	global CONFIG_L2_SZ16; set CONFIG_L2_SZ16 0
	global CONFIG_L2_SZ32; set CONFIG_L2_SZ32 0
	global CONFIG_L2_SZ64; set CONFIG_L2_SZ64 0
	global CONFIG_L2_SZ128; set CONFIG_L2_SZ128 0
	global CONFIG_L2_SZ256; set CONFIG_L2_SZ256 0
	global CONFIG_L2_SZ512; set CONFIG_L2_SZ512 0
	global CONFIG_L2_LINE32; set CONFIG_L2_LINE32 0
	global CONFIG_L2_LINE64; set CONFIG_L2_LINE64 0
	global CONFIG_GRUSB_DCL_ULPI; set CONFIG_GRUSB_DCL_ULPI 0
	global CONFIG_GRUSB_DCL_UTMI8; set CONFIG_GRUSB_DCL_UTMI8 0
	global CONFIG_GRUSB_DCL_UTMI16; set CONFIG_GRUSB_DCL_UTMI16 0
	global CONFIG_DSU_ETHSZ1; set CONFIG_DSU_ETHSZ1 0
	global CONFIG_DSU_ETHSZ2; set CONFIG_DSU_ETHSZ2 0
	global CONFIG_DSU_ETHSZ4; set CONFIG_DSU_ETHSZ4 0
	global CONFIG_DSU_ETHSZ8; set CONFIG_DSU_ETHSZ8 0
	global CONFIG_DSU_ETHSZ16; set CONFIG_DSU_ETHSZ16 0
	global CONFIG_AHBRAM_SZ1; set CONFIG_AHBRAM_SZ1 0
	global CONFIG_AHBRAM_SZ2; set CONFIG_AHBRAM_SZ2 0
	global CONFIG_AHBRAM_SZ4; set CONFIG_AHBRAM_SZ4 0
	global CONFIG_AHBRAM_SZ8; set CONFIG_AHBRAM_SZ8 0
	global CONFIG_AHBRAM_SZ16; set CONFIG_AHBRAM_SZ16 0
	global CONFIG_AHBRAM_SZ32; set CONFIG_AHBRAM_SZ32 0
	global CONFIG_AHBRAM_SZ64; set CONFIG_AHBRAM_SZ64 0
	global CONFIG_AHBRAM_SZ128; set CONFIG_AHBRAM_SZ128 0
	global CONFIG_AHBRAM_SZ256; set CONFIG_AHBRAM_SZ256 0
	global CONFIG_AHBRAM_SZ512; set CONFIG_AHBRAM_SZ512 0
	global CONFIG_AHBRAM_SZ1024; set CONFIG_AHBRAM_SZ1024 0
	global CONFIG_AHBRAM_SZ2048; set CONFIG_AHBRAM_SZ2048 0
	global CONFIG_AHBRAM_SZ4096; set CONFIG_AHBRAM_SZ4096 0
	global CONFIG_GRETH_FIFO4; set CONFIG_GRETH_FIFO4 0
	global CONFIG_GRETH_FIFO8; set CONFIG_GRETH_FIFO8 0
	global CONFIG_GRETH_FIFO16; set CONFIG_GRETH_FIFO16 0
	global CONFIG_GRETH_FIFO32; set CONFIG_GRETH_FIFO32 0
	global CONFIG_GRETH_FIFO64; set CONFIG_GRETH_FIFO64 0
	global CONFIG_GRUSBHC_ULPI; set CONFIG_GRUSBHC_ULPI 0
	global CONFIG_GRUSBHC_UTMI16; set CONFIG_GRUSBHC_UTMI16 0
	global CONFIG_GRUSBHC_UTMI8; set CONFIG_GRUSBHC_UTMI8 0
	global CONFIG_GRUSBHC_VBUSEXT; set CONFIG_GRUSBHC_VBUSEXT 0
	global CONFIG_GRUSBHC_VBUSINT; set CONFIG_GRUSBHC_VBUSINT 0
	global CONFIG_GRUSBHC_FAULTL; set CONFIG_GRUSBHC_FAULTL 0
	global CONFIG_GRUSBHC_FAULTH; set CONFIG_GRUSBHC_FAULTH 0
	global CONFIG_GRUSBHC_FAULTN; set CONFIG_GRUSBHC_FAULTN 0
	global CONFIG_GRUSBHC_ENABLEH; set CONFIG_GRUSBHC_ENABLEH 0
	global CONFIG_GRUSBHC_ENABLEL; set CONFIG_GRUSBHC_ENABLEL 0
	global CONFIG_GRUSBHC_FAULT2H; set CONFIG_GRUSBHC_FAULT2H 0
	global CONFIG_GRUSBHC_FAULT2L; set CONFIG_GRUSBHC_FAULT2L 0
	global CONFIG_GRUSBDC_ULPI; set CONFIG_GRUSBDC_ULPI 0
	global CONFIG_GRUSBDC_UTMI8; set CONFIG_GRUSBDC_UTMI8 0
	global CONFIG_GRUSBDC_UTMI16; set CONFIG_GRUSBDC_UTMI16 0
	global CONFIG_SPW_AHBFIFO4; set CONFIG_SPW_AHBFIFO4 0
	global CONFIG_SPW_AHBFIFO8; set CONFIG_SPW_AHBFIFO8 0
	global CONFIG_SPW_AHBFIFO16; set CONFIG_SPW_AHBFIFO16 0
	global CONFIG_SPW_AHBFIFO32; set CONFIG_SPW_AHBFIFO32 0
	global CONFIG_SPW_RXFIFO16; set CONFIG_SPW_RXFIFO16 0
	global CONFIG_SPW_RXFIFO32; set CONFIG_SPW_RXFIFO32 0
	global CONFIG_SPW_RXFIFO64; set CONFIG_SPW_RXFIFO64 0
	global CONFIG_SPW_RMAPBUF2; set CONFIG_SPW_RMAPBUF2 0
	global CONFIG_SPW_RMAPBUF4; set CONFIG_SPW_RMAPBUF4 0
	global CONFIG_SPW_RMAPBUF6; set CONFIG_SPW_RMAPBUF6 0
	global CONFIG_SPW_RMAPBUF8; set CONFIG_SPW_RMAPBUF8 0
	global CONFIG_SPW_GRSPW1; set CONFIG_SPW_GRSPW1 0
	global CONFIG_SPW_GRSPW2; set CONFIG_SPW_GRSPW2 0
	global CONFIG_SPW_RX_SDR; set CONFIG_SPW_RX_SDR 0
	global CONFIG_SPW_RX_DDR; set CONFIG_SPW_RX_DDR 0
	global CONFIG_SPW_RX_PAD; set CONFIG_SPW_RX_PAD 0
	global CONFIG_SPW_RX_XOR; set CONFIG_SPW_RX_XOR 0
	global CONFIG_SPW_RX_AFLEX; set CONFIG_SPW_RX_AFLEX 0
	global CONFIG_SPW_TX_SDR; set CONFIG_SPW_TX_SDR 0
	global CONFIG_SPW_TX_DDR; set CONFIG_SPW_TX_DDR 0
	global CONFIG_SPW_TX_AFLEX; set CONFIG_SPW_TX_AFLEX 0
	global CONFIG_UA1_FIFO1; set CONFIG_UA1_FIFO1 0
	global CONFIG_UA1_FIFO2; set CONFIG_UA1_FIFO2 0
	global CONFIG_UA1_FIFO4; set CONFIG_UA1_FIFO4 0
	global CONFIG_UA1_FIFO8; set CONFIG_UA1_FIFO8 0
	global CONFIG_UA1_FIFO16; set CONFIG_UA1_FIFO16 0
	global CONFIG_UA1_FIFO32; set CONFIG_UA1_FIFO32 0
	global CONFIG_SPICTRL_NOFT; set CONFIG_SPICTRL_NOFT 0
	global CONFIG_SPICTRL_DMRFT; set CONFIG_SPICTRL_DMRFT 0
	global CONFIG_SPICTRL_TMRFT; set CONFIG_SPICTRL_TMRFT 0
	global CONFIG_SPICTRL_PROT0; set CONFIG_SPICTRL_PROT0 0
	global CONFIG_SPICTRL_PROT1; set CONFIG_SPICTRL_PROT1 0
	global CONFIG_SPICTRL_PROT2; set CONFIG_SPICTRL_PROT2 0
	global CONFIG_DPR_FIFO64; set CONFIG_DPR_FIFO64 0
	global CONFIG_DPR_FIFO128; set CONFIG_DPR_FIFO128 0
	global CONFIG_DPR_FIFO256; set CONFIG_DPR_FIFO256 0
	global CONFIG_DPR_FIFO512; set CONFIG_DPR_FIFO512 0
}


proc update_choices { } {
	global tmpvar_0
	set tmpvar_0 "Inferred"
	global CONFIG_SYN_INFERRED
	if { $CONFIG_SYN_INFERRED == 1 } then { set tmpvar_0 "Inferred" }
	global CONFIG_SYN_AXCEL
	if { $CONFIG_SYN_AXCEL == 1 } then { set tmpvar_0 "Actel-Axcelerator" }
	global CONFIG_SYN_AXDSP
	if { $CONFIG_SYN_AXDSP == 1 } then { set tmpvar_0 "Actel-Axcelerator-DSP" }
	global CONFIG_SYN_PROASIC
	if { $CONFIG_SYN_PROASIC == 1 } then { set tmpvar_0 "Actel-Proasic" }
	global CONFIG_SYN_PROASICPLUS
	if { $CONFIG_SYN_PROASICPLUS == 1 } then { set tmpvar_0 "Actel-ProasicPlus" }
	global CONFIG_SYN_PROASIC3
	if { $CONFIG_SYN_PROASIC3 == 1 } then { set tmpvar_0 "Actel-Proasic3" }
	global CONFIG_SYN_PROASIC3E
	if { $CONFIG_SYN_PROASIC3E == 1 } then { set tmpvar_0 "Actel-Proasic3E" }
	global CONFIG_SYN_PROASIC3L
	if { $CONFIG_SYN_PROASIC3L == 1 } then { set tmpvar_0 "Actel-Proasic3L" }
	global CONFIG_SYN_IGLOO
	if { $CONFIG_SYN_IGLOO == 1 } then { set tmpvar_0 "Actel-IGLOO/p/L" }
	global CONFIG_SYN_IGLOO2
	if { $CONFIG_SYN_IGLOO2 == 1 } then { set tmpvar_0 "Actel-IGLOO2" }
	global CONFIG_SYN_SF2
	if { $CONFIG_SYN_SF2 == 1 } then { set tmpvar_0 "Actel-SmartFusion2" }
	global CONFIG_SYN_RTG4
	if { $CONFIG_SYN_RTG4 == 1 } then { set tmpvar_0 "Actel-RTG4" }
	global CONFIG_SYN_FUSION
	if { $CONFIG_SYN_FUSION == 1 } then { set tmpvar_0 "Actel-Fusion" }
	global CONFIG_SYN_UT025CRH
	if { $CONFIG_SYN_UT025CRH == 1 } then { set tmpvar_0 "Aeroflex-UT025CRH" }
	global CONFIG_SYN_UT130HBD
	if { $CONFIG_SYN_UT130HBD == 1 } then { set tmpvar_0 "Aeroflex-UT130HBD" }
	global CONFIG_SYN_UT90NHBD
	if { $CONFIG_SYN_UT90NHBD == 1 } then { set tmpvar_0 "Aeroflex-UT90NHBD" }
	global CONFIG_SYN_CYCLONEIII
	if { $CONFIG_SYN_CYCLONEIII == 1 } then { set tmpvar_0 "Altera-CycloneIII" }
	global CONFIG_SYN_STRATIX
	if { $CONFIG_SYN_STRATIX == 1 } then { set tmpvar_0 "Altera-Stratix" }
	global CONFIG_SYN_STRATIXII
	if { $CONFIG_SYN_STRATIXII == 1 } then { set tmpvar_0 "Altera-StratixII" }
	global CONFIG_SYN_STRATIXIII
	if { $CONFIG_SYN_STRATIXIII == 1 } then { set tmpvar_0 "Altera-StratixIII" }
	global CONFIG_SYN_STRATIXIV
	if { $CONFIG_SYN_STRATIXIV == 1 } then { set tmpvar_0 "Altera-StratixIV" }
	global CONFIG_SYN_STRATIXV
	if { $CONFIG_SYN_STRATIXV == 1 } then { set tmpvar_0 "Altera-StratixV" }
	global CONFIG_SYN_ALTERA
	if { $CONFIG_SYN_ALTERA == 1 } then { set tmpvar_0 "Altera-Others" }
	global CONFIG_SYN_ATC18
	if { $CONFIG_SYN_ATC18 == 1 } then { set tmpvar_0 "Atmel-ATC18" }
	global CONFIG_SYN_ATC18RHA
	if { $CONFIG_SYN_ATC18RHA == 1 } then { set tmpvar_0 "Atmel-ATC18RHA" }
	global CONFIG_SYN_CUSTOM1
	if { $CONFIG_SYN_CUSTOM1 == 1 } then { set tmpvar_0 "Custom1" }
	global CONFIG_SYN_DARE
	if { $CONFIG_SYN_DARE == 1 } then { set tmpvar_0 "DARE" }
	global CONFIG_SYN_CMOS9SF
	if { $CONFIG_SYN_CMOS9SF == 1 } then { set tmpvar_0 "IBM-CMOS9SF" }
	global CONFIG_SYN_LATTICE
	if { $CONFIG_SYN_LATTICE == 1 } then { set tmpvar_0 "Lattice-EC/ECP/XP" }
	global CONFIG_SYN_ECLIPSE
	if { $CONFIG_SYN_ECLIPSE == 1 } then { set tmpvar_0 "Quicklogic-Eclipse" }
	global CONFIG_SYN_RH_LIB18T
	if { $CONFIG_SYN_RH_LIB18T == 1 } then { set tmpvar_0 "RH-LIB18T" }
	global CONFIG_SYN_RHUMC
	if { $CONFIG_SYN_RHUMC == 1 } then { set tmpvar_0 "RH-UMC" }
	global CONFIG_SYN_RHS65
	if { $CONFIG_SYN_RHS65 == 1 } then { set tmpvar_0 "RHS65" }
	global CONFIG_SYN_SAED32
	if { $CONFIG_SYN_SAED32 == 1 } then { set tmpvar_0 "SAED32" }
	global CONFIG_SYN_SMIC13
	if { $CONFIG_SYN_SMIC13 == 1 } then { set tmpvar_0 "SMIC130" }
	global CONFIG_SYN_TM65GPLUS
	if { $CONFIG_SYN_TM65GPLUS == 1 } then { set tmpvar_0 "TM65Gplus" }
	global CONFIG_SYN_TSMC90
	if { $CONFIG_SYN_TSMC90 == 1 } then { set tmpvar_0 "TSMC90" }
	global CONFIG_SYN_UMC
	if { $CONFIG_SYN_UMC == 1 } then { set tmpvar_0 "UMC180" }
	global CONFIG_SYN_ARTIX7
	if { $CONFIG_SYN_ARTIX7 == 1 } then { set tmpvar_0 "Xilinx-Artix7" }
	global CONFIG_SYN_KINTEX7
	if { $CONFIG_SYN_KINTEX7 == 1 } then { set tmpvar_0 "Xilinx-Kintex7" }
	global CONFIG_SYN_SPARTAN3
	if { $CONFIG_SYN_SPARTAN3 == 1 } then { set tmpvar_0 "Xilinx-Spartan3" }
	global CONFIG_SYN_SPARTAN3E
	if { $CONFIG_SYN_SPARTAN3E == 1 } then { set tmpvar_0 "Xilinx-Spartan3E" }
	global CONFIG_SYN_SPARTAN6
	if { $CONFIG_SYN_SPARTAN6 == 1 } then { set tmpvar_0 "Xilinx-Spartan6" }
	global CONFIG_SYN_VIRTEX2
	if { $CONFIG_SYN_VIRTEX2 == 1 } then { set tmpvar_0 "Xilinx-Virtex2" }
	global CONFIG_SYN_VIRTEX4
	if { $CONFIG_SYN_VIRTEX4 == 1 } then { set tmpvar_0 "Xilinx-Virtex4" }
	global CONFIG_SYN_VIRTEX5
	if { $CONFIG_SYN_VIRTEX5 == 1 } then { set tmpvar_0 "Xilinx-Virtex5" }
	global CONFIG_SYN_VIRTEX6
	if { $CONFIG_SYN_VIRTEX6 == 1 } then { set tmpvar_0 "Xilinx-Virtex6" }
	global CONFIG_SYN_VIRTEX7
	if { $CONFIG_SYN_VIRTEX7 == 1 } then { set tmpvar_0 "Xilinx-Virtex7" }
	global CONFIG_SYN_ZYNQ7000
	if { $CONFIG_SYN_ZYNQ7000 == 1 } then { set tmpvar_0 "Xilinx-Zynq7000" }
	global tmpvar_1
	set tmpvar_1 "Inferred"
	global CONFIG_MEM_INFERRED
	if { $CONFIG_MEM_INFERRED == 1 } then { set tmpvar_1 "Inferred" }
	global CONFIG_MEM_UMC
	if { $CONFIG_MEM_UMC == 1 } then { set tmpvar_1 "UMC18" }
	global CONFIG_MEM_RHUMC
	if { $CONFIG_MEM_RHUMC == 1 } then { set tmpvar_1 "RH-UMC" }
	global CONFIG_MEM_SAED32
	if { $CONFIG_MEM_SAED32 == 1 } then { set tmpvar_1 "SAED32" }
	global CONFIG_MEM_DARE
	if { $CONFIG_MEM_DARE == 1 } then { set tmpvar_1 "DARE" }
	global CONFIG_MEM_RHS65
	if { $CONFIG_MEM_RHS65 == 1 } then { set tmpvar_1 "RHS65" }
	global CONFIG_MEM_ARTISAN
	if { $CONFIG_MEM_ARTISAN == 1 } then { set tmpvar_1 "Artisan" }
	global CONFIG_MEM_CUSTOM1
	if { $CONFIG_MEM_CUSTOM1 == 1 } then { set tmpvar_1 "Custom1" }
	global CONFIG_MEM_VIRAGE
	if { $CONFIG_MEM_VIRAGE == 1 } then { set tmpvar_1 "Virage" }
	global CONFIG_MEM_VIRAGE90
	if { $CONFIG_MEM_VIRAGE90 == 1 } then { set tmpvar_1 "Virage-TSMC90" }
	global tmpvar_2
	set tmpvar_2 "GTP0"
	global CONFIG_TRANS_GTP0
	if { $CONFIG_TRANS_GTP0 == 1 } then { set tmpvar_2 "GTP0" }
	global CONFIG_TRANS_GTP1
	if { $CONFIG_TRANS_GTP1 == 1 } then { set tmpvar_2 "GTP1" }
	global CONFIG_TRANS_GTX0
	if { $CONFIG_TRANS_GTX0 == 1 } then { set tmpvar_2 "GTX0" }
	global CONFIG_TRANS_GTX1
	if { $CONFIG_TRANS_GTX1 == 1 } then { set tmpvar_2 "GTX1" }
	global CONFIG_TRANS_GTH0
	if { $CONFIG_TRANS_GTH0 == 1 } then { set tmpvar_2 "GTH0" }
	global CONFIG_TRANS_GTH1
	if { $CONFIG_TRANS_GTH1 == 1 } then { set tmpvar_2 "GTH1" }
	global tmpvar_3
	set tmpvar_3 "Inferred"
	global CONFIG_CLK_INFERRED
	if { $CONFIG_CLK_INFERRED == 1 } then { set tmpvar_3 "Inferred" }
	global CONFIG_CLK_HCLKBUF
	if { $CONFIG_CLK_HCLKBUF == 1 } then { set tmpvar_3 "Actel-HCLKBUF" }
	global CONFIG_CLK_UT130HBD
	if { $CONFIG_CLK_UT130HBD == 1 } then { set tmpvar_3 "Aeroflex-UT130HBD" }
	global CONFIG_CLK_ALTDLL
	if { $CONFIG_CLK_ALTDLL == 1 } then { set tmpvar_3 "Altera-ALTPLL" }
	global CONFIG_CLK_LATDLL
	if { $CONFIG_CLK_LATDLL == 1 } then { set tmpvar_3 "Lattice-EXPLL" }
	global CONFIG_CLK_PRO3PLL
	if { $CONFIG_CLK_PRO3PLL == 1 } then { set tmpvar_3 "Proasic3-PLL" }
	global CONFIG_CLK_PRO3EPLL
	if { $CONFIG_CLK_PRO3EPLL == 1 } then { set tmpvar_3 "Proasic3E-PLL" }
	global CONFIG_CLK_PRO3LPLL
	if { $CONFIG_CLK_PRO3LPLL == 1 } then { set tmpvar_3 "Proasic3L-PLL" }
	global CONFIG_CLK_FUSPLL
	if { $CONFIG_CLK_FUSPLL == 1 } then { set tmpvar_3 "Fusion-PLL" }
	global CONFIG_CLK_LIB18T
	if { $CONFIG_CLK_LIB18T == 1 } then { set tmpvar_3 "RH-LIB18T-PLL" }
	global CONFIG_CLK_RHUMC
	if { $CONFIG_CLK_RHUMC == 1 } then { set tmpvar_3 "RHUMC-PLL" }
	global CONFIG_CLK_DARE
	if { $CONFIG_CLK_DARE == 1 } then { set tmpvar_3 "DARE-PLL" }
	global CONFIG_CLK_SAED32
	if { $CONFIG_CLK_SAED32 == 1 } then { set tmpvar_3 "SAED32-PLL" }
	global CONFIG_CLK_EASIC45
	if { $CONFIG_CLK_EASIC45 == 1 } then { set tmpvar_3 "EASIC45-PLL" }
	global CONFIG_CLK_RHS65
	if { $CONFIG_CLK_RHS65 == 1 } then { set tmpvar_3 "RHS65-PLL" }
	global CONFIG_CLK_CLKPLLE2
	if { $CONFIG_CLK_CLKPLLE2 == 1 } then { set tmpvar_3 "Xilinx-PLLE2" }
	global CONFIG_CLK_CLKDLL
	if { $CONFIG_CLK_CLKDLL == 1 } then { set tmpvar_3 "Xilinx-CLKDLL" }
	global CONFIG_CLK_DCM
	if { $CONFIG_CLK_DCM == 1 } then { set tmpvar_3 "Xilinx-DCM" }
	global tmpvar_4
	set tmpvar_4 "LEON3"
	global CONFIG_LEON3
	if { $CONFIG_LEON3 == 1 } then { set tmpvar_4 "LEON3" }
	global CONFIG_LEON4
	if { $CONFIG_LEON4 == 1 } then { set tmpvar_4 "LEON4" }
	global tmpvar_5
	set tmpvar_5 "Custom-configuration"
	global CONFIG_LEON_MIN
	if { $CONFIG_LEON_MIN == 1 } then { set tmpvar_5 "Minimal-configuration" }
	global CONFIG_LEON_GP
	if { $CONFIG_LEON_GP == 1 } then { set tmpvar_5 "General-purpose-cfg" }
	global CONFIG_LEON_HP
	if { $CONFIG_LEON_HP == 1 } then { set tmpvar_5 "High-Performance-cfg" }
	global CONFIG_LEON_CUSTOM
	if { $CONFIG_LEON_CUSTOM == 1 } then { set tmpvar_5 "Custom-configuration" }
	global tmpvar_6
	set tmpvar_6 "5-cycles"
	global CONFIG_IU_MUL_LATENCY_2
	if { $CONFIG_IU_MUL_LATENCY_2 == 1 } then { set tmpvar_6 "2-cycles" }
	global CONFIG_IU_MUL_LATENCY_4
	if { $CONFIG_IU_MUL_LATENCY_4 == 1 } then { set tmpvar_6 "4-cycles" }
	global CONFIG_IU_MUL_LATENCY_5
	if { $CONFIG_IU_MUL_LATENCY_5 == 1 } then { set tmpvar_6 "5-cycles" }
	global tmpvar_7
	set tmpvar_7 "Inferred"
	global CONFIG_IU_MUL_INFERRED
	if { $CONFIG_IU_MUL_INFERRED == 1 } then { set tmpvar_7 "Inferred" }
	global CONFIG_IU_MUL_MODGEN
	if { $CONFIG_IU_MUL_MODGEN == 1 } then { set tmpvar_7 "NTNU_Modgen" }
	global CONFIG_IU_MUL_TECHSPEC
	if { $CONFIG_IU_MUL_TECHSPEC == 1 } then { set tmpvar_7 "TechSpec" }
	global CONFIG_IU_MUL_DW
	if { $CONFIG_IU_MUL_DW == 1 } then { set tmpvar_7 "Designware" }
	global tmpvar_8
	set tmpvar_8 "GRFPU"
	global CONFIG_FPU_GRFPU
	if { $CONFIG_FPU_GRFPU == 1 } then { set tmpvar_8 "GRFPU" }
	global CONFIG_FPU_GRFPULITE
	if { $CONFIG_FPU_GRFPULITE == 1 } then { set tmpvar_8 "GRFPU-LITE" }
	global tmpvar_9
	set tmpvar_9 "Inferred"
	global CONFIG_FPU_GRFPU_INFMUL
	if { $CONFIG_FPU_GRFPU_INFMUL == 1 } then { set tmpvar_9 "Inferred" }
	global CONFIG_FPU_GRFPU_DWMUL
	if { $CONFIG_FPU_GRFPU_DWMUL == 1 } then { set tmpvar_9 "DW" }
	global CONFIG_FPU_GRFPU_MODGEN
	if { $CONFIG_FPU_GRFPU_MODGEN == 1 } then { set tmpvar_9 "ModGen" }
	global CONFIG_FPU_GRFPU_TECHSPEC
	if { $CONFIG_FPU_GRFPU_TECHSPEC == 1 } then { set tmpvar_9 "TechSpec" }
	global tmpvar_10
	set tmpvar_10 "Simple"
	global CONFIG_FPU_GRFPC0
	if { $CONFIG_FPU_GRFPC0 == 1 } then { set tmpvar_10 "Simple" }
	global CONFIG_FPU_GRFPC1
	if { $CONFIG_FPU_GRFPC1 == 1 } then { set tmpvar_10 "Data-forwarding" }
	global CONFIG_FPU_GRFPC2
	if { $CONFIG_FPU_GRFPC2 == 1 } then { set tmpvar_10 "Non-blocking" }
	global tmpvar_11
	set tmpvar_11 "1"
	global CONFIG_ICACHE_ASSO1
	if { $CONFIG_ICACHE_ASSO1 == 1 } then { set tmpvar_11 "1" }
	global CONFIG_ICACHE_ASSO2
	if { $CONFIG_ICACHE_ASSO2 == 1 } then { set tmpvar_11 "2" }
	global CONFIG_ICACHE_ASSO3
	if { $CONFIG_ICACHE_ASSO3 == 1 } then { set tmpvar_11 "3" }
	global CONFIG_ICACHE_ASSO4
	if { $CONFIG_ICACHE_ASSO4 == 1 } then { set tmpvar_11 "4" }
	global tmpvar_12
	set tmpvar_12 "4"
	global CONFIG_ICACHE_SZ1
	if { $CONFIG_ICACHE_SZ1 == 1 } then { set tmpvar_12 "1" }
	global CONFIG_ICACHE_SZ2
	if { $CONFIG_ICACHE_SZ2 == 1 } then { set tmpvar_12 "2" }
	global CONFIG_ICACHE_SZ4
	if { $CONFIG_ICACHE_SZ4 == 1 } then { set tmpvar_12 "4" }
	global CONFIG_ICACHE_SZ8
	if { $CONFIG_ICACHE_SZ8 == 1 } then { set tmpvar_12 "8" }
	global CONFIG_ICACHE_SZ16
	if { $CONFIG_ICACHE_SZ16 == 1 } then { set tmpvar_12 "16" }
	global CONFIG_ICACHE_SZ32
	if { $CONFIG_ICACHE_SZ32 == 1 } then { set tmpvar_12 "32" }
	global CONFIG_ICACHE_SZ64
	if { $CONFIG_ICACHE_SZ64 == 1 } then { set tmpvar_12 "64" }
	global CONFIG_ICACHE_SZ128
	if { $CONFIG_ICACHE_SZ128 == 1 } then { set tmpvar_12 "128" }
	global CONFIG_ICACHE_SZ256
	if { $CONFIG_ICACHE_SZ256 == 1 } then { set tmpvar_12 "256" }
	global tmpvar_13
	set tmpvar_13 "32"
	global CONFIG_ICACHE_LZ16
	if { $CONFIG_ICACHE_LZ16 == 1 } then { set tmpvar_13 "16" }
	global CONFIG_ICACHE_LZ32
	if { $CONFIG_ICACHE_LZ32 == 1 } then { set tmpvar_13 "32" }
	global tmpvar_14
	set tmpvar_14 "Random"
	global CONFIG_ICACHE_ALGORND
	if { $CONFIG_ICACHE_ALGORND == 1 } then { set tmpvar_14 "Random" }
	global CONFIG_ICACHE_ALGOLRU
	if { $CONFIG_ICACHE_ALGOLRU == 1 } then { set tmpvar_14 "LRU/Dynamic" }
	global tmpvar_15
	set tmpvar_15 "4"
	global CONFIG_ICACHE_LRAM_SZ1
	if { $CONFIG_ICACHE_LRAM_SZ1 == 1 } then { set tmpvar_15 "1" }
	global CONFIG_ICACHE_LRAM_SZ2
	if { $CONFIG_ICACHE_LRAM_SZ2 == 1 } then { set tmpvar_15 "2" }
	global CONFIG_ICACHE_LRAM_SZ4
	if { $CONFIG_ICACHE_LRAM_SZ4 == 1 } then { set tmpvar_15 "4" }
	global CONFIG_ICACHE_LRAM_SZ8
	if { $CONFIG_ICACHE_LRAM_SZ8 == 1 } then { set tmpvar_15 "8" }
	global CONFIG_ICACHE_LRAM_SZ16
	if { $CONFIG_ICACHE_LRAM_SZ16 == 1 } then { set tmpvar_15 "16" }
	global CONFIG_ICACHE_LRAM_SZ32
	if { $CONFIG_ICACHE_LRAM_SZ32 == 1 } then { set tmpvar_15 "32" }
	global CONFIG_ICACHE_LRAM_SZ64
	if { $CONFIG_ICACHE_LRAM_SZ64 == 1 } then { set tmpvar_15 "64" }
	global CONFIG_ICACHE_LRAM_SZ128
	if { $CONFIG_ICACHE_LRAM_SZ128 == 1 } then { set tmpvar_15 "128" }
	global CONFIG_ICACHE_LRAM_SZ256
	if { $CONFIG_ICACHE_LRAM_SZ256 == 1 } then { set tmpvar_15 "256" }
	global tmpvar_16
	set tmpvar_16 "1"
	global CONFIG_DCACHE_ASSO1
	if { $CONFIG_DCACHE_ASSO1 == 1 } then { set tmpvar_16 "1" }
	global CONFIG_DCACHE_ASSO2
	if { $CONFIG_DCACHE_ASSO2 == 1 } then { set tmpvar_16 "2" }
	global CONFIG_DCACHE_ASSO3
	if { $CONFIG_DCACHE_ASSO3 == 1 } then { set tmpvar_16 "3" }
	global CONFIG_DCACHE_ASSO4
	if { $CONFIG_DCACHE_ASSO4 == 1 } then { set tmpvar_16 "4" }
	global tmpvar_17
	set tmpvar_17 "4"
	global CONFIG_DCACHE_SZ1
	if { $CONFIG_DCACHE_SZ1 == 1 } then { set tmpvar_17 "1" }
	global CONFIG_DCACHE_SZ2
	if { $CONFIG_DCACHE_SZ2 == 1 } then { set tmpvar_17 "2" }
	global CONFIG_DCACHE_SZ4
	if { $CONFIG_DCACHE_SZ4 == 1 } then { set tmpvar_17 "4" }
	global CONFIG_DCACHE_SZ8
	if { $CONFIG_DCACHE_SZ8 == 1 } then { set tmpvar_17 "8" }
	global CONFIG_DCACHE_SZ16
	if { $CONFIG_DCACHE_SZ16 == 1 } then { set tmpvar_17 "16" }
	global CONFIG_DCACHE_SZ32
	if { $CONFIG_DCACHE_SZ32 == 1 } then { set tmpvar_17 "32" }
	global CONFIG_DCACHE_SZ64
	if { $CONFIG_DCACHE_SZ64 == 1 } then { set tmpvar_17 "64" }
	global CONFIG_DCACHE_SZ128
	if { $CONFIG_DCACHE_SZ128 == 1 } then { set tmpvar_17 "128" }
	global CONFIG_DCACHE_SZ256
	if { $CONFIG_DCACHE_SZ256 == 1 } then { set tmpvar_17 "256" }
	global tmpvar_18
	set tmpvar_18 "16"
	global CONFIG_DCACHE_LZ16
	if { $CONFIG_DCACHE_LZ16 == 1 } then { set tmpvar_18 "16" }
	global CONFIG_DCACHE_LZ32
	if { $CONFIG_DCACHE_LZ32 == 1 } then { set tmpvar_18 "32" }
	global tmpvar_19
	set tmpvar_19 "Random"
	global CONFIG_DCACHE_ALGORND
	if { $CONFIG_DCACHE_ALGORND == 1 } then { set tmpvar_19 "Random" }
	global CONFIG_DCACHE_ALGOLRU
	if { $CONFIG_DCACHE_ALGOLRU == 1 } then { set tmpvar_19 "LRU/Dynamic" }
	global tmpvar_20
	set tmpvar_20 "64-bit"
	global CONFIG_CACHE_64BIT
	if { $CONFIG_CACHE_64BIT == 1 } then { set tmpvar_20 "64-bit" }
	global CONFIG_CACHE_128BIT
	if { $CONFIG_CACHE_128BIT == 1 } then { set tmpvar_20 "128-bit" }
	global tmpvar_21
	set tmpvar_21 "4"
	global CONFIG_DCACHE_LRAM_SZ1
	if { $CONFIG_DCACHE_LRAM_SZ1 == 1 } then { set tmpvar_21 "1" }
	global CONFIG_DCACHE_LRAM_SZ2
	if { $CONFIG_DCACHE_LRAM_SZ2 == 1 } then { set tmpvar_21 "2" }
	global CONFIG_DCACHE_LRAM_SZ4
	if { $CONFIG_DCACHE_LRAM_SZ4 == 1 } then { set tmpvar_21 "4" }
	global CONFIG_DCACHE_LRAM_SZ8
	if { $CONFIG_DCACHE_LRAM_SZ8 == 1 } then { set tmpvar_21 "8" }
	global CONFIG_DCACHE_LRAM_SZ16
	if { $CONFIG_DCACHE_LRAM_SZ16 == 1 } then { set tmpvar_21 "16" }
	global CONFIG_DCACHE_LRAM_SZ32
	if { $CONFIG_DCACHE_LRAM_SZ32 == 1 } then { set tmpvar_21 "32" }
	global CONFIG_DCACHE_LRAM_SZ64
	if { $CONFIG_DCACHE_LRAM_SZ64 == 1 } then { set tmpvar_21 "64" }
	global CONFIG_DCACHE_LRAM_SZ128
	if { $CONFIG_DCACHE_LRAM_SZ128 == 1 } then { set tmpvar_21 "128" }
	global CONFIG_DCACHE_LRAM_SZ256
	if { $CONFIG_DCACHE_LRAM_SZ256 == 1 } then { set tmpvar_21 "256" }
	global tmpvar_22
	set tmpvar_22 "combined"
	global CONFIG_MMU_COMBINED
	if { $CONFIG_MMU_COMBINED == 1 } then { set tmpvar_22 "combined" }
	global CONFIG_MMU_SPLIT
	if { $CONFIG_MMU_SPLIT == 1 } then { set tmpvar_22 "split" }
	global tmpvar_23
	set tmpvar_23 "Increment"
	global CONFIG_MMU_REPARRAY
	if { $CONFIG_MMU_REPARRAY == 1 } then { set tmpvar_23 "LRU" }
	global CONFIG_MMU_REPINCREMENT
	if { $CONFIG_MMU_REPINCREMENT == 1 } then { set tmpvar_23 "Increment" }
	global tmpvar_24
	set tmpvar_24 "8"
	global CONFIG_MMU_I2
	if { $CONFIG_MMU_I2 == 1 } then { set tmpvar_24 "2" }
	global CONFIG_MMU_I4
	if { $CONFIG_MMU_I4 == 1 } then { set tmpvar_24 "4" }
	global CONFIG_MMU_I8
	if { $CONFIG_MMU_I8 == 1 } then { set tmpvar_24 "8" }
	global CONFIG_MMU_I16
	if { $CONFIG_MMU_I16 == 1 } then { set tmpvar_24 "16" }
	global CONFIG_MMU_I32
	if { $CONFIG_MMU_I32 == 1 } then { set tmpvar_24 "32" }
	global CONFIG_MMU_I64
	if { $CONFIG_MMU_I64 == 1 } then { set tmpvar_24 "64" }
	global tmpvar_25
	set tmpvar_25 "8"
	global CONFIG_MMU_D2
	if { $CONFIG_MMU_D2 == 1 } then { set tmpvar_25 "2" }
	global CONFIG_MMU_D4
	if { $CONFIG_MMU_D4 == 1 } then { set tmpvar_25 "4" }
	global CONFIG_MMU_D8
	if { $CONFIG_MMU_D8 == 1 } then { set tmpvar_25 "8" }
	global CONFIG_MMU_D16
	if { $CONFIG_MMU_D16 == 1 } then { set tmpvar_25 "16" }
	global CONFIG_MMU_D32
	if { $CONFIG_MMU_D32 == 1 } then { set tmpvar_25 "32" }
	global CONFIG_MMU_D64
	if { $CONFIG_MMU_D64 == 1 } then { set tmpvar_25 "64" }
	global tmpvar_26
	set tmpvar_26 "4K"
	global CONFIG_MMU_PAGE_4K
	if { $CONFIG_MMU_PAGE_4K == 1 } then { set tmpvar_26 "4K" }
	global CONFIG_MMU_PAGE_8K
	if { $CONFIG_MMU_PAGE_8K == 1 } then { set tmpvar_26 "8K" }
	global CONFIG_MMU_PAGE_16K
	if { $CONFIG_MMU_PAGE_16K == 1 } then { set tmpvar_26 "16K" }
	global CONFIG_MMU_PAGE_32K
	if { $CONFIG_MMU_PAGE_32K == 1 } then { set tmpvar_26 "32K" }
	global CONFIG_MMU_PAGE_PROG
	if { $CONFIG_MMU_PAGE_PROG == 1 } then { set tmpvar_26 "Programmable" }
	global tmpvar_27
	set tmpvar_27 "1"
	global CONFIG_DSU_ITRACESZ1
	if { $CONFIG_DSU_ITRACESZ1 == 1 } then { set tmpvar_27 "1" }
	global CONFIG_DSU_ITRACESZ2
	if { $CONFIG_DSU_ITRACESZ2 == 1 } then { set tmpvar_27 "2" }
	global CONFIG_DSU_ITRACESZ4
	if { $CONFIG_DSU_ITRACESZ4 == 1 } then { set tmpvar_27 "4" }
	global CONFIG_DSU_ITRACESZ8
	if { $CONFIG_DSU_ITRACESZ8 == 1 } then { set tmpvar_27 "8" }
	global CONFIG_DSU_ITRACESZ16
	if { $CONFIG_DSU_ITRACESZ16 == 1 } then { set tmpvar_27 "16" }
	global tmpvar_28
	set tmpvar_28 "1"
	global CONFIG_DSU_ATRACESZ1
	if { $CONFIG_DSU_ATRACESZ1 == 1 } then { set tmpvar_28 "1" }
	global CONFIG_DSU_ATRACESZ2
	if { $CONFIG_DSU_ATRACESZ2 == 1 } then { set tmpvar_28 "2" }
	global CONFIG_DSU_ATRACESZ4
	if { $CONFIG_DSU_ATRACESZ4 == 1 } then { set tmpvar_28 "4" }
	global CONFIG_DSU_ATRACESZ8
	if { $CONFIG_DSU_ATRACESZ8 == 1 } then { set tmpvar_28 "8" }
	global CONFIG_DSU_ATRACESZ16
	if { $CONFIG_DSU_ATRACESZ16 == 1 } then { set tmpvar_28 "16" }
	global tmpvar_29
	set tmpvar_29 "Pipelined"
	global CONFIG_DSU_AHBWP2
	if { $CONFIG_DSU_AHBWP2 == 1 } then { set tmpvar_29 "Pipelined" }
	global CONFIG_DSU_AHBWP1
	if { $CONFIG_DSU_AHBWP1 == 1 } then { set tmpvar_29 "Enabled" }
	global CONFIG_DSU_AHBWP0
	if { $CONFIG_DSU_AHBWP0 == 1 } then { set tmpvar_29 "Disabled" }
	global tmpvar_30
	set tmpvar_30 "None"
	global CONFIG_IUFT_NONE
	if { $CONFIG_IUFT_NONE == 1 } then { set tmpvar_30 "None" }
	global CONFIG_IUFT_PAR
	if { $CONFIG_IUFT_PAR == 1 } then { set tmpvar_30 "Parity" }
	global CONFIG_IUFT_DMR
	if { $CONFIG_IUFT_DMR == 1 } then { set tmpvar_30 "PDMR" }
	global CONFIG_IUFT_BCH
	if { $CONFIG_IUFT_BCH == 1 } then { set tmpvar_30 "BCH" }
	global CONFIG_IUFT_BCHOTF
	if { $CONFIG_IUFT_BCHOTF == 1 } then { set tmpvar_30 "BCH-OTF" }
	global CONFIG_IUFT_TECHSPEC
	if { $CONFIG_IUFT_TECHSPEC == 1 } then { set tmpvar_30 "TechSpec" }
	global CONFIG_IUFT_TMR
	if { $CONFIG_IUFT_TMR == 1 } then { set tmpvar_30 "TMR" }
	global tmpvar_31
	set tmpvar_31 "None"
	global CONFIG_FPUFT_NONE
	if { $CONFIG_FPUFT_NONE == 1 } then { set tmpvar_31 "None" }
	global CONFIG_FPUFT_PAR
	if { $CONFIG_FPUFT_PAR == 1 } then { set tmpvar_31 "Parity" }
	global CONFIG_FPUFT_DMR
	if { $CONFIG_FPUFT_DMR == 1 } then { set tmpvar_31 "PDMR" }
	global CONFIG_FPUFT_TMR
	if { $CONFIG_FPUFT_TMR == 1 } then { set tmpvar_31 "TMR" }
	global tmpvar_32
	set tmpvar_32 "None"
	global CONFIG_CACHE_FT_NONE
	if { $CONFIG_CACHE_FT_NONE == 1 } then { set tmpvar_32 "None" }
	global CONFIG_CACHE_FT_EN
	if { $CONFIG_CACHE_FT_EN == 1 } then { set tmpvar_32 "Parity" }
	global CONFIG_CACHE_FT_BCH
	if { $CONFIG_CACHE_FT_BCH == 1 } then { set tmpvar_32 "SECDEC-BCH" }
	global CONFIG_CACHE_FT_TECH
	if { $CONFIG_CACHE_FT_TECH == 1 } then { set tmpvar_32 "TechSpec" }
	global tmpvar_33
	set tmpvar_33 "1"
	global CONFIG_L2_ASSO1
	if { $CONFIG_L2_ASSO1 == 1 } then { set tmpvar_33 "1" }
	global CONFIG_L2_ASSO2
	if { $CONFIG_L2_ASSO2 == 1 } then { set tmpvar_33 "2" }
	global CONFIG_L2_ASSO3
	if { $CONFIG_L2_ASSO3 == 1 } then { set tmpvar_33 "3" }
	global CONFIG_L2_ASSO4
	if { $CONFIG_L2_ASSO4 == 1 } then { set tmpvar_33 "4" }
	global tmpvar_34
	set tmpvar_34 "64"
	global CONFIG_L2_SZ1
	if { $CONFIG_L2_SZ1 == 1 } then { set tmpvar_34 "1" }
	global CONFIG_L2_SZ2
	if { $CONFIG_L2_SZ2 == 1 } then { set tmpvar_34 "2" }
	global CONFIG_L2_SZ4
	if { $CONFIG_L2_SZ4 == 1 } then { set tmpvar_34 "4" }
	global CONFIG_L2_SZ8
	if { $CONFIG_L2_SZ8 == 1 } then { set tmpvar_34 "8" }
	global CONFIG_L2_SZ16
	if { $CONFIG_L2_SZ16 == 1 } then { set tmpvar_34 "16" }
	global CONFIG_L2_SZ32
	if { $CONFIG_L2_SZ32 == 1 } then { set tmpvar_34 "32" }
	global CONFIG_L2_SZ64
	if { $CONFIG_L2_SZ64 == 1 } then { set tmpvar_34 "64" }
	global CONFIG_L2_SZ128
	if { $CONFIG_L2_SZ128 == 1 } then { set tmpvar_34 "128" }
	global CONFIG_L2_SZ256
	if { $CONFIG_L2_SZ256 == 1 } then { set tmpvar_34 "256" }
	global CONFIG_L2_SZ512
	if { $CONFIG_L2_SZ512 == 1 } then { set tmpvar_34 "512" }
	global tmpvar_35
	set tmpvar_35 "32"
	global CONFIG_L2_LINE32
	if { $CONFIG_L2_LINE32 == 1 } then { set tmpvar_35 "32" }
	global CONFIG_L2_LINE64
	if { $CONFIG_L2_LINE64 == 1 } then { set tmpvar_35 "64" }
	global tmpvar_36
	set tmpvar_36 "ULPI"
	global CONFIG_GRUSB_DCL_ULPI
	if { $CONFIG_GRUSB_DCL_ULPI == 1 } then { set tmpvar_36 "ULPI" }
	global CONFIG_GRUSB_DCL_UTMI8
	if { $CONFIG_GRUSB_DCL_UTMI8 == 1 } then { set tmpvar_36 "UTMI/UTMI+8-bit" }
	global CONFIG_GRUSB_DCL_UTMI16
	if { $CONFIG_GRUSB_DCL_UTMI16 == 1 } then { set tmpvar_36 "UTMI/UTMI+16-bit" }
	global tmpvar_37
	set tmpvar_37 "2"
	global CONFIG_DSU_ETHSZ1
	if { $CONFIG_DSU_ETHSZ1 == 1 } then { set tmpvar_37 "1" }
	global CONFIG_DSU_ETHSZ2
	if { $CONFIG_DSU_ETHSZ2 == 1 } then { set tmpvar_37 "2" }
	global CONFIG_DSU_ETHSZ4
	if { $CONFIG_DSU_ETHSZ4 == 1 } then { set tmpvar_37 "4" }
	global CONFIG_DSU_ETHSZ8
	if { $CONFIG_DSU_ETHSZ8 == 1 } then { set tmpvar_37 "8" }
	global CONFIG_DSU_ETHSZ16
	if { $CONFIG_DSU_ETHSZ16 == 1 } then { set tmpvar_37 "16" }
	global tmpvar_38
	set tmpvar_38 "4"
	global CONFIG_AHBRAM_SZ1
	if { $CONFIG_AHBRAM_SZ1 == 1 } then { set tmpvar_38 "1" }
	global CONFIG_AHBRAM_SZ2
	if { $CONFIG_AHBRAM_SZ2 == 1 } then { set tmpvar_38 "2" }
	global CONFIG_AHBRAM_SZ4
	if { $CONFIG_AHBRAM_SZ4 == 1 } then { set tmpvar_38 "4" }
	global CONFIG_AHBRAM_SZ8
	if { $CONFIG_AHBRAM_SZ8 == 1 } then { set tmpvar_38 "8" }
	global CONFIG_AHBRAM_SZ16
	if { $CONFIG_AHBRAM_SZ16 == 1 } then { set tmpvar_38 "16" }
	global CONFIG_AHBRAM_SZ32
	if { $CONFIG_AHBRAM_SZ32 == 1 } then { set tmpvar_38 "32" }
	global CONFIG_AHBRAM_SZ64
	if { $CONFIG_AHBRAM_SZ64 == 1 } then { set tmpvar_38 "64" }
	global CONFIG_AHBRAM_SZ128
	if { $CONFIG_AHBRAM_SZ128 == 1 } then { set tmpvar_38 "128" }
	global CONFIG_AHBRAM_SZ256
	if { $CONFIG_AHBRAM_SZ256 == 1 } then { set tmpvar_38 "256" }
	global CONFIG_AHBRAM_SZ512
	if { $CONFIG_AHBRAM_SZ512 == 1 } then { set tmpvar_38 "512" }
	global CONFIG_AHBRAM_SZ1024
	if { $CONFIG_AHBRAM_SZ1024 == 1 } then { set tmpvar_38 "1024" }
	global CONFIG_AHBRAM_SZ2048
	if { $CONFIG_AHBRAM_SZ2048 == 1 } then { set tmpvar_38 "2048" }
	global CONFIG_AHBRAM_SZ4096
	if { $CONFIG_AHBRAM_SZ4096 == 1 } then { set tmpvar_38 "4096" }
	global tmpvar_39
	set tmpvar_39 "8"
	global CONFIG_GRETH_FIFO4
	if { $CONFIG_GRETH_FIFO4 == 1 } then { set tmpvar_39 "4" }
	global CONFIG_GRETH_FIFO8
	if { $CONFIG_GRETH_FIFO8 == 1 } then { set tmpvar_39 "8" }
	global CONFIG_GRETH_FIFO16
	if { $CONFIG_GRETH_FIFO16 == 1 } then { set tmpvar_39 "16" }
	global CONFIG_GRETH_FIFO32
	if { $CONFIG_GRETH_FIFO32 == 1 } then { set tmpvar_39 "32" }
	global CONFIG_GRETH_FIFO64
	if { $CONFIG_GRETH_FIFO64 == 1 } then { set tmpvar_39 "64" }
	global tmpvar_40
	set tmpvar_40 "ULPI"
	global CONFIG_GRUSBHC_ULPI
	if { $CONFIG_GRUSBHC_ULPI == 1 } then { set tmpvar_40 "ULPI" }
	global CONFIG_GRUSBHC_UTMI16
	if { $CONFIG_GRUSBHC_UTMI16 == 1 } then { set tmpvar_40 "UTMI+16-bit" }
	global CONFIG_GRUSBHC_UTMI8
	if { $CONFIG_GRUSBHC_UTMI8 == 1 } then { set tmpvar_40 "UTMI+8-bit" }
	global tmpvar_41
	set tmpvar_41 "External"
	global CONFIG_GRUSBHC_VBUSEXT
	if { $CONFIG_GRUSBHC_VBUSEXT == 1 } then { set tmpvar_41 "External" }
	global CONFIG_GRUSBHC_VBUSINT
	if { $CONFIG_GRUSBHC_VBUSINT == 1 } then { set tmpvar_41 "Internal" }
	global tmpvar_42
	set tmpvar_42 "ActiveLow"
	global CONFIG_GRUSBHC_FAULTL
	if { $CONFIG_GRUSBHC_FAULTL == 1 } then { set tmpvar_42 "ActiveLow" }
	global CONFIG_GRUSBHC_FAULTH
	if { $CONFIG_GRUSBHC_FAULTH == 1 } then { set tmpvar_42 "ActiveHigh" }
	global CONFIG_GRUSBHC_FAULTN
	if { $CONFIG_GRUSBHC_FAULTN == 1 } then { set tmpvar_42 "None" }
	global tmpvar_43
	set tmpvar_43 "ActiveHigh"
	global CONFIG_GRUSBHC_ENABLEH
	if { $CONFIG_GRUSBHC_ENABLEH == 1 } then { set tmpvar_43 "ActiveHigh" }
	global CONFIG_GRUSBHC_ENABLEL
	if { $CONFIG_GRUSBHC_ENABLEL == 1 } then { set tmpvar_43 "ActiveLow" }
	global tmpvar_44
	set tmpvar_44 "ActiveHigh"
	global CONFIG_GRUSBHC_FAULT2H
	if { $CONFIG_GRUSBHC_FAULT2H == 1 } then { set tmpvar_44 "ActiveHigh" }
	global CONFIG_GRUSBHC_FAULT2L
	if { $CONFIG_GRUSBHC_FAULT2L == 1 } then { set tmpvar_44 "ActiveLow" }
	global tmpvar_45
	set tmpvar_45 "ULPI"
	global CONFIG_GRUSBDC_ULPI
	if { $CONFIG_GRUSBDC_ULPI == 1 } then { set tmpvar_45 "ULPI" }
	global CONFIG_GRUSBDC_UTMI8
	if { $CONFIG_GRUSBDC_UTMI8 == 1 } then { set tmpvar_45 "UTMI/UTMI+8-bit" }
	global CONFIG_GRUSBDC_UTMI16
	if { $CONFIG_GRUSBDC_UTMI16 == 1 } then { set tmpvar_45 "UTMI/UTMI+16-bit" }
	global tmpvar_46
	set tmpvar_46 "16"
	global CONFIG_SPW_AHBFIFO4
	if { $CONFIG_SPW_AHBFIFO4 == 1 } then { set tmpvar_46 "4" }
	global CONFIG_SPW_AHBFIFO8
	if { $CONFIG_SPW_AHBFIFO8 == 1 } then { set tmpvar_46 "8" }
	global CONFIG_SPW_AHBFIFO16
	if { $CONFIG_SPW_AHBFIFO16 == 1 } then { set tmpvar_46 "16" }
	global CONFIG_SPW_AHBFIFO32
	if { $CONFIG_SPW_AHBFIFO32 == 1 } then { set tmpvar_46 "32" }
	global tmpvar_47
	set tmpvar_47 "16"
	global CONFIG_SPW_RXFIFO16
	if { $CONFIG_SPW_RXFIFO16 == 1 } then { set tmpvar_47 "16" }
	global CONFIG_SPW_RXFIFO32
	if { $CONFIG_SPW_RXFIFO32 == 1 } then { set tmpvar_47 "32" }
	global CONFIG_SPW_RXFIFO64
	if { $CONFIG_SPW_RXFIFO64 == 1 } then { set tmpvar_47 "64" }
	global tmpvar_48
	set tmpvar_48 "64"
	global CONFIG_SPW_RMAPBUF2
	if { $CONFIG_SPW_RMAPBUF2 == 1 } then { set tmpvar_48 "64" }
	global CONFIG_SPW_RMAPBUF4
	if { $CONFIG_SPW_RMAPBUF4 == 1 } then { set tmpvar_48 "128" }
	global CONFIG_SPW_RMAPBUF6
	if { $CONFIG_SPW_RMAPBUF6 == 1 } then { set tmpvar_48 "192" }
	global CONFIG_SPW_RMAPBUF8
	if { $CONFIG_SPW_RMAPBUF8 == 1 } then { set tmpvar_48 "256" }
	global tmpvar_49
	set tmpvar_49 "2"
	global CONFIG_SPW_GRSPW1
	if { $CONFIG_SPW_GRSPW1 == 1 } then { set tmpvar_49 "1" }
	global CONFIG_SPW_GRSPW2
	if { $CONFIG_SPW_GRSPW2 == 1 } then { set tmpvar_49 "2" }
	global tmpvar_50
	set tmpvar_50 "DDR"
	global CONFIG_SPW_RX_SDR
	if { $CONFIG_SPW_RX_SDR == 1 } then { set tmpvar_50 "SDR" }
	global CONFIG_SPW_RX_DDR
	if { $CONFIG_SPW_RX_DDR == 1 } then { set tmpvar_50 "DDR" }
	global CONFIG_SPW_RX_PAD
	if { $CONFIG_SPW_RX_PAD == 1 } then { set tmpvar_50 "PAD" }
	global CONFIG_SPW_RX_XOR
	if { $CONFIG_SPW_RX_XOR == 1 } then { set tmpvar_50 "Xor" }
	global CONFIG_SPW_RX_AFLEX
	if { $CONFIG_SPW_RX_AFLEX == 1 } then { set tmpvar_50 "Aeroflex" }
	global tmpvar_51
	set tmpvar_51 "SDR"
	global CONFIG_SPW_TX_SDR
	if { $CONFIG_SPW_TX_SDR == 1 } then { set tmpvar_51 "SDR" }
	global CONFIG_SPW_TX_DDR
	if { $CONFIG_SPW_TX_DDR == 1 } then { set tmpvar_51 "DDR" }
	global CONFIG_SPW_TX_AFLEX
	if { $CONFIG_SPW_TX_AFLEX == 1 } then { set tmpvar_51 "Aeroflex" }
	global tmpvar_52
	set tmpvar_52 "1"
	global CONFIG_UA1_FIFO1
	if { $CONFIG_UA1_FIFO1 == 1 } then { set tmpvar_52 "1" }
	global CONFIG_UA1_FIFO2
	if { $CONFIG_UA1_FIFO2 == 1 } then { set tmpvar_52 "2" }
	global CONFIG_UA1_FIFO4
	if { $CONFIG_UA1_FIFO4 == 1 } then { set tmpvar_52 "4" }
	global CONFIG_UA1_FIFO8
	if { $CONFIG_UA1_FIFO8 == 1 } then { set tmpvar_52 "8" }
	global CONFIG_UA1_FIFO16
	if { $CONFIG_UA1_FIFO16 == 1 } then { set tmpvar_52 "16" }
	global CONFIG_UA1_FIFO32
	if { $CONFIG_UA1_FIFO32 == 1 } then { set tmpvar_52 "32" }
	global tmpvar_53
	set tmpvar_53 "None"
	global CONFIG_SPICTRL_NOFT
	if { $CONFIG_SPICTRL_NOFT == 1 } then { set tmpvar_53 "None" }
	global CONFIG_SPICTRL_DMRFT
	if { $CONFIG_SPICTRL_DMRFT == 1 } then { set tmpvar_53 "Parity-DMR" }
	global CONFIG_SPICTRL_TMRFT
	if { $CONFIG_SPICTRL_TMRFT == 1 } then { set tmpvar_53 "TMR" }
	global tmpvar_54
	set tmpvar_54 "Standard"
	global CONFIG_SPICTRL_PROT0
	if { $CONFIG_SPICTRL_PROT0 == 1 } then { set tmpvar_54 "Standard" }
	global CONFIG_SPICTRL_PROT1
	if { $CONFIG_SPICTRL_PROT1 == 1 } then { set tmpvar_54 "Dual" }
	global CONFIG_SPICTRL_PROT2
	if { $CONFIG_SPICTRL_PROT2 == 1 } then { set tmpvar_54 "Quad" }
	global tmpvar_55
	set tmpvar_55 "64"
	global CONFIG_DPR_FIFO64
	if { $CONFIG_DPR_FIFO64 == 1 } then { set tmpvar_55 "64" }
	global CONFIG_DPR_FIFO128
	if { $CONFIG_DPR_FIFO128 == 1 } then { set tmpvar_55 "128" }
	global CONFIG_DPR_FIFO256
	if { $CONFIG_DPR_FIFO256 == 1 } then { set tmpvar_55 "256" }
	global CONFIG_DPR_FIFO512
	if { $CONFIG_DPR_FIFO512 == 1 } then { set tmpvar_55 "512" }
}


proc update_define_mainmenu {} {
	global CONFIG_MODULES
	global CONFIG_LEON3FT_PRESENT
	global CONFIG_HAS_SHARED_GRFPU
	global CONSTANT_Y
	set CONFIG_LEON3FT_PRESENT $CONSTANT_Y
	set CONFIG_HAS_SHARED_GRFPU $CONSTANT_Y
}


# FILE: tail.tk
# This file is boilerplate TCL/TK function definitions for 'make xconfig'.
#
# CHANGES
# =======
#
# 8 January 1998, Michael Elizabeth Chastain, <mec@shout.net>
# Arrange buttons in three columns for better screen fitting.
#

#
# Read the user's settings from .config.  These will override whatever is
# in config.in.  Don't do this if the user specified a -D to force
# the defaults.
#

set defaults defconfig

if { [file readable .config] == 1} then {
	if { $argc > 0 } then {
		if { [lindex $argv 0] != "-D" } then {
			read_config .config
			if { [lindex $argv 0] == "-regen" } then {
				catch {exec cp -f .config .config.old};
				writeconfig .config config.h
				exit 2
			}
		}
		else
		{
			read_config $defaults
		}
	} else {
		read_config .config
	}
} else {
	read_config $defaults
}

update_define 1 $total_menus 0
update_mainmenu

button .f0.right.save -anchor w -text "Save and Exit" -underline 0\
    -command { catch {exec cp -f .config .config.old}; \
		writeconfig .config config.h; wrapup .wrap }

button .f0.right.quit -anchor w -text "Quit Without Saving" -underline 0\
    -command { maybe_exit .maybe }

button .f0.right.load -anchor w -text "Load Configuration from File" \
    -command { load_configfile .load "Load Configuration from file" read_config_file
}

button .f0.right.store -anchor w -text "Store Configuration to File" \
    -command { load_configfile .load "Store Configuration to file" write_config_file }

#
# Now pack everything.
#

pack .f0.right.store .f0.right.load .f0.right.quit .f0.right.save \
    -padx 0 -pady 0 -side bottom -fill x
pack .f0.left .f0.middle .f0.right -side left -padx 5 -pady 0 -fill y
pack .f0 -padx 5 -pady 5

update idletasks
set winy [expr 10 + [winfo reqheight .f0]]
set scry [lindex [wm maxsize .] 1]
set winx [expr 10 + [winfo reqwidth .f0]]
set scrx [lindex [wm maxsize .] 0]
if {$winx < $scrx} then {set maxx -1} else {set maxx $winx}
if {$winy < $scry} then {set maxy -1} else {set maxy $winy}
.f0 configure -width $winx -height $winy 
wm maxsize . $maxx $maxy

#
# If we cannot write our config files, disable the write button.
#
if { [file exists .config] == 1 } then {
		if { [file writable .config] == 0 } then {
			.f0.right.save configure -state disabled
		}
	} else {
		if { [file writable .] == 0 } then {
			.f0.right.save configure -state disabled
		}
	}

#if { [file exists include/linux/autoconf.h] == 1 } then {
#		if { [file writable include/linux/autoconf.h] == 0 } then {
#			.f0.right.save configure -state disabled
#		}
#	} else {
#		if { [file writable include/linux/] == 0 } then {
#			.f0.right.save configure -state disabled
#		}
#	}
