-
Notifications
You must be signed in to change notification settings - Fork 0
/
Buffer3.v
94 lines (89 loc) · 1.9 KB
/
Buffer3.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
`timescale 1ns / 1ps
module Buffer3 #(parameter WIDTH=32)
(
input RegWriteD,
input MemtoRegD,
input MemWriteD,
input ALUSrcD,
input ALUSrcNoExD,
input RegDstD,
input [3:0] ALUControlD,
input [WIDTH-1:0] RD1D,
input [WIDTH-1:0] RD2D,
input [4:0] RsD,
input [4:0] RtD,
input [4:0] RdD,
input [WIDTH-1:0] SignImmD,
input [WIDTH-1:0] NoSignImmD,
input CLR,
input clk,
output reg RegWriteE,
output reg MemtoRegE,
output reg MemWriteE,
output reg ALUSrcE,
output reg ALUSrcNoExE,
output reg RegDstE,
output reg [3:0] ALUControlE,
output reg [WIDTH-1:0] RD1E,
output reg [WIDTH-1:0] RD2E,
output reg [4:0] RsE,
output reg [4:0] RtE,
output reg [4:0] RdE,
output reg [WIDTH-1:0] SignImmE,
output reg [WIDTH-1:0] NoSignImmE
);
initial
begin
RegWriteE<=0;
MemtoRegE<=0;
MemWriteE<=0;
ALUSrcE<=0;
ALUSrcNoExE<=0;
RegDstE<=0;
ALUControlE<=0;
RD1E<=0;
RD2E<=0;
RsE<=0;
RtE<=0;
RdE<=0;
SignImmE<=0;
NoSignImmE<=0;
end // initial begin
always @(posedge clk)
begin
if(CLR)
begin
RegWriteE<=0;
MemtoRegE<=0;
MemWriteE<=0;
ALUSrcE<=0;
ALUSrcNoExE<=0;
RegDstE<=0;
ALUControlE<=0;
RD1E<=0;
RD2E<=0;
RsE<=0;
RtE<=0;
RdE<=0;
SignImmE<=0;
NoSignImmE<=0;
end // if (CLR)
else
begin
RegWriteE<=RegWriteD;
MemtoRegE<=MemtoRegD;
MemWriteE<=MemWriteD;
ALUSrcE<=ALUSrcD;
ALUSrcNoExE<=ALUSrcNoExD;
RegDstE<=RegDstD;
ALUControlE<=ALUControlD;
RD1E<=RD1D;
RD2E<=RD2D;
RsE<=RsD;
RtE<=RtD;
RdE<=RdD;
SignImmE<=SignImmD;
NoSignImmE<=NoSignImmD;
end // else: !if(CLR)
end
endmodule // Buffer3