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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 15 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 3 homer.hsin
`timescale 1ns / 1ps
18
 
19 5 homer.hsin
`define P 20 // clock period
20
 
21 3 homer.hsin
module test_ram;
22
 
23
        // Inputs
24
        reg clk;
25 5 homer.hsin
        reg reset;
26
        reg sel;
27
        reg [5:0] addr;
28
        reg w;
29
        reg [197:0] data;
30 3 homer.hsin
 
31
        // Outputs
32 5 homer.hsin
        wire [197:0] out;
33
        wire done;
34 3 homer.hsin
 
35
        // Instantiate the Unit Under Test (UUT)
36 5 homer.hsin
        tiny uut (
37 3 homer.hsin
                .clk(clk),
38 5 homer.hsin
                .reset(reset),
39
                .sel(sel),
40
                .addr(addr),
41
                .w(w),
42
                .data(data),
43
                .out(out),
44
                .done(done)
45 3 homer.hsin
        );
46
 
47
        initial begin
48
                // Initialize Inputs
49
                clk = 0;
50 5 homer.hsin
                reset = 0;
51
                sel = 0;
52
                addr = 0;
53
                w = 0;
54
                data = 0;
55 3 homer.hsin
 
56
                // Wait 100 ns for global reset to finish
57
                #100;
58
 
59
                // Add stimulus here
60
        @ (negedge clk);
61
 
62 5 homer.hsin
        // write
63
        sel = 1; w = 1;
64
        data = 198'h115a25886512165251569195908560596a6695612620504191;
65
        addr = 0;
66
        #(`P);
67
        data = 198'h1559546442405a181195655549614540592955a15a26984015;
68
        addr = 3;
69
        #(`P);
70
        // not write
71
        w = 0;
72
        data = 198'h12222222222222222222222222222222222222222222222222;
73
        addr = 3;
74
        #(`P);
75
 
76
        // read
77
        sel = 1; w = 0;
78
        addr = 0;
79
        #(`P);
80
        if (out !== 198'h115a25886512165251569195908560596a6695612620504191)
81
            $display("E");
82
 
83
        addr = 3;
84
        #(`P);
85
        if (out !== 198'h1559546442405a181195655549614540592955a15a26984015)
86
            $display("E");
87
 
88
        #(`P);
89
 
90
        $display("Good");
91 3 homer.hsin
        $finish;
92
        end
93 5 homer.hsin
 
94 3 homer.hsin
    initial #100 forever #(`P/2) clk = ~clk;
95
endmodule
96
 

powered by: WebSVN 2.1.0

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