-
Notifications
You must be signed in to change notification settings - Fork 1
/
write_response_ms.v.bak
67 lines (44 loc) · 1.18 KB
/
write_response_ms.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
module write_response_ms(ACLK,ARESETn,BREADY, BVALID, i_BRESP, o_BRESP);
input ACLK, ARESETn;
input BVALID, BREADY;
input [1:0] i_BRESP;
output [1:0] o_BRESP;
wire o_BVALID, o_BREADY;
wire [1:0] w_BRESP;
write_response_slave resp_s(ACLK, ARESETn, BVALID, o_BVALID, o_BREADY, i_BRESP, w_BRESP);
write_response_master resp_m(ACLK,ARESETn, o_BVALID, BREADY, o_BREADY, w_BRESP, o_BRESP);
endmodule
module write_response_master(ACLK,ARESETn, BVALID, i_BREADY, o_BREADY, i_BRESP, o_BRESP);
input ACLK, ARESETn;
input i_BREADY, BVALID;
input [1:0] i_BRESP;
output reg [1:0] o_BRESP;
output reg o_BREADY;
always @(ACLK) begin
o_BREADY <= i_BREADY;
o_BRESP <= i_BRESP;
if (ARESETn) begin //RESET
o_BREADY <= 0;
o_BRESP <= 0;
end
end
endmodule
module write_response_slave(ACLK, ARESETn,i_BVALID, o_BVALID, BREADY, i_BRESP, o_BRESP);
input ACLK, ARESETn;
input i_BVALID, BREADY;
input [1:0] i_BRESP;
output reg o_BVALID;
output reg [1:0] o_BRESP;
always @(posedge ACLK) begin
o_BVALID <= i_BVALID;
if(ARESETn)
begin // RESET
o_BVALID <= 1'b0;
o_BRESP <= 1'b0;
end
else if(BREADY && o_BVALID)
o_BRESP <= i_BRESP;
else
o_BRESP <= 2'b0;
end
endmodule