-
Notifications
You must be signed in to change notification settings - Fork 0
/
IrtazaModule.v
52 lines (40 loc) · 843 Bytes
/
IrtazaModule.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
module Q1(Select, CP, clr, SI, PI, Out);
input Select, CP, clr, SI;
input [3:0] PI;
output reg [3:0] Out;
initial
begin
Out[0] = 0;
Out[1] = 0;
Out[3] = 0;
Out[2] = 0;
end
always @ (negedge CP)
begin
Out[3] = (~clr)&((Select&PI[3])|(~Select&Out[2]));
Out[2] = (~clr)&((Select&PI[2])|(~Select&Out[1]));
Out[1] = (~clr)&((Select&PI[1])|(~Select&Out[0]));
Out[0] = (~clr)&((Select&PI[0])|(~Select&SI));
end
endmodule
module testbench;
reg Sel, clk, clr, si;
reg [3:0] pi;
wire [3:0] Out;
Q1 run(.Select(Sel), .CP(clk), .clr(clr), .SI(si), .PI(pi), .Out(Out));
initial
begin
Sel = 0;
clk = 1;
clr = 0;
si = 1;
pi = 4'b1111;
#500
Sel = 1;
end
always #50 clk = ~clk;
always #100
begin
si = ~si;
end
endmodule