-
Notifications
You must be signed in to change notification settings - Fork 1
/
FSM_MSI_BUS_requests_controller.v
59 lines (58 loc) · 1.42 KB
/
FSM_MSI_BUS_requests_controller.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
50
51
52
53
54
55
56
57
58
59
module FSM_MSI_BUS_requests_controller(
input [1:0] state_in,
input bus_write_miss,
input bus_read_miss,
input bus_invalidate,
output reg abort_mem_access_next,
output reg write_back_block_next,
output reg [1:0] state_next
);
parameter INVALID=2'b00, MODIFIED=2'b01, SHARED=2'b10;
initial begin
state_next <= INVALID;
write_back_block_next <= 0;
abort_mem_access_next <= 0;
end
always@(*)begin
case(state_in)
MODIFIED:begin
case({bus_write_miss,bus_read_miss})
2'b01:begin
state_next <= SHARED;
write_back_block_next <= 1;
abort_mem_access_next <= 1;
end
2'b10:begin
state_next <= INVALID;
write_back_block_next <= 1;
abort_mem_access_next <= 1;
end
default: begin
state_next <= state_next;
write_back_block_next <= 0;
abort_mem_access_next <= 0;
end
endcase
end
SHARED:begin
case({bus_invalidate,bus_write_miss,bus_read_miss})
3'b001:begin
state_next <= SHARED;
write_back_block_next <= 0;
abort_mem_access_next <= 0;
end
3'b010,3'b100:begin
state_next <= INVALID;
write_back_block_next <= 0;
abort_mem_access_next <= 0;
end
default:begin
write_back_block_next <= 0;
abort_mem_access_next <= 0;
state_next <= state_next;
end
endcase
end
endcase
end
endmodule