OpenCores
URL https://opencores.org/ocsvn/aes-encryption/aes-encryption/trunk

Subversion Repositories aes-encryption

[/] [aes-encryption/] [trunk/] [aes_5cycle_2stage/] [aes_cipher_top.v] - Diff between revs 2 and 3

Show entire file | Details | Blame | View Log

Rev 2 Rev 3
Line 43... Line 43...
 
 
 
 
 
 
`timescale 1 ns/1 ps
`timescale 1 ns/1 ps
 
 
module aes_cipher_top(clk, rst, ld, done, key, text_in, text_out,aes_en);
module aes_cipher_top(clk, rst, ld, done, key, text_in, text_out);
 
 
input           clk, rst;
input           clk, rst;
input           ld;
input           ld;
output          done;
output          done;
input   [127:0]  key;
input   [127:0]  key;
input   [127:0]  text_in;
input   [127:0]  text_in;
output  [127:0]  text_out;
output  [127:0]  text_out;
 
 
input aes_en;
 
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
//
//
// Local Wires
// Local Wires
//
//
 
 
Line 125... Line 125...
//
//
// Misc Logic
// Misc Logic
//
//
 
 
always @(posedge clk)
always @(posedge clk)
if(aes_en)
 
begin
begin
        if(rst) begin dcnt <=  4'h0;     end
        if(~rst)        begin dcnt <=  4'h0;     end
        else
        else
        if(ld)  begin   dcnt <=  4'h6;   end
        if(ld)  begin   dcnt <=  4'h6;   end
        else
        else
        if(|dcnt) begin dcnt <=  dcnt - 4'h1;  end
        if(|dcnt) begin dcnt <=  dcnt - 4'h1;  end
 
 
Line 282... Line 281...
assign sa32_next_round2 = sa32_mc ^ w6[07:00];
assign sa32_next_round2 = sa32_mc ^ w6[07:00];
assign sa33_next_round2 = sa33_mc ^ w7[07:00];
assign sa33_next_round2 = sa33_mc ^ w7[07:00];
 
 
 
 
always @(posedge clk)
always @(posedge clk)
 if(aes_en && ~rst)
 
begin
begin
 
 
         /* $strobe($time,": roundkeyodd = %h, text_out_odd is %h\n",{w0,w1,w2,w3},text_out_temp);
         /* $strobe($time,": roundkeyodd = %h, text_out_odd is %h\n",{w0,w1,w2,w3},text_out_temp);
          $strobe($time,": roundkeyeven is %h\n",{w4,w5,w6,w7});        */
          $strobe($time,": roundkeyeven is %h\n",{w4,w5,w6,w7});        */
          text_out_temp[127:120] <=  sa00_sr ^ w4[31:24];
          text_out_temp[127:120] <=  sa00_sr ^ w4[31:24];
Line 364... Line 362...
// Final text output
// Final text output
//
//
 
 
 
 
always @(posedge clk)
always @(posedge clk)
 if(aes_en && ~rst)
 
 begin
 begin
                /*  $strobe($time,": round_key2 is %h\n",{w4,w5,w6,w7});
                /*  $strobe($time,": round_key2 is %h\n",{w4,w5,w6,w7});
                  $strobe($time,": roundkeyeven = %h, text_out_even is %h\n",{w4,w5,w6,w7},text_out);*/
                  $strobe($time,": roundkeyeven = %h, text_out_even is %h\n",{w4,w5,w6,w7},text_out);*/
                  text_out[127:120] <=  sa00_sr_round2 ^ w0[31:24];
                  text_out[127:120] <=  sa00_sr_round2 ^ w0[31:24];
                  text_out[095:088] <=  sa01_sr_round2 ^ w1[31:24];
                  text_out[095:088] <=  sa01_sr_round2 ^ w1[31:24];
Line 387... Line 384...
                  text_out[039:032] <=  sa32_sr_round2 ^ w2[07:00];
                  text_out[039:032] <=  sa32_sr_round2 ^ w2[07:00];
                  text_out[007:000] <=  sa33_sr_round2 ^ w3[07:00];
                  text_out[007:000] <=  sa33_sr_round2 ^ w3[07:00];
        end
        end
 
 
 
 
always @(posedge clk)
/* -----\/----- EXCLUDED -----\/-----
        begin
always @(posedge clk)
/*      $strobe($time,": text_out_temp is %h\n",text_out_temp);
        begin
 
/-*     $strobe($time,": text_out_temp is %h\n",text_out_temp);
 
 
 
 
*/      /*
*-/     /-*
        $strobe($time,": subbytes is %h\n",{sa00_sub, sa01_sub, sa02_sub, sa03_sub,
        $strobe($time,": subbytes is %h\n",{sa00_sub, sa01_sub, sa02_sub, sa03_sub,
                                                                                                         sa10_sub, sa11_sub, sa12_sub, sa13_sub,
                                                                                                         sa10_sub, sa11_sub, sa12_sub, sa13_sub,
                                                                                                         sa20_sub, sa21_sub, sa22_sub, sa23_sub,
                                                                                                         sa20_sub, sa21_sub, sa22_sub, sa23_sub,
                                                                                                         sa30_sub, sa31_sub, sa32_sub, sa33_sub});
                                                                                                         sa30_sub, sa31_sub, sa32_sub, sa33_sub});
 
 
Line 427... Line 425...
 
 
        $strobe($time,": mixcolumn_e is %h\n",{sa00_mc_round2, sa01_mc_round2, sa02_mc_round2, sa03_mc_round2,
        $strobe($time,": mixcolumn_e is %h\n",{sa00_mc_round2, sa01_mc_round2, sa02_mc_round2, sa03_mc_round2,
                                                                                                          sa10_mc_round2, sa11_mc_round2, sa12_mc_round2, sa13_mc_round2,
                                                                                                          sa10_mc_round2, sa11_mc_round2, sa12_mc_round2, sa13_mc_round2,
                                                                                                          sa20_mc_round2, sa21_mc_round2, sa22_mc_round2, sa23_mc_round2,
                                                                                                          sa20_mc_round2, sa21_mc_round2, sa22_mc_round2, sa23_mc_round2,
                                                                                                          sa30_mc_round2, sa31_mc_round2, sa32_mc_round2, sa33_mc_round2});
                                                                                                          sa30_mc_round2, sa31_mc_round2, sa32_mc_round2, sa33_mc_round2});
        */
        *-/
        end
        end
 
 
 
 
/*
/-*
always @(posedge clk)
always @(posedge clk)
       begin
       begin
                                if(done)
                                if(done)
                                                begin
                                                begin
                                                        text_out_64 <= text_out[127:64];
                                                        text_out_64 <= text_out[127:64];
//                                                      done2 <= 1;
//                                                      done2 <= 1;
                                                end
                                                end
                                else if(~done)
                                else if(~done)
                                                        text_out_64 <= text_out[63:0];
                                                        text_out_64 <= text_out[63:0];
                end
                end
        */
        *-/
 
 
/*
/-*
always @(posedge clk)
always @(posedge clk)
                         begin
                         begin
                                if(done2)
                                if(done2)
                                        begin
                                        begin
                                                text_out_64 <= text_out[63:0];
                                                text_out_64 <= text_out[63:0];
                                        end
                                        end
                 end
                 end
*/
*-/
 
 -----/\----- EXCLUDED -----/\----- */
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
//
//
// Generic Functions
// Generic Functions
//
//
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.