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_697_bits/] [rtl/] [const.v] - Blame information for rev 18

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 18 homer.hsin
/*
2
 * Copyright 2012, Homer Hsing <homer.hsing@gmail.com>
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 * http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
 
17
`define M     503         // M is the degree of the irreducible polynomial
18
`define WIDTH (2*`M-1)    // width for a GF(3^M) element
19
`define WIDTH_D0 (1008-1)
20
 
21
/*
22
 * the module of constants
23
 *
24
 * addr  out  effective
25
 *    1   0     1
26
 *    2   1     1
27
 *    4   +     1
28
 *    8   -     1
29
 *   16 cubic   1
30
 * other  0     0
31
 */
32
module const_ (clk, addr, out, effective);
33
    input clk;
34
    input [5:0] addr;
35
    output reg [`WIDTH_D0:0] out;
36
    output reg effective; // active high if out is effective
37
 
38
    always @ (posedge clk)
39
      begin
40
         effective <= 1;
41
         case (addr)
42
            1:  out <= 0;
43
            2:  out <= 1;
44
            4:  out <= {6'b000101, 1002'd0};
45
            8:  out <= {6'b001001, 1002'd0};
46
            16: out <= {6'b010101, 1002'd0};
47
            default:
48
               begin out <= 0; effective <= 0; end
49
         endcase
50
      end
51
endmodule

powered by: WebSVN 2.1.0

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