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

Subversion Repositories csa

[/] [csa/] [trunk/] [bench/] [stream_cypher_tb.v] - Blame information for rev 30

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

Line No. Rev Author Line
1 20 simon111
 
2
 
3
// this file is the testbench of stream_cypher module
4
 
5
`timescale 1ns/1ns
6
module stream_cypher_tb;
7
 
8
reg clk;
9
reg rst;
10
 
11
reg en;
12
reg init;
13
 
14
 
15
reg [8*8-1:0] ck;
16
reg [8*8-1:0] sb;
17
 
18
wire [8*8-1:0] cb;
19
 
20
reg [24*8-1:0] tt; // input 
21
 
22
initial
23
begin
24 22 simon111
//        $read_data(
25
//                                "../test_dat/stream_cypher.in"
26
//                               ,tt
27
//                  );
28
        tt=192'b001001110001111100011000000100010000101000000010111110111111010011101101111001101101111011010111110100001100100111000001101110101011001110101100101001001001110110010110100011111000011110000000;
29 20 simon111
        @(posedge rst);
30
        ck =tt[ 24* 8-1: 16* 8];
31
        en=1;
32
        init=1;
33
        sb =tt[ 16*8-1:8* 8];
34
        @(posedge clk);
35
        en=1;
36
        init=0;
37
        sb =tt[ 8*8-1:0* 8];
38 22 simon111
 
39
//        $write_data(
40
//                                 "../test_dat/stream_cypher.out.v"
41
//                                ,"w"
42
//                                ,cb
43
//                   );
44
 
45 20 simon111
        @(posedge clk);
46
        $display("\ncb=%b\n",cb);
47 22 simon111
        $display("b.b.b1.b1.op=%b\n",b.b.b1.b1.op);
48
        $display("b.b.b1.b1.Do=%b\n",b.b.b1.b1.Do);
49
        $display("b.b.b1.b1.Ei=%b\n",b.b.b1.b1.Ei);
50
        $display("b.b.b1.b1.Zi=%b\n",b.b.b1.b1.Zi);
51
        $display("b.b.b1.b1.extra_B=%b\n",b.b.b1.b1.extra_B);
52
        $display("b.b.b1.b2.op=%b\n",b.b.b1.b2.op);
53
        $display("b.b.b1.b3.op=%b\n",b.b.b1.b3.op);
54
        $display("b.b.b1.b4.op=%b\n",b.b.b1.b4.op);
55 20 simon111
 
56 22 simon111
//        $write_data(
57
//                                 "../test_dat/stream_cypher.out.v"
58
//                                ,"a"
59
//                                ,cb
60
//                   );
61 20 simon111
        @(posedge clk);
62
 
63 22 simon111
        $finish;
64 20 simon111
end
65
 
66
initial
67
begin
68
        clk<=1'b0;
69 22 simon111
        forever #5 clk=~clk;
70 20 simon111
end
71
 
72
initial
73
begin
74
        rst<=1'b0;
75
        @(posedge clk);
76
        @(posedge clk);
77
        rst=1'h1;
78
end
79
 
80
stream_cypher b(
81
                 .clk   (clk)
82 29 simon111
                ,.rst   (rst)
83 20 simon111
                ,.en    (en)
84
                ,.init  (init)
85
                ,.ck    (ck)
86
                ,.sb    (sb)
87
                ,.cb    (cb)
88
                );
89
 
90
endmodule

powered by: WebSVN 2.1.0

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