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

Subversion Repositories ft816float

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

powered by: WebSVN 2.1.0

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