test.v
714 Bytes
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
module test;
wire clk;
reg sig1;
reg[31:0] in1;
wire[31:0] out1, out2;
Clock clock(clk);
testA ta(clk, sig1, in1, out1, out2);
initial begin
sig1 <= 1'b0;
in1 <= 32'd0;
#100;
in1 <= 32'hffffffff;
#100;
sig1 <= 1'b1;
in1 <= 32'h0000ffff;
#100;
sig1 <= 1'b1;
in1 <= 32'hffff0000;
#100;
end
/*
wire clk;
reg[31:0] pc;
wire[31:0] instr, tempPC;
Clock clock(clk);
InstructionFetch IF(clk, pc, instr, tempPC);
initial begin
pc = 32'hfffffffc;
end
always @(negedge clk) begin
pc = pc + 4;
end
*/
endmodule
module testA(clk, sig1, in1, out1, out2);
input clk, sig1;
input[31:0] in1;
output reg[31:0] out1, out2;
always @(posedge clk) begin
out1 <= in1;
if(sig1 == 1) out2 <= in1;
end
endmodule