// ************************************************************************** // // // // eses eses // // eses eses // // eses eseses esesese eses Embedded Systems Group // // ese ese ese ese ese // // ese eseseses eseseses ese Department of Computer Science // // eses eses ese eses // // eses eseses eseseses eses University of Kaiserslautern // // eses eses // // // // ************************************************************************** // [8]nat x; [8]nat y; [9]nat s; thread RadixBAddCarryLookahead8 { bool g0,g1,g2,g3,g4,g5,g6,g7; bool p0,p1,p2,p3,p4,p5,p6,p7; nat x0,x1,x2,x3,x4,x5,x6,x7; nat y0,y1,y2,y3,y4,y5,y6,y7; nat s0,s1,s2,s3,s4,s5,s6,s7,s8; x0 = x[0]; x1 = x[1]; x2 = x[2]; x3 = x[3]; x4 = x[4]; x5 = x[5]; x6 = x[6]; x7 = x[7]; y0 = y[0]; y1 = y[1]; y2 = y[2]; y3 = y[3]; y4 = y[4]; y5 = y[5]; y6 = y[6]; y7 = y[7]; // preliminary sum digits s0 = x0 + y0; s1 = x1 + y1; s2 = x2 + y2; s3 = x3 + y3; s4 = x4 + y4; s5 = x5 + y5; s6 = x6 + y6; s7 = x7 + y7; // initial generate conditions g0 = s0>255; g1 = s1>255; g2 = s2>255; g3 = s3>255; g4 = s4>255; g5 = s5>255; g6 = s6>255; g7 = s7>255; // initial propagate conditions p0 = s0==255; p1 = s1==255; p2 = s2==255; p3 = s3==255; p4 = s4==255; p5 = s5==255; p6 = s6==255; p7 = s7==255; // carry propagation prefix tree // up-level 1 g1 = g0 & p1 | g1; p1 = p1 & p0; g3 = g2 & p3 | g3; p3 = p3 & p2; g5 = g4 & p5 | g5; p5 = p5 & p4; g7 = g6 & p7 | g7; p7 = p7 & p6; // up-level 2 g3 = g1 & p3 | g3; p3 = p3 & p1; g7 = g5 & p7 | g7; p7 = p7 & p5; // up-level 3 g7 = g3 & p7 | g7; p7 = p7 & p3; // down-level 5 // down-level 6 g5 = g3 & p5 | g5; p5 = p5 & p3; // down-level 7 g2 = g1 & p2 | g2; p2 = p2 & p1; g4 = g3 & p4 | g4; p4 = p4 & p3; g6 = g5 & p6 | g6; p6 = p6 & p5; // compute final sum digits s[0] = s0 % 256; s[1] = (s1+(g0?1:0)) % 256; s[2] = (s2+(g1?1:0)) % 256; s[3] = (s3+(g2?1:0)) % 256; s[4] = (s4+(g3?1:0)) % 256; s[5] = (s5+(g4?1:0)) % 256; s[6] = (s6+(g5?1:0)) % 256; s[7] = (s7+(g6?1:0)) % 256; s[8] = (g7?1:0); }