![]() ![]() ![]() |
// ************************************************************************** // // // // 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 // // // // ************************************************************************** // // The following module implements a basic cell that can be used for the // // construction of multiplier arrays. Due to the types of the arguments, the // // local variable sm is bounded as follows: sm <= (B-1)*(B-1)+(B-1)+(B-1), // // thus sm <= B^2-1 and sm>=(-B)*(B-1)+(B-1)+(B-1) = -(B-2)*(B-1)>-B^2, thus // // sm has type int{B*B}. The carry-out cout is therefore -B,...,B-1. // // ************************************************************************** // macro B = 4; // base of the radix numbers macro alpha(x) = (x<B/2 ? +x : +x-B); macro gamma(y) = (y<0 ? y+B : y); module FullMulInt(int{B} ?x,nat{B} ?y,?pin,int{B} ?cin,!cout,nat{B} !pout) { event int{B*B} sm; sm = x * y + pin + cin; cout = sm / B; pout = sm % B; }

|