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

powered by: WebSVN 2.1.0

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