URL
https://opencores.org/ocsvn/pairing/pairing/trunk
Subversion Repositories pairing
Compare Revisions
- This comparison shows the changes necessary to convert path
/
- from Rev 9 to Rev 10
- ↔ Reverse comparison
Rev 9 → Rev 10
/pairing/trunk/testbench/test_tate_pairing.v
7,13 → 7,10
reg clk; |
reg reset; |
reg [`WIDTH:0] x1, y1, x2, y2; |
reg [2:0] sel; |
reg [7:0] sel; |
reg [149:0] o0,o1,o2,o3,o4,o5,o6,o7; |
reg [`W6:0] wish; |
wire [`W6:0] o; |
|
assign o = {o7[113:0],o6,o5,o4,o3,o2,o1,o0}; |
|
// Outputs |
wire done; |
wire [149:0] out; |
61,15 → 58,15
@ (negedge clk); reset = 1; |
@ (negedge clk); reset = 0; |
@ (posedge done); @ (negedge clk); |
sel = 0; #20; o0=out; |
sel = 1; #20; o1=out; |
sel = 2; #20; o2=out; |
sel = 3; #20; o3=out; |
sel = 4; #20; o4=out; |
sel = 5; #20; o5=out; |
sel = 6; #20; o6=out; |
sel = 7; #20; o7=out; |
if (o !== wish) $display("E"); |
sel = 8'b0000_0001; #20; o0=out; |
sel = 8'b0000_0010; #20; o1=out; |
sel = 8'b0000_0100; #20; o2=out; |
sel = 8'b0000_1000; #20; o3=out; |
sel = 8'b0001_0000; #20; o4=out; |
sel = 8'b0010_0000; #20; o5=out; |
sel = 8'b0100_0000; #20; o6=out; |
sel = 8'b1000_0000; #20; o7=out; |
if ({o7[113:0],o6,o5,o4,o3,o2,o1,o0} !== wish) begin $display("E"); end |
$finish; |
end |
|
/pairing/trunk/rtl/f36m.v
21,6 → 21,7
wire [`W2:0] in0, in1; |
wire [`W2:0] o; |
reg mult_reset, delay1, delay2; |
reg [`W2:0] in0d,in1d; |
|
assign {e0,e1,e2,e3,e4,e5} = K[6:1]; |
assign {a2,a1,a0} = a; |
33,7 → 34,7
ins1 (a2,v1,a1,v3,v5,a0,e0,e1,e2,e3,e4,e5,in0), // $in0$ is the first input |
ins2 (b2,v2,b1,v4,v6,b0,e0,e1,e2,e3,e4,e5,in1); // $in1$ is the second input |
f32m_mult |
ins3 (clk, mult_reset, in0, in1, o, mult_done); // o == in0 * in1 |
ins3 (clk, mult_reset, in0d, in1d, o, mult_done); // o == in0 * in1 |
func6 |
ins4 (clk, reset, mult_done, p); |
f32m_add |
58,6 → 59,11
|
always @ (posedge clk) |
begin |
in0d <= in0; in1d <= in1; |
end |
|
always @ (posedge clk) |
begin |
if (reset) K <= 7'b1000000; |
else if (p | K[0]) K <= {1'b0,K[6:1]}; |
end |
/pairing/trunk/rtl/tate_pairing.v
90,7 → 90,7
module tate_pairing(clk, reset, x1, y1, x2, y2, done, sel, out); |
input clk, reset; |
input [`WIDTH:0] x1, y1, x2, y2; |
input [2:0] sel; |
input [7:0] sel; |
output reg done; |
output reg [149:0] out; |
|
127,15 → 127,13
else if (K[0]) begin done <= 1; o <= out2; end |
|
always @ (o, sel) |
case (sel) |
3'd0: out = o[150-1:0]; |
3'd1: out = o[300-1:150]; |
3'd2: out = o[450-1:300]; |
3'd3: out = o[600-1:450]; |
3'd4: out = o[750-1:600]; |
3'd5: out = o[900-1:750]; |
3'd6: out = o[1050-1:900]; |
3'd7: out = o[`W6-1:1050]; |
default: out = 0; |
endcase |
out = (sel[0] ? o[150-1:0] : 0) | |
(sel[1] ? o[300-1:150] : 0) | |
(sel[2] ? o[450-1:300] : 0) | |
(sel[3] ? o[600-1:450] : 0) | |
(sel[4] ? o[750-1:600] : 0) | |
(sel[5] ? o[900-1:750] : 0) | |
(sel[6] ? o[1050-1:900] : 0) | |
(sel[7] ? o[`W6-1:1050] : 0) ; |
|
endmodule |