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

Subversion Repositories verilog_fixed_point_math_library

[/] [verilog_fixed_point_math_library/] [trunk/] [TestDiv.v] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 tomburkeii
`timescale 1ns / 1ps
2
 
3
////////////////////////////////////////////////////////////////////////////////
4
// Company: 
5
// Engineer:
6
//
7
// Create Date:   18:48:08 12/29/2013
8
// Design Name:   qdiv
9
// Module Name:   G:/Tran3005/TestDiv.v
10
// Project Name:  Trancendental
11
// Target Device:  
12
// Tool versions:  
13
// Description: 
14
//
15
// Verilog Test Fixture created by ISE for module: qdiv
16
//
17
// Dependencies:
18
// 
19
// Revision:
20
// Revision 0.01 - File Created
21
// Additional Comments:
22
// 
23
////////////////////////////////////////////////////////////////////////////////
24
 
25
module TestDiv;
26
 
27
        // Inputs
28
        reg [31:0] i_dividend;
29
        reg [31:0] i_divisor;
30
        reg i_start;
31
        reg i_clk;
32
 
33
        // Outputs
34
        wire [31:0] o_quotient_out;
35
        wire o_complete;
36
        wire o_overflow;
37
 
38
        // Instantiate the Unit Under Test (UUT)
39
        qdiv uut (
40
                .i_dividend(i_dividend),
41
                .i_divisor(i_divisor),
42
                .i_start(i_start),
43
                .i_clk(i_clk),
44
                .o_quotient_out(o_quotient_out),
45
                .o_complete(o_complete),
46
                .o_overflow(o_overflow)
47
        );
48
 
49
        reg [10:0]       count;
50
 
51
        initial begin
52
                // Initialize Inputs
53
                i_dividend = 1;
54
                i_divisor = 1;
55
                i_start = 0;
56
                i_clk = 0;
57
 
58
                count <= 0;
59
 
60
                // Wait 100 ns for global reset to finish
61
                #100;
62
 
63
                // Add stimulus here
64
                forever #2 i_clk = ~i_clk;
65
        end
66
 
67
                always @(posedge i_clk) begin
68
                        if (count == 47) begin
69
                                count <= 0;
70
                                i_start <= 1'b1;
71
                                end
72
                        else begin
73
                                count <= count + 1;
74
                                i_start <= 1'b0;
75
                                end
76
                        end
77
 
78
                always @(count) begin
79
                        if (count == 47) begin
80
                                if ( i_divisor > 32'h1FFFFFFF ) begin
81
                                        i_divisor <= 1;
82
                                        i_dividend = (i_dividend << 1) + 3;
83
                                        end
84
                                else
85
                                        i_divisor = (i_divisor << 1) + 1;
86
                                end
87
                        end
88
 
89
        always @(posedge o_complete)
90
                $display ("%b,%b,%b, %b", i_dividend, i_divisor, o_quotient_out, o_overflow);           //      Monitor the stuff we care about
91
 
92
endmodule
93
 

powered by: WebSVN 2.1.0

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