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

Subversion Repositories ecg

[/] [ecg/] [trunk/] [testbench/] [test_point_scalar_mult.v] - Blame information for rev 13

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 6 homer.xing
`timescale 1ns / 1ps
2
`include "../rtl/inc.v"
3
 
4
module test_point_scalar_mult;
5
 
6
        // Inputs
7
        reg clk;
8
        reg reset;
9
        reg [`WIDTH:0] x1, y1;
10
        reg zero1;
11
    reg [`SCALAR_WIDTH:0] c;
12
 
13
        // Outputs
14
        wire done;
15
        wire zero3;
16
    wire [`WIDTH:0] x3, y3;
17
 
18
        // Instantiate the Unit Under Test (UUT)
19
        point_scalar_mult uut (
20
                .clk(clk),
21
                .reset(reset),
22
                .x1(x1),
23
                .y1(y1),
24
                .zero1(zero1),
25
                .c(c),
26
                .done(done),
27
                .x3(x3),
28
                .y3(y3),
29
                .zero3(zero3)
30
        );
31
 
32
    initial begin
33
                // Initialize Inputs
34
                clk = 0;
35
                reset = 0;
36
                x1 = 0;
37
                y1 = 0;
38
                zero1 = 0;
39
                c = 0;
40
 
41
                // Wait 100 ns for global reset to finish
42
                #100;
43
 
44
                // Add stimulus here
45
        // if scalar value is zero, then the result is inf point
46
        x1 = 194'h2a4290286121261a82446a41200622024988295015114486;
47
        y1 = 194'h16595a61040a8611209820112a1582a081a1a182264601252;
48
        zero1 = 0;
49
        c = 0;
50
        go;
51 11 homer.xing
        if (zero3 !== 1) begin $display("E"); $finish; end else $display(":D");
52 6 homer.xing
 
53
        // if scalar value is one, then the result is the input point, test case 1
54
        x1 = 194'h2a4290286121261a82446a41200622024988295015114486;
55
        y1 = 194'h16595a61040a8611209820112a1582a081a1a182264601252;
56
        zero1 = 0;
57
        c = 1;
58
        go;
59
        if (zero3 !== 0 ||
60
            x3 !== 194'h2a4290286121261a82446a41200622024988295015114486 ||
61
            y3 !== 194'h16595a61040a8611209820112a1582a081a1a182264601252
62 11 homer.xing
            ) begin $display("E"); $finish; end
63
        else $display(":D");
64 6 homer.xing
 
65
        // if scalar value is one, then the result is the input point, test case 2
66
        x1 = 194'h2a4290286121261a82446a41200622024988295015114486;
67
        y1 = 194'h16595a61040a8611209820112a1582a081a1a182264601252;
68
        zero1 = 1;
69
        c = 1;
70
        go;
71
        if (zero3 !== 1) begin $display("E"); $finish; end
72 11 homer.xing
        else $display(":D");
73 6 homer.xing
 
74
        // if scalar value is one thousand. test case 1
75
        x1 = 194'h126569286a9860859046680265109015266416aa984082610;
76
        y1 = 194'h2a41880890628944a6844a269258216041061196854181160;
77
        zero1 = 0;
78
        c = 1000;
79
        go;
80
        if (zero3 !== 0 ||
81
            x3 !== 194'h221495405a9425682104a6a005a42a562564469158a962019 ||
82
            y3 !== 194'h1048569408a2846964811161095218005098aa06582419a46
83
            ) begin $display("E"); $finish; end
84 11 homer.xing
        else $display(":D");
85 6 homer.xing
 
86
        // if scalar value is one thousand. test case 2
87
        x1 = 194'h126569286a9860859046680265109015266416aa984082610;
88
        y1 = 194'h2a41880890628944a6844a269258216041061196854181160;
89
        zero1 = 1;
90
        c = 1000;
91
        go;
92
        if (zero3 !== 1) begin $display("E"); $finish; end
93 11 homer.xing
        else $display(":D");
94 6 homer.xing
 
95 13 homer.xing
        // if scalar value is the order of the generator point, then the result is the inf point
96 6 homer.xing
        x1 = 194'h288162298554054820552a05426081a1842886a58916a6249;
97
        y1 = 194'h2895955069089214054596a189a4420556589054140941695;
98
        zero1 = 0;
99
        c = 152'd2726865189058261010774960798134976187171462721;
100
        go;
101 11 homer.xing
        if (zero3 !== 1) begin $display("E"); $finish; end
102 13 homer.xing
        else $display(":D");
103 6 homer.xing
 
104
        // good work, buddy
105
        $display("nice!");
106
        $finish;
107
        end
108
 
109
        always #5 clk = ~clk;
110
 
111
        task go;
112
      begin
113
        @ (negedge clk); reset = 1; @ (negedge clk); reset = 0;
114
        @ (posedge done); #5 ;
115
      end
116
        endtask
117
endmodule
118
 

powered by: WebSVN 2.1.0

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