Page 272 - Hardware Implementation of Finite-Field Arithmetic
P. 272
252 Cha pte r Ei g h t
begin
if reset = ‘1’ then cc <= (others => ‘0’);
elsif clk’event and clk = ‘1’ then
if inic = ‘1’ then
cc <= a;
else
cc <= sq_c;
end if;
end if;
end process register_C;
sh_register_E: process(clk)
begin
if reset = ‘1’ then ee <= (others => ‘0’);
elsif clk’event and clk = ‘1’ then
if inic = ‘1’ then
ee <= e;
end if;
if shift_r = ‘1’ then
ee <= ‘0’ & ee(M-1 downto 1);
end if;
end if;
end process sh_register_E;
register_B: process(inic, clk)
begin
if inic = ‘1’ or reset = ‘1’ then bb <= (others => ‘1’);
elsif clk’event and clk = ‘1’ then
if ce_c = ‘1’ and ee(0) = ‘1’ then
bb <= mult_bc;
else
bb <= bb;
end if;
end if;
end process register_B;
-- Squaring operation:
sq_c(0) <= cc(M-1);
sq_c_calc: for i in 1 to M-1 generate
sq_c(i) <= cc(i-1);
end generate;
--
b <= bb;
The complete model additionally includes a counter and a con-
trol unit.
The above binary method has an obvious generalization: Use a
base larger than two ([BGMW92], [Gor98]). In such a case, let
l
e = ∑ rm i (8.35)
i
i=0
e
The m-ary method for exponentiation computes a using Eq. (8.35)
by means of the following algorithm: