-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstall_unit.v.bak
46 lines (44 loc) · 899 Bytes
/
stall_unit.v.bak
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
module stall_handle_unit(
input stall_lw,
input stall_j,
input clock,
output reg ff_stop_updateF,
output reg ff_stop_updateD,//Tich cuc muc CAO
output reg pc_stop_update //Tich cuc muc CAO
);
reg stall_state;
reg last_state;
always @(negedge clock)
begin
if (stall_lw == 1) begin
ff_stop_updateF = 1;
ff_stop_updateF = 1;
pc_stop_update = 1;
// Stall state = true
last_state = stall_state;
stall_state = 1;
end
else if (stall_j == 1) begin
ff_stop_updateF = 1;
ff_stop_updateD = 0;
pc_stop_update = 0;
// Stall state = true
last_state = stall_state;
stall_state = 1;
end
else begin
ff_stop_updateF = 0;
ff_stop_updateD = 0;
pc_stop_update = 0;
last_state = stall_state;
end
if (last_state && stall_state) begin
ff_stop_updateF = 0;
ff_stop_updateD = 0;
pc_stop_update = 0;
// Stall state = false
last_state = stall_state;
stall_state = 0;
end
end
endmodule