• No se han encontrado resultados

B) DACION CUENTA ACTAS COMISIONES DE GOBIERNO NUMEROS 7 AL 9/2003.-Dada cuenta de las Actas de las Comisiones de Gobierno números 7 al

In document AJUNTAMENT DE PATERNA (VALENCIA) (página 48-53)

TÍTULO IV: DERECHOS Y DEBERES DE LOS MIEMBROS DEL CONSEJO

B) DACION CUENTA ACTAS COMISIONES DE GOBIERNO NUMEROS 7 AL 9/2003.-Dada cuenta de las Actas de las Comisiones de Gobierno números 7 al

Boolean functions may be used directly in a concept specification with thecomplexGate

and function high-level concepts (Section 3.3.1), or be used to generate a concept

specification (Section 4.2). Both of these features are built into Plato,complexGateand

function in the circuit-specific concept library, and a function called bool-to-concept. In both cases, the Boolean functions may be in any form, and must be evaluated in order to find the CNF, which is used to generate concepts. Algorithms to convert Boolean functions into CNF are discussed in Section 2.6. CNF for the functions is necessary as this is the form in which concepts are represented in Plato.

Bool-to-concepts can take arguments of the set and reset functions or just a set function, a file path to a file in which to write the concept specification, and the name of the effect signal. If functions are not given, the user will be prompted to enter them, and the reset function can be left blank. In the event a reset function is not entered, the reset function will be treated as the inversion of the set function. If no output file path is given, the resulting concept specification will be printed to stdout.

Algorithm 4Algorithm to generate concepts from Boolean functions

1: //Main function. Takes Boolean set and reset functions. Outputs a concept

specification.

2: //This converts the functions into CNF and uses this to generate concepts.

3: functionBOOL-TO-CONCEPT(setFunc, resetFunc)

4: ifsetFunc is empty then

5: (setFunc, resetFunc)←get-functions

6: end if

7: ifresetFunc is empty then

8: resetFunc←invert(setFunc)

9: end if

10: allVars←get-vars(setFunc, resetFunc)

11: outVar←get-output-var

12: setCNF←convert-to-CNF(setFunction)

13: resetCNF←convert-to-CNF(resetFunction)

14: outputRise←generate-concepts-text(setCNF, rise outVar)

15: outputFall←generate-concepts-text(resetCNF, fall outVar)

16: print-concepts(fielpath, allVars, outVar, outputRise, outputFall)

17: end function

18:

19: //Takes a function, and an output transition. Generates the concept for

20: //the output to rise or fall. Outputs this in text form.

21: functionGENERATE-CONCEPTS-TEXT(function, output-transition) 22: for allsub-functions in function do

23: for allvariables in sub-function do

24: ifvariable is negated then

25: causes←causes + “fall” + variable

26: else

27: causes←causes + “rise” + variable

28: end if

29: end for

30: concepts←concepts + “<>” + causes + “~|~>“ + output-transition

31: end for

32: end function

Algorithm 4 details how, given Boolean set and reset functions, a concept specification will be generated. We will use our NOR gate with enable example to detail the operation of this Algorithm. Suppose the functions given were as follows:

set :(a∧b) ∧e

reset : (a∧e) ∨ (b∧e)

The main function of this algorithm is bool-to-concept. As with the main functions in other algorithms, it calls other functions which perform useful functions, and return information for further functions. This function is passed a set and reset function, which may contain functions from calling this function, or may be empty. It begins by checking

this, and if empty, calls get-functions which prompts the user to enter them.

Following this, it then checks the reset function, as this can be left empty by the user. If this is the case, the algorithm inverts the set function to use as the reset function, as performed on line 8.

When the set and reset functions are obtained, a list of all variables in both functions is created, resulting in a, b and e. get-output-var obtains the output variable name, which may be input by a user when calling the function, or be a default of out. For this example we will set it as z.

Next, bool-to-concept will convert the functions provided to CNF, using Algorithm 1. The resulting CNF functions, simplified will be as follows:

setCNF : a∧b∧e

resetCNF :(a∨b) ∧e

Now, we can begin to generate the text of concepts, using the function generate-

concept-text. This is used in order to generate both the concept for the output to rise

and to fall, and as such, passed into it is a function, either set or reset, and the output

transition, either rise z or fall z.

generate-concept-text begins with a loop, working with each sub-function in the given

function. A sub-function in this case is found between each top-level AND. Using setCNF this leaves us with three sub-functions, each a single variable; a, b and e. For each of

these, it will determine whether the variable is negated or, using the fall function to

indicate a falling transition if so, or arisefunction, indicating a rising transition, if not.

The text of the transition is created and stored in a list fo each sub-function.

Once all variables in the sub-function have been used to generate a transition, we then create the concept in text-form for this, using OR-causality to the given effect transition of the output variable. Each sub-functions causes are composed with one another as expected for the specification.

Line 13 in bool-to-concept will reuse generate-concepts-text for resetCNF, creating

a concept with the effect transition of fall zinstead. Note, that we use OR-causality

exclusively in this algorithm. For the purposes of automatic concept generation, we use only this form of causality, as if a sub-function contains only one variable, then this can be described as the only possible cause of the effect signal, having the same effect as AND causality, and we will refer to these cases as AND-causality in this example

Following this, we have created the concepts of outputRise and outputFall, which will be as follows:

outputSet = fall a ~>rise z <> fall b ~>rise z <> rise e ~>rise z outputReset = [rise a, rise b] ~|~>fall z <> rise e ~>fall z

With these, the behaviours are described, and a concept specification can be generated, and printed to the desired destination. We pass the necessary variables to the print-

concepts function which will print a concept specification in the form as seen throughout

this thesis, seen in Figure 5.8.

Note that when generating these concepts, for initial state concepts we assume that all signals in the system will be initially 0, and for the interface concepts, it is assumed the given output variable is the only output, and all variables in the functions are inputs. This specification is now complete, Figure 5.8 displayss the resulting file.

moduleConceptwhere importCircuitConcepts

circuit a b c z =outputRise <>outputFall

<>initState <>interface where

outputRise =fall a ~> rise z <>fall b ~> rise z

<>fall c ~> rise z

outputFall =[rise a,rise b,rise c] ~|~> fall z

initState =initialise0 [a, b, c, z]

interface =inputs [a, b, c] <>outputs [z]

Figure 5.8: 3-input NOR gate concept file generated by Bool-to-Concepts

The assumptions of interface and initial state are not accurate, as from the set and reset functions alone it is not possible to derive what the interface and initial states of the given system are. For the purposes of automation, we include these default interface and initial state concepts in order to generate a specification which is immediately translatable, as Figure 5.8 is. In this way, a user can translate the specification, and discover this information through simulation of the circuit, or if the interface is known for example, can edit the generated concept specification themselves. This process is still quicker than that of manually deriving the concepts of a circuit for which only the set and reset functions are known.

In document AJUNTAMENT DE PATERNA (VALENCIA) (página 48-53)