-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCTRL.v
34 lines (33 loc) · 839 Bytes
/
CTRL.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
`include "lib/defines.vh"
module CTRL(
input wire rst,
// input wire stallreq_for_ex,
input wire stall_for_load,
input wire stall_for_ex,
output reg flush,
output reg [31:0] new_pc,
output reg [`StallBus-1:0] stall
);
always @ (*) begin
if (rst) begin
stall <= `StallBus'b0;
flush <= 1'b0;
new_pc <= 32'b0;
end
else if (stall_for_load) begin
stall <= `StallBus'b00_0111;
flush <= 1'b0;
new_pc <= 32'b0;
end
else if (stall_for_ex) begin
stall <= `StallBus'b00_1111;
flush <= 1'b0;
new_pc <= 32'b0;
end
else begin
stall <= `StallBus'b0;
flush <= 1'b0;
new_pc <= 32'b0;
end
end
endmodule