URL
https://opencores.org/ocsvn/ft816float/ft816float/trunk
Subversion Repositories ft816float
[/] [ft816float/] [trunk/] [test_bench/] [DDBCDToBin_tb.sv] - Rev 67
Go to most recent revision | Compare with Previous | Blame | View Log
module DDBCDToBin_tb();reg rst;reg clk;reg [15:0] adr;reg [171:0] bcd;reg [7:0] count;wire [127:0] bin;integer outfile;initial beginrst = 1'b0;clk = 1'b0;adr = 0;bcd = $urandom(1);#20 rst = 1;#50 rst = 0;#10000000 $fclose(outfile);#10 $finish;endalways #5clk = ~clk;genvar g;generate begin : gRandfor (g = 0; g < 172; g = g + 4) beginalways @(posedge clk) beginif (count==2)bcd[g+3:g] <= $urandom() % 10;endendendendgeneratealways @(posedge clk)if (rst) beginadr <= 0;count <= 0;endelsebeginif (adr==0) beginoutfile = $fopen("d:/cores2022/rf6809/rtl/dfpu/test_bench/DDBinToBCD_tvo.txt", "wb");$fwrite(outfile, " ------ bin ------ ------ bcd ------ \n");endcount <= count + 1;if (count > 140)count <= 1'd1;if (adr==2) beginbcd <= 172'h010;endif (adr==3) beginbcd <= 172'h0100;endif (adr==4) beginbcd <= 172'h12345678;endif (count==140) begin$fwrite(outfile, "%h\t%h\n", bin, bcd);adr <= adr + 1;endend//fpMulnr #(64) u1 (clk, 1'b1, a, b, o, rm);//, sign_exe, inf, overflow, underflow);DDBCDToBin #(128) u6 (.rst(rst),.clk(clk),.ld(count==3),.bcd(bcd),.bin(bin));endmodule
Go to most recent revision | Compare with Previous | Blame | View Log
