-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_ALU.v
73 lines (69 loc) · 1.26 KB
/
test_ALU.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
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer: [email protected]
// License: MIT
//
// Create Date: 18:34:39 05/30/2021
// Design Name:
// Module Name: test_ALU
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module test_ALU(
);
reg [7:0] _x;
reg [7:0] _y;
reg [3:0] _control;
wire [8:0] _z;
// clock
reg clk;
initial begin
clk <= 0;
end
always #5 clk <= !clk;
// end clock
// module
ALU ttt(
.x(_x),
.y(_y),
.control(_control),
.z(_z),
.clk(clk)
);
//display
integer i;
integer j;
initial begin
for (i=0; i<16; i=i+1)
begin
_control <= i;
#10;
$display("control: %b ----------", _control);
for(j=0; j<2; j=j+1)
begin
_x <= $random;
_y <= $random;
#10;
$display("x: %b %b \ny: %b %b \nz:%b %b %b \n###",
_x[7:4],
_x[3:0],
_y[7:4],
_y[3:0],
_z[8],
_z[7:4],
_z[3:0]
);
end
end
end
endmodule