1 |
3 |
uson |
// ********************************************************************
|
2 |
|
|
// Actel Corporation Proprietary and Confidential
|
3 |
|
|
// Copyright 2010 Actel Corporation. All rights reserved.
|
4 |
|
|
//
|
5 |
|
|
// ANY USE OR REDISTRIBUTION IN PART OR IN WHOLE MUST BE HANDLED IN
|
6 |
|
|
// ACCORDANCE WITH THE ACTEL LICENSE AGREEMENT AND MUST BE APPROVED
|
7 |
|
|
// IN ADVANCE IN WRITING.
|
8 |
|
|
//
|
9 |
|
|
// Description: User testbench AHBLite master 1 BFM script for CoreAHBLite
|
10 |
|
|
//
|
11 |
|
|
// Revision Information:
|
12 |
|
|
// Date Description
|
13 |
|
|
// 10Feb10 Production Release Version 3.1
|
14 |
|
|
//
|
15 |
|
|
// SVN Revision Information:
|
16 |
|
|
// SVN $Revision: 21348 $
|
17 |
|
|
// SVN $Date: 2013-10-23 20:30:39 +0530 (Wed, 23 Oct 2013) $
|
18 |
|
|
//
|
19 |
|
|
// Resolved SARs
|
20 |
|
|
// SAR Date Who Description
|
21 |
|
|
//
|
22 |
|
|
// Notes:
|
23 |
|
|
// 1. best viewed with tabstops set to "4"
|
24 |
|
|
// 2. Most of the behavior is driven from the BFM script for the AHBLite master.
|
25 |
|
|
// Consult the Actel AMBA BFM documentation for more information.
|
26 |
|
|
// 3. All procedures, variables, and constants used by the 'main' procedure
|
27 |
|
|
// are declared in the include file "coreahblite_usertb_include.bfm"
|
28 |
|
|
//
|
29 |
|
|
// History: 11/05/08 - TFB created
|
30 |
|
|
//
|
31 |
|
|
// *********************************************************************
|
32 |
|
|
|
33 |
|
|
// include constants, and miscellaneous procedures used in this main file
|
34 |
|
|
include "coreahblite_usertb_include.bfm"
|
35 |
|
|
|
36 |
|
|
procedure main
|
37 |
|
|
int i
|
38 |
|
|
int j
|
39 |
|
|
int k
|
40 |
|
|
int dtmp[4]
|
41 |
|
|
int atmp
|
42 |
|
|
int slot_incr
|
43 |
|
|
|
44 |
|
|
header "User Testbench for CoreAHBLite: BFM AHBLite Master 1 Test Harness"
|
45 |
|
|
print "(c) Copyright 2010 Actel Corporation. All rights reserved."
|
46 |
|
|
call pr_underscores
|
47 |
|
|
|
48 |
|
|
debug 1 // only text strings printed
|
49 |
|
|
timeout 2000 // timeout in cycles, in case BFM stalls
|
50 |
|
|
wait 200
|
51 |
|
|
|
52 |
|
|
// initialize local variables passed from testbench HDL to the
|
53 |
|
|
// ARGVALUE* BFM parameters
|
54 |
|
|
call init_parameter_vars
|
55 |
|
|
|
56 |
|
|
wait 2
|
57 |
|
|
|
58 |
|
|
# Set slot increment based on MEMSPACE parameter
|
59 |
|
|
if MEMSPACE == 0
|
60 |
|
|
call pr_underscores
|
61 |
|
|
print "Master 1, memory space: 16 64KB slave slots, one huge slave slot, testing beginning at: %0d ns." $TIME
|
62 |
|
|
call pr_underscores
|
63 |
|
|
set slot_incr 0x00010000;
|
64 |
|
|
endif
|
65 |
|
|
if MEMSPACE == 1
|
66 |
|
|
call pr_underscores
|
67 |
|
|
print "Master 1, memory space = 4GB, 16 256MB slave slots, testing beginning at: %0d ns." $TIME
|
68 |
|
|
call pr_underscores
|
69 |
|
|
set slot_incr 0x10000000;
|
70 |
|
|
endif
|
71 |
|
|
if MEMSPACE == 2
|
72 |
|
|
call pr_underscores
|
73 |
|
|
print "Master 1, memory space = 256MB, 16 16MB slave slots, testing beginning at: %0d ns." $TIME
|
74 |
|
|
call pr_underscores
|
75 |
|
|
set slot_incr 0x01000000;
|
76 |
|
|
endif
|
77 |
|
|
if MEMSPACE == 3
|
78 |
|
|
call pr_underscores
|
79 |
|
|
print "Master 1, memory space = 16MB, 16 1MB slave slots, testing beginning at: %0d ns." $TIME
|
80 |
|
|
call pr_underscores
|
81 |
|
|
set slot_incr 0x00100000;
|
82 |
|
|
endif
|
83 |
|
|
if MEMSPACE == 4
|
84 |
|
|
call pr_underscores
|
85 |
|
|
print "Master 1, memory space = 1MB, 16 64KB slave slots, testing beginning at: %0d ns." $TIME
|
86 |
|
|
call pr_underscores
|
87 |
|
|
set slot_incr 0x00010000;
|
88 |
|
|
endif
|
89 |
|
|
if MEMSPACE == 5
|
90 |
|
|
call pr_underscores
|
91 |
|
|
print "Master 1, memory space = 64KB, 16 4KB slave slots, testing beginning at: %0d ns." $TIME
|
92 |
|
|
call pr_underscores
|
93 |
|
|
set slot_incr 0x00001000;
|
94 |
|
|
endif
|
95 |
|
|
if MEMSPACE == 6
|
96 |
|
|
call pr_underscores
|
97 |
|
|
print "Master 1, memory space = 4KB, 16 256B slave slots, testing beginning at: %0d ns." $TIME
|
98 |
|
|
call pr_underscores
|
99 |
|
|
set slot_incr 0x00000100;
|
100 |
|
|
endif
|
101 |
|
|
|
102 |
|
|
//=========================================================================
|
103 |
|
|
# Test byte/halfword/word writes and reads for all enabled slots
|
104 |
|
|
loop i 0 15 1
|
105 |
|
|
if SC[i] == 0
|
106 |
|
|
if M1_AHBSLOTENABLE[i]
|
107 |
|
|
call pr_underscores
|
108 |
|
|
print "Master 1 testing AHBLite slot:%0d at: %0d ns." i $TIME
|
109 |
|
|
call pr_underscores
|
110 |
|
|
// write/read 32-bit word
|
111 |
|
|
set atmp i * slot_incr + 0x0
|
112 |
|
|
set dtmp[0] 0x12345678
|
113 |
|
|
print "Master 1 writes:%08x to AHBLite slave:%0d at: %0d ns." dtmp[0] i $TIME
|
114 |
|
|
write w BASE atmp dtmp[0]
|
115 |
|
|
print "Master 1 verifying (reading):%08x from AHBLite slave:%0d at: %0d ns." dtmp[0] i $TIME
|
116 |
|
|
readcheck w BASE atmp dtmp[0]
|
117 |
|
|
wait 8
|
118 |
|
|
// write/read 16-bit halfwords
|
119 |
|
|
set dtmp[0] 0xdead
|
120 |
|
|
set dtmp[1] 0xbeef
|
121 |
|
|
loop j 0 1 1
|
122 |
|
|
set k j * 2
|
123 |
|
|
set atmp i * slot_incr + k
|
124 |
|
|
print "Master 1 writes:%04x to AHBLite slave:%0d at: %0d ns." dtmp[j] i $TIME
|
125 |
|
|
write h BASE atmp dtmp[j]
|
126 |
|
|
endloop
|
127 |
|
|
loop j 0 1 1
|
128 |
|
|
set k j * 2
|
129 |
|
|
set atmp i * slot_incr + k
|
130 |
|
|
print "Master 1 verifying (reading):%04x from AHBLite slave:%0d at: %0d ns." dtmp[j] i $TIME
|
131 |
|
|
readcheck h BASE atmp dtmp[j]
|
132 |
|
|
endloop
|
133 |
|
|
wait 8
|
134 |
|
|
// write/read 8-bit bytes
|
135 |
|
|
set dtmp[0] 0x9a
|
136 |
|
|
set dtmp[1] 0x56
|
137 |
|
|
set dtmp[2] 0x34
|
138 |
|
|
set dtmp[3] 0x12
|
139 |
|
|
loop j 0 3 1
|
140 |
|
|
set k j * 1
|
141 |
|
|
set atmp i * slot_incr + k
|
142 |
|
|
print "Master 1 writes:%02x to AHBLite slave:%0d at: %0d ns." dtmp[j] i $TIME
|
143 |
|
|
write b BASE atmp dtmp[j]
|
144 |
|
|
endloop
|
145 |
|
|
loop j 0 3 1
|
146 |
|
|
set k j * 1
|
147 |
|
|
set atmp i * slot_incr + k
|
148 |
|
|
print "Master 1 verifying (reading):%02x from AHBLite slave:%0d at: %0d ns." dtmp[j] i $TIME
|
149 |
|
|
readcheck b BASE atmp dtmp[j]
|
150 |
|
|
endloop
|
151 |
|
|
wait 8
|
152 |
|
|
// write/read 32-bit word 0xaaaaaaaa
|
153 |
|
|
set atmp i * slot_incr + 0x0
|
154 |
|
|
set dtmp[0] 0xaaaaaaaa
|
155 |
|
|
print "Master 1 writes:%08x to AHBLite slave:%0d at: %0d ns." dtmp[0] i $TIME
|
156 |
|
|
write w BASE atmp dtmp[0]
|
157 |
|
|
print "Master 1 verifying (reading):%08x from AHBLite slave:%0d at: %0d ns." dtmp[0] i $TIME
|
158 |
|
|
readcheck w BASE atmp dtmp[0]
|
159 |
|
|
wait 8
|
160 |
|
|
// write/read 32-bit word 0x55555555
|
161 |
|
|
set atmp i * slot_incr + 0x0
|
162 |
|
|
set dtmp[0] 0x55555555
|
163 |
|
|
print "Master 1 writes:%08x to AHBLite slave:%0d at: %0d ns." dtmp[0] i $TIME
|
164 |
|
|
write w BASE atmp dtmp[0]
|
165 |
|
|
print "Master 1 verifying (reading):%08x from AHBLite slave:%0d at: %0d ns." dtmp[0] i $TIME
|
166 |
|
|
readcheck w BASE atmp dtmp[0]
|
167 |
|
|
wait 8
|
168 |
|
|
print "Master 1 done testing AHBLite slot:%0d at: %0d ns." i $TIME
|
169 |
|
|
call pr_underscores
|
170 |
|
|
else
|
171 |
|
|
call pr_underscores
|
172 |
|
|
print "Master 1 skipping test of AHBLite slot:%0d at: %0d ns." i $TIME
|
173 |
|
|
call pr_underscores
|
174 |
|
|
endif
|
175 |
|
|
else
|
176 |
|
|
call pr_underscores
|
177 |
|
|
print "Master 1 skipping test of AHBLite slot:%0d at: %0d ns." i $TIME
|
178 |
|
|
call pr_underscores
|
179 |
|
|
endif
|
180 |
|
|
// wait here between loops
|
181 |
|
|
endloop
|
182 |
|
|
//=========================================================================
|
183 |
|
|
quit
|
184 |
|
|
return
|