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/] [testbench/] [test_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
`timescale 1ns / 1ps
18
`define P 20 // clock period
19
 
20
module test_const;
21
 
22
        // Inputs
23
    reg clk;
24
        reg [5:0] addr;
25
 
26
        // Outputs
27
        wire [1007:0] out;
28
        wire effective;
29
    reg [1007:0] w_out;
30
    reg w_effective;
31
 
32
        // Instantiate the Unit Under Test (UUT)
33
        const_ uut (
34
        .clk(clk),
35
                .addr(addr),
36
                .out(out),
37
                .effective(effective)
38
        );
39
 
40
        initial begin
41
                // Initialize Inputs
42
                addr = 0; clk = 0;
43
 
44
                // Wait 100 ns for global reset to finish
45
                #100;
46
 
47
                // Add stimulus here
48
        @ (negedge clk);
49
        addr = 1; w_out = 0; w_effective = 1;
50
        #(`P); check;
51
        addr = 2; w_out = 1;
52
        #(`P); check;
53
        addr = 4; w_out = {6'b000101, 1002'd0};
54
        #(`P); check;
55
        addr = 8; w_out = {6'b001001, 1002'd0};
56
        #(`P); check;
57
        addr = 16; w_out = {6'b010101, 1002'd0};
58
        #(`P); check;
59
        addr = 0; w_out = 0; w_effective = 0;
60
        #(`P); check;
61
        $display("Good");
62
        $finish;
63
        end
64
 
65
    initial #100 forever #(`P/2) clk = ~clk;
66
 
67
    task check;
68
      begin
69
        if (out !== w_out || effective !== w_effective)
70
            $display("E %d %h %h", addr, out, w_out);
71
      end
72
    endtask
73
endmodule

powered by: WebSVN 2.1.0

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