-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathControlstall.v
More file actions
53 lines (46 loc) · 848 Bytes
/
Controlstall.v
File metadata and controls
53 lines (46 loc) · 848 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
module Controlstall(clk,op1,op2,op3,stall);
input [5:0]op1,op2,op3;
input clk;
output reg stall;
initial begin
stall=1'b1;
end
always @(posedge clk)begin
if(op1==6'b000100 | op1==6'b000101 | op1==6'b000010)begin// beq or bne or j
stall=1'b0;
end
if(op2==6'b000100 | op2==6'b000101 | op2==6'b000010)begin// beq or bne or j
stall=1'b0;
end
if(op3==6'b000100 | op3==6'b000101 | op3==6'b000010)begin// beq or bne or j
stall=1'b0;
end
else begin
stall=1'b1;
end
end
endmodule
module nopSet(clk,s1,s2,oldF,oldD,newF,newD);
input clk,s1,s2;
input [31:0] oldF,oldD;
output reg[31:0]newD,newF;
initial begin
end
always @(posedge clk)begin
if(s1==1'b0 && s2==1'b0)begin
newF=32'b0;
newD=32'b0;
end
else if(s1==1'b0 && s2==1'b1)begin
newD=32'b0;
end
else if(s1==1'b1 && s2==1'b0)begin
newF=32'b0;
end
else
begin
newD=oldD;
newF=oldF;
end
end
endmodule