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

Subversion Repositories csa

[/] [csa/] [trunk/] [rtl/] [decrypt.v] - Blame information for rev 52

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 18 simon111
 
2 40 simon111
`include "../bench/timescale.v"
3 18 simon111
// this module will do csa decrypt work
4
 
5 41 simon111
module decrypt(clk,rst,ck,key_en,even_odd,en,encrypted,decrypted,valid);
6 21 simon111
input             clk;
7
input             rst;
8
input             key_en;    // signal high valid,
9
input             even_odd;  // indiate the input ck is even or odd, 0 --- even odd ---odd
10
input             en;        // decrypted
11
input  [8*8-1:0]  ck;        // input ck
12
input  [  8-1:0]  encrypted; // input ts stream
13
output [  8-1:0]  decrypted; // decrypt ts stream
14 41 simon111
output            valid;     // output data is valid
15 20 simon111
 
16 41 simon111
wire [ 8*8-1:0] odd_ck;
17
wire [ 8*8-1:0] even_ck;
18
wire [56*8-1:0] odd_kk;
19
wire [56*8-1:0] even_kk;
20 20 simon111
 
21 41 simon111
 
22 21 simon111
// key register 
23 41 simon111
key_cnt key_cnt(
24
                  .clk        (clk)
25
                , .rst        (rst)
26
                , .en         (key_en)
27
                , .evenodd    (even_odd)
28
                , .ck_in      (ck)
29
                , .busy       ()
30
                , .odd_ck     (odd_ck)
31
                , .odd_kk     (odd_kk)
32
                , .even_ck    (even_ck)
33
                , .even_kk    (even_kk)
34
                );
35 20 simon111
 
36 41 simon111
wire  ts_valid;
37 42 simon111
wire  ts_init;
38
wire  ts_head;
39
wire  ts_dec;
40
wire  ts_evenodd;
41 41 simon111
wire [8*8-1:0]group;
42
wire [3:0] bytes;
43 20 simon111
 
44 42 simon111
 
45 41 simon111
ts_sync ts_sync(
46
               . clk      (clk)
47
             , . rst      (rst)
48
             , . en       (en)
49
             , . datain   (encrypted)
50
             , . valid    (ts_valid)
51 42 simon111
             , . head     (ts_head)
52
             , . dec      (ts_dec)
53
             , . init     (ts_init)
54
             , . evenodd  (ts_evenodd)
55 41 simon111
             , . group    (group)
56
             , . bytes    (bytes)
57
        );
58 20 simon111
 
59 42 simon111
wire dec_valid;
60
wire [8*8-1:0]ogroup;
61
wire [  4-1:0]obytes;
62
group_decrypt group_decrypt(
63
                          .clk     (clk)
64
                        , .rst     (rst)
65
                        , .en      (ts_valid)
66
                        , .dec     (ts_dec)
67
                        , .init    (ts_init)
68
                        , .ck      (ts_evenodd?even_ck:odd_ck)
69
                        , .kk      (ts_evenodd?even_kk:odd_kk)
70
                        , .group   (group)
71
                        , .bytes   (bytes)
72
                        , .valid   (dec_valid)
73
                        , .ogroup  (ogroup)
74
                        , .obytes  (obytes)
75
                );
76
 
77 41 simon111
ts_serial_out ts_serial_out(
78
                          .clk      (clk)
79
                        , .rst      (rst)
80 42 simon111
                        , .group    (ogroup)
81
                        , .bytes    (obytes)
82
                        , .en       (dec_valid)
83 41 simon111
                        , .dec      (decrypted)
84
                        , .valid    (valid)
85 21 simon111
                        );
86
 
87
 
88 18 simon111
endmodule

powered by: WebSVN 2.1.0

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