AddrOut.v
3.74 KB
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
module AddrOut (
memclk,
Reset,
Bk0WCAS,
Bk0RCAS,
Bk0PRAS,
Bk0APCAS,
Bk0RAS,
Bk0D,
Bk0I,
Bk0XCnt,
Bk0Addr,
Bk0M36,
Bk1WCAS,
Bk1RCAS,
Bk1PRAS,
Bk1APCAS,
Bk1RAS,
Bk1D,
Bk1I,
Bk1XCnt,
Bk1Addr,
Bk1M36,
Bk2WCAS,
Bk2RCAS,
Bk2PRAS,
Bk2APCAS,
Bk2RAS,
Bk2D,
Bk2I,
Bk2XCnt,
Bk2Addr,
Bk2M36,
Bk3WCAS,
Bk3RCAS,
Bk3PRAS,
Bk3APCAS,
Bk3RAS,
Bk3D,
Bk3I,
Bk3XCnt,
Bk3Addr,
Bk3M36,
StR1,
Init_Ref,
Init_Pre,
Init_Mod,
CDataIn,
XMem,
RA,
BA,
CS,
RAS,
CAS,
WE
);
input memclk;
input Reset;
input Bk0WCAS;
input Bk0RCAS;
input Bk0PRAS;
input Bk0APCAS;
input Bk0RAS;
input Bk0D;
input Bk0I;
input [3:0] Bk0XCnt;
input [27:0] Bk0Addr;
input Bk0M36;
input Bk1WCAS;
input Bk1RCAS;
input Bk1PRAS;
input Bk1APCAS;
input Bk1RAS;
input Bk1D;
input Bk1I;
input [3:0] Bk1XCnt;
input [27:0] Bk1Addr;
input Bk1M36;
input Bk2WCAS;
input Bk2RCAS;
input Bk2PRAS;
input Bk2APCAS;
input Bk2RAS;
input Bk2D;
input Bk2I;
input [3:0] Bk2XCnt;
input [27:0] Bk2Addr;
input Bk2M36;
input Bk3WCAS;
input Bk3RCAS;
input Bk3PRAS;
input Bk3APCAS;
input Bk3RAS;
input Bk3D;
input Bk3I;
input [3:0] Bk3XCnt;
input [27:0] Bk3Addr;
input Bk3M36;
input StR1;
input Init_Ref;
input Init_Pre;
input Init_Mod;
input [14:0] CDataIn;
input XMem;
output [12:0] RA;
output [1:0] BA;
output CS;
output RAS;
output CAS;
output WE;
wire Bk0Sel = Bk0WCAS | Bk0RCAS | Bk0PRAS | Bk0RAS;
wire Bk1Sel = Bk1WCAS | Bk1RCAS | Bk1PRAS | Bk1RAS;
wire Bk2Sel = Bk2WCAS | Bk2RCAS | Bk2PRAS | Bk2RAS;
wire Bk3Sel = Bk3WCAS | Bk3RCAS | Bk3PRAS | Bk3RAS;
wire [27:0] Addr = {28{Bk0Sel}} & Bk0Addr
| {28{Bk1Sel}} & Bk1Addr
| {28{Bk2Sel}} & Bk2Addr
| {28{Bk3Sel}} & Bk3Addr;
wire [3:0] XCnt = {4{Bk0Sel}} & Bk0XCnt
| {4{Bk1Sel}} & Bk1XCnt
| {4{Bk2Sel}} & Bk2XCnt
| {4{Bk3Sel}} & Bk3XCnt;
wire D = Bk0Sel & Bk0D
| Bk1Sel & Bk1D
| Bk2Sel & Bk2D
| Bk3Sel & Bk3D;
wire I = Bk0Sel & Bk0I
| Bk1Sel & Bk1I
| Bk2Sel & Bk2I
| Bk3Sel & Bk3I;
wire M36 = Bk0Sel & Bk0M36
| Bk1Sel & Bk1M36
| Bk2Sel & Bk2M36
| Bk3Sel & Bk3M36;
wire PRAS = Bk3PRAS | Bk2PRAS | Bk1PRAS | Bk0PRAS;
wire CS = Bk3Sel | Bk2Sel | Bk1Sel | Bk0Sel | StR1;
wire RAS = Bk3RAS | Bk2RAS | Bk1RAS | Bk0RAS | PRAS | StR1;
wire RCAS = Bk3RCAS | Bk2RCAS | Bk1RCAS | Bk0RCAS;
wire WCAS = Bk3WCAS | Bk2WCAS | Bk1WCAS | Bk0WCAS;
wire APCAS = Bk3APCAS | Bk2APCAS | Bk1APCAS | Bk0APCAS;
wire CAS = RCAS | WCAS | StR1 & ~Init_Pre;
wire WE = WCAS | PRAS | StR1 & (Init_Mod | Init_Pre);
wire [6:4] M36DWAddr = I ? (Addr[6:4] ^ XCnt[2:0])
: (D ? ({1'b0,Addr[6:4]} - XCnt)
: ({1'b0,Addr[6:4]} + XCnt));
wire [6:3] M64DWAddr = I ? (Addr[6:3] ^ XCnt[3:0])
: (D ? ({1'b0,Addr[6:3]} - XCnt)
: ({1'b0,Addr[6:3]} + XCnt));
wire [6:3] DWAddr = M36 ? {M36DWAddr,1'b0}
: M64DWAddr;
wire AutoPrecharge = APCAS;
wire [12:0] RowAddr = StR1 ? (Init_Pre ? {13{1'b1}}
: CDataIn[12:0])
: PRAS ? {13{1'b0}} : {XMem & Addr[25],
Addr[23:22],
Addr[20:11]};
wire [12:0] ColAddr = XMem ? {1'b0,
Addr[27], //Col A11
AutoPrecharge, //Col A10
Addr[26], //Col A9
Addr[24], //Col A8
Addr[10:8],
DWAddr,
1'b0}
: {4'b0000,
AutoPrecharge, //Col A8
Addr[10:8],
DWAddr,
1'b0};
wire [1:0] BA = StR1 ? CDataIn[14:13]
: {(Bk3Sel | Bk2Sel),(Bk3Sel | Bk1Sel)};
wire [12:0] RA = {13{ RAS}} & RowAddr
| {13{RCAS}} & ColAddr
| {13{WCAS}} & ColAddr;
endmodule