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

Subversion Repositories hight

[/] [hight/] [trunk/] [rtl/] [WKG.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 truemind
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  Whitening key generator of key scheduler                    ////
4
////  for HIGHT Crypto Core                                       ////
5
////                                                              ////
6
////  This file is part of the HIGHT Crypto Core project          ////
7
////  http://github.com/OpenSoCPlus/hight_crypto_core             ////
8
////  http://www.opencores.org/project,hight                      ////
9
////                                                              ////
10
////  Description                                                 ////
11
////  __description__                                             ////
12
////                                                              ////
13
////  Author(s):                                                  ////
14
////      - JoonSoo Ha, json.ha@gmail.com                         ////
15
////      - Younjoo Kim, younjookim.kr@gmail.com                  ////
16
////                                                              ////
17
//////////////////////////////////////////////////////////////////////
18
////                                                              ////
19
//// Copyright (C) 2015 Authors, OpenSoCPlus and OPENCORES.ORG    ////
20
////                                                              ////
21
//// This source file may be used and distributed without         ////
22
//// restriction provided that this copyright statement is not    ////
23
//// removed from the file and that any derivative work contains  ////
24
//// the original copyright notice and the associated disclaimer. ////
25
////                                                              ////
26
//// This source file is free software; you can redistribute it   ////
27
//// and/or modify it under the terms of the GNU Lesser General   ////
28
//// Public License as published by the Free Software Foundation; ////
29
//// either version 2.1 of the License, or (at your option) any   ////
30
//// later version.                                               ////
31
////                                                              ////
32
//// This source is distributed in the hope that it will be       ////
33
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
34
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
35
//// PURPOSE.  See the GNU Lesser General Public License for more ////
36
//// details.                                                     ////
37
////                                                              ////
38
//// You should have received a copy of the GNU Lesser General    ////
39
//// Public License along with this source; if not, download it   ////
40
//// from http://www.opencores.org/lgpl.shtml                     ////
41
////                                                              ////
42
//////////////////////////////////////////////////////////////////////
43
 
44
module WKG(
45
        i_op          ,
46
 
47
        i_wf_post_pre ,
48
 
49
        i_mk3to0      ,
50
        i_mk15to12    ,
51
 
52
        o_wk3_7       ,
53
        o_wk2_6       ,
54
        o_wk1_5       ,
55
        o_wk0_4
56
);
57
 
58
 
59
//=====================================
60
//
61
//          PARAMETERS 
62
//
63
//=====================================
64
 
65
 
66
//=====================================
67
//
68
//          I/O PORTS 
69
//
70
//=====================================
71
input       i_op          ;
72
 
73
input       i_wf_post_pre ;
74
 
75
input[31:0] i_mk3to0      ;
76
input[31:0] i_mk15to12    ;
77
 
78
output[7:0] o_wk3_7       ;
79
output[7:0] o_wk2_6       ;
80
output[7:0] o_wk1_5       ;
81
output[7:0] o_wk0_4       ;
82
 
83
 
84
//=====================================
85
//
86
//          REGISTERS
87
//
88
//=====================================
89
 
90
 
91
//=====================================
92
//
93
//          WIRES
94
//
95
//=====================================
96
wire        w_out_sel;
97
 
98
 
99
//=====================================
100
//
101
//          MAIN
102
//
103
//=====================================
104
// w_out_sel
105
assign      w_out_sel = i_op ^ i_wf_post_pre; // 0 if 2 signals have same value
106
                                              // 1 if 2 signals hava different value
107
 
108
// o_wk3_7
109
assign      o_wk3_7 = (~w_out_sel) ? i_mk15to12[31:24] : // w_out_sel == 0
110
                                     i_mk3to0[31:24]   ; // w_out_sel == 1 
111
// o_wk2_6
112
assign      o_wk2_6 = (~w_out_sel) ? i_mk15to12[23:16] : // w_out_sel == 0
113
                                     i_mk3to0[23:16]   ; // w_out_sel == 1 
114
// o_wk1_5
115
assign      o_wk1_5 = (~w_out_sel) ? i_mk15to12[15:8]  : // w_out_sel == 0
116
                                     i_mk3to0[15:8]    ; // w_out_sel == 1  
117
// o_wk0_4
118
assign      o_wk0_4 = (~w_out_sel) ? i_mk15to12[7:0]   : // w_out_sel == 0
119
                                     i_mk3to0[7:0]     ; // w_out_sel == 1  
120
 
121
endmodule
122
 
123
 
124
 
125
 
126
 
127
 
128
 
129
 

powered by: WebSVN 2.1.0

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