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 11

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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