Root/Examples/ehw4/src/test/evalfit.h

1//evalfit.h
2
3/************************** Constant Definitions ***************************/
4/*
5    VARS numero de variables
6    FUNCIONES funciones booleanas, aparte de la YES. 0=NOT, 1=AND, 2=XOR, 3=OR, 4=YES . YES es obligatoria.
7*/
8#define VARS 4
9#define FUNCIONES 4
10#define COMBS (int) pow(2,VARS)
11#define FUNCOMBS (int) pow(FUNCIONES + 1, 3)
12#define COMBSLUT 16
13//#define TAMA_ARBOL 16
14//#define NIVEL_ARBOL_MASC 3
15#define FUN_NOT 0
16#define FUN_AND 1
17#define FUN_XOR 2
18#define FUN_OR 3
19#define YES FUNCIONES
20#define NOVAR VARS
21#define PESO_SALIDA 1
22#define PESO_PUERTAS 1
23#define MAXGENERACIONES 10000
24#define RESULTADOS 4
25
26/* Numero de generaciones en el que se amplia la logitud del cromosoma*/
27#define UMBRAL_GENERACION (int) pow(3, pentarboles) * 5000
28#define MAX_PENTARBOLES 16
29#define POBLACION 64
30#define ARBOLES 5
31#define LONG_ARBOL 8
32/*
33POBLACION define el numero de individuos. minimo 6. 2 padres 4 taras
34ARBOLES define el numero de arboles en un individuo. Cada arbol tiene 3 funciones 4 variables.
35INDICES_XXX define el desplazamiento de un individuo en el cromosoma completo de la poblacion, cromo
36*/
37#define nivel1 pentarboles * 4
38#define ARBOLES_INDIV (int)(nivel1 + nivel2(pentarboles) + nivel3(pentarboles) + nivel4(pentarboles) + nivel5(pentarboles))
39#define LONG_INDIV (int)(ARBOLES_INDIV * LONG_ARBOL)
40
41/* Variables globales */
42char *funlut_ap;
43void *evalfit_ptr;
44
45
46/************************** Constant Definitions ***************************/
47
48#define CONFIG_REGS_BASE 0x13010000
49#define SMCR2_OFFSET 0x18
50#define SACR2_OFFSET 0x38
51
52#define EVALFIT_PHYSBASE1 0x14000000
53#define MAP_SIZE 0x4000Ul
54#define MAP_MASK (MAP_SIZE - 1)
55
56#define DONE_MASK 0x8000
57#define ERRORS_MASK 0xFFFF
58
59/** CONTROL REGISTERS **/
60#define EVALFIT_REGBASE_OFFSET 0x1000
61
62#define EVALFIT_CONTROL_OFFSET EVALFIT_REGBASE_OFFSET + 0x1D
63#define CONTROL_RESET_MASK 0x80
64#define CONTROL_START_MASK 0x40
65
66#define EVALFIT_REG_OFFSET EVALFIT_REGBASE_OFFSET + 0
67
68/** WRITE REGISTERS **/
69
70#define EVALFIT_MAX_COMBS EVALFIT_REGBASE_OFFSET + 0x1E
71#define EVALFIT_MAX_LEVEL EVALFIT_REGBASE_OFFSET + 0x1C
72
73
74#define EVALFIT_WREG4 (EVALFIT_REGBASE_OFFSET + (4*4))
75#define EVALFIT_WREG5 (EVALFIT_REGBASE_OFFSET + (4*5))
76#define EVALFIT_wREG6 (EVALFIT_REGBASE_OFFSET + (4*6))
77#define EVALFIT_wREG7 (EVALFIT_REGBASE_OFFSET + (4*7))
78#define EVALFIT_wREG8 (EVALFIT_REGBASE_OFFSET + (4*8))
79
80/** READ REGISTERS **/
81#define EVALFIT_ERRORS EVALFIT_REGBASE_OFFSET + 0x14
82#define EVALFIT_RANDOM EVALFIT_REGBASE_OFFSET + 0x18
83#define EVALFIT_STATUS EVALFIT_REGBASE_OFFSET + 0x16
84
85
86#define EVALFIT_RDREG0 (EVALFIT_REGBASE_OFFSET)
87#define EVALFIT_RDREG1 (EVALFIT_REGBASE_OFFSET + (4*1))
88#define EVALFIT_RDREG2 (EVALFIT_REGBASE_OFFSET + (4*2))
89#define EVALFIT_RDREG3 (EVALFIT_REGBASE_OFFSET + (4*3))
90#define EVALFIT_RDREG4 (EVALFIT_REGBASE_OFFSET + (4*4))
91#define EVALFIT_RDREG5 (EVALFIT_REGBASE_OFFSET + (4*5))
92#define EVALFIT_RDREG6 (EVALFIT_REGBASE_OFFSET + (4*6))
93#define EVALFIT_RDREG7 (EVALFIT_REGBASE_OFFSET + (4*7))
94#define EVALFIT_RDREG8 (EVALFIT_REGBASE_OFFSET + (4*8))
95/** MEMORY **/
96#define EVALFIT_MEMOFFSET 0x0
97#define EVALFIT_OBJOFFSET EVALFIT_MEMOFFSET + (0x40 * 8)

Archive Download this file

Branches:
master



interactive