Community
cancel
Showing results for 
Search instead for 
Did you mean: 
CLyna
Beginner
444 Views

Issue with algorithm

I have been working on a version of the AES encryption algorithm, but the output waves are not matching up to what they should be i have included screenshot of the wave an the code, any help would be great as i have been stuck on this for a while the three modules byte substitution, row shifting and mixed columns are working correctly the issue seems to be lying with the state machine and key generator module. should i leave the load at one constantly? if i do it gives ten rounds out which is correct. But if i have it as a pulse it gives 40 outputs i am confused the code seems correct but it isn't functioning as so? Any help would be great. I have included a pdf with the codeoutputdiagram.PNG

0 Kudos
4 Replies
CLyna
Beginner
82 Views

ControllingStateMachine: process(CLOCK) begin if rising_edge(CLOCK) then --sets the round value to 11 so it will reset the counter. if RESET = '1' then RoundNum <= x"a" & "01"; else --if it is round eleven then reset the round counter. if RoundNum = (x"a" & "01") then if LOAD = '1' then RoundNum <= "000000"; end if; --if the round number is not equal 11 then increment the counter elsif RoundNum /= (x"a" & "01") then RoundNum <= RoundNum + '1'; end if; end if; end if; end process; --Good shows when the 10th round has been iterated by the value 1 else it shows a 0. GOOD <= '1' when RoundNum = x"a" & "00" else '0'; --Complete shows the value 1 after the 10th round is complete Complete <= '1' when RoundNum = x"a" & "01" else '0';

 

sstrell
Honored Contributor II
82 Views

Just looking at your code, you have an if check on LOAD equal to 1 but you don't specify what to do if LOAD equals 0. That's going to create a latch and could be the cause of your issues.

 

You always want to have a final "else" clause to cover all cases.

 

#iwork4intel

CLyna
Beginner
82 Views

IF i leave load on one will it constantly stay on round one? I want it to stay on one but to then jump from that if statement and continue the round count? i have an endif straight after?

82 Views

Hi,

 

Have you try sstrell's suggestion?

 

Thanks.

Reply