hello,can any one explain how to get multiplicative inverse for 4 bit input,i.e,for modulo 17(2^4+1),i have written a code but its not being run ,
number in integer multiplicative inverse\
0 0
1 1
2 9
3 6
4 13
5 7
6 3
7 5
8 15
9 2
10 12
11 14
12 10
13 4
14 11
15 8
at 4b, the best choice will be a lookup table. you can declare that as a constant in VHDL for this size.
Code:
type int_array is array (natural range <>) of integer;
constant MULT_INV : int_array(0 to 15) := (0,1,9,6,13,7,3,5,15,2,12,14,10,4,11,8 );
signal x : integer range 0 to 15;
signal y : integer range 0 to 15;
...
y <= MULT_INV(x);