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

316    App endix  A


               and the corresponding architecture is
               first_step: modif_csa_multiplier port map(
                 x => x, y => y, clk=> clk, reset => reset, start =>
                 start1, ps => ps, pc => pc, p => p, done => done1
               );
               sum <= ps + pc; mult <= sum & p;
               second_step: mod_p192_reducer port map(x => mult, z => z);

                  The complete model also includes a control unit in charge of the
               done flag generation.
                  The implementation results are the following (Spartan3, speed -5):


                    FFs   LUTs    Slices  Period  Cycles   Total time
                    584   1,828   1,355   5.9     192      1132.8




          A.5 mod p Exponentiation
               The Montgomery method is used. The following values must be
               previously computed:
                          k
                                                                 16
                  exp_k = 2  mod p =  2  mod (2  − 2  − 1) =  2  +  1 =  16  +  1
                                                64
                                                        64
                                           192
                                   192
                                                    32
                                           16
                                                2
                        exp_2k = 2  mod p = (16  + 1)  = 16  + 2 · 16  + 1
                                2k
                                                            16
                  The package storing the parameter values includes the following
               constant definitions:
               constant K: integer := 192;
               --logK is the number of bits of K
               constant logK: integer := 8;
               constant M: std_logic_vector(K-1 downto 0) :=
                 X”fffffffffffffffffffffffffffffffeffffffffffffffff”;
               --minus_m = 2**k - m
               constant minus_M: std_logic_vector(K downto 0) :=
                 ‘0’ & X”000000000000000000000000000000010000000000000
                  001”;
               constant one: std_logic_vector(K-1 downto 0) :=
                 conv_std_logic_vector(1, K);
               --exp_k = 2**k mod m
               constant exp_K: std_logic_vector(K-1 downto 0) :=
                 X”000000000000000000000000000000010000000000000001”;
               --exp_2k = 2**(2*k) mod m
               constant exp_2K: std_logic_vector(K-1 downto 0) :=
                 X”000000000000000100000000000000020000000000000001”;
                  Both the MSB-first and LSB-first algorithms have been implemented
               (Spartan3, speed-5) (Table A.3).
   331   332   333   334   335   336   337   338   339   340   341