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

Subversion Repositories hight

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

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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