OpenCores
URL https://opencores.org/ocsvn/csa/csa/trunk

Subversion Repositories csa

[/] [csa/] [trunk/] [rtl/] [decrypt.v] - Diff between revs 41 and 42

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 41 Rev 42
Line 32... Line 32...
                , .even_ck    (even_ck)
                , .even_ck    (even_ck)
                , .even_kk    (even_kk)
                , .even_kk    (even_kk)
                );
                );
 
 
wire  ts_valid;
wire  ts_valid;
 
wire  ts_init;
 
wire  ts_head;
 
wire  ts_dec;
 
wire  ts_evenodd;
wire [8*8-1:0]group;
wire [8*8-1:0]group;
wire [3:0] bytes;
wire [3:0] bytes;
 
 
 
 
ts_sync ts_sync(
ts_sync ts_sync(
               . clk      (clk)
               . clk      (clk)
             , . rst      (rst)
             , . rst      (rst)
             , . en       (en)
             , . en       (en)
             , . datain   (encrypted)
             , . datain   (encrypted)
             , . valid    (ts_valid)
             , . valid    (ts_valid)
             , . head     ()
             , . head     (ts_head)
             , . dec      ()
             , . dec      (ts_dec)
             , . evenodd  ()
             , . init     (ts_init)
 
             , . evenodd  (ts_evenodd)
             , . group    (group)
             , . group    (group)
             , . bytes    (bytes)
             , . bytes    (bytes)
        );
        );
 
 
//// word grouper
wire dec_valid;
//reg  [8*8-1:0] group;    // 64bits
wire [8*8-1:0]ogroup;
//reg            sync;     // find sync
wire [  4-1:0]obytes;
//reg  [8-1:0]   ts_cnt;   // ts packet count
group_decrypt group_decrypt(
//reg            using_even_odd_key; // 0 --- using even key; 1 --- using odd key
                          .clk     (clk)
//reg            need_dec;
                        , .rst     (rst)
//reg            group_valid;
                        , .en      (ts_valid)
//reg            group_valid_d;
                        , .dec     (ts_dec)
//reg            head;
                        , .init    (ts_init)
//reg   [5:0]    group_id;
                        , .ck      (ts_evenodd?even_ck:odd_ck)
//reg [4*8-1:0]  group_d;
                        , .kk      (ts_evenodd?even_kk:odd_kk)
//
                        , .group   (group)
//
                        , .bytes   (bytes)
//always @(posedge clk)
                        , .valid   (dec_valid)
//        if (rst)
                        , .ogroup  (ogroup)
//        begin
                        , .obytes  (obytes)
//                group  <= 64'h00000000;
                );
//                sync   <= 1'h0;
 
//                ts_cnt <= 8'h00;
 
//                using_even_odd_key <= 1'h0;
 
//                need_dec <= 1'h0;
 
//                group_valid_d <=1'h0; 
 
//                head <= 1'h0;
 
//        end
 
//        else
 
//        begin
 
//                group_valid <=1'h0;
 
//                group_valid_d <= group_valid;
 
//                head <= 1'h0;
 
//                group_d <= group;
 
//                if(en)
 
//                begin
 
//                        group  <= {  encrypted, group [8*8-1:1*8] };
 
//                        if(sync)
 
//                        begin
 
//                                ts_cnt <= ts_cnt + 8'h01;
 
//                                if(ts_cnt[2:0]==3'h7)
 
//                                begin
 
//                                        group_valid<=1'h1;
 
//                                        group_id<=ts_cnt[7:3];
 
//                                end
 
//                                if(ts_cnt == 8'hb7 ) // 0xb8=188-4
 
//                                begin
 
//                                        sync <= 1'h0;
 
//                                        ts_cnt<=8'h0;
 
//                                end
 
//                        end
 
//                        else
 
//                        begin
 
//                                if(group[5*8-1:4*8]==8'h47)
 
//                                begin
 
//                                        sync   <= 1;
 
//                                        ts_cnt <= 8'h00;
 
//                                        using_even_odd_key <= group[62];
 
//                                        head  <= 1'h1;
 
//                                        group_d <= {1'h0,group[62:32]};
 
//                                end
 
//                        end
 
//                end
 
//        end
 
//
//
//// decrypt
//// decrypt
//reg  [8*8-1:0] db;
//reg  [8*8-1:0] db;
//reg            db_valid;
//reg            db_valid;
//
//
Line 199... Line 163...
//                end
//                end
//
//
//        end
//        end
//end
//end
//
//
//// degrouper
 
//reg [2:0]     cnt;
 
//reg           valid;
 
//reg [7:0]     decrypted;
 
//reg [7*8-1:0] dec_group_ouput;
 
//
 
//always @(posedge clk)
 
//        if(rst)
 
//        begin
 
//                dec_group_ouput <= 32'h00000000;
 
//                cnt <= 2'h0;
 
//        end
 
//        else
 
//        begin
 
//                valid <= 1'h0;
 
//                if(db_valid)
 
//                begin
 
//                        dec_group_ouput <= db[8*8-1:1*8];
 
//                        decrypted <= db[7:0];
 
//                        cnt <= 3'h7;
 
//                        valid <= 1'h1;
 
//                end
 
//                if(cnt)
 
//                begin
 
//                        valid <= 1'h1;
 
//                        dec_group_ouput <= {dec_group_ouput [7:0],dec_group_ouput[7*8-1:1*8]};
 
//                        decrypted <= dec_group_ouput [ 7:0 ];
 
//                        cnt <= cnt - 2'h1;
 
//                end
 
//                if(head)
 
//                begin
 
//                        dec_group_ouput <= group_d[4*8-1:1*8];
 
//                        decrypted <= group_d[7:0];
 
//                        cnt <= 2'h3;
 
//                        valid <= 1'h1;
 
//                end
 
//        end
 
//
 
 
 
 
 
ts_serial_out ts_serial_out(
ts_serial_out ts_serial_out(
                          .clk      (clk)
                          .clk      (clk)
                        , .rst      (rst)
                        , .rst      (rst)
                        , .group    (group)
                        , .group    (ogroup)
                        , .bytes    (bytes)
                        , .bytes    (obytes)
                        , .en       (ts_valid)
                        , .en       (dec_valid)
                        , .dec      (decrypted)
                        , .dec      (decrypted)
                        , .valid    (valid)
                        , .valid    (valid)
                        );
                        );
 
 
 
 

powered by: WebSVN 2.1.0

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