![]() ![]() ![]() |
// ************************************************************************** // // // // 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 // // // // ************************************************************************** // // It is known that the division of N-bit radix-2 numbers can be reduced to // // the powering problem, which requires to compute for an N-bit radix-2 number// // x all N^2-bit numbers x^2,x^3,…,x^N. For a proof of the reductions between // // these two problems see [BeCH84,Reif93]. The module implements powering by // // the parallel prefix computation similar to the list ranking problem. Thus, // // it requires O(log(N)) steps which determines the depth, and in total the // // number of multiplications is O(N*log(N)) which determines the work. // // ************************************************************************** // macro N = 8; macro R = exp(2,N); macro R2 = exp(2,N*N); module Powering(nat{R} ?x,[N]nat{R2} p,event !rdy) { for(i=0..N-1) p[i] = x; for(i=0..log(N)-1) { for(j=exp(2,i)..N-1) { next(p[j]) = p[j] * p[j-exp(2,i)]; } pause; } emit(rdy); } drivenby { x = bv2nat(0b10000000); await(rdy); for(i=0..N-1) assert(p[i] == exp(x,i+1)); } drivenby { x = bv2nat(0b11111111); await(rdy); for(i=0..N-1) assert(p[i] == exp(x,i+1)); }

|