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

Subversion Repositories ft816float

[/] [ft816float/] [trunk/] [test_bench/] [fpFMA_tb.v] - Diff between revs 23 and 32

Show entire file | Details | Blame | View Log

Rev 23 Rev 32
Line 35... Line 35...
// ============================================================================
// ============================================================================
 
 
module fpFMA_tb();
module fpFMA_tb();
reg rst;
reg rst;
reg clk;
reg clk;
reg [12:0] adr;
reg [15:0] adr;
reg [127:0] mem [0:8191];
reg [131:0] mems [0:24000];
reg [127:0] memo [0:9000];
reg [131:0] memso [0:24000];
reg [255:0] memd [0:8191];
reg [259:0] memd [0:24000];
reg [255:0] memdo [0:9000];
reg [259:0] memdo [0:24000];
 
reg [515:0] memq [0:24000];
 
reg [515:0] memqo [0:24000];
reg [31:0] a,b,c;
reg [31:0] a,b,c;
wire [31:0] a5,b5,c5;
reg [3:0] rm, rmd, rmq;
wire [31:0] o;
wire [31:0] o;
reg [63:0] ad,bd,cd;
reg [63:0] ad,bd,cd;
wire [63:0] ad5,bd5,cd5,ad17,bd17,cd17;
 
wire [63:0] od;
wire [63:0] od;
reg [4:0] cnt;
reg [127:0] aq,bq,cq;
 
wire [127:0] oq;
 
reg [7:0] cnt;
 
 
initial begin
initial begin
        rst = 1'b0;
        rst = 1'b0;
        clk = 1'b0;
        clk = 1'b0;
        adr = 0;
        adr = 0;
        cnt = 0;
        cnt = 0;
//      $readmemh("d:/cores6/rtfItanium/v1/rtl/fpUnit/test_bench/fpFMA_tv.txt", mem);
        $readmemh("d:/cores6/nvio/v2/rtl/fpUnit/test_bench/fpFMA_tvs.txt", mems);
        $readmemh("d:/cores6/rtfItanium/v1/rtl/fpUnit/test_bench/fpFMA_tvd.txt", memd);
        $readmemh("d:/cores6/nvio/v2/rtl/fpUnit/test_bench/fpFMA_tvd.txt", memd);
 
        $readmemh("d:/cores6/nvio/v2/rtl/fpUnit/test_bench/fpFMA_tvq.txt", memq);
        #20 rst = 1;
        #20 rst = 1;
        #50 rst = 0;
        #50 rst = 0;
end
end
 
 
always #5
always #5
        clk = ~clk;
        clk = ~clk;
 
 
delay5 #(32) u2 (clk, 1'b1, a, a5);
 
delay5 #(32) u3 (clk, 1'b1, b, b5);
 
delay5 #(32) u4 (clk, 1'b1, c, c5);
 
delay5 #(64) u5 (clk, 1'b1, ad, ad5);
 
delay5 #(64) u6 (clk, 1'b1, bd, bd5);
 
delay5 #(64) u7 (clk, 1'b1, cd, cd5);
 
vtdl #(64,32) u8 (clk, 1'b1, 5'd16, ad, ad17);
 
vtdl #(64,32) u9 (clk, 1'b1, 5'd16, bd, bd17);
 
vtdl #(64,32) u10 (clk, 1'b1, 5'd16, cd, cd17);
 
 
 
always @(posedge clk)
 
        cnt <= cnt + 1;
 
 
 
always @(posedge clk)
always @(posedge clk)
if (rst)
if (rst) begin
        adr = 0;
        adr <= 0;
else
        cnt <= 0;
 
end else
begin
begin
        if (cnt==1)
        cnt <= cnt + 1;
 
        if (cnt==54)
 
                cnt <= 0;
 
        if (cnt==4)
        begin
        begin
                a <= mem[adr][31: 0];
                a <= mems[adr][31: 0];
                b <= mem[adr][63:32];
                b <= mems[adr][63:32];
                c <= mem[adr][95:64];
                c <= mems[adr][95:64];
 
                rm <= mems[adr][131:128];
                ad <= memd[adr][63: 0];
                ad <= memd[adr][63: 0];
                bd <= memd[adr][127:64];
                bd <= memd[adr][127:64];
                cd <= memd[adr][191:128];
                cd <= memd[adr][191:128];
 
                rmd <= memd[adr][259:256];
 
                aq <= memq[adr][127: 0];
 
                bq <= memq[adr][255:128];
 
                cq <= memq[adr][383:256];
 
                rmq <= memq[adr][515:512];
        end
        end
        if (cnt==31)
        if (cnt==53)
        begin
        begin
                adr <= adr + 1;
                adr <= adr + 1;
//              memo[adr] <= {o,c17,b17,a17};
                memso[adr] <= {rm,o,c,b,a};
//              memdo[adr] <= {od,cd17,bd17,ad17};
                memdo[adr] <= {rmd,od,cd,bd,ad};
                memdo[adr] <= {od,cd,bd,ad};
                memqo[adr] <= {rmq,oq,cq,bq,aq};
 
                //memdo[adr] <= {rmd,od,cdx,bdx,adx};
                if (adr==8191) begin
                if (adr==8191) begin
                        //$writememh("d:/cores6/rtfItanium/v1/rtl/fpUnit/test_bench/fpFMA_tvo.txt", memo);
                        $writememh("d:/cores6/nvio/v2/rtl/fpUnit/test_bench/fpFMA_tvso.txt", memso);
                        $writememh("d:/cores6/rtfItanium/v1/rtl/fpUnit/test_bench/fpFMA_tvdo.txt", memdo);
                        $writememh("d:/cores6/nvio/v2/rtl/fpUnit/test_bench/fpFMA_tvdo.txt", memdo);
 
                        $writememh("d:/cores6/nvio/v2/rtl/fpUnit/test_bench/fpFMA_tvqo.txt", memqo);
                        $finish;
                        $finish;
                end
                end
        end
        end
end
end
 
 
//fpFMAnr #(32) u1 (clk, 1'b1, a, b, o, 3'b000);//, sign_exe, inf, overflow, underflow);
fpFMAnr #(32) u1 (clk, 1'b1, 1'b0, rm[2:0], c, b, a, o);//, sign_exe, inf, overflow, underflow);
fpFMAnr #(64) u11 (clk, 1'b1, 1'b0, 3'b000, ad, bd, cd, od);//, sign_exe, inf, overflow, underflow);
fpFMAnr #(64) u16 (clk, 1'b1, 1'b0, rmd[2:0], ad, bd, cd, od);//, sign_exe, inf, overflow, underflow);
 
fpFMAnr #(128) u17 (clk, 1'b1, 1'b0, rmq[2:0], cq, bq, aq, oq);//, sign_exe, inf, overflow, underflow);
 
//fpFMAnr #(64) u15 (clk, 1'b1, 1'b0, rmd[2:0], ad, bd, cd, od);//, inf, overflow, underflow, inexact);
 
 
endmodule
endmodule
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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