-
Notifications
You must be signed in to change notification settings - Fork 9
/
pipe_mem_wb.v
71 lines (67 loc) · 1.82 KB
/
pipe_mem_wb.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
60
61
62
63
64
65
66
67
68
69
70
71
// Pipeline stage
module pipe_mem_wb #( parameter ADDRESS_WIDTH = 32,
parameter DATA_WIDTH = 32,
parameter REG_ADDR_WIDTH = 5,
parameter FREE_LIST_WIDTH = 3
)
(
// Inputs
input i_Clk,
input i_Reset_n, // Async reset (highest priority)
input i_Flush, // Flush (2nd highest priority)
input i_Stall, // Stall (lowest priority)
// Pipe in/out
input [DATA_WIDTH-1:0] i_WriteBack_Data,
output reg [DATA_WIDTH-1:0] o_WriteBack_Data,
input i_Writes_Back,
output reg o_Writes_Back,
input [REG_ADDR_WIDTH-1:0] i_VWrite_Addr,
output reg [REG_ADDR_WIDTH-1:0] o_VWrite_Addr,
input [REG_ADDR_WIDTH:0] i_PWrite_Addr,
output reg [REG_ADDR_WIDTH:0] o_PWrite_Addr,
input [FREE_LIST_WIDTH-1:0] i_Phys_Active_List_Index,
output reg [FREE_LIST_WIDTH-1:0] o_Phys_Active_List_Index,
input i_Is_Branch,
output reg o_Is_Branch
);
// Asynchronous output driver
always @(posedge i_Clk or negedge i_Reset_n)
begin
if( !i_Reset_n )
begin
// Initialize outputs to 0s
o_WriteBack_Data <= 0;
o_Writes_Back <= 0;
o_VWrite_Addr <= 0;
o_PWrite_Addr <= 0;
o_Phys_Active_List_Index <= 0;
o_Is_Branch <= 0;
end
else
begin
if( !i_Stall )
begin
if( i_Flush )
begin
// Pass through all 0s
o_WriteBack_Data <= 0;
o_Writes_Back <= 0;
o_VWrite_Addr <= 0;
o_PWrite_Addr <= 0;
o_Phys_Active_List_Index <= 0;
o_Is_Branch <= 0;
end
else
begin
// Pass through signals
o_WriteBack_Data <= i_WriteBack_Data;
o_Writes_Back <= i_Writes_Back;
o_VWrite_Addr <= i_VWrite_Addr;
o_PWrite_Addr <= i_PWrite_Addr;
o_Phys_Active_List_Index <= i_Phys_Active_List_Index;
o_Is_Branch <= i_Is_Branch;
end
end
end
end
endmodule