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

Subversion Repositories ahbmaster

[/] [ahbmaster/] [trunk/] [test79_AHBmaster/] [component/] [Actel/] [DirectCore/] [CoreAHBLite/] [5.3.101/] [rtl/] [vhdl/] [amba_bfm/] [bfm_ahbslaveext.vhd] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 uson
-- Actel Corporation Proprietary and Confidential
2
-- Copyright 2008 Actel Corporation.  All rights reserved.
3
-- ANY USE OR REDISTRIBUTION IN PART OR IN WHOLE MUST BE HANDLED IN 
4
-- ACCORDANCE WITH THE ACTEL LICENSE AGREEMENT AND MUST BE APPROVED 
5
-- IN ADVANCE IN WRITING.  
6
-- Revision Information:
7
-- SVN Revision Information:
8
-- SVN $Revision: 22340 $
9
-- SVN $Date: 2014-04-11 21:59:35 +0530 (Fri, 11 Apr 2014) $
10
library Ieee;
11
use ieEE.Std_LOGic_1164.all;
12
use iEEE.numeRIC_stD.all;
13
use Work.bFM_misC.all;
14
use WOrk.Bfm_tEXTio.all;
15
use wORK.bfm_PACkage.all;
16
use std.textIO.all;
17
entity bfM_AHbslaVEext is
18
generic (awiDTH: intEGEr range 1 to 32;
19
DEPth: INTeger := 256;
20
ext_Size: INTegeR range 0 to 2 := 2;
21
iNITfile: StriNG := "";
22
id: intEGEr := 0;
23
eNFUNc: INTeger := 0;
24
enfiFO: InteGER range 0 to 1024 := 0;
25
Tpd: INtegeR range 0 to 1000 := 1;
26
Debug: intEGEr range -1 to 5 := -1); port (Hclk: in stD_LogiC;
27
hresETN: in sTD_logIC;
28
HSEl: in stD_logiC;
29
hWRITe: in stD_LogiC;
30
haDDR: in Std_LOGIc_vECTor(aWIDth-1 downto 0);
31
HWData: in Std_LOGic_vECTor(31 downto 0);
32
hrdaTA: out STd_loGIC_veCTOr(31 downto 0);
33
HreaDYIn: in STd_loGIC;
34
hREAdyouT: out Std_LOGIc;
35
HtraNS: in std_LOGic_VECtor(1 downto 0);
36
HsizE: in std_LOgic_VEctoR(2 downto 0);
37
HbursT: in Std_lOGIc_vECTor(2 downto 0);
38
HMastLOCK: in sTD_logIC;
39
hproT: in sTD_logIC_vecTOR(3 downto 0);
40
Hresp: out std_LOgic;
41
Ext_EN: in stD_logiC;
42
EXT_wr: in STd_lOGIC;
43
ext_RD: in sTD_logiC;
44
ext_ADDr: in Std_lOGIc_veCTOr(awIDTh-1 downto 0);
45
EXT_daTA: inout STD_logIC_veCTOr(31 downto 0);
46
TxreADY: out STD_loGIC;
47
rxrEADy: out STD_logIC);
48
end BFM_ahbSLAveeXT;
49
 
50
architecture BFMA1io1OL of bfm_AHbslAVEext is
51
 
52
signal BFMA1lIILl: INtegeR := debuG;
53
 
54
constant BFMA1ol00: tIME := tpd*1 ns;
55
 
56
subtype BFMA1iiILL is STd_loGIC_veCTOr(7 downto 0);
57
 
58
type BFMA1O0ill is array (iNTEger range <> ) of BFMA1IIill;
59
 
60
subtype BFMA1L0Ill is std_LOgic_VEctoR(31 downto 0);
61
 
62
type BFMA1I0Ill is array (INTegeR range <> ) of BFMA1l0ilL;
63
 
64
signal BFMA1O1ill: Std_LOGIc;
65
 
66
signal BFMA1l1ilL: STd_loGIC_veCTOr(1 downto 0);
67
 
68
signal BFMA1i1ILL: STD_logIC_vecTOR(2 downto 0);
69
 
70
signal BFMA1OO0ll: STD_logIC_veCTOr(aWIDth-1 downto 0);
71
 
72
signal BFMA1LO0ll: Std_LOGic;
73
 
74
signal BFMA1IO0ll: sTD_logIC;
75
 
76
signal BFMA1OL0ll: STd_lOGIC_veCTOr(3 downto 0);
77
 
78
signal BFMA1lL0Ll: STd_loGIc_vECTor(2 downto 0);
79
 
80
signal BFMA1il0lL: Std_lOGIC;
81
 
82
signal BFMA1OLlll: std_LOgic;
83
 
84
signal BFMA1Oi0ll: STD_logIC;
85
 
86
signal BFMA1LI0ll: stD_LogiC;
87
 
88
signal BFMA1II0ll: STD_logIC;
89
 
90
signal BFMA1o00LL: BOOLean;
91
 
92
signal BFMA1o0II: sTD_logIC_vecTOR(31 downto 0);
93
 
94
signal BFMA1L00ll: STd_loGIC;
95
 
96
begin
97
BFMA1O0Ii <= ( others => '0');
98
BFMA1I00ll:
99
process (Hclk,HresETN)
100
file BFMA1ll00: TExt;
101
file BFMA1iL00: teXT;
102
type BFMA1O10ll is (BFMA1L10ll,BFMA1i10LL,ext);
103
variable BFMA1oo1LL: BFMA1O0ill(0 to deptH-1);
104
variable BFMA1Lo1ll: InteGER;
105
variable BFMA1o10OL: iNTEger;
106
variable BFMA1IO1ll: stD_LogiC_VectOR(31 downto 0);
107
variable BFMA1ol1LL: STD_logIC_veCTOr(31 downto 0);
108
variable BFMA1LL1ll: inTEGer;
109
variable BFMA1IL1ll: inteGER := 0;
110
variable BFMA1oi1LL: std_Logic;
111
variable BFMA1LI1ll: stD_logiC;
112
variable BFMA1ii1Ll: std_Logic_VEctoR(1 downto 0);
113
variable BFMA1o01LL: STD_logIC_vecTOr(2 downto 0);
114
variable BFMA1L01ll: sTD_logiC_vectOR(AwidtH-1 downto 0);
115
variable BFMA1I01lL: sTD_logIC_vecTOR(3 downto 0);
116
variable BFMA1o11LL: std_LOgic_VEctoR(2 downto 0);
117
variable BFMA1l11Ll: sTD_logIC;
118
variable BFMA1i11lL: STD_logIC;
119
variable BFMA1OOOil: inteGER;
120
variable BFMA1LOoil: inteGER;
121
variable BFMA1iooiL: STD_logIC_vecTOr(31 downto 0);
122
variable BFMA1o1ii: Std_lOGIc_veCTor(7 downto 0);
123
variable BFMA1OLoil: STD_logIC_vecTOr(31 downto 0);
124
variable BFMA1llOIL: bOOLEan;
125
variable BFMA1ILOIl: inteGER;
126
variable BFMA1I0L1: boolEAN;
127
variable L: LIne;
128
variable BFMA1i000: FILe_opEN_staTUs;
129
variable BFMA1O100: BOoleaN := faLSE;
130
variable BFMA1O1l1: CHaracTER;
131
variable v: INtegeR;
132
variable BFMA1oIOIl: intEGEr;
133
variable BFMA1lIOIl: intEGEr;
134
variable BFMA1OLl1: sTRIng(1 to 80);
135
variable BFMA1iol1: STrinG(1 to 80);
136
variable BFMA1IIoil: BoolEAN;
137
variable BFMA1O0Oil: BOOlean;
138
variable BFMA1L0oil: BOOlean;
139
variable BFMA1i0OIl: BOOlean;
140
variable BFMA1O1Oil: BOOleaN;
141
variable BFMA1L1oiL: STd_loGIC_veCTOr(AWidth-1 downto 0);
142
variable BFMA1I1oil: IntegER;
143
variable BFMA1OOLIl: BooleAN;
144
variable BFMA1lOLIl: BFMA1O10ll;
145
variable BFMA1ioliL: BFMA1O10ll;
146
variable BFMA1oLLIl: inteGER;
147
variable BFMA1lLLIl: InteGER;
148
variable BFMA1illiL: std_LOgic_VEctoR(31 downto 0);
149
variable BFMA1OIlil: std_LOgic_VEctoR(31 downto 0);
150
variable BFMA1LIlil: BFMA1i0ILL(0 to enfiFO);
151
variable BFMA1iiliL: inTEGer;
152
variable BFMA1O0lil: INTegeR;
153
variable BFMA1L0Lil: iNTEger;
154
variable BFMA1I0lil: InteGER;
155
variable BFMA1O1Lil: intEGEr;
156
variable BFMA1L1lil: inteGER;
157
variable BFMA1I1lil: BFMA1i0ILl(0 to ENFifo);
158
variable BFMA1oOIIl: InteGER;
159
variable BFMA1loIIL: INtegeR;
160
variable BFMA1IOIil: inteGER;
161
variable BFMA1OLIIl: INTeger;
162
variable BFMA1Lliil: intEGEr;
163
variable BFMA1ILIil: intEGEr;
164
variable BFMA1oIIIl: INtegeR;
165
begin
166
if hCLK'Event and HCLk = '1'
167
and not BFMA1O100 then
168
if iNITfile'LEngth > 2 then
169
PRintf("Opening BFM AHB Slave %d Initialisation file %s",
170
FMt(ID)&fMT(iNITfile));
171
File_OPen(BFMA1i000,
172
BFMA1ll00,
173
iniTFIle);
174
if not (BFMA1i000 = Open_OK) then
175
assert fALSe report "Failed to open script file "&InitfILE severity FAIlure;
176
else
177
v := 0;
178
BFMA1i0L1 := fALSe;
179
while not BFMA1I0l1
180
loop
181
BFMA1oo1LL(v) := ( others => '0');
182
ReaDLIne(BFMA1ll00,
183
l);
184
for BFMA1LL0i in 1 to 8
185
loop
186
reAD(L,
187
BFMA1O1l1);
188
if BFMA1o1L1 = '1' then
189
BFMA1Oo1lL(V)(8-BFMA1lL0I) := '1';
190
end if;
191
end loop;
192
V := v+1;
193
BFMA1i0L1 := enDFIle(BFMA1ll00);
194
end loop;
195
FIle_CLOSe(BFMA1LL00);
196
prINTf(" Loaded %d Locations",
197
FMT(v));
198
end if;
199
end if;
200
BFMA1O100 := True;
201
end if;
202
if hreSETn = '0' then
203
BFMA1oi1lL := '1';
204
BFMA1iL0Ll <= '0';
205
HRdata <= ( others => '0');
206
BFMA1O1Ill <= '0';
207
BFMA1L1ill <= "00";
208
BFMA1Lo0ll <= '0';
209
BFMA1OO0ll <= ( others => '0');
210
BFMA1i1iLL <= ( others => '0');
211
BFMA1ollLL <= '1';
212
eXT_datA <= ( others => 'Z');
213
BFMA1lI0Ll <= '1';
214
BFMA1Ii0lL <= '0';
215
BFMA1lL1Ll := BFMA1IL1ll;
216
BFMA1ol1lL := ( others => '0');
217
BFMA1io1LL := ( others => '0');
218
BFMA1OOOil := 0;
219
BFMA1looiL := 256;
220
BFMA1LLOIl := falSE;
221
BFMA1ilOIL := 0;
222
BFMA1O0oil := true;
223
BFMA1l0oIL := fALSE;
224
BFMA1i0oiL := falsE;
225
BFMA1L1oil := ( others => '0');
226
BFMA1o1OIL := fALSe;
227
BFMA1I1oil := 67;
228
BFMA1oOLIl := falSE;
229
BFMA1iilIL := 0;
230
BFMA1o0liL := 0;
231
BFMA1L0lil := 0;
232
BFMA1o1LIl := 0;
233
BFMA1I0lil := 0;
234
BFMA1l1LIl := 0;
235
BFMA1ooIIL := 0;
236
BFMA1Loiil := 0;
237
BFMA1IOiil := 0;
238
BFMA1llIIL := 0;
239
BFMA1oliiL := 0;
240
BFMA1ILIil := 0;
241
BFMA1O00ll <= FalsE;
242
elsif HClk'eveNT and HClk = '1' then
243
BFMA1lolIL := BFMA1l10LL;
244
BFMA1Iolil := BFMA1l10lL;
245
if hREAdyin = '1' then
246
BFMA1o1iLL <= HSEl;
247
BFMA1L1Ill <= htraNS;
248
BFMA1lO0Ll <= HWrite;
249
BFMA1OO0ll <= HAddr;
250
BFMA1I1Ill <= hSIZe;
251
BFMA1OL0ll <= HPRot;
252
BFMA1Ll0ll <= HbursT;
253
BFMA1io0LL <= hmASTlock;
254
if BFMA1IL1ll >= 256 then
255
BFMA1i1OIl := BFMA1O0li(BFMA1I1oil);
256
BFMA1LL1ll := BFMA1i0LI(BFMA1i1OIl,
257
BFMA1IL1ll mod 256);
258
else
259
BFMA1ll1LL := BFMA1il1lL;
260
end if;
261
end if;
262
if hreaDYIn = '1' then
263
BFMA1LI1ll := Hsel;
264
BFMA1L01ll := Haddr;
265
BFMA1Ii1lL := HTrans;
266
BFMA1o01LL := hsizE;
267
BFMA1l11ll := HWrite;
268
BFMA1i01Ll := hproT;
269
BFMA1o11LL := HBurst;
270
BFMA1i11LL := HmasTLOCk;
271
else
272
BFMA1li1lL := BFMA1o1ILl;
273
BFMA1L01ll := BFMA1oo0LL;
274
BFMA1II1ll := BFMA1l1ILl;
275
BFMA1O01ll := BFMA1i1ILL;
276
BFMA1l11LL := BFMA1Lo0lL;
277
BFMA1I01ll := BFMA1OL0ll;
278
BFMA1o11Ll := BFMA1ll0LL;
279
BFMA1I11ll := BFMA1io0LL;
280
end if;
281
if hrEADyin = '1' and hsEL = '1'
282
and htrANS(1) = '1' then
283
if BFMA1iL1Ll >= 256 then
284
BFMA1I1oil := BFMA1o0lI(BFMA1I1oil);
285
BFMA1ll1LL := BFMA1i0lI(BFMA1i1OIl,
286
BFMA1Il1ll mod 256);
287
else
288
BFMA1LL1ll := BFMA1IL1ll;
289
end if;
290
BFMA1oi1lL := '0';
291
if BFMA1ilOIL > 0 then
292
BFMA1iloIL := BFMA1iLOIl-1;
293
end if;
294
if BFMA1LLoil and BFMA1ILOil = 0
295
and BFMA1ll1LL = 0 then
296
BFMA1ll1LL := 1;
297
end if;
298
end if;
299
if hsEL = '1' and HReadyIN = '1'
300
and htrANS(1) = '1'
301
and BFMA1l0OIl then
302
case hsiZE is
303
when "000" =>
304
when "001" =>
305
if HAddr(0) /= '0' then
306
BFMA1lloIL := TRue;
307
BFMA1ILoil := 0;
308
end if;
309
when "010" =>
310
if BFMA1OO0ll(1 downto 0) /= "00" then
311
BFMA1LLOil := tRUE;
312
BFMA1iloiL := 0;
313
end if;
314
when others =>
315
BFMA1llOIL := trUE;
316
end case;
317
if HWrite = '1' and BFMA1I0Oil
318
and haddR /= BFMA1L1oil then
319
BFMA1llOIL := tRUE;
320
BFMA1ILOil := 0;
321
end if;
322
end if;
323
BFMA1IL0ll <= '0';
324
if BFMA1ll1LL > 0 then
325
BFMA1Ll1lL := BFMA1LL1ll-1;
326
else
327
if not (BFMA1llOIL and BFMA1Iloil = 0) then
328
BFMA1OI1ll := '1';
329
elsif BFMA1IL0ll = '0' then
330
BFMA1IL0ll <= '1';
331
BFMA1oi1LL := '0';
332
else
333
BFMA1OI1ll := '1';
334
BFMA1iL0Ll <= '1';
335
BFMA1lloIL := faLSE;
336
end if;
337
end if;
338
BFMA1IioiL := FalsE;
339
if BFMA1O1Ill = '1' and BFMA1Lo0ll = '1'
340
and HReadyIN = '1'
341
and BFMA1L1Ill(1) = '1' then
342
BFMA1LO1ll := to_iNTEger(TO_unsIGNed(BFMA1oo0LL(haddR'LEFt downto 2)&"00"));
343
BFMA1O10ol := to_iNTEger(to_UnsigNED(BFMA1oo0LL(1 downto 0)));
344
if not (EnfunC > 0 and BFMA1lo1lL >= enfUNC
345
and BFMA1LO1ll < enFUNc+256) then
346
case BFMA1I1ill is
347
when "000" =>
348
if not BFMA1I0oil then
349
BFMA1OO1ll(BFMA1LO1ll+BFMA1o10oL) := HWData(BFMA1o10OL*8+7 downto BFMA1o10Ol*8+0);
350
IfpriNTF((BFMA1LIIll = 1),
351
"AHBS:%d Byte Write %08u=%02u at %t ns",
352
FMT(iD)&FMT(BFMA1LO1ll+BFMA1o10OL)&FMt(hwdATA(BFMA1o10Ol*8+7 downto BFMA1o10OL*8+0)));
353
else
354
BFMA1IIOil := truE;
355
IfpriNTF((BFMA1lIILl = 1),
356
"AHBS:%d Word Write %08u Misaligned or ROM at %t ns",
357
fmt(ID)&Fmt(BFMA1lo1LL+BFMA1O10ol));
358
end if;
359
when "001" =>
360
if (BFMA1o1OIl or BFMA1oO0Ll(0) = '0') and not BFMA1I0oil then
361
BFMA1OO1ll(BFMA1lo1LL+BFMA1o10Ol+0) := hwdATA(BFMA1O10oL*8+7 downto BFMA1O10ol*8+0);
362
BFMA1oO1Ll(BFMA1lo1LL+BFMA1o10OL+1) := HWData(BFMA1o10OL*8+15 downto BFMA1o10OL*8+8);
363
IFPrintF((BFMA1liilL = 1),
364
"AHBS:%d Half Write %08u=%02u at %t ns",
365
Fmt(id)&fmt(BFMA1LO1ll+BFMA1o10OL)&fMT(hwDATA(BFMA1O10ol*8+15 downto BFMA1O10ol*8+0)));
366
else
367
BFMA1iIOIl := tRUE;
368
iFPRintf((BFMA1liiLL = 1),
369
"AHBS:%d Half Write %08u Misaligned or ROM at %t ns",
370
fmt(Id)&fMT(BFMA1lo1LL+BFMA1O10ol));
371
end if;
372
when "010" =>
373
if (BFMA1O1oil or BFMA1Oo0ll(1 downto 0) = "00") and not BFMA1i0OIl then
374
BFMA1oo1LL(BFMA1LO1ll+0) := HwdaTA(7 downto 0);
375
BFMA1OO1ll(BFMA1LO1ll+1) := hWDAta(15 downto 8);
376
BFMA1OO1ll(BFMA1lo1LL+2) := hWDAta(23 downto 16);
377
BFMA1oo1LL(BFMA1LO1ll+3) := HWdata(31 downto 24);
378
ifpRINtf((BFMA1lIILl = 1),
379
"AHBS:%d Word Write %08u=%02u at %t ns",
380
fmT(ID)&Fmt(BFMA1lo1LL+BFMA1O10ol)&fmT(hwDATa));
381
else
382
BFMA1IIOil := TRue;
383
ifPRINtf((BFMA1liiLL = 1),
384
"AHBS:%d Word Write %08u Misaligned or ROM at %t ns",
385
fmt(ID)&FMT(BFMA1lo1LL+BFMA1O10ol));
386
end if;
387
when others =>
388
assert falsE report "BFM_AHBSLAVE: Illegal AHB SIZE Setting during write" severity ERror;
389
end case;
390
BFMA1Oioil := BFMA1LO1ll;
391
BFMA1lioiL := BFMA1OIoi(hwdaTA);
392
else
393
BFMA1IOLil := BFMA1i10ll;
394
BFMA1oLLIl := BFMA1lo1LL-eNFUnc;
395
BFMA1ILlil := HwdatA;
396
end if;
397
BFMA1OLoil := BFMA1O0Ii(31 downto 20)&"00"&BFMA1io0LL&BFMA1LO0ll&'0'&BFMA1ll0LL&BFMA1ol0LL&'0'&BFMA1I1Ill&"00"&BFMA1L1Ill;
398
end if;
399
BFMA1OL1ll := ( others => '0');
400
if BFMA1oOLIl then
401
BFMA1OL1ll := ( others => 'X');
402
end if;
403
if BFMA1oI1Ll = '1' and BFMA1lI1Ll = '1'
404
and BFMA1iI1Ll(1) = '1'
405
and BFMA1l11LL = '0' then
406
BFMA1lo1LL := to_iNTEger(TO_unsIGNed(BFMA1l01Ll(HADDr'Left downto 2)&"00"));
407
BFMA1O10ol := TO_inteGER(TO_unsiGNEd(BFMA1L01lL(1 downto 0)));
408
case BFMA1o01LL is
409
when "000" =>
410
BFMA1ol1LL(BFMA1o10OL*8+7 downto BFMA1O10ol*8+0) := BFMA1Oo1lL(BFMA1LO1ll+BFMA1O10ol);
411
IfpriNTF((BFMA1liILL = 1),
412
"AHBS:%d Byte Read %08u=%02u at %t ns",
413
fmT(iD)&fMT(BFMA1LO1ll)&fMT(BFMA1oL1Ll(BFMA1O10ol*8+7 downto BFMA1O10ol*8+0)));
414
when "001" =>
415
if BFMA1O1oil or BFMA1L01ll(0) = '0' then
416
BFMA1Ol1ll(BFMA1o10Ol*8+15 downto BFMA1O10ol*8+0) := BFMA1oo1LL(BFMA1LO1ll+BFMA1O10ol+1)&BFMA1OO1ll(BFMA1LO1ll+BFMA1o10Ol+0);
417
ifPRIntf((BFMA1liiLL = 1),
418
"AHBS:%d Half Read %08u=%04u at %t ns",
419
fmT(id)&FMt(BFMA1LO1ll+BFMA1O10ol)&fmt(BFMA1OL1ll(BFMA1O10ol*8+15 downto BFMA1o10oL*8+0)));
420
else
421
ifPRIntf((BFMA1Liill = 1),
422
"AHBS:%d Half Read %08u Misaligned at %t ns",
423
FMT(Id)&FMt(BFMA1lo1LL));
424
BFMA1iIOIl := trUE;
425
BFMA1OL1ll := ( others => '0');
426
end if;
427
when "010" =>
428
if BFMA1O1Oil or BFMA1L01ll(1 downto 0) = "00" then
429
BFMA1ol1LL := BFMA1OO1ll(BFMA1lo1lL+3)&BFMA1OO1ll(BFMA1lo1LL+2)&BFMA1oo1LL(BFMA1LO1ll+1)&BFMA1oO1Ll(BFMA1lo1LL+0);
430
ifPRIntf((BFMA1liiLL = 1),
431
"AHBS:%d Word Read %08u=%08u at %t ns",
432
FMt(ID)&Fmt(BFMA1Lo1ll)&fmt(BFMA1oL1Ll));
433
else
434
ifPRIntf((BFMA1liILL = 1),
435
"AHBS:%d Word Read %08u Misaligned at %t ns",
436
Fmt(id)&fmt(BFMA1lo1LL));
437
BFMA1iIOIl := TRUe;
438
BFMA1OL1ll := ( others => '0');
439
end if;
440
when others =>
441
assert FALse report "BFM_AHBSLAVE: Illegal AHB SIZE Setting during read" severity erroR;
442
end case;
443
if not (EnfuNC > 0 and BFMA1LO1ll >= ENFunc
444
and BFMA1LO1ll < enfUNC+256) then
445
BFMA1OLoil := BFMA1o0iI(31 downto 20)&"00"&BFMA1i11lL&BFMA1L11ll&'0'&BFMA1o11LL&BFMA1I01ll&'0'&BFMA1O01ll&"00"&BFMA1ii1LL;
446
BFMA1OIOil := BFMA1lo1lL;
447
BFMA1LIoil := BFMA1OIOi(BFMA1ol1LL);
448
else
449
BFMA1Lolil := BFMA1I10ll;
450
BFMA1Lllil := BFMA1lO1Ll-ENfunc;
451
BFMA1OILil := BFMA1oL1Ll;
452
end if;
453
end if;
454
if BFMA1IIoil and BFMA1o0OIL then
455
PRintf("AHBS:%d Misaligned Transfer - %08u",
456
fmt(ID)&FMt(BFMA1LO1ll+BFMA1O10oL));
457
assert fALSe report "Misaligned Transfer Detected" severity ERror;
458
end if;
459
EXt_daTA <= ( others => 'Z');
460
if ext_En = '1' and EXT_rd = '1' then
461
case eXT_sizE is
462
when 0 =>
463
BFMA1lo1lL := TO_intEGEr(tO_unsiGNEd(EXt_adDR(ext_ADDr'Left downto 0)));
464
when 1 =>
465
BFMA1lo1LL := TO_inteGER(to_UNsigNED(EXt_adDR(ext_ADDr'LEFt downto 1)&'0'));
466
when 2 =>
467
BFMA1Lo1ll := To_iNTEger(To_unSIGned(EXt_adDR(ext_Addr'LEFt downto 2)&"00"));
468
end case;
469
if not (ENFUnc > 0 and BFMA1lO1ll >= EnfunC
470
and BFMA1lO1Ll < ENFunc+256) then
471
case EXt_siZE is
472
when 0 =>
473
BFMA1io1LL := BFMA1o0iI(31 downto 8)&BFMA1OO1ll(BFMA1lO1Ll+0);
474
when 1 =>
475
BFMA1Io1lL := BFMA1o0II(31 downto 16)&BFMA1OO1ll(BFMA1lo1lL+1)&BFMA1oO1Ll(BFMA1Lo1ll+0);
476
when 2 =>
477
BFMA1iO1Ll := BFMA1OO1ll(BFMA1LO1ll+3)&BFMA1OO1ll(BFMA1LO1ll+2)&BFMA1Oo1ll(BFMA1lo1LL+1)&BFMA1oo1LL(BFMA1lo1LL+0);
478
end case;
479
IFPrintF(BFMA1LIIll >= 1,
480
"AHBS: Slot %d Extension Read %04x=%04x ",
481
fmt(ID)&Fmt(BFMA1lO1Ll)&FMt(BFMA1IO1ll));
482
Ext_DATa <= BFMA1IO1ll;
483
else
484
assert BFMA1LOLil = BFMA1l10LL report "AHBS slave does not allow simultanous EXT and AHB access to control registers" severity ERror;
485
BFMA1lOLIl := EXT;
486
BFMA1lllIL := BFMA1lo1lL-EnfunC;
487
BFMA1OILil := ( others => '0');
488
end if;
489
end if;
490
if eXT_en = '1' and ext_WR = '1' then
491
case Ext_sIZE is
492
when 0 =>
493
BFMA1Lo1ll := to_INtegeR(to_UNsigNED(EXT_adDR(Ext_aDDR'lefT downto 0)));
494
when 1 =>
495
BFMA1LO1ll := tO_InteGER(to_UNSigneD(EXt_adDR(Ext_aDDR'lEFT downto 1)&'0'));
496
when 2 =>
497
BFMA1Lo1ll := to_INtegER(TO_unsIGNed(Ext_aDDR(EXT_adDR'Left downto 2)&"00"));
498
end case;
499
if not (ENFUnc > 0 and BFMA1LO1ll >= ENfunc
500
and BFMA1LO1ll < enFUNc+256) then
501
case Ext_sIZE is
502
when 0 =>
503
BFMA1oo1LL(BFMA1LO1ll+0) := EXT_datA(7 downto 0);
504
when 1 =>
505
BFMA1OO1ll(BFMA1lO1Ll+0) := exT_data(7 downto 0);
506
BFMA1Oo1lL(BFMA1lo1lL+1) := Ext_DATa(15 downto 8);
507
when 2 =>
508
BFMA1OO1ll(BFMA1lo1LL+0) := ext_Data(7 downto 0);
509
BFMA1oo1LL(BFMA1lo1LL+1) := ext_DAta(15 downto 8);
510
BFMA1OO1ll(BFMA1lo1LL+2) := EXt_daTA(23 downto 16);
511
BFMA1oO1Ll(BFMA1lo1LL+3) := EXT_daTA(31 downto 24);
512
end case;
513
IfpriNTF(BFMA1LIill >= 1,
514
"AHBS: Slot %d Extension Write %04x=%04x ",
515
FMT(Id)&fMT(BFMA1LO1ll)&FMT(exT_Data));
516
else
517
assert BFMA1LOlil = BFMA1L10ll report "AHBS slave does not allow simultanous EXT and AHB access" severity erroR;
518
BFMA1IOLIl := EXT;
519
BFMA1OLLil := BFMA1lo1LL-EnfuNC;
520
BFMA1iLLIl := EXT_datA;
521
end if;
522
end if;
523
if BFMA1oooiL > 1 then
524
BFMA1ooOIL := BFMA1oOOIl-1;
525
elsif BFMA1ooOIL = 1 then
526
priNTF("UPDATED %08x  %08x",
527
FMt(enFUNc+28)&Fmt(BFMA1IOOil));
528
BFMA1oO1Ll(EnfunC+28+0) := BFMA1IOoil(7 downto 0);
529
BFMA1OO1ll(enfUNC+28+1) := BFMA1IOOil(15 downto 8);
530
BFMA1oo1LL(enFUNc+28+2) := BFMA1iooIL(23 downto 16);
531
BFMA1oo1lL(ENfunc+28+3) := BFMA1IOoil(31 downto 24);
532
BFMA1OOOil := 0;
533
end if;
534
if BFMA1iOLIl /= BFMA1l10lL then
535
PRintf("AHBS:%d Setting ENFUNC %d %d",
536
fMT(Id)&fmt(BFMA1OLLil)&FMT(BFMA1illIL));
537
case BFMA1oLLIl is
538
when 0 =>
539
BFMA1llOIL := True;
540
BFMA1IloiL := BFMA1oIOI(BFMA1ilLIL(7 downto 0));
541
prINTf("AHBS: HRESP will be set on the %d access",
542
Fmt(BFMA1Iloil));
543
when 4 =>
544
BFMA1il1LL := tO_int_UNSignED(BFMA1Illil(9 downto 0));
545
BFMA1oI1Ll := '1';
546
BFMA1LL1ll := 0;
547
if BFMA1iL1Ll >= 256 then
548
PRintf("AHBS:HREADY timing random 0 to %d cycles",
549
fmt(BFMA1il1LL mod 256));
550
else
551
pRINtf("AHBS:HREADY timing %d cycles ",
552
FMT(BFMA1il1lL));
553
end if;
554
when 8 =>
555
BFMA1LIill <= To_inT_unsiGNEd(BFMA1iLLIl(7 downto 0));
556
when 12 =>
557
BFMA1Oo1ll := ( others => ( others => '0'));
558
when 16 =>
559
for BFMA1I0ii in 0 to deptH-1
560
loop
561
BFMA1oO1Ll(BFMA1i0iI) := not tO_Std_LOGic(to_UNSignED(BFMA1I0ii,
562
32))(7 downto 0);
563
end loop;
564
when 24 =>
565
BFMA1O0Oil := (BFMA1ILlil(0) = '1');
566
BFMA1l0oIL := (BFMA1ILLil(1) = '1');
567
BFMA1i0OIl := (BFMA1ILLil(2) = '1');
568
BFMA1o1oiL := (BFMA1ILLil(3) = '1');
569
BFMA1l1oiL := BFMA1OO0ll;
570
PrinTF("AHBS: Misaligned Transfer Detection set to %d",
571
fmt(hWDAta(2 downto 0)));
572
when 28 =>
573
prINTf("AHBS: Delaying write of %08x for %d Clocks",
574
fMT(BFMA1illIL)&Fmt(BFMA1Looil));
575
BFMA1IooiL := BFMA1ilLIL;
576
BFMA1oooIL := BFMA1LOoil;
577
when 32 =>
578
BFMA1loOIL := BFMA1OIOi(BFMA1illIL);
579
when 36 =>
580
BFMA1o100 := fALSe;
581
when 40 =>
582
SpriNTF(BFMA1Oll1,
583
"image%d.txt",
584
Fmt(id));
585
FIle_OPEn(BFMA1i000,
586
BFMA1Il00,
587
BFMA1olL1,
588
WRIte_MODE);
589
if BFMA1I000 = opeN_ok then
590
priNTF("AHBS:%d: Dumping to %s",
591
fmt(ID)&fmt(BFMA1oll1));
592
else
593
assert FalsE report "Logfile open failed" severity FailuRE;
594
end if;
595
for BFMA1i0II in 0 to dEPTh-1
596
loop
597
BFMA1O1ii := ( others => '0');
598
for BFMA1Ii1l in 0 to 7
599
loop
600
if BFMA1Oo1ll(BFMA1i0II)(BFMA1II1l) = '1' then
601
BFMA1o1II(BFMA1ii1L) := '1';
602
end if;
603
end loop;
604
SpriNTF(BFMA1iol1,
605
"%08b",
606
FMt(BFMA1o1ii));
607
WRIte(L,
608
BFMA1Iol1);
609
wRITelinE(BFMA1iL00,
610
L);
611
end loop;
612
File_CLOse(BFMA1il00);
613
when 52 =>
614
BFMA1OOlil := (BFMA1ILlil(0) = '1');
615
PrintF("AHBS: Special Mode Enables set to %d",
616
Fmt(BFMA1ILLil(2 downto 0)));
617
when 128 =>
618
BFMA1lILIl(BFMA1IIlil) := BFMA1illIL;
619
BFMA1L0Lil := BFMA1l0lIL+1;
620
if BFMA1Iilil = EnfiFO-1 then
621
BFMA1iiLIL := 0;
622
else
623
BFMA1iilIL := BFMA1Iilil+1;
624
end if;
625
if (BFMA1i0liL > 0 and BFMA1l1lIL <= BFMA1I0Lil) or BFMA1li0LL = '0' then
626
assert FAlse report "AHBS:Detected Write to TXFIFO when iTXREADY=0" severity ERRor;
627
end if;
628
BFMA1L1lil := 0;
629
when 136 =>
630
BFMA1oiiiL := BFMA1oIOI(BFMA1ILLil);
631
if BFMA1OIIil = 0 then
632
BFMA1iILIl := 0;
633
BFMA1O0lil := 0;
634
BFMA1l0lIL := 0;
635
else
636
end if;
637
when 140 =>
638
BFMA1o1LIl := BFMA1oioi(BFMA1ILlil);
639
when 144 =>
640
BFMA1i0LIL := BFMA1Oioi(BFMA1ILLil);
641
BFMA1L1Lil := BFMA1OIOi(BFMA1ilLIL);
642
when 148 =>
643
BFMA1O00ll <= (BFMA1IlliL(0) = '1');
644
when 160 =>
645
BFMA1I1Lil(BFMA1ooiIL) := BFMA1illIL;
646
BFMA1IOiil := BFMA1ioiiL+1;
647
if BFMA1ooIIL = EnfifO-1 then
648
BFMA1OOIIl := 0;
649
else
650
BFMA1OOIil := BFMA1oOIIl+1;
651
end if;
652
when 168 =>
653
BFMA1OIIil := BFMA1oiOI(BFMA1ILlil);
654
if BFMA1OIiil = 0 then
655
BFMA1ooIIL := 0;
656
BFMA1loiiL := 0;
657
BFMA1iOIIl := 0;
658
else
659
end if;
660
when 172 =>
661
BFMA1lLIIl := BFMA1Oioi(BFMA1iLLIl);
662
when 176 =>
663
BFMA1OLiil := BFMA1OIoi(BFMA1ILlil);
664
BFMA1iLIIl := BFMA1oIOI(BFMA1ILLil);
665
when others =>
666
end case;
667
end if;
668
if BFMA1loliL /= BFMA1l10Ll then
669
case BFMA1Lllil is
670
when 20 =>
671
BFMA1oiLIL := BFMA1OLOil;
672
when 28 =>
673
PRIntf("ADDR 28   CNT %d",
674
fMT(BFMA1oooiL));
675
when 44 =>
676
BFMA1OILIl := To_sLV32(BFMA1oIOIl);
677
when 48 =>
678
BFMA1Oilil := to_sLV32(BFMA1lioIL);
679
when 132 =>
680
BFMA1oiLIL := BFMA1LILil(BFMA1o0lIL);
681
BFMA1L0lil := BFMA1l0Lil-1;
682
if BFMA1o0LIl = eNFIfo-1 then
683
BFMA1O0Lil := 0;
684
else
685
BFMA1o0lIL := BFMA1o0lIL+1;
686
end if;
687
when 136 =>
688
BFMA1oILIl := to_SLv32(BFMA1L0liL);
689
when 164 =>
690
BFMA1oiliL := BFMA1i1LIl(BFMA1LOiil);
691
BFMA1IOiil := BFMA1IOIil-1;
692
BFMA1Iliil := 0;
693
if BFMA1LOiil = EnfifO-1 then
694
BFMA1loiiL := 0;
695
else
696
BFMA1LOiil := BFMA1LOIil+1;
697
end if;
698
if (BFMA1OLIil > 0 and BFMA1Iliil <= BFMA1Oliil) or BFMA1ii0LL = '0' then
699
assert falsE report "AHBS:Detected Read from RXFIFO when iRXREADY=0" severity ErroR;
700
end if;
701
when 168 =>
702
BFMA1OILil := To_sLV32(BFMA1iOIIl);
703
when others =>
704
end case;
705
if BFMA1LOlil = exT then
706
ext_DAta <= BFMA1OiliL;
707
end if;
708
if BFMA1Lolil = BFMA1i10lL then
709
BFMA1Ol1ll := BFMA1OIlil;
710
end if;
711
end if;
712
if BFMA1L1lil >= BFMA1I0lil then
713
BFMA1li0LL <= '1';
714
if BFMA1L0lil = ENfifo then
715
BFMA1LI0ll <= '0';
716
end if;
717
else
718
if BFMA1l1LIl >= BFMA1o1LIL then
719
BFMA1lI0Ll <= '0';
720
end if;
721
end if;
722
if BFMA1iliiL >= BFMA1oliiL then
723
BFMA1II0ll <= '1';
724
if BFMA1Ioiil = 0 then
725
BFMA1Ii0ll <= '0';
726
end if;
727
else
728
if BFMA1ilIIL >= BFMA1LLiil then
729
BFMA1II0ll <= '0';
730
end if;
731
end if;
732
BFMA1l1LIl := BFMA1L1Lil+1;
733
BFMA1ILIil := BFMA1iliIL+1;
734
hrDATa <= BFMA1oL1ll after BFMA1Ol00;
735
BFMA1Ollll <= BFMA1oI1Ll;
736
end if;
737
end process;
738
HresP <= BFMA1il0LL after BFMA1OL00;
739
HReadyOUT <= BFMA1olllL after BFMA1ol00;
740
tXREady <= BFMA1LI0ll when not BFMA1o00lL else
741
BFMA1ii0LL after BFMA1oL00;
742
rxreADY <= BFMA1ii0lL when not BFMA1o00LL else
743
BFMA1Li0ll after BFMA1OL00;
744
BFMA1liIIL:
745
process (hclk,hresETN)
746
variable BFMA1iiiiL: booLEAn;
747
begin
748
if HReseTN = '0' then
749
BFMA1L00lL <= '0';
750
BFMA1oI0Ll <= '0';
751
elsif Hclk'EVent and HClk = '1' then
752
BFMA1Iiiil := FAlse;
753
if HTrans = "00" and hreaDYIn = '1' then
754
BFMA1L00ll <= '0';
755
end if;
756
if HTrans /= "00" then
757
BFMA1L00ll <= '1';
758
end if;
759
if hTRAns = "11" and haDDR(9 downto 0) = BFMA1o0II(9 downto 0) then
760
PRintF("AHBS: AHB Violation: 1K Boundary Crossed");
761
BFMA1IIiil := TRUe;
762
end if;
763
if HReadYIN = '1' then
764
BFMA1OI0ll <= '0';
765
end if;
766
if HSEl = '1' and HtranS /= "00"
767
and HreadYIN = '1' then
768
BFMA1oi0LL <= '1';
769
end if;
770
if BFMA1oI0ll = '1' and hrEADyin /= BFMA1oLLLl then
771
assert False report "AHBS: HREADYIN was not the same as HREADYOUT when selected" severity eRROr;
772
end if;
773
if BFMA1IIIil then
774
assert False report "AHB Violation" severity FAIlure;
775
end if;
776
end if;
777
end process;
778
end BFMA1io1oL;

powered by: WebSVN 2.1.0

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