Page 344 - Hardware Implementation of Finite-Field Arithmetic
P. 344

324    App endix  B


                                LUTs   Slices  Total time
                                97     49      9



               B.2.4 mod p Multiplication
               The double, add, and reduce algorithm, with stored-carry encoding
               (Eq 3.10), is used. The package storing the parameter values is the
               following:

               package dar_csa_multiplier_parameters is
                  constant k: integer := 32;
                  --logk is the number of bits of k-1
                  constant logk: integer := 5;
                  constant m: std_logic_vector(k+1 downto 0) :=
                      “00” & X”fffffe7d”;
                  --minus_m = 2**(k+2) - m
                  constant minus_m: std_logic_vector(k+1 downto 0) :=
                      “11” & X”00000183”;
               end dar_csa_multiplier_parameters;

                  Some kind of synchronization of the final operations should be
               introduced.



                    FFs    LUTs  Slices  Period  Cycles   Total time
                    109    322   167     6.1     64       390.4


               B.2.5 mod p Division
               The plus-minus algorithm is used. The following values are previously
               computed:

                                    34
                 minus_p = 2 k +  2  − p = 2 − (2 − 387) = 3.2 + 387 = [300000183]
                                                   32
                                        32
                                                                     16
                         two_p = 2p = 2[FFFFFE7D] = [1FFFFFCFA]
                                               16            16
                  In this case, p mod 4 = 1 (the least significant bits of p are 01) so
                                                   −1
               that Eq. (4.28) is used for computing  w4  mod  p. The parameter
               values are the following:
               constant K: natural := 32;
               constant     P:    std_logic_vector(K        downto    0)
                 := ‘0’&X”fffffe7d”;
               --LOGK+1 bits for representing integers between -k and k
               constant LOGK: natural := 6;
               constant MINUS_P: std_logic_vector(K+1 downto 0)
                 := (‘1’ & not P) + ‘1’;
               constant TWO_P: std_logic_vector(K+1 downto 0) := P & ‘0’;
   339   340   341   342   343   344   345   346   347   348   349