Commit 9c153df7 authored by Leonardo Solis's avatar Leonardo Solis

LS9 blocks + added comments + corrections

parent 3938e557
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// IGL_Arbiter keeps checking whether any kernel (GA or any LSs)
// is sending genotypes to Conform, as well as whether
// GA sent the "turn-off" signal.
// Its name references the logic that is producing genotypes:
// IC, GG and any LS.
// IC and GG are two logic blocks inside the GA kernel,
// while any LS logic is a kernel itself.
// It uses the valid signals to determine the "mode" value,
// used as a mux selector signal (of genotype logic-producers) in Conform.
// Initially genotypes passed through this kernel getting reordered and
// synchronized with "mode".
// This has been later optimized, so now genotypes go directly
// from producer logic/kernel (IC, GG, LSs) to the consumer (Conform) kernel.
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
__kernel __attribute__ ((max_global_work_dim(0))) __kernel __attribute__ ((max_global_work_dim(0)))
void Krnl_IGL_Arbiter(/*unsigned char DockConst_num_of_genes*/) { void Krnl_IGL_Arbiter(/*unsigned char DockConst_num_of_genes*/) {
...@@ -71,12 +86,11 @@ while(active) { ...@@ -71,12 +86,11 @@ while(active) {
active = Off_valid ? 0x00 : 0x01; active = Off_valid ? 0x00 : 0x01;
char mode [9]; // mode for all LS char mode [9]; // mode for all LS
/* // Determine "mode" value
float genotypeICGG [ACTUAL_GENOTYPE_LENGTH]; // This considers all possible cases as all LS could be
float genotype [3][ACTUAL_GENOTYPE_LENGTH]; // potentially producing genotypes simultaneously.
*/ // Be careful modifying the nested conditional-statements below,
// as even a litle mistake may be undetectable in emulation.
// get genotype from IC, GG, LS1, LS2, LS3
if (active == 0x01) { if (active == 0x01) {
if (IC_valid == true) { if (IC_valid == true) {
...@@ -86,7 +100,7 @@ while(active) { ...@@ -86,7 +100,7 @@ while(active) {
bound_tmp++; bound_tmp++;
} }
else{ else{
// Reorder the mode & genotype coming from LS // Reorder the mode & from LS
// ************************************************************************************** // **************************************************************************************
// LS1: yes // LS1: yes
...@@ -1292,45 +1306,20 @@ while(active) { ...@@ -1292,45 +1306,20 @@ while(active) {
uchar bound = active ? bound_tmp : 1; uchar bound = active ? bound_tmp : 1;
/* // Send "mode" to Conform
if ((LS1_end_valid || LS2_end_valid || LS3_end_valid)) {
printf("bound_tmp: %-5u, LS1: %-5s, LS2: %-5s, LS3: %-5s\n", bound_tmp, LS1_end_valid?"yes":"no", LS2_end_valid?"yes":"no", LS3_end_valid?"yes":"no");
}
*/
// send data to Krnl_Conform
for (uchar j=0; j<bound; j++) { for (uchar j=0; j<bound; j++) {
char mode_tmp = Off_valid? 0x00: IC_valid? 'I': GG_valid? 'G': mode[j]; char mode_tmp = Off_valid? 0x00: IC_valid? 'I': GG_valid? 'G': mode[j];
//printf("IGL: %u\n", mode_tmp);
char2 actmode = {active, mode_tmp}; char2 actmode = {active, mode_tmp};
write_channel_altera(chan_IGL2Conform_actmode, actmode); write_channel_altera(chan_IGL2Conform_actmode, actmode);
/*
mem_fence(CLK_CHANNEL_MEM_FENCE);
*/
/* #if defined (DEBUG_KRNL_IGL_ARBITER)
for (uchar i=0; i<DockConst_num_of_genes; i++) {
float gene_tmp = (IC_valid || GG_valid)? genotypeICGG[i]: genotype[j][i & MASK_GENOTYPE];
if (i > 2) {
gene_tmp = gene_tmp * DEG_TO_RAD;
}
write_channel_altera(chan_IGL2Conform_genotype, gene_tmp);
}
*/
#if defined (DEBUG_KRNL_CONF_ARBITER)
printf("bound: %u, mode: %u\n", bound, mode_tmp); printf("bound: %u, mode: %u\n", bound, mode_tmp);
#endif #endif
} }
// Only for debugging // Only for debugging
/* /*
if (LS1_end_active == true) { if (LS1_end_active == true) {
LS1_eval = 0; LS1_eval = 0;
} }
...@@ -1342,9 +1331,8 @@ while(active) { ...@@ -1342,9 +1331,8 @@ while(active) {
if (LS3_end_active == true) { if (LS3_end_active == true) {
LS3_eval = 0; LS3_eval = 0;
} }
*/ */
} // End of while (active) } // End of while (active)
} }
......
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// The function calculates the intermolecular energy of a ligand given by // InterE calculates the intermolecular energy of a ligand given by
// myligand parameter, and a receptor represented as a grid. // ligand xyz-positions, and a receptor represented as a grid.
// The grid point values must be stored at the location which starts at GlobFgrids, // The grid point values must be stored at the location which starts at GlobFgrids.
// the memory content can be generated with get_gridvalues function. // If an atom is remains outside the grid,
// The mygrid parameter must be the corresponding grid informtaion. // a very high value will be added to the current energy as a penalty.
// If an atom is outside the grid, the coordinates will be changed with
// the value of outofgrid_tolerance,
// if it remains outside, a very high value will be added to the current energy as a penalty.
// Originally from: processligand.c // Originally from: processligand.c
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
__kernel __attribute__ ((max_global_work_dim(0))) __kernel __attribute__ ((max_global_work_dim(0)))
...@@ -47,9 +44,6 @@ void Krnl_InterE( ...@@ -47,9 +44,6 @@ void Krnl_InterE(
*/ */
) )
{ {
/*
bool active = true;
*/
char active = 0x01; char active = 0x01;
__global const float* GlobFgrids2 = & GlobFgrids [Host_mul_tmp2]; __global const float* GlobFgrids2 = & GlobFgrids [Host_mul_tmp2];
...@@ -80,12 +74,6 @@ while(active) { ...@@ -80,12 +74,6 @@ while(active) {
active = actmode.x; active = actmode.x;
mode = actmode.y; mode = actmode.y;
/*
for (uchar pipe_cnt=0; pipe_cnt<DockConst_num_of_atoms; pipe_cnt++) {
loc_coords[pipe_cnt] = read_channel_altera(chan_Conf2Intere_xyz);
}
*/
for (uchar pipe_cnt=0; pipe_cnt<DockConst_num_of_atoms; pipe_cnt+=2) { 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_channel_altera(chan_Conf2Intere_xyz);
float3 tmp1 = {tmp.s0, tmp.s1, tmp.s2}; float3 tmp1 = {tmp.s0, tmp.s1, tmp.s2};
...@@ -94,7 +82,6 @@ while(active) { ...@@ -94,7 +82,6 @@ while(active) {
loc_coords[pipe_cnt+1] = tmp2; loc_coords[pipe_cnt+1] = tmp2;
} }
// -------------------------------------------------------------- // --------------------------------------------------------------
//printf("AFTER In INTER CHANNEL\n"); //printf("AFTER In INTER CHANNEL\n");
...@@ -108,7 +95,7 @@ while(active) { ...@@ -108,7 +95,7 @@ while(active) {
float interE = 0.0f; float interE = 0.0f;
#endif #endif
// for each atom // For each ligand atom
for (uchar atom1_id=0; atom1_id<DockConst_num_of_atoms; atom1_id++) for (uchar atom1_id=0; atom1_id<DockConst_num_of_atoms; atom1_id++)
{ {
char atom1_typeid = KerConstStatic_atom_types_const [atom1_id]; char atom1_typeid = KerConstStatic_atom_types_const [atom1_id];
...@@ -119,11 +106,11 @@ while(active) { ...@@ -119,11 +106,11 @@ while(active) {
float y = loc_coords_atid1.y; float y = loc_coords_atid1.y;
float z = loc_coords_atid1.z; float z = loc_coords_atid1.z;
#if defined (FIXED_POINT_INTERE) #if defined (FIXED_POINT_INTERE)
#else #else
float q = KerConstStatic_atom_charges_const [atom1_id]; float q = KerConstStatic_atom_charges_const [atom1_id];
#endif #endif
#if defined (FIXED_POINT_INTERE) #if defined (FIXED_POINT_INTERE)
fixedpt64 fixpt_x = fixedpt64_fromfloat(loc_coords_atid1.x); fixedpt64 fixpt_x = fixedpt64_fromfloat(loc_coords_atid1.x);
...@@ -143,7 +130,7 @@ while(active) { ...@@ -143,7 +130,7 @@ while(active) {
float partialE3; float partialE3;
#endif #endif
// if the atom is outside of the grid // If the atom is outside of the grid
#if defined (FIXED_POINT_INTERE) #if defined (FIXED_POINT_INTERE)
if ((fixpt_x < 0) || (fixpt_x >= fixedpt64_fromint(DockConst_gridsize_x_minus1)) || if ((fixpt_x < 0) || (fixpt_x >= fixedpt64_fromint(DockConst_gridsize_x_minus1)) ||
(fixpt_y < 0) || (fixpt_y >= fixedpt64_fromint(DockConst_gridsize_y_minus1)) || (fixpt_y < 0) || (fixpt_y >= fixedpt64_fromint(DockConst_gridsize_y_minus1)) ||
...@@ -154,7 +141,7 @@ while(active) { ...@@ -154,7 +141,7 @@ while(active) {
(z < 0.0f) || (z >= DockConst_gridsize_z_minus1)) { (z < 0.0f) || (z >= DockConst_gridsize_z_minus1)) {
#endif #endif
//penalty is 2^24 for each atom outside the grid // Penalty is 2^24 for each atom outside the grid
/* /*
interE += 16777216.0f; interE += 16777216.0f;
*/ */
...@@ -235,7 +222,7 @@ while(active) { ...@@ -235,7 +222,7 @@ while(active) {
printf("coeff(1,1,1) = %f\n", weights [1][1][1]); printf("coeff(1,1,1) = %f\n", weights [1][1][1]);
#endif #endif
// lvs added temporal variables // Added temporal variables
uint cube_000, cube_100, cube_010, cube_110, cube_001, cube_101, cube_011, cube_111; uint cube_000, cube_100, cube_010, cube_110, cube_001, cube_101, cube_011, cube_111;
uint ylow_times_g1 = y_low * DockConst_g1; uint ylow_times_g1 = y_low * DockConst_g1;
...@@ -254,7 +241,7 @@ while(active) { ...@@ -254,7 +241,7 @@ while(active) {
uint mul_tmp = atom1_typeid * DockConst_g3; uint mul_tmp = atom1_typeid * DockConst_g3;
//energy contribution of the current grid type // Energy contribution of the current grid type
#if defined (FIXED_POINT_INTERE) #if defined (FIXED_POINT_INTERE)
fixedpt64 fixpt_cube [2][2][2]; fixedpt64 fixpt_cube [2][2][2];
fixpt_cube [0][0][0] = fixedpt64_fromfloat(GlobFgrids[cube_000 + mul_tmp]); fixpt_cube [0][0][0] = fixedpt64_fromfloat(GlobFgrids[cube_000 + mul_tmp]);
...@@ -314,7 +301,7 @@ while(active) { ...@@ -314,7 +301,7 @@ while(active) {
printf("interpolated value = %f\n\n", TRILININTERPOL(cube, weights)); printf("interpolated value = %f\n\n", TRILININTERPOL(cube, weights));
#endif #endif
//energy contribution of the electrostatic grid // Energy contribution of the electrostatic grid
/* /*
#if defined(SEPARATE_FGRID_INTERE) #if defined(SEPARATE_FGRID_INTERE)
#else #else
...@@ -383,7 +370,7 @@ while(active) { ...@@ -383,7 +370,7 @@ while(active) {
printf("interpolated value = %f, multiplied by q = %f\n\n", TRILININTERPOL(cube, weights), q*TRILININTERPOL(cube, weights)); printf("interpolated value = %f, multiplied by q = %f\n\n", TRILININTERPOL(cube, weights), q*TRILININTERPOL(cube, weights));
#endif #endif
//energy contribution of the desolvation grid // Energy contribution of the desolvation grid
/* /*
#if defined(SEPARATE_FGRID_INTERE) #if defined(SEPARATE_FGRID_INTERE)
#else #else
...@@ -471,42 +458,21 @@ while(active) { ...@@ -471,42 +458,21 @@ while(active) {
#endif #endif
switch (mode) { switch (mode) {
// IC case 'I': write_channel_altera(chan_Intere2StoreIC_intere, final_interE); break;
case 'I': write_channel_altera(chan_Intere2StoreIC_intere, final_interE); break; case 'G': write_channel_altera(chan_Intere2StoreGG_intere, final_interE); break;
// GG
case 'G': write_channel_altera(chan_Intere2StoreGG_intere, final_interE); break;
// LS 1
case 0x01: write_channel_altera(chan_Intere2StoreLS_LS1_intere, final_interE); break; case 0x01: write_channel_altera(chan_Intere2StoreLS_LS1_intere, final_interE); break;
// LS 2
case 0x02: write_channel_altera(chan_Intere2StoreLS_LS2_intere, final_interE); break; case 0x02: write_channel_altera(chan_Intere2StoreLS_LS2_intere, final_interE); break;
// LS 3
case 0x03: write_channel_altera(chan_Intere2StoreLS_LS3_intere, final_interE); break; case 0x03: write_channel_altera(chan_Intere2StoreLS_LS3_intere, final_interE); break;
// LS 4
case 0x04: write_channel_altera(chan_Intere2StoreLS_LS4_intere, final_interE); break; case 0x04: write_channel_altera(chan_Intere2StoreLS_LS4_intere, final_interE); break;
// LS 5
case 0x05: write_channel_altera(chan_Intere2StoreLS_LS5_intere, final_interE); break; case 0x05: write_channel_altera(chan_Intere2StoreLS_LS5_intere, final_interE); break;
// LS 6
case 0x06: write_channel_altera(chan_Intere2StoreLS_LS6_intere, final_interE); break; case 0x06: write_channel_altera(chan_Intere2StoreLS_LS6_intere, final_interE); break;
// LS 7
case 0x07: write_channel_altera(chan_Intere2StoreLS_LS7_intere, final_interE); break; case 0x07: write_channel_altera(chan_Intere2StoreLS_LS7_intere, final_interE); break;
// LS 8
case 0x08: write_channel_altera(chan_Intere2StoreLS_LS8_intere, final_interE); break; case 0x08: write_channel_altera(chan_Intere2StoreLS_LS8_intere, final_interE); break;
// LS 9
case 0x09: write_channel_altera(chan_Intere2StoreLS_LS9_intere, final_interE); break; case 0x09: write_channel_altera(chan_Intere2StoreLS_LS9_intere, final_interE); break;
} }
// -------------------------------------------------------------- // --------------------------------------------------------------
} // End of while(1) } // End of while(active)
#if defined (DEBUG_ACTIVE_KERNEL) #if defined (DEBUG_ACTIVE_KERNEL)
printf(" %-20s: %s\n", "Krnl_InterE", "disabled"); printf(" %-20s: %s\n", "Krnl_InterE", "disabled");
......
...@@ -4,10 +4,12 @@ float sqrt_custom(const float x) ...@@ -4,10 +4,12 @@ float sqrt_custom(const float x)
uint i = *(uint*) &x; uint i = *(uint*) &x;
i += 127 << 23; // adjust bias i += 127 << 23; // adjust bias
i >>= 1; // approximation of square root i >>= 1; // approximation of square root
return as_float(i); //return *(float*) &i; return as_float(i); // return *(float*) &i;
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// IntraE calculates the intramolecular energy of a set of atomic ligand
// contributor-pairs.
// Originally from: processligand.c // Originally from: processligand.c
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
__kernel __attribute__ ((max_global_work_dim(0))) __kernel __attribute__ ((max_global_work_dim(0)))
...@@ -28,15 +30,8 @@ void Krnl_IntraE( ...@@ -28,15 +30,8 @@ void Krnl_IntraE(
float DockConst_coeff_elec, float DockConst_coeff_elec,
float DockConst_qasp, float DockConst_qasp,
float DockConst_coeff_desolv float DockConst_coeff_desolv
/*
,
unsigned int Host_square_num_of_atypes
*/
) )
{ {
/*
bool active = true;
*/
char active = 0x01; char active = 0x01;
__local char3 intraE_contributors_localcache [MAX_INTRAE_CONTRIBUTORS]; __local char3 intraE_contributors_localcache [MAX_INTRAE_CONTRIBUTORS];
...@@ -68,12 +63,6 @@ while(active) { ...@@ -68,12 +63,6 @@ while(active) {
active = actmode.x; active = actmode.x;
mode = actmode.y; mode = actmode.y;
/*
for (uchar pipe_cnt=0; pipe_cnt<DockConst_num_of_atoms; pipe_cnt++) {
loc_coords[pipe_cnt] = read_channel_altera(chan_Conf2Intrae_xyz);
}
*/
for (uchar pipe_cnt=0; pipe_cnt<DockConst_num_of_atoms; pipe_cnt+=2) { 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_channel_altera(chan_Conf2Intrae_xyz);
float3 tmp1 = {tmp.s0, tmp.s1, tmp.s2}; float3 tmp1 = {tmp.s0, tmp.s1, tmp.s2};
...@@ -92,9 +81,9 @@ while(active) { ...@@ -92,9 +81,9 @@ while(active) {
float intraE = 0.0f; float intraE = 0.0f;
#if defined (FIXED_POINT_INTRAE) #if defined (FIXED_POINT_INTRAE)
// create shift register to reduce II (initially II=32, unroll-factor=8) // Create shift register to reduce II (initially II=32, unroll-factor=8)
// use fixedpt64 to reduce II=4 (after shift-register) downto II=1 // Use fixedpt64 to reduce II=4 (after shift-register) downto II=1
//float shift_intraE[33]; //float shift_intraE[33];
fixedpt64 shift_intraE[33]; fixedpt64 shift_intraE[33];
...@@ -104,9 +93,9 @@ while(active) { ...@@ -104,9 +93,9 @@ while(active) {
shift_intraE[i] = 0; shift_intraE[i] = 0;
} }
#endif #endif
//for each intramolecular atom contributor pair // For each intramolecular atom contributor pair
//#pragma unroll 10 //#pragma unroll 10
for (ushort contributor_counter=0; contributor_counter<DockConst_num_of_intraE_contributors; contributor_counter++) { for (ushort contributor_counter=0; contributor_counter<DockConst_num_of_intraE_contributors; contributor_counter++) {
...@@ -130,7 +119,7 @@ while(active) { ...@@ -130,7 +119,7 @@ while(active) {
#if defined (DEBUG_KRNL_INTRAE) #if defined (DEBUG_KRNL_INTRAE)
printf("\n\nToo low distance (%f) between atoms %u and %u\n", distance_leo, atom1_id, atom2_id); printf("\n\nToo low distance (%f) between atoms %u and %u\n", distance_leo, atom1_id, atom2_id);
#endif #endif
//return HIGHEST_ENERGY; //returning maximal value //return HIGHEST_ENERGY; // Returning maximal value
distance_leo = 1.0f; distance_leo = 1.0f;
} }
...@@ -144,7 +133,7 @@ while(active) { ...@@ -144,7 +133,7 @@ while(active) {
float partialE3; float partialE3;
float partialE4; float partialE4;
//but only if the distance is less than distance cutoff value and 20.48A (because of the tables) // But only if the distance is less than distance cutoff value and 20.48A (because of the tables)
//if ((distance_leo < 8.0f) && (distance_leo < 20.48f)) //if ((distance_leo < 8.0f) && (distance_leo < 20.48f))
if (distance_leo < 8.0f) if (distance_leo < 8.0f)
{ {
...@@ -158,20 +147,20 @@ while(active) { ...@@ -158,20 +147,20 @@ while(active) {
char atom1_typeid = KerConstStatic_atom_types_const [atom1_id]; char atom1_typeid = KerConstStatic_atom_types_const [atom1_id];
char atom2_typeid = KerConstStatic_atom_types_const [atom2_id]; char atom2_typeid = KerConstStatic_atom_types_const [atom2_id];
//calculating van der Waals / hydrogen bond term // Calculating van der Waals / hydrogen bond term
partialE1 = KerConstStatic_VWpars_AC_const [atom1_typeid*DockConst_num_of_atypes+atom2_typeid]*inverse_distance_pow_12; partialE1 = KerConstStatic_VWpars_AC_const [atom1_typeid*DockConst_num_of_atypes+atom2_typeid]*inverse_distance_pow_12;
float tmp_pE2 = KerConstStatic_VWpars_BD_const [atom1_typeid*DockConst_num_of_atypes+atom2_typeid]; float tmp_pE2 = KerConstStatic_VWpars_BD_const [atom1_typeid*DockConst_num_of_atypes+atom2_typeid];
if (ref_intraE_contributors_const.z == 1) //H-bond if (ref_intraE_contributors_const.z == 1) // H-bond
partialE2 = tmp_pE2 * inverse_distance_pow_10; partialE2 = tmp_pE2 * inverse_distance_pow_10;
else //van der Waals else // Van der Waals
partialE2 = tmp_pE2 * inverse_distance_pow_6; partialE2 = tmp_pE2 * inverse_distance_pow_6;
//calculating electrostatic term // Calculating electrostatic term
partialE3 = native_divide( (DockConst_coeff_elec*KerConstStatic_atom_charges_const[atom1_id]*KerConstStatic_atom_charges_const[atom2_id]) , (distance_leo*(-8.5525f + native_divide(86.9525f, (1.0f + 7.7839f*native_exp(-0.3154f*distance_leo))))) ); partialE3 = native_divide( (DockConst_coeff_elec*KerConstStatic_atom_charges_const[atom1_id]*KerConstStatic_atom_charges_const[atom2_id]) , (distance_leo*(-8.5525f + native_divide(86.9525f, (1.0f + 7.7839f*native_exp(-0.3154f*distance_leo))))) );
//calculating desolvation term // Calculating desolvation term
partialE4 = ( partialE4 = (
(KerConstStatic_dspars_S_const [atom1_typeid] + DockConst_qasp*fabs(KerConstStatic_atom_charges_const[atom1_id])) * KerConstStatic_dspars_V_const [atom2_typeid] + (KerConstStatic_dspars_S_const [atom1_typeid] + DockConst_qasp*fabs(KerConstStatic_atom_charges_const[atom1_id])) * KerConstStatic_dspars_V_const [atom2_typeid] +
(KerConstStatic_dspars_S_const [atom2_typeid] + DockConst_qasp*fabs(KerConstStatic_atom_charges_const[atom2_id])) * KerConstStatic_dspars_V_const [atom1_typeid]) * (KerConstStatic_dspars_S_const [atom2_typeid] + DockConst_qasp*fabs(KerConstStatic_atom_charges_const[atom2_id])) * KerConstStatic_dspars_V_const [atom1_typeid]) *
...@@ -179,7 +168,7 @@ while(active) { ...@@ -179,7 +168,7 @@ while(active) {
} // End of if: if ((dist < dcutoff) && (dist < 20.48)) } // End of if: if ((dist < dcutoff) && (dist < 20.48))
#if defined (FIXED_POINT_INTRAE) #if defined (FIXED_POINT_INTRAE)
//shift_intraE[32] = shift_intraE[0] + partialE1 + partialE2 + partialE3 + partialE4; //shift_intraE[32] = shift_intraE[0] + partialE1 + partialE2 + partialE3 + partialE4;
shift_intraE[32] = shift_intraE[0] + fixedpt64_fromfloat(partialE1) + shift_intraE[32] = shift_intraE[0] + fixedpt64_fromfloat(partialE1) +
fixedpt64_fromfloat(partialE2) + fixedpt64_fromfloat(partialE2) +
...@@ -190,13 +179,13 @@ while(active) { ...@@ -190,13 +179,13 @@ while(active) {
for (uchar j=0; j<32; j++) { for (uchar j=0; j<32; j++) {
shift_intraE[j] = shift_intraE[j+1]; shift_intraE[j] = shift_intraE[j+1];
} }
#else #else
intraE += partialE1 + partialE2 + partialE3 + partialE4; intraE += partialE1 + partialE2 + partialE3 + partialE4;
#endif #endif
} // End of contributor_counter for-loop } // End of contributor_counter for-loop
#if defined (FIXED_POINT_INTRAE) #if defined (FIXED_POINT_INTRAE)
fixedpt64 fixpt_intraE = 0; fixedpt64 fixpt_intraE = 0;
#pragma unroll #pragma unroll
...@@ -205,48 +194,27 @@ while(active) { ...@@ -205,48 +194,27 @@ while(active) {
fixpt_intraE += shift_intraE[j]; fixpt_intraE += shift_intraE[j];
} }
intraE = fixedpt64_tofloat(fixpt_intraE); intraE = fixedpt64_tofloat(fixpt_intraE);
#endif #endif
// -------------------------------------------------------------- // --------------------------------------------------------------
// Send intramolecular energy to channel // Send intramolecular energy to channel
// -------------------------------------------------------------- // --------------------------------------------------------------
switch (mode) { switch (mode) {
// IC case 'I': write_channel_altera(chan_Intrae2StoreIC_intrae, intraE); break;
case 'I': write_channel_altera(chan_Intrae2StoreIC_intrae, intraE); break; case 'G': write_channel_altera(chan_Intrae2StoreGG_intrae, intraE); break;
// GG
case 'G': write_channel_altera(chan_Intrae2StoreGG_intrae, intraE); break;
// LS 1
case 0x01: write_channel_altera(chan_Intrae2StoreLS_LS1_intrae, intraE); break; case 0x01: write_channel_altera(chan_Intrae2StoreLS_LS1_intrae, intraE); break;
// LS 2
case 0x02: write_channel_altera(chan_Intrae2StoreLS_LS2_intrae, intraE); break; case 0x02: write_channel_altera(chan_Intrae2StoreLS_LS2_intrae, intraE); break;
// LS 3
case 0x03: write_channel_altera(chan_Intrae2StoreLS_LS3_intrae, intraE); break; case 0x03: write_channel_altera(chan_Intrae2StoreLS_LS3_intrae, intraE); break;
// LS 4
case 0x04: write_channel_altera(chan_Intrae2StoreLS_LS4_intrae, intraE); break; case 0x04: write_channel_altera(chan_Intrae2StoreLS_LS4_intrae, intraE); break;
// LS 5
case 0x05: write_channel_altera(chan_Intrae2StoreLS_LS5_intrae, intraE); break; case 0x05: write_channel_altera(chan_Intrae2StoreLS_LS5_intrae, intraE); break;
// LS 6
case 0x06: write_channel_altera(chan_Intrae2StoreLS_LS6_intrae, intraE); break; case 0x06: write_channel_altera(chan_Intrae2StoreLS_LS6_intrae, intraE); break;
// LS 7
case 0x07: write_channel_altera(chan_Intrae2StoreLS_LS7_intrae, intraE); break; case 0x07: write_channel_altera(chan_Intrae2StoreLS_LS7_intrae, intraE); break;
// LS 8
case 0x08: write_channel_altera(chan_Intrae2StoreLS_LS8_intrae, intraE); break; case 0x08: write_channel_altera(chan_Intrae2StoreLS_LS8_intrae, intraE); break;
// LS 9
case 0x09: write_channel_altera(chan_Intrae2StoreLS_LS9_intrae, intraE); break; case 0x09: write_channel_altera(chan_Intrae2StoreLS_LS9_intrae, intraE); break;
} }
// -------------------------------------------------------------- // --------------------------------------------------------------
} // End of while(1) } // End of while(active)
#if defined (DEBUG_ACTIVE_KERNEL) #if defined (DEBUG_ACTIVE_KERNEL)
printf(" %-20s: %s\n", "Krnl_IntraE", "disabled"); printf(" %-20s: %s\n", "Krnl_IntraE", "disabled");
......
...@@ -22,32 +22,6 @@ void Krnl_LS( ...@@ -22,32 +22,6 @@ void Krnl_LS(
) )
{ {
bool valid = true; bool valid = true;
/*
// added to find out which fixed-point precision is needed
// 16.16 is enough
fixedpt fp1 = fixedpt_fromfloat(DockConst_rho_lower_bound);
fixedpt fp2 = fixedpt_fromfloat(DockConst_base_dmov_mul_sqrt3);
fixedpt fp3 = fixedpt_fromfloat(DockConst_base_dang_mul_sqrt3);
printf("DockConst_rho_lower_bound: %f %f\n", DockConst_rho_lower_bound, fixedpt_tofloat(fp1));
printf("DockConst_base_dmov_mul_sqrt3: %f %f\n", DockConst_base_dmov_mul_sqrt3, fixedpt_tofloat(fp2));
printf("DockConst_base_dang_mul_sqrt3: %f %f\n", DockConst_base_dang_mul_sqrt3, fixedpt_tofloat(fp3));
*/
/*
// print fixedpt representation of 180.0f and 360.0f
printf("180f: %f %i %x\n", 180.0f, fixedpt_fromfloat(180.0f), fixedpt_fromfloat(180.0f));
printf("360f: %f %i %x\n", 360.0f, fixedpt_fromfloat(360.0f), fixedpt_fromfloat(360.0f));
// 180f: 180.000000 11796480 b40000
// 360f: 360.000000 23592960 1680000
*/