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

m
                             Operations over  GF (2 )—Polynomial Bases      195

               register_w: process(reset, inic, clk)
               begin
                 if reset = ‘1’ then w <= (others => ‘0’);
                 elsif clk’event and clk = ‘1’ then
                   if inic = ‘1’ then
                     w(0) <= A(0);
                     square: for i in 1 to (M-1)/2 loop
                       w(2*i-1) <= ‘0’; w(2*i) <= A(i);
                     end loop;
                     if M mod 2 = 0 then w(M-1) <= ‘0’; end if;
                   elsif ce_c = ‘1’ then w <= new_w; end if;
                 end if;
               end process register_w;
               z <= w;
               counter: process(reset, clk)
               begin
                 if reset = ‘1’ then count <= 0;
                 elsif clk’ event and clk = ‘1’ then
                   if inic = ‘1’ then count <= 0;
                   elsif shift_r = ‘1’ then count <= count+1; end if;
                 end if;
               end process counter;
               control_unit: process(clk, reset, current_state)
               begin
                 case current_state is
                   when 0 to 1 => inic <= ‘0’; shift_r <=’0’; done <=’1’;
                    ce_c <=’0’;
                   when 2 => inic <= ‘1’; shift_r <= ‘0’; done <= ‘0’;
                    ce_c <= ‘0’;
                   when 3 => inic <= ‘0’; shift_r <= ‘1’; done <= ‘0’;
                    ce_c <= ‘1’;
                 end case;
                 if reset = ‘1’ then current_state <= 0;
                 elsif clk’event and clk = ‘1’ then
                   case current_state is
                  when 0 => if start = ‘0’ then current_state <= 1;
                   end if;
                  when 1 => if start = ‘1’ then current_state <= 2;
                   end if;
                   when 2 => current_state <= 3;
                  when 3 => if count = (M+1)/2-1 then current_state
                   <= 0; end if;
                   end case;
                 end if;
               end process control_unit;


          7.3 Exponentiation
                                                        m
               Let a be a n arbitrary element of a finite field GF(2 ), and e an arbitrary
               positive integer. Then, field exponentiation is defined as the problem
                                         m
                                                                e
               of finding an element b ∈ GF(2 ) so that the equation b = a  holds. In
                                                                 m
               general, an arbitrary integer power of an element a ∈ GF(2 ) can be
   210   211   212   213   214   215   216   217   218   219   220