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/] [pairing.v] - Blame information for rev 15

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 11 homer.hsin
/*
2 15 homer.hsin
 * 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 11 homer.hsin
 
17
`define M     593         // 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 1187
20
 
21
module pairing(clk, reset, sel, addr, w, update, ready, i, o, done);
22
   input clk;
23
   input reset; // for the arithmethic core
24
   input sel;
25
   input [5:0] addr;
26
   input w;
27
   input update; // update reg_in & reg_out
28
   input ready;  // shift reg_in & reg_out
29
   input i;
30
   output o;
31
   output done;
32
 
33
   reg [`WIDTH_D0:0] reg_in, reg_out;
34
   wire [`WIDTH_D0:0] out;
35
 
36
   assign o = reg_out[0];
37
 
38
   tiny
39
      tiny0 (clk, reset, sel, addr, w, reg_in, out, done);
40
 
41
   always @ (posedge clk) // write LSB firstly
42
      if (update) reg_in <= 0;
43
      else if (ready) reg_in <= {i,reg_in[`WIDTH_D0:1]};
44
 
45
   always @ (posedge clk) // read LSB firstly
46
      if (update) reg_out <= out;
47
      else if (ready) reg_out <= reg_out>>1;
48
endmodule

powered by: WebSVN 2.1.0

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