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

Subversion Repositories ft816float

[/] [ft816float/] [trunk/] [test_bench/] [fpAddsub_tb.v] - Blame information for rev 31

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

Line No. Rev Author Line
1 31 robfinch
module fpAddsub_tb();
2
reg rst;
3
reg clk;
4
reg [15:0] adr;
5
reg [103:0] mem [0:38000];
6
reg [103:0] memo [0:38000];
7
reg [391:0] memq [0:38000];
8
reg [391:0] memqo [0:38000];
9
reg [31:0] a,b,a6,b6;
10
reg [127:0] aq, bq;
11
wire [127:0] oq;
12
wire [31:0] a5,b5;
13
wire [31:0] o;
14
reg [3:0] rm, op, rmq, opq;
15
wire [3:0] rm5;
16
wire [3:0] op5;
17
 
18
initial begin
19
        rst = 1'b0;
20
        clk = 1'b0;
21
        adr = 0;
22
        $readmemh("d:/cores6/nvio/v2/rtl/fpUnit/test_bench/fpAddsub_tvs.txt", mem);
23
        $readmemh("d:/cores6/nvio/v2/rtl/fpUnit/test_bench/fpAddsub_tvq.txt", memq);
24
        #20 rst = 1;
25
        #50 rst = 0;
26
end
27
 
28
always #5
29
        clk = ~clk;
30
 
31
delay4 #(32) u3 (clk, 1'b1, a, a5);
32
delay4 #(32) u4 (clk, 1'b1, b, b5);
33
delay4 #(4) u5 (clk, 1'b1, rm, rm5);
34
delay4 #(4) u6 (clk, 1'b1, op, op5);
35
 
36
reg [7:0] count;
37
 
38
always @(posedge clk)
39
if (rst) begin
40
        adr <= 0;
41
        count <= 0;
42
end
43
else
44
begin
45
        count <= count + 1;
46
        if (count==49)
47
                count <= 0;
48
        if (count==2) begin
49
                a <= mem[adr][31: 0];
50
                b <= mem[adr][63:32];
51
                rm <= mem[adr][99:96];
52
                op <= mem[adr][103:100];
53
                aq <= memq[adr][127: 0];
54
                bq <= memq[adr][255:128];
55
                rmq <= memq[adr][387:384];
56
                opq <= memq[adr][391:388];
57
        end
58
        if (count==48) begin
59
                memo[adr] <= {op,rm,o,b,a};
60
                memqo[adr] <= {opq,rmq,oq,bq,aq};
61
                if (adr==8192) begin
62
                        $writememh("d:/cores6/nvio/v2/rtl/fpUnit/test_bench/fpAddsub_tvso.txt", memo);
63
                        $writememh("d:/cores6/nvio/v2/rtl/fpUnit/test_bench/fpAddsub_tvqo.txt", memqo);
64
                        $finish;
65
                end
66
                adr <= adr + 1;
67
        end
68
end
69
 
70
fpAddsubnr #(32) u1 (clk, 1'b1, rm[2:0], op[0], a, b, o);
71
fpAddsubnr #(128) u2 (clk, 1'b1, rm[2:0], op[0], aq, bq, oq);
72
 
73
endmodule

powered by: WebSVN 2.1.0

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