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

Subversion Repositories ecg

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

Go to most recent revision | 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
        if (zero3 !== 1) begin $display("E"); $finish; end
52
 
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
            ) begin $display("E"); $finish; end
63
 
64
        // if scalar value is one, then the result is the input point, test case 2
65
        x1 = 194'h2a4290286121261a82446a41200622024988295015114486;
66
        y1 = 194'h16595a61040a8611209820112a1582a081a1a182264601252;
67
        zero1 = 1;
68
        c = 1;
69
        go;
70
        if (zero3 !== 1) begin $display("E"); $finish; end
71
 
72
        // if scalar value is one thousand. test case 1
73
        x1 = 194'h126569286a9860859046680265109015266416aa984082610;
74
        y1 = 194'h2a41880890628944a6844a269258216041061196854181160;
75
        zero1 = 0;
76
        c = 1000;
77
        go;
78
        if (zero3 !== 0 ||
79
            x3 !== 194'h221495405a9425682104a6a005a42a562564469158a962019 ||
80
            y3 !== 194'h1048569408a2846964811161095218005098aa06582419a46
81
            ) begin $display("E"); $finish; end
82
 
83
        // if scalar value is one thousand. test case 2
84
        x1 = 194'h126569286a9860859046680265109015266416aa984082610;
85
        y1 = 194'h2a41880890628944a6844a269258216041061196854181160;
86
        zero1 = 1;
87
        c = 1000;
88
        go;
89
        if (zero3 !== 1) begin $display("E"); $finish; end
90
 
91
        // if scalar value is the order of the generator point, then the result is the inf point
92
        x1 = 194'h288162298554054820552a05426081a1842886a58916a6249;
93
        y1 = 194'h2895955069089214054596a189a4420556589054140941695;
94
        zero1 = 0;
95
        c = 152'd2726865189058261010774960798134976187171462721;
96
        go;
97
        if (zero3 !== 1) begin $display("E"); $finish; end
98
 
99
        // good work, buddy
100
        $display("nice!");
101
        $finish;
102
        end
103
 
104
        always #5 clk = ~clk;
105
 
106
        task go;
107
      begin
108
        @ (negedge clk); reset = 1; @ (negedge clk); reset = 0;
109
        @ (posedge done); #5 ;
110
      end
111
        endtask
112
endmodule
113
 

powered by: WebSVN 2.1.0

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