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/] [TestMultS.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:   14:01:19 01/02/2014
8
// Design Name:   qmults
9
// Module Name:   F:/FixedPoint/TestMultS.v
10
// Project Name:  FixedPoint
11
// Target Device:  
12
// Tool versions:  
13
// Description: 
14
//
15
// Verilog Test Fixture created by ISE for module: qmults
16
//
17
// Dependencies:
18
// 
19
// Revision:
20
// Revision 0.01 - File Created
21
// Additional Comments:
22
// 
23
////////////////////////////////////////////////////////////////////////////////
24
 
25
module TestMultS;
26
 
27
        // Inputs
28
        reg [31:0] i_multiplicand;
29
        reg [31:0] i_multiplier;
30
        reg i_start;
31
        reg i_clk;
32
 
33
        // Outputs
34
        wire [31:0] o_result_out;
35
        wire o_complete;
36
        wire o_overflow;
37
 
38
        // Instantiate the Unit Under Test (UUT)
39
        qmults uut (
40
                .i_multiplicand(i_multiplicand),
41
                .i_multiplier(i_multiplier),
42
                .i_start(i_start),
43
                .i_clk(i_clk),
44
                .o_result_out(o_result_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_multiplicand = 0;
54
                i_multiplier = 0;
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
                // Add stimulus here
65
                forever #2 i_clk = ~i_clk;
66
                end
67
 
68
                always @(posedge i_clk) begin
69
                        if (count == 47) begin
70
                                count <= 0;
71
                                i_start <= 1'b1;
72
                                end
73
                        else begin
74
                                count <= count + 1;
75
                                i_start <= 1'b0;
76
                                end
77
                        end
78
 
79
                always @(count) begin
80
                        if (count == 47) begin
81
                                if ( i_multiplier > 32'h1FFFFFFF ) begin
82
                                        i_multiplier <= 1;
83
                                        i_multiplicand = (i_multiplicand << 1) + 3;
84
                                        end
85
                                else
86
                                        i_multiplier = (i_multiplier << 1) + 1;
87
                                end
88
                        end
89
 
90
        always @(posedge o_complete)
91
                $display ("%b,%b,%b,%b", i_multiplicand, i_multiplier, o_result_out, o_overflow);               //      Monitor the stuff we care about
92
 
93
 
94
 
95
endmodule
96
 

powered by: WebSVN 2.1.0

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