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

Subversion Repositories ft816float

[/] [ft816float/] [trunk/] [test_bench/] [i2df128_tb.sv] - Blame information for rev 60

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

Line No. Rev Author Line
1 60 robfinch
module i2df128_tb();
2
 
3
reg rst;
4
reg clk;
5
reg [15:0] adr;
6
wire [127:0] flt;
7
reg [7:0] count;
8
 
9
reg [127:0] bin;
10
 
11
integer outfile;
12
 
13
initial begin
14
        rst = 1'b0;
15
        clk = 1'b0;
16
        adr = 0;
17
        bin = $urandom(1);
18
        #20 rst = 1;
19
        #50 rst = 0;
20
        #10000000  $fclose(outfile);
21
        #10 $finish;
22
end
23
 
24
always #5
25
        clk = ~clk;
26
 
27
genvar g;
28
generate begin : gRand
29
        for (g = 0; g < 128; g = g + 4) begin
30
                always @(posedge clk) begin
31
                        if (count==2)
32
                                bin[g+3:g] <= $urandom() % 16;
33
                end
34
        end
35
end
36
endgenerate
37
 
38
always @(posedge clk)
39
if (rst) begin
40
        adr <= 0;
41
        count <= 0;
42
end
43
else
44
begin
45
  if (adr==0) begin
46
    outfile = $fopen("d:/cores2022/rf6809/rtl/dfpu/test_bench/i2df128_tvo.txt", "wb");
47
    $fwrite(outfile, "s ------ bin ------  ------ flt ------  \n");
48
  end
49
        count <= count + 1;
50
        if (count > 140)
51
                count <= 1'd1;
52
        if (adr==2) begin
53
                bin <= 128'h0A;
54
        end
55
        if (adr==3) begin
56
                bin <= 128'd100;
57
        end
58
        if (adr==5) begin
59
                bin <= 128'd12345678;
60
        end
61
        if (count==140) begin
62
        $fwrite(outfile, "%c %h\t%h\n", adr[11] ? "s" : "u", bin, flt);
63
                adr <= adr + 1;
64
        end
65
end
66
 
67
i2df128 u6 (
68
        .rst(rst),
69
  .clk(clk),
70
  .ce(1'b1),
71
  .op(adr[11]),
72
  .rm(3'd0),
73
  .ld(count==3),
74
  .i(bin),
75
  .o(flt),
76
  .done()
77
);
78
 
79
endmodule

powered by: WebSVN 2.1.0

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