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

Subversion Repositories tiny_tate_bilinear_pairing

[/] [tiny_tate_bilinear_pairing/] [trunk/] [group_size_is_911_bits/] [rtl/] [const.v] - Blame information for rev 11

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

Line No. Rev Author Line
1 11 homer.hsin
/*
2
    Copyright 2012 Homer Hsing
3
 
4
    This file is part of Tiny Tate Bilinear Pairing Core.
5
 
6
    Tiny Tate Bilinear Pairing Core is free software: you can redistribute it and/or modify
7
    it under the terms of the GNU Lesser General Public License as published by
8
    the Free Software Foundation, either version 3 of the License, or
9
    (at your option) any later version.
10
 
11
    Tiny Tate Bilinear Pairing Core is distributed in the hope that it will be useful,
12
    but WITHOUT ANY WARRANTY; without even the implied warranty of
13
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
    GNU Lesser General Public License for more details.
15
 
16
    You should have received a copy of the GNU Lesser General Public License
17
    along with Tiny Tate Bilinear Pairing Core.  If not, see http://www.gnu.org/licenses/lgpl.txt
18
*/
19
 
20
`define M     593         // M is the degree of the irreducible polynomial
21
`define WIDTH (2*`M-1)    // width for a GF(3^M) element
22
`define WIDTH_D0 1187
23
 
24
/*
25
 * the module of constants
26
 *
27
 * addr  out  effective
28
 *    1   0     1
29
 *    2   1     1
30
 *    4   +     1
31
 *    8   -     1
32
 *   16 cubic   1
33
 * other  0     0
34
 */
35
module const_ (clk, addr, out, effective);
36
    input clk;
37
    input [5:0] addr;
38
    output reg [`WIDTH_D0:0] out;
39
    output reg effective; // active high if out is effective
40
 
41
    always @ (posedge clk)
42
      begin
43
         effective <= 1;
44
         case (addr)
45
            1:  out <= 0;
46
            2:  out <= 1;
47
            4:  out <= {6'b000101, 1182'd0};
48
            8:  out <= {6'b001001, 1182'd0};
49
            16: out <= {6'b010101, 1182'd0};
50
            default:
51
               begin out <= 0; effective <= 0; end
52
         endcase
53
      end
54
endmodule

powered by: WebSVN 2.1.0

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