cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Newbie
Newbie
6,150 Views
Registered: ‎04-29-2011

AES encryption in vhdl

i downloaded the code of aes in vhdl from OpenCores

but there is some code i don't understand

the all codes here
aes_pkg.vhdl
aes_enc.vhd
key_expansion.vhdl
aes_dec.vhd

 

do you know ((v_CALCULATION_CNTR )) abbreviation for what?? and also ((v_TEMP_VECTOR)) and((i_FRW_ADD_RD0))

and also ((FF_VALID_KEY ))
and also ((v_KEY_COL_IN0 )) and (( i_INTERN_ADDR_RD0 ))

if you know plz tell me as they are all signals and i need to understand code very well for my graduation project

 

and i don't understand this code

_________________________________________________________________________________

_________________________________________________________________________________

         -- RAM
         if CE_I = '1' then
            if SRAM_WREN0 = '1' then
               KEY_EXPAN0(i_SRAM_ADDR_WR0) <= v_KEY_COL_IN0;
            end if;
            v_KEY_COL_OUT0  <= KEY_EXPAN0(i_SRAM_ADDR_RD0);
         end if;

         -- Write address
         if RESET_I = '1' then
            i_SRAM_ADDR_WR0 <= 0;
         elsif CE_I = '1' then
            if FF_VALID_KEY = '0' and VALID_KEY_I = '1' then
               i_SRAM_ADDR_WR0 <= 0;
            elsif SRAM_WREN0 = '1' then
               i_SRAM_ADDR_WR0 <= i_SRAM_ADDR_WR0 + 1;
            end if;
         end if;

________________________________________________________________________________

________________________________________________________________________________

and also this

________________________________________________________________________________

         -- Read address
         if RESET_I = '1' then
            i_INTERN_ADDR_RD0 <= 0;
         elsif CE_I = '1' then
            if FF_VALID_KEY = '0' and VALID_KEY_I = '1' then
               i_INTERN_ADDR_RD0 <= 0;
            elsif v_CALCULATION_CNTR = x"07" then
               i_INTERN_ADDR_RD0 <= i_INTERN_ADDR_RD0 + 1;
            elsif v_CALCULATION_CNTR = x"08" then
               i_INTERN_ADDR_RD0 <= i_INTERN_ADDR_RD0 + 1;
            elsif v_CALCULATION_CNTR = x"09" then
               i_INTERN_ADDR_RD0 <= i_INTERN_ADDR_RD0 + 1;
            elsif v_CALCULATION_CNTR = x"0A" then
               i_INTERN_ADDR_RD0 <= i_INTERN_ADDR_RD0 + 1;
            elsif KEY_SIZE = 1 then
               if v_CALCULATION_CNTR = x"0B" then
                  i_INTERN_ADDR_RD0 <= i_INTERN_ADDR_RD0 + 1;
               elsif v_CALCULATION_CNTR = x"0C" then
                  i_INTERN_ADDR_RD0 <= i_INTERN_ADDR_RD0 + 1;
               end if;
            elsif KEY_SIZE = 2 then
               if v_CALCULATION_CNTR = x"10" then
                  i_INTERN_ADDR_RD0 <= i_INTERN_ADDR_RD0 + 1;
               elsif v_CALCULATION_CNTR = x"11" then
                  i_INTERN_ADDR_RD0 <= i_INTERN_ADDR_RD0 + 1;
               elsif v_CALCULATION_CNTR = x"12" then
                  i_INTERN_ADDR_RD0 <= i_INTERN_ADDR_RD0 + 1;
               elsif v_CALCULATION_CNTR = x"13" then
                  i_INTERN_ADDR_RD0 <= i_INTERN_ADDR_RD0 + 1;
               end if;

_______________________________________________________________________________________

plz i need to understand the code any one can help me ?

0 Kudos
2 Replies
Highlighted
Teacher
Teacher
6,137 Views
Registered: ‎08-14-2007

Hi,

maybe you should start with a book like "The Design of Rijndale". ISBN-10: 9783540425809

 

The code snippets you are asking about are mainly about key loading and scheduling.

There are two commonly used methods for that:

 - On the fly calculation

 - single calculation and storing in a small RAM

 

Which one is used in the chosen core?

(besides: the mediafire links are set to private, and so useless for others)

 

Also you should try to find a pattern in the naming convention of that project.

e.g. v_CALCULATION_CNTR

surely means something like Calculation Counter.

The leading v_, i_ etc. may indicate something like variable or input, giving a hint that these names behave not like signals.

 

A simulation should show you what's going on in the design at runtime, thus helping you to understand the code.

 

Have a nice simulation

  Eilert

 

0 Kudos
Highlighted
Visitor
Visitor
5,457 Views
Registered: ‎11-03-2012

i donot know whether it is right or wrong.i am sending a code.please check it and send me the correct one and its block also.

Tags (1)
0 Kudos