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

Subversion Repositories present_encryptor

[/] [present_encryptor/] [trunk/] [rtl/] [verilog/] [sbox.v] - Blame information for rev 21

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 21 rameli
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@//
2
// Design Name: Present Cipher S-BOX                              //
3
// Module Name: sbox                                              //
4
// Language:    Verilog                                           //
5
// Date Created: 1/16/2011                                        //
6
// Author: Reza Ameli                                             //
7
//         Digital Systems Lab                                    //
8
//         Ferdowsi University of Mashhad, Iran                   //
9
//         http://commeng.um.ac.ir/dslab                          //
10
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@//
11
//                                                                //
12
// This source file may be used and distributed without           //
13
// restriction provided that this copyright statement is not      //
14
// removed from the file and that any derivative work contains    //
15
// the original copyright notice and the associated disclaimer.   //
16
//                                                                //
17
// This source file is free software; you can redistribute it     //
18
// and/or modify it under the terms of the GNU Lesser General     //
19
// Public License as published by the Free Software Foundation;   //
20
// either version 2.1 of the License, or (at your option) any     //
21
// later version.                                                 //
22
//                                                                //
23
// This source is distributed in the hope that it will be         //
24
// useful, but WITHOUT ANY WARRANTY; without even the implied     //
25
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR        //
26
// PURPOSE. See the GNU Lesser General Public License for more    //
27
// details.                                                       //
28
//                                                                //
29
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@//
30
 
31
module sbox (data_o,data_i);
32
 
33
//- Module IOs ----------------------------------------------------------------
34
 
35
output reg [3:0] data_o;
36
input  wire [3:0] data_i;
37
 
38
//- Continuous Assigments------------------------------------------------------
39
 
40
always @(data_i)
41
    case (data_i)
42
        4'h0 : data_o = 4'hC;
43
        4'h1 : data_o = 4'h5;
44
        4'h2 : data_o = 4'h6;
45
        4'h3 : data_o = 4'hB;
46
        4'h4 : data_o = 4'h9;
47
        4'h5 : data_o = 4'h0;
48
        4'h6 : data_o = 4'hA;
49
        4'h7 : data_o = 4'hD;
50
        4'h8 : data_o = 4'h3;
51
        4'h9 : data_o = 4'hE;
52
        4'hA : data_o = 4'hF;
53
        4'hB : data_o = 4'h8;
54
        4'hC : data_o = 4'h4;
55
        4'hD : data_o = 4'h7;
56
        4'hE : data_o = 4'h1;
57
        4'hF : data_o = 4'h2;
58
    endcase
59
 
60
//-----------------------------------------------------------------------------
61
endmodule

powered by: WebSVN 2.1.0

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