Commit bf2f00b6 authored by lvs's avatar lvs
Browse files

all channels transformed into pipes

parent 2bc7c000
......@@ -80,8 +80,14 @@ while(active) {
)) loc_coords [MAX_NUM_OF_ATOMS];
#endif
/*
char2 actmode = read_channel_altera(chan_IGL2Conform_actmode);
*/
char2 actmode;
read_pipe_block(chan_IGL2Conform_actmode, &actmode);
/*
mem_fence(CLK_CHANNEL_MEM_FENCE);
*/
active = actmode.x;
mode = actmode.y;
......@@ -97,6 +103,7 @@ while(active) {
for (uchar i=0; i<DockConst_num_of_genes; i++) {
float fl_tmp;
switch (mode) {
/*
case 'I': fl_tmp = read_channel_altera(chan_IC2Conf_genotype); break;
case 'G': fl_tmp = read_channel_altera(chan_GG2Conf_genotype); break;
case 0x01: fl_tmp = read_channel_altera(chan_LS2Conf_LS1_genotype); break;
......@@ -108,6 +115,18 @@ while(active) {
case 0x07: fl_tmp = read_channel_altera(chan_LS2Conf_LS7_genotype); break;
case 0x08: fl_tmp = read_channel_altera(chan_LS2Conf_LS8_genotype); break;
case 0x09: fl_tmp = read_channel_altera(chan_LS2Conf_LS9_genotype); break;
*/
case 'I': read_pipe_block(chan_IC2Conf_genotype, &fl_tmp); break;
case 'G': read_pipe_block(chan_GG2Conf_genotype, &fl_tmp); break;
case 0x01: read_pipe_block(chan_LS2Conf_LS1_genotype, &fl_tmp); break;
case 0x02: read_pipe_block(chan_LS2Conf_LS2_genotype, &fl_tmp); break;
case 0x03: read_pipe_block(chan_LS2Conf_LS3_genotype, &fl_tmp); break;
case 0x04: read_pipe_block(chan_LS2Conf_LS4_genotype, &fl_tmp); break;
case 0x05: read_pipe_block(chan_LS2Conf_LS5_genotype, &fl_tmp); break;
case 0x06: read_pipe_block(chan_LS2Conf_LS6_genotype, &fl_tmp); break;
case 0x07: read_pipe_block(chan_LS2Conf_LS7_genotype, &fl_tmp); break;
case 0x08: read_pipe_block(chan_LS2Conf_LS8_genotype, &fl_tmp); break;
case 0x09: read_pipe_block(chan_LS2Conf_LS9_genotype, &fl_tmp); break;
}
if (i > 2) {
......@@ -436,11 +455,16 @@ while(active) {
char active_tmp = active;
char mode_tmp = mode;
char2 actmode = {active_tmp, mode_tmp};
/*
write_channel_altera(chan_Conf2Intere_actmode, actmode);
write_channel_altera(chan_Conf2Intrae_actmode, actmode);
*/
write_pipe_block(chan_Conf2Intere_actmode, &actmode);
write_pipe_block(chan_Conf2Intrae_actmode, &actmode);
}
/*
mem_fence(CLK_CHANNEL_MEM_FENCE);
*/
#if defined (FIXED_POINT_CONFORM)
fixedpt3 tmp_coords[2];
......@@ -469,9 +493,12 @@ while(active) {
tmp.s0 = tmp_coords[0].x; tmp.s1 = tmp_coords[0].y; tmp.s2 = tmp_coords[0].z; //tmp.s3
tmp.s4 = tmp_coords[1].x; tmp.s5 = tmp_coords[1].y; tmp.s6 = tmp_coords[1].z; //tmp.s7
#endif
/*
write_channel_altera(chan_Conf2Intere_xyz, tmp);
write_channel_altera(chan_Conf2Intrae_xyz, tmp);
*/
write_pipe_block(chan_Conf2Intere_xyz, &tmp);
write_pipe_block(chan_Conf2Intrae_xyz, &tmp);
}
// --------------------------------------------------------------
......
......@@ -999,7 +999,7 @@ void Krnl_GA(__global float* restrict GlobPopulationCurrent,
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
/*
#include "Krnl_PRNG.cl"
#include "Krnl_LS.cl"
......@@ -1016,4 +1016,3 @@ void Krnl_GA(__global float* restrict GlobPopulationCurrent,
#include "Krnl_Conform.cl"
#include "Krnl_InterE.cl"
#include "Krnl_IntraE.cl"
*/
......@@ -68,6 +68,7 @@ while(active) {
(LS8_end_valid == false) &&
(LS9_end_valid == false)
){
/*
Off_active = read_channel_nb_altera(chan_IGLArbiter_Off, &Off_valid);
IC_active = read_channel_nb_altera(chan_GA2IGL_IC_active, &IC_valid);
GG_active = read_channel_nb_altera(chan_GA2IGL_GG_active, &GG_valid);
......@@ -80,6 +81,19 @@ while(active) {
LS7_end_active = read_channel_nb_altera(chan_LS2Arbiter_LS7_end, &LS7_end_valid);
LS8_end_active = read_channel_nb_altera(chan_LS2Arbiter_LS8_end, &LS8_end_valid);
LS9_end_active = read_channel_nb_altera(chan_LS2Arbiter_LS9_end, &LS9_end_valid);
*/
Off_valid = read_pipe(chan_IGLArbiter_Off, &Off_active);
IC_valid = read_pipe(chan_GA2IGL_IC_active, &IC_active);
GG_valid = read_pipe(chan_GA2IGL_GG_active, &GG_active);
LS1_end_valid = read_pipe(chan_LS2Arbiter_LS1_end, &LS1_end_active);
LS2_end_valid = read_pipe(chan_LS2Arbiter_LS2_end, &LS2_end_active);
LS3_end_valid = read_pipe(chan_LS2Arbiter_LS3_end, &LS3_end_active);
LS4_end_valid = read_pipe(chan_LS2Arbiter_LS4_end, &LS4_end_active);
LS5_end_valid = read_pipe(chan_LS2Arbiter_LS5_end, &LS5_end_active);
LS6_end_valid = read_pipe(chan_LS2Arbiter_LS6_end, &LS6_end_active);
LS7_end_valid = read_pipe(chan_LS2Arbiter_LS7_end, &LS7_end_active);
LS8_end_valid = read_pipe(chan_LS2Arbiter_LS8_end, &LS8_end_active);
LS9_end_valid = read_pipe(chan_LS2Arbiter_LS9_end, &LS9_end_active);
}
uchar bound_tmp = 0;
......@@ -1311,7 +1325,10 @@ while(active) {
char mode_tmp = Off_valid? 0x00: IC_valid? 'I': GG_valid? 'G': mode[j];
char2 actmode = {active, mode_tmp};
/*
write_channel_altera(chan_IGL2Conform_actmode, actmode);
*/
write_pipe_block(chan_IGL2Conform_actmode, &actmode);
#if defined (DEBUG_KRNL_IGL_ARBITER)
printf("bound: %u, mode: %u\n", bound, mode_tmp);
......
......@@ -68,14 +68,25 @@ while(active) {
// Wait for ligand atomic coordinates in channel
// --------------------------------------------------------------
/*
char2 actmode = read_channel_altera(chan_Conf2Intere_actmode);
*/
char2 actmode;
read_pipe_block(chan_Conf2Intere_actmode, &actmode);
/*
mem_fence(CLK_CHANNEL_MEM_FENCE);
*/
active = actmode.x;
mode = actmode.y;
for (uchar pipe_cnt=0; pipe_cnt<DockConst_num_of_atoms; pipe_cnt+=2) {
/*
float8 tmp = read_channel_altera(chan_Conf2Intere_xyz);
*/
float8 tmp;
read_pipe_block(chan_Conf2Intere_xyz, &tmp);
float3 tmp1 = {tmp.s0, tmp.s1, tmp.s2};
float3 tmp2 = {tmp.s4, tmp.s5, tmp.s6};
loc_coords[pipe_cnt] = tmp1;
......@@ -458,6 +469,7 @@ while(active) {
#endif
switch (mode) {
/*
case 'I': write_channel_altera(chan_Intere2StoreIC_intere, final_interE); break;
case 'G': write_channel_altera(chan_Intere2StoreGG_intere, final_interE); break;
case 0x01: write_channel_altera(chan_Intere2StoreLS_LS1_intere, final_interE); break;
......@@ -469,6 +481,18 @@ while(active) {
case 0x07: write_channel_altera(chan_Intere2StoreLS_LS7_intere, final_interE); break;
case 0x08: write_channel_altera(chan_Intere2StoreLS_LS8_intere, final_interE); break;
case 0x09: write_channel_altera(chan_Intere2StoreLS_LS9_intere, final_interE); break;
*/
case 'I': write_pipe_block(chan_Intere2StoreIC_intere, &final_interE); break;
case 'G': write_pipe_block(chan_Intere2StoreGG_intere, &final_interE); break;
case 0x01: write_pipe_block(chan_Intere2StoreLS_LS1_intere, &final_interE); break;
case 0x02: write_pipe_block(chan_Intere2StoreLS_LS2_intere, &final_interE); break;
case 0x03: write_pipe_block(chan_Intere2StoreLS_LS3_intere, &final_interE); break;
case 0x04: write_pipe_block(chan_Intere2StoreLS_LS4_intere, &final_interE); break;
case 0x05: write_pipe_block(chan_Intere2StoreLS_LS5_intere, &final_interE); break;
case 0x06: write_pipe_block(chan_Intere2StoreLS_LS6_intere, &final_interE); break;
case 0x07: write_pipe_block(chan_Intere2StoreLS_LS7_intere, &final_interE); break;
case 0x08: write_pipe_block(chan_Intere2StoreLS_LS8_intere, &final_interE); break;
case 0x09: write_pipe_block(chan_Intere2StoreLS_LS9_intere, &final_interE); break;
}
// --------------------------------------------------------------
......
......@@ -56,15 +56,25 @@ while(active) {
// --------------------------------------------------------------
// Wait for ligand atomic coordinates in channel
// --------------------------------------------------------------
/*
char2 actmode = read_channel_altera(chan_Conf2Intrae_actmode);
*/
char2 actmode;
read_pipe_block(chan_Conf2Intrae_actmode, &actmode);
/*
mem_fence(CLK_CHANNEL_MEM_FENCE);
*/
active = actmode.x;
mode = actmode.y;
for (uchar pipe_cnt=0; pipe_cnt<DockConst_num_of_atoms; pipe_cnt+=2) {
/*
float8 tmp = read_channel_altera(chan_Conf2Intrae_xyz);
*/
float8 tmp;
read_pipe_block(chan_Conf2Intrae_xyz, &tmp);
float3 tmp1 = {tmp.s0, tmp.s1, tmp.s2};
float3 tmp2 = {tmp.s4, tmp.s5, tmp.s6};
loc_coords[pipe_cnt] = tmp1;
......@@ -200,6 +210,7 @@ while(active) {
// Send intramolecular energy to channel
// --------------------------------------------------------------
switch (mode) {
/*
case 'I': write_channel_altera(chan_Intrae2StoreIC_intrae, intraE); break;
case 'G': write_channel_altera(chan_Intrae2StoreGG_intrae, intraE); break;
case 0x01: write_channel_altera(chan_Intrae2StoreLS_LS1_intrae, intraE); break;
......@@ -211,6 +222,18 @@ while(active) {
case 0x07: write_channel_altera(chan_Intrae2StoreLS_LS7_intrae, intraE); break;
case 0x08: write_channel_altera(chan_Intrae2StoreLS_LS8_intrae, intraE); break;
case 0x09: write_channel_altera(chan_Intrae2StoreLS_LS9_intrae, intraE); break;
*/
case 'I': write_pipe_block(chan_Intrae2StoreIC_intrae, &intraE); break;
case 'G': write_pipe_block(chan_Intrae2StoreGG_intrae, &intraE); break;
case 0x01: write_pipe_block(chan_Intrae2StoreLS_LS1_intrae, &intraE); break;
case 0x02: write_pipe_block(chan_Intrae2StoreLS_LS2_intrae, &intraE); break;
case 0x03: write_pipe_block(chan_Intrae2StoreLS_LS3_intrae, &intraE); break;
case 0x04: write_pipe_block(chan_Intrae2StoreLS_LS4_intrae, &intraE); break;
case 0x05: write_pipe_block(chan_Intrae2StoreLS_LS5_intrae, &intraE); break;
case 0x06: write_pipe_block(chan_Intrae2StoreLS_LS6_intrae, &intraE); break;
case 0x07: write_pipe_block(chan_Intrae2StoreLS_LS7_intrae, &intraE); break;
case 0x08: write_pipe_block(chan_Intrae2StoreLS_LS8_intrae, &intraE); break;
case 0x09: write_pipe_block(chan_Intrae2StoreLS_LS9_intrae, &intraE); break;
}
// --------------------------------------------------------------
......
......@@ -32,8 +32,12 @@ while(valid) {
bool valid_energy = false;
while( (valid_active == false) && (valid_energy == false)) {
/*
active = read_channel_nb_altera(chan_GA2LS_Off1_active, &valid_active);
current_energy = read_channel_nb_altera(chan_GA2LS_LS1_energy, &valid_energy);
*/
valid_active = read_pipe(chan_GA2LS_Off1_active, &active);
valid_energy = read_pipe(chan_GA2LS_LS1_energy, &current_energy);
}
valid = active || valid_energy;
......@@ -47,10 +51,18 @@ while(valid) {
for (uchar i=0; i<DockConst_num_of_genes; i++) {
#if defined (FIXED_POINT_LS1)
/*
float tmp_gene = read_channel_altera(chan_GA2LS_LS1_genotype);
*/
float tmp_gene;
read_pipe_block(chan_GA2LS_LS1_genotype, &tmp_gene);
genotype [i] = fixedpt_fromfloat(tmp_gene);
#else
/*
genotype [i] = read_channel_altera(chan_GA2LS_LS1_genotype);
*/
read_pipe_block(chan_GA2LS_LS1_genotype, &genotype [i]);
#endif
}
......@@ -116,18 +128,33 @@ while(valid) {
// Not completely strict as the (iteration_cnt < DockConst_max_num_of_iters) is ignored
// In practice, rho condition dominates most of the cases
#if defined (FIXED_POINT_LS1)
/*
write_channel_altera(chan_LS2Arbiter_LS1_end, (fixpt_rho < DockConst_rho_lower_bound)?true:false);
*/
bool tmp_bool = (fixpt_rho < DockConst_rho_lower_bound)?true:false;
write_pipe_block(chan_LS2Arbiter_LS1_end, &tmp_bool);
#else
/*
write_channel_altera(chan_LS2Arbiter_LS1_end, (rho < DockConst_rho_lower_bound)?true:false);
*/
bool tmp_bool = (rho < DockConst_rho_lower_bound)?true:false;
write_pipe_block(chan_LS2Arbiter_LS1_end, &tmp_bool);
#endif
/*
mem_fence(CLK_CHANNEL_MEM_FENCE);
*/
// new random deviate
// rho is the deviation of the uniform distribution
for (uchar i=0; i<DockConst_num_of_genes; i++) {
/*
float tmp_prng = read_channel_altera(chan_PRNG2GA_LS_float_prng);
*/
float tmp_prng;
read_pipe_block(chan_PRNG2GA_LS_float_prng, &tmp_prng);
/*
mem_fence(CLK_CHANNEL_MEM_FENCE);
*/
#if defined (FIXED_POINT_LS1)
fixedpt fixpt_tmp_prng = *(fixedpt*) &tmp_prng;
......@@ -156,7 +183,10 @@ while(valid) {
else { fixpt_tmp3 = fixedpt_map_angle_360(fixpt_tmp3); }}
entity_possible_new_genotype [i] = fixpt_tmp3;
/*
write_channel_altera(chan_LS2Conf_LS1_genotype, fixedpt_tofloat(fixpt_tmp3));
*/
write_pipe_block(chan_LS2Conf_LS1_genotype, &fixedpt_tofloat(fixpt_tmp3));
#else
// tmp1 is genotype_deviate
......@@ -170,7 +200,7 @@ while(valid) {
// tmp2 is the addition: genotype_deviate + genotype_bias
// tmp3 is entity_possible_new_genotype
float tmp_bias = (iteration_cnt == 1)? 0.0f:genotype_bias[i];
float bias = 0.6 * tmp_bias;
float bias = 0.6f * tmp_bias;
deviate_plus_bias [i] = deviate + bias;
deviate_minus_bias [i] = deviate - bias;
......@@ -182,7 +212,10 @@ while(valid) {
else { tmp3 = map_angle_360(tmp3); }}
entity_possible_new_genotype [i] = tmp3;
/*
write_channel_altera(chan_LS2Conf_LS1_genotype, tmp3);
*/
write_pipe_block(chan_LS2Conf_LS1_genotype, &tmp3);
#endif
#if defined (DEBUG_KRNL_LS1)
......@@ -198,10 +231,16 @@ while(valid) {
bool inter_valid = false;
while( (intra_valid == false) || (inter_valid == false)) {
if (intra_valid == false) {
/*
energyIA_LS_rx = read_channel_nb_altera(chan_Intrae2StoreLS_LS1_intrae, &intra_valid);
*/
intra_valid = read_pipe(chan_Intrae2StoreLS_LS1_intrae, &energyIA_LS_rx);
}
else if (inter_valid == false) {
/*
energyIE_LS_rx = read_channel_nb_altera(chan_Intere2StoreLS_LS1_intere, &inter_valid);
*/
inter_valid = read_pipe(chan_Intere2StoreLS_LS1_intere, &energyIE_LS_rx);
}
}
......@@ -286,14 +325,25 @@ while(valid) {
for (uchar i=0; i<DockConst_num_of_genes; i++) {
if (i == 0) {
float2 evalenergy = {*(float*)&LS_eval, current_energy};
/*
write_channel_altera(chan_LS2GA_LS1_evalenergy, evalenergy);
*/
write_pipe_block(chan_LS2GA_LS1_evalenergy, &evalenergy);
}
/*
mem_fence(CLK_CHANNEL_MEM_FENCE);
*/
#if defined (FIXED_POINT_LS1)
/*
write_channel_altera(chan_LS2GA_LS1_genotype, fixedpt_tofloat(genotype [i]));
*/
write_pipe_block(chan_LS2GA_LS1_genotype, &fixedpt_tofloat(genotype [i]));
#else
/*
write_channel_altera(chan_LS2GA_LS1_genotype, genotype [i]);
*/
write_pipe_block(chan_LS2GA_LS1_genotype, &genotype [i]);
#endif
}
......
......@@ -31,8 +31,12 @@ while(valid) {
bool valid_energy = false;
while( (valid_active == false) && (valid_energy == false)) {
/*
active = read_channel_nb_altera(chan_GA2LS_Off2_active, &valid_active);
current_energy = read_channel_nb_altera(chan_GA2LS_LS2_energy, &valid_energy);
*/
valid_active = read_pipe(chan_GA2LS_Off2_active, &active);
valid_energy = read_pipe(chan_GA2LS_LS2_energy, &current_energy);
}
valid = active || valid_energy;
......@@ -46,10 +50,18 @@ while(valid) {
for (uchar i=0; i<DockConst_num_of_genes; i++) {
#if defined (FIXED_POINT_LS2)
/*
float tmp_gene = read_channel_altera(chan_GA2LS_LS2_genotype);
*/
float tmp_gene;
read_pipe_block(chan_GA2LS_LS2_genotype, &tmp_gene);
genotype [i] = fixedpt_fromfloat(tmp_gene);
#else
/*
genotype [i] = read_channel_altera(chan_GA2LS_LS2_genotype);
*/
read_pipe_block(chan_GA2LS_LS2_genotype, &genotype [i]);
#endif
}
......@@ -119,18 +131,33 @@ while(valid) {
// Not completely strict as the (iteration_cnt < DockConst_max_num_of_iters) is ignored
// In practice, rho condition dominates most of the cases
#if defined (FIXED_POINT_LS2)
/*
write_channel_altera(chan_LS2Arbiter_LS2_end, (fixpt_rho < DockConst_rho_lower_bound)?true:false);
*/
bool tmp_bool = (fixpt_rho < DockConst_rho_lower_bound)?true:false;
write_pipe_block(chan_LS2Arbiter_LS2_end, &tmp_bool);
#else
/*
write_channel_altera(chan_LS2Arbiter_LS2_end, (rho < DockConst_rho_lower_bound)?true:false);
*/
bool tmp_bool = (rho < DockConst_rho_lower_bound)?true:false;
write_pipe_block(chan_LS2Arbiter_LS2_end, tmp_bool);
#endif
/*
mem_fence(CLK_CHANNEL_MEM_FENCE);
*/
// new random deviate
// rho is the deviation of the uniform distribution
for (uchar i=0; i<DockConst_num_of_genes; i++) {
/*
float tmp_prng = read_channel_altera(chan_PRNG2GA_LS2_float_prng);
*/
float tmp_prng;
read_pipe_block(chan_PRNG2GA_LS2_float_prng, &tmp_prng);
/*
mem_fence(CLK_CHANNEL_MEM_FENCE);
*/
#if defined (FIXED_POINT_LS2)
fixedpt fixpt_tmp_prng = *(fixedpt*) &tmp_prng;
......@@ -159,7 +186,10 @@ while(valid) {
else { fixpt_tmp3 = fixedpt_map_angle_360(fixpt_tmp3);}}
entity_possible_new_genotype [i] = fixpt_tmp3;
/*
write_channel_altera(chan_LS2Conf_LS2_genotype, fixedpt_tofloat(fixpt_tmp3));
*/
write_pipe_block(chan_LS2Conf_LS2_genotype, &fixedpt_tofloat(fixpt_tmp3));
#else
// tmp1 is genotype_deviate
......@@ -173,7 +203,7 @@ while(valid) {
// tmp2 is the addition: genotype_deviate + genotype_bias
// tmp3 is entity_possible_new_genotype
float tmp_bias = (iteration_cnt == 1)? 0.0f:genotype_bias [i];
float bias = 0.6 * tmp_bias;
float bias = 0.6f * tmp_bias;
deviate_plus_bias [i] = deviate + bias;
deviate_minus_bias [i] = deviate - bias;
......@@ -185,7 +215,10 @@ while(valid) {
else { tmp3 = map_angle_360(tmp3);}}
entity_possible_new_genotype [i] = tmp3;
/*
write_channel_altera(chan_LS2Conf_LS2_genotype, tmp3);
*/
write_pipe_block(chan_LS2Conf_LS2_genotype, &tmp3);
#endif
#if defined (DEBUG_KRNL_LS2)
......@@ -201,10 +234,16 @@ while(valid) {
bool inter_valid = false;
while( (intra_valid == false) || (inter_valid == false)) {
if (intra_valid == false) {
/*
energyIA_LS_rx = read_channel_nb_altera(chan_Intrae2StoreLS_LS2_intrae, &intra_valid);
*/
intra_valid = read_pipe(chan_Intrae2StoreLS_LS2_intrae, &energyIA_LS_rx);
}
else if (inter_valid == false) {
/*
energyIE_LS_rx = read_channel_nb_altera(chan_Intere2StoreLS_LS2_intere, &inter_valid);
*/
inter_valid = read_pipe(chan_Intere2StoreLS_LS2_intere, &energyIE_LS_rx);
}
}
......@@ -293,14 +332,25 @@ while(valid) {
for (uchar i=0; i<DockConst_num_of_genes; i++) {
if (i == 0) {
float2 evalenergy = {*(float*)&LS_eval, current_energy};
/*
write_channel_altera(chan_LS2GA_LS2_evalenergy, evalenergy);
*/
write_pipe_block(chan_LS2GA_LS2_evalenergy, &evalenergy);
}
/*
mem_fence(CLK_CHANNEL_MEM_FENCE);
*/
#if defined (FIXED_POINT_LS2)
/*
write_channel_altera(chan_LS2GA_LS2_genotype, fixedpt_tofloat(genotype [i]));
*/
write_pipe_block(chan_LS2GA_LS2_genotype, &fixedpt_tofloat(genotype [i]));
#else
/*
write_channel_altera(chan_LS2GA_LS2_genotype, genotype [i]);
*/
write_pipe_block(chan_LS2GA_LS2_genotype, &genotype [i]);
#endif
}
......
......@@ -31,8 +31,12 @@ while(valid) {
bool valid_energy = false;
while( (valid_active == false) && (valid_energy == false)) {
/*
active = read_channel_nb_altera(chan_GA2LS_Off3_active, &valid_active);
current_energy = read_channel_nb_altera(chan_GA2LS_LS3_energy, &valid_energy);
*/
valid_active = read_pipe(chan_GA2LS_Off3_active, &active);
valid_energy = read_pipe(chan_GA2LS_LS3_energy, &current_energy);
}
valid = active || valid_energy;
......@@ -46,10 +50,18 @@ while(valid) {
for (uchar i=0; i<DockConst_num_of_genes; i++) {
#if defined (FIXED_POINT_LS3)
/*
float tmp_gene = read_channel_altera(chan_GA2LS_LS3_genotype);
*/
float tmp_gene;
read_pipe_block(chan_GA2LS_LS3_genotype, &tmp_gene);
genotype [i] = fixedpt_fromfloat(tmp_gene);
#else
/*
genotype [i] = read_channel_altera(chan_GA2LS_LS3_genotype);
*/
read_pipe_block(chan_GA2LS_LS3_genotype, &genotype [i]);
#endif
}
......@@ -119,18 +131,33 @@ while(valid) {
// Not completely strict as the (iteration_cnt < DockConst_max_num_of_iters) is ignored
// In practice, rho condition dominates most of the cases
#if defined (FIXED_POINT_LS3)
/*
write_channel_altera(chan_LS2Arbiter_LS3_end, (fixpt_rho < DockConst_rho_lower_bound)?true:false);
*/
bool tmp_bool = (fixpt_rho < DockConst_rho_lower_bound)?true:false;
write_pipe_block(chan_LS2Arbiter_LS3_end, &tmp_bool);
#else
/*
write_channel_altera(chan_LS2Arbiter_LS3_end, (rho < DockConst_rho_lower_bound)?true:false);
*/
bool tmp_bool = (rho < DockConst_rho_lower_bound)?true:false;
write_pipe_block(chan_LS2Arbiter_LS3_end, &tmp_bool);
#endif
/*
mem_fence(CLK_CHANNEL_MEM_FENCE);
*/
// new random deviate
// rho is the deviation of the uniform distribution
for (uchar i=0; i<DockConst_num_of_genes; i++) {
/*
float tmp_prng = read_channel_altera(chan_PRNG2GA_LS3_float_prng);
*/
float tmp_prng;
read_pipe_block(chan_PRNG2GA_LS3_float_prng, &tmp_prng);
/*
mem_fence(CLK_CHANNEL_MEM_FENCE);
*/
#if defined (FIXED_POINT_LS3)
fixedpt fixpt_tmp_prng = *(fixedpt*) &tmp_prng;
......@@ -159,7 +186,10 @@ while(valid) {
else { fixpt_tmp3 = fixedpt_map_angle_360(fixpt_tmp3); }}
entity_possible_new_genotype [i] = fixpt_tmp3;
/*
write_channel_altera(chan_LS2Conf_LS3_genotype, fixedpt_tofloat(fixpt_tmp3));
*/
write_pipe_block(chan_LS2Conf_LS3_genotype, &fixedpt_tofloat(fixpt_tmp3));
#else
// tmp1 is genotype_deviate
......@@ -185,7 +215,10 @@ while(valid) {
else { tmp3 = map_angle_360(tmp3);}}
entity_possible_new_genotype [i] = tmp3;
/*
write_channel_altera(chan_LS2Conf_LS3_genotype, tmp3);
*/
write_pipe_block(chan_LS2Conf_LS3_genotype, &tmp3);
#endif
#if defined (DEBUG_KRNL_LS3)
......@@ -201,10 +234,16 @@ while(valid) {
bool inter_valid = false;
while( (intra_valid == false) || (inter_valid == false)) {
if (intra_valid == false) {
/*
energyIA_LS_rx = read_channel_nb_altera(chan_Intrae2StoreLS_LS3_intrae, &intra_valid);
*/
intra_valid = read_pipe(chan_Intrae2StoreLS_LS3_intrae, &energyIA_LS_rx);
}
else if (inter_valid == false) {
/*
energyIE_LS_rx = read_channel_nb_altera(chan_Intere2StoreLS_LS3_intere, &inter_valid);
*/
inter_valid = read_pipe(chan_Intere2StoreLS_LS3_intere, &energyIE_LS_rx);
}
}
......@@ -293,14 +332,25 @@ while(valid) {
for (uchar i=0; i<DockConst_num_of_genes; i++) {
if (i == 0) {
float2 evalenergy = {*(float*)&LS_eval, current_energy};
/*
write_channel_altera(chan_LS2GA_LS3_evalenergy, evalenergy);
*/
write_pipe_block(chan_LS2GA_LS3_evalenergy, &evalenergy);
}
/*