= Translation of RSF-Files into DIMACS Format = [[PageOutline(2-5, Table of Contents, pullout)]] == Translation of Tristate Variables == Tristate variables will be translated into 2 variables. This translation shall be equal to the translation of Undertaker or KConfigReader: * One variable declaring whether the related KConfig variable is permanently selected * One variable declaring whether the related KConfig variable is selected as a module. * Only one of these variables can be selected at the same time. The translation will be done as follows: * In RSF: {{{ Item VARIABLE tristate }}} * In DIMACS: {{{ Not(VARIABLE) or Not(VARIABLE_MODULE) }}} * Meaning: ||'''VARIABLE'''||'''VARIABLE_MODULE'''||'''Explanation'''|| ||0||0||VARIABLE is permanently deselected ('n' was selected)|| ||1||0||VARIABLE is permanently selected ('y' was selected)|| ||0||1||VARIABLE is selected as a module ('m' was selected)|| ||1||1||Illegal state|| == Translation of String, Integer, Hex Variables == === Concrete Values === For String, Integer, and Hex variables we list all used values as different variables in the following form: {{{ VARIABLE= }}} For a not configured variable (or an empty String) a variable in the following form will be created: {{{ VARIABLE=n }}} Further, constraints must ensure that exactly one variable will be selected: * In Boolean formula: {{{ VARIABLE=n XOR VARIABLE=value1 XOR ... XOR VARIABLE=valueN }}} * In DIMACS: {{{ Not(VARIABLE=n) OR Not(VARIABLE=value1) Not(VARIABLE=n) OR (VARIABLE=value2) ... Not(VARIABLE=n) OR (VARIABLE=valueN) Not(VARIABLE=value1) OR (VARIABLE=value2) ... Not(VARIABLE=value1) OR (VARIABLE=valueN) ... VARIABLE=n OR VARIABLE=value1 OR ... OR VARIABLE=valueN }}} All combinations of 2 negated variables + 1 constraint were all variables are used in a positive combination. === Ranges === Ranges of !Integers/Hex variables will not be considered. Since KConfig supports only == and != comparisons, only values used in constraints will be translated to DIMACS. == Translation of ''depends'' Constraints == Each variable can have multiple depends statements, specifying when the variable can be configured. The variable must remain unconfigured (in case of a Boolean or Tristate variable, it must be set to ''n''), if none of the depends statements is fulfilled. Conditions will be translated as follows: 1. One Condition: * In RSF: {{{ depends Variable Condition }}} * In Boolean formula: {{{ Not(Condition) implies Not(Variable) }}} * In DIMACS: {{{ Condition or Not(Variable) }}} 1. Multiple Conditions * In RSF: {{{ depends Variable Condition1 depends Variable Condition2 }}} * In Boolean formula: {{{ Not(Condition1) and Not(Condition2) implies Not(Variable) }}} * In DIMACS: {{{ Condition1 or Condition2 or Not(Variable) }}} 1. Variable depends of Tristate * In RSF: {{{ depends VARIABLE TRISTATE_VAR }}} * In Boolean formula: {{{ Not(TRISTATE_VAR) and Not(TRISTATE_VAR_MODULE) implies Not(VARIABLE ) }}} * In DIMACS: {{{ TRISTATE_VAR or TRISTATE_VAR_MODULE or Not(VARIABLE ) }}} 1. Tristate variable depends of Condition * In RSF: {{{ depends TRISTATE_VAR CONDITION }}} * In Boolean formula: {{{ Not(CONDITION) implies Not(TRISTATE_VAR) Not(CONDITION) implies Not(TRISTATE_VAR_MODULE) }}} * In DIMACS: {{{ CONDITION or Not(TRISTATE_VAR) CONDITION or Not(TRISTATE_VAR_MODULE_VAR) }}} == Translation of ''!ItemSelects'' Constraints == The [https://www.kernel.org/doc/Documentation/kbuild/kconfig-language.txt KConfig specification] defines select statements as follows: > reverse dependencies: "select" !["if" ] > While normal dependencies reduce the upper limit of a symbol (see > below), reverse dependencies can be used to force a lower limit of > another symbol. The value of the current menu symbol is used as the > minimal value can be set to. If is selected multiple > times, the limit is set to the largest selection. > Reverse dependencies can only be used with boolean or tristate > symbols. 1. Translation of Boolean !ItemSelect statements: * In RSF: {{{ ItemSelects BOOLEAN_VAR OTHER_VAR CONDITION }}} * In Boolean formula: {{{ (BOOLEAN_VAR and CONDITION) implies OTHER_VAR }}} * In DIMACS: {{{ Not(BOOLEAN_VAR) or Not(CONDITION) or OTHER_VAR }}} 2. Translation of Tristate !ItemSelect statements: * In RSF: {{{ ItemSelects TRISTATE_VAR OTHER_VAR CONDITION }}} * In Boolean formula: {{{ (TRISTATE_VAR and CONDITION) implies OTHER_VAR (TRISTATE_VAR_MODULE and CONDITION) implies OTHER_VAR_MODULE }}} * In DIMACS: {{{ Not(TRISTATE_VAR) or Not(CONDITION) or OTHER_VAR Not(TRISTATE_VAR_MODULE) or Not(CONDITION) or OTHER_VAR_MODULE }}}