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