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/] [Test_add.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:   15:35:03 06/30/2013
8
// Design Name:   qadd
9
// Module Name:   I:/Projects/xilinx/FPInterface/Tester/Tran3005/Tes_add.v
10
// Project Name:  Trancendental
11
// Target Device:  
12
// Tool versions:  
13
// Description: 
14
//
15
// Verilog Test Fixture created by ISE for module: qadd
16
//
17
// Dependencies:
18
// 
19
// Revision:
20
// Revision 0.01 - File Created
21
// Additional Comments:
22
// 
23
////////////////////////////////////////////////////////////////////////////////
24
 
25
module Test_add;
26
 
27
        // Inputs
28
        reg [31:0] a;
29
        reg [31:0] b;
30
 
31
        // Outputs
32
        wire [31:0] c;
33
 
34
        // Instantiate the Unit Under Test (UUT)
35
        qadd #(19,32) uut (
36
                .a(a),
37
                .b(b),
38
                .c(c)
39
        );
40
 
41
        //      These are to monitor the values...
42
        wire    [30:0]   c_out;
43
        wire    [30:0]   a_in;
44
        wire    [30:0]   b_in;
45
        wire                            a_sign;
46
        wire                            b_sign;
47
        wire                            c_sign;
48
 
49
 
50
        assign  a_in = a[30:0];
51
        assign  b_in = b[30:0];
52
        assign  c_out = c[30:0];
53
        assign  a_sign = a[31];
54
        assign  b_sign = b[31];
55
        assign  c_sign = c[31];
56
 
57
 
58
        initial begin
59
                // Initialize Inputs
60
                a[30:0] = 0;
61
                a[31] = 0;
62
                b[31] = 1;
63
                b[30:0] = 0;
64
 
65
                // Wait 100 ns for global reset to finish
66
                #100;
67
 
68
                // Add stimulus here
69
                forever begin
70
                        #1 a = a+5179347;                       //      why not?
71
                        a[31] = 0;                                       //      a is negative...
72
                        b[31] = 1;
73
 
74
 
75
                        if (a[30:0] > 2.1E9)                     //      input will always be "positive"
76
                                begin
77
                                        a = 0;
78
                                        b[31] = 1;                              //      b is negative...
79
                                        b[30:0] = b[30:0] + 3779351;
80
                                end
81
                end
82
 
83
        end
84
 
85
endmodule
86
 

powered by: WebSVN 2.1.0

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