OpenCores
URL https://opencores.org/ocsvn/robust_axi_fabric/robust_axi_fabric/trunk

Subversion Repositories robust_axi_fabric

[/] [robust_axi_fabric/] [trunk/] [src/] [base/] [ic_decerr.v] - Blame information for rev 2

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 eyalhoc
OUTFILE PREFIX_ic_decerr.v
2
 
3
module PREFIX_ic_decerr(PORTS);
4
 
5
   input                          clk;
6
   input                          reset;
7
 
8
   input                          AWIDOK;
9
   input                          ARIDOK;
10
   port                           GROUP_IC_AXI;
11
 
12
 
13
   parameter                      RESP_SLVERR = 2'b10;
14
   parameter                      RESP_DECERR = 2'b11;
15
 
16
 
17
   reg                            AWREADY;
18
   reg [ID_BITS-1:0]               BID;
19
   reg [1:0]                       BRESP;
20
   reg                            BVALID;
21
   reg                            ARREADY;
22
   reg [ID_BITS-1:0]               RID;
23
   reg [1:0]                       RRESP;
24
   reg                            RVALID;
25
   reg [4-1:0]             rvalid_cnt;
26
 
27
 
28
   assign                         BUSER = 'd0;
29
   assign                         RUSER = 'd0;
30
   assign                         RDATA = {DATA_BITS{1'b0}};
31
 
32
 
33
   //WRITE
34
   assign                         WREADY = 1'b1;
35
 
36
   always @(posedge clk or posedge reset)
37
     if (reset)
38
       begin
39
          AWREADY <= #FFD 1'b1;
40
          BID     <= #FFD {ID_BITS{1'b0}};
41
          BRESP   <= #FFD 2'b00;
42
       end
43
     else if (BVALID & BREADY)
44
       begin
45
          AWREADY <= #FFD 1'b1;
46
       end
47
     else if (AWVALID & AWREADY)
48
       begin
49
          AWREADY <= #FFD 1'b0;
50
          BID     <= #FFD AWID;
51
          BRESP   <= #FFD AWIDOK ? RESP_DECERR : RESP_SLVERR;
52
       end
53
 
54
   always @(posedge clk or posedge reset)
55
     if (reset)
56
       BVALID <= #FFD 1'b0;
57
     else if (WVALID & WREADY & WLAST)
58
       BVALID <= #FFD 1'b1;
59
     else if (BVALID & BREADY)
60
       BVALID <= #FFD 1'b0;
61
 
62
 
63
   //READ   
64
   always @(posedge clk or posedge reset)
65
     if (reset)
66
       begin
67
          ARREADY <= #FFD 1'b1;
68
          RID     <= #FFD {ID_BITS{1'b0}};
69
          RRESP   <= #FFD 2'b00;
70
       end
71
     else if (RVALID & RREADY & RLAST)
72
       begin
73
          ARREADY <= #FFD 1'b1;
74
       end
75
     else if (ARVALID & ARREADY)
76
       begin
77
          ARREADY <= #FFD 1'b0;
78
          RID     <= #FFD ARID;
79
          RRESP   <= #FFD ARIDOK ? RESP_DECERR : RESP_SLVERR;
80
       end
81
 
82
 
83
   always @(posedge clk or posedge reset)
84
     if (reset)
85
       rvalid_cnt <= #FFD {4{1'b0}};
86
     else if (RVALID & RREADY & RLAST)
87
       rvalid_cnt <= #FFD {4{1'b0}};
88
     else if (RVALID & RREADY)
89
       rvalid_cnt <= #FFD rvalid_cnt - 1'b1;
90
     else if (ARVALID & ARREADY)
91
       rvalid_cnt <= #FFD ARLEN;
92
 
93
 
94
   always @(posedge clk or posedge reset)
95
     if (reset)
96
       RVALID <= #FFD 1'b0;
97
     else if (RVALID & RREADY & RLAST)
98
       RVALID <= #FFD 1'b0;
99
     else if (ARVALID & ARREADY)
100
       RVALID <= #FFD 1'b1;
101
 
102
   assign RLAST = (rvalid_cnt == 'd0) & RVALID;
103
 
104
 
105
 
106
 
107
 
108
 
109
endmodule
110
 
111
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.