1 |
2 |
HanySalah |
//-----------------------------------------------------------------------------
|
2 |
|
|
//
|
3 |
|
|
// UART2BUS VERIFICATION
|
4 |
|
|
//
|
5 |
|
|
//-----------------------------------------------------------------------------
|
6 |
|
|
// CREATOR : HANY SALAH
|
7 |
|
|
// PROJECT : UART2BUS UVM TEST BENCH
|
8 |
|
|
// UNIT : TEST
|
9 |
|
|
//-----------------------------------------------------------------------------
|
10 |
|
|
// TITLE : UART TEST
|
11 |
|
|
// DESCRIPTION: This
|
12 |
|
|
//-----------------------------------------------------------------------------
|
13 |
|
|
// LOG DETAILS
|
14 |
|
|
//-------------
|
15 |
|
|
// VERSION NAME DATE DESCRIPTION
|
16 |
|
|
// 1 HANY SALAH 10012016 FILE CREATION
|
17 |
|
|
//-----------------------------------------------------------------------------
|
18 |
|
|
// ALL COPYRIGHTS ARE RESERVED FOR THE PRODUCER ONLY .THIS FILE IS PRODUCED FOR
|
19 |
|
|
// OPENCORES MEMBERS ONLY AND IT IS PROHIBTED TO USE THIS MATERIAL WITHOUT THE
|
20 |
|
|
// CREATOR'S PERMISSION
|
21 |
|
|
//-----------------------------------------------------------------------------
|
22 |
|
|
class uart_base_test extends uvm_test;
|
23 |
|
|
|
24 |
|
|
uart_env env;
|
25 |
|
|
|
26 |
|
|
uvm_table_printer printer;
|
27 |
|
|
|
28 |
|
|
uart_config _config;
|
29 |
|
|
|
30 |
|
|
`uvm_component_utils(uart_base_test)
|
31 |
|
|
|
32 |
|
|
function new (string name,uvm_component parent);
|
33 |
|
|
super.new(name,parent);
|
34 |
|
|
endfunction:new
|
35 |
|
|
|
36 |
|
|
function void build_phase (uvm_phase phase);
|
37 |
|
|
super.build_phase(phase);
|
38 |
|
|
|
39 |
|
|
env = uart_env::type_id::create("env",this);
|
40 |
|
|
|
41 |
|
|
_config = uart_config::type_id::create("_config",this);
|
42 |
|
|
|
43 |
|
|
uvm_config_db#(uart_config)::set(this,"*","UART_CONFIGURATION",_config);
|
44 |
|
|
|
45 |
|
|
printer = new();
|
46 |
|
|
printer.knobs.depth = 3;
|
47 |
|
|
endfunction:build_phase
|
48 |
|
|
|
49 |
|
|
function void connect_phase (uvm_phase phase);
|
50 |
|
|
super.connect_phase(phase);
|
51 |
|
|
endfunction:connect_phase
|
52 |
|
|
|
53 |
|
|
function void end_of_elaboration_phase (uvm_phase phase);
|
54 |
|
|
super.end_of_elaboration_phase(phase);
|
55 |
|
|
_config._edge = pos_edge;
|
56 |
|
|
_config._start = lsb;
|
57 |
|
|
_config._datamode = ascii;
|
58 |
|
|
_config.num_stop_bits = 1;
|
59 |
|
|
_config.num_of_bits = 8;
|
60 |
|
|
_config._paritymode = parity_off;
|
61 |
|
|
_config.response_time = 10000;
|
62 |
|
|
endfunction:end_of_elaboration_phase
|
63 |
|
|
|
64 |
|
|
task run_phase (uvm_phase phase);
|
65 |
|
|
phase.phase_done.set_drain_time(this,5000);
|
66 |
|
|
endtask:run_phase
|
67 |
|
|
endclass:uart_base_test
|
68 |
|
|
|
69 |
|
|
|
70 |
|
|
class write_text_mode extends uart_base_test;
|
71 |
|
|
|
72 |
|
|
seq_1p1 seq1;
|
73 |
|
|
seq_1p2 seq2;
|
74 |
|
|
seq_1p3 seq3;
|
75 |
|
|
seq_1p4 seq4;
|
76 |
|
|
seq_1p5 seq5;
|
77 |
|
|
seq_1p6 seq6;
|
78 |
|
|
seq_1p7 seq7;
|
79 |
|
|
seq_1p8 seq8;
|
80 |
|
|
seq_1p9 seq9;
|
81 |
|
|
seq_1p10 seq10;
|
82 |
|
|
seq_1p11 seq11;
|
83 |
|
|
|
84 |
|
|
`uvm_component_utils(write_text_mode)
|
85 |
|
|
|
86 |
|
|
function new (string name,uvm_component parent);
|
87 |
|
|
super.new(name,parent);
|
88 |
|
|
endfunction:new
|
89 |
|
|
|
90 |
|
|
function void build_phase (uvm_phase phase);
|
91 |
|
|
super.build_phase (phase);
|
92 |
|
|
seq1 = seq_1p1::type_id::create("seq1");
|
93 |
|
|
seq2 = seq_1p2::type_id::create("seq2");
|
94 |
|
|
seq3 = seq_1p3::type_id::create("seq3");
|
95 |
|
|
seq4 = seq_1p4::type_id::create("seq4");
|
96 |
|
|
seq5 = seq_1p5::type_id::create("seq5");
|
97 |
|
|
seq6 = seq_1p6::type_id::create("seq6");
|
98 |
|
|
seq7 = seq_1p7::type_id::create("seq7");
|
99 |
|
|
seq8 = seq_1p8::type_id::create("seq8");
|
100 |
|
|
seq9 = seq_1p9::type_id::create("seq9");
|
101 |
|
|
seq10 = seq_1p10::type_id::create("seq10");
|
102 |
|
|
seq11 = seq_1p11::type_id::create("seq11");
|
103 |
|
|
endfunction:build_phase
|
104 |
|
|
|
105 |
|
|
|
106 |
|
|
task run_phase (uvm_phase phase);
|
107 |
|
|
super.run_phase(phase);
|
108 |
|
|
phase.raise_objection(this);
|
109 |
|
|
seq1.start(env.agent._seq,null);
|
110 |
|
|
seq2.start(env.agent._seq,null);
|
111 |
|
|
seq3.start(env.agent._seq,null);
|
112 |
|
|
seq4.start(env.agent._seq,null);
|
113 |
|
|
seq5.start(env.agent._seq,null);
|
114 |
|
|
seq6.start(env.agent._seq,null);
|
115 |
|
|
seq7.start(env.agent._seq,null);
|
116 |
|
|
seq8.start(env.agent._seq,null);
|
117 |
|
|
seq9.start(env.agent._seq,null);
|
118 |
|
|
seq10.start(env.agent._seq,null);
|
119 |
|
|
seq11.start(env.agent._seq,null);
|
120 |
|
|
phase.drop_objection(this);
|
121 |
|
|
endtask:run_phase
|
122 |
|
|
endclass:write_text_mode
|
123 |
|
|
|
124 |
|
|
|
125 |
|
|
class read_text_mode extends uart_base_test;
|
126 |
|
|
|
127 |
|
|
seq_2p1 seq1;
|
128 |
|
|
seq_2p2 seq2;
|
129 |
|
|
seq_2p3 seq3;
|
130 |
|
|
seq_2p4 seq4;
|
131 |
|
|
seq_2p5 seq5;
|
132 |
|
|
seq_2p6 seq6;
|
133 |
|
|
seq_2p7 seq7;
|
134 |
|
|
seq_2p8 seq8;
|
135 |
|
|
seq_2p9 seq9;
|
136 |
|
|
seq_2p10 seq10;
|
137 |
|
|
seq_2p11 seq11;
|
138 |
|
|
|
139 |
|
|
|
140 |
|
|
`uvm_component_utils(read_text_mode)
|
141 |
|
|
|
142 |
|
|
function new (string name,uvm_component parent);
|
143 |
|
|
super.new(name,parent);
|
144 |
|
|
endfunction:new
|
145 |
|
|
|
146 |
|
|
function void build_phase (uvm_phase phase);
|
147 |
|
|
super.build_phase(phase);
|
148 |
|
|
seq1 = seq_2p1::type_id::create("seq1");
|
149 |
|
|
seq2 = seq_2p2::type_id::create("seq2");
|
150 |
|
|
seq3 = seq_2p3::type_id::create("seq3");
|
151 |
|
|
seq4 = seq_2p4::type_id::create("seq4");
|
152 |
|
|
seq5 = seq_2p5::type_id::create("seq5");
|
153 |
|
|
seq6 = seq_2p6::type_id::create("seq6");
|
154 |
|
|
seq7 = seq_2p7::type_id::create("seq7");
|
155 |
|
|
seq8 = seq_2p8::type_id::create("seq8");
|
156 |
|
|
seq9 = seq_2p9::type_id::create("seq9");
|
157 |
|
|
seq10 = seq_2p10::type_id::create("seq10");
|
158 |
|
|
seq11 = seq_2p11::type_id::create("seq11");
|
159 |
|
|
endfunction:build_phase
|
160 |
|
|
|
161 |
|
|
task run_phase (uvm_phase phase);
|
162 |
|
|
super.run_phase(phase);
|
163 |
|
|
phase.raise_objection(this);
|
164 |
|
|
seq1.start(env.agent._seq,null);
|
165 |
|
|
seq2.start(env.agent._seq,null);
|
166 |
|
|
seq3.start(env.agent._seq,null);
|
167 |
|
|
seq4.start(env.agent._seq,null);
|
168 |
|
|
seq5.start(env.agent._seq,null);
|
169 |
|
|
seq6.start(env.agent._seq,null);
|
170 |
|
|
seq7.start(env.agent._seq,null);
|
171 |
|
|
seq8.start(env.agent._seq,null);
|
172 |
|
|
seq9.start(env.agent._seq,null);
|
173 |
|
|
seq10.start(env.agent._seq,null);
|
174 |
|
|
seq11.start(env.agent._seq,null);
|
175 |
|
|
phase.drop_objection(this);
|
176 |
|
|
endtask:run_phase
|
177 |
|
|
endclass:read_text_mode
|
178 |
|
|
|
179 |
|
|
class nop_command_mode extends uart_base_test;
|
180 |
|
|
|
181 |
|
|
seq_3p1 seq1;
|
182 |
|
|
//seq_3p2 seq2;
|
183 |
|
|
seq_3p3 seq3;
|
184 |
|
|
seq_4p1 seq4;
|
185 |
|
|
//seq_4p2 seq5;
|
186 |
|
|
seq_4p3 seq6;
|
187 |
|
|
|
188 |
|
|
`uvm_component_utils(nop_command_mode)
|
189 |
|
|
|
190 |
|
|
function new (string name,uvm_component parent);
|
191 |
|
|
super.new(name,parent);
|
192 |
|
|
endfunction:new
|
193 |
|
|
|
194 |
|
|
function void build_phase (uvm_phase phase);
|
195 |
|
|
super.build_phase(phase);
|
196 |
|
|
seq1 = seq_3p1::type_id::create("seq1");
|
197 |
|
|
//seq2 = seq_3p2::type_id::create("seq2");
|
198 |
|
|
seq3 = seq_3p3::type_id::create("seq3");
|
199 |
|
|
seq4 = seq_4p1::type_id::create("seq4");
|
200 |
|
|
//seq5 = seq_4p2::type_id::create("seq5");
|
201 |
|
|
seq6 = seq_4p3::type_id::create("seq6");
|
202 |
|
|
endfunction:build_phase
|
203 |
|
|
|
204 |
|
|
task run_phase(uvm_phase phase);
|
205 |
|
|
super.run_phase(phase);
|
206 |
|
|
phase.raise_objection(this);
|
207 |
|
|
seq1.start(env.agent._seq,null);
|
208 |
|
|
//seq2.start(env.agent._seq,null);
|
209 |
|
|
seq3.start(env.agent._seq,null);
|
210 |
|
|
seq4.start(env.agent._seq,null);
|
211 |
|
|
//seq5.start(env.agent._seq,null);
|
212 |
|
|
seq6.start(env.agent._seq,null);
|
213 |
|
|
phase.drop_objection(this);
|
214 |
|
|
endtask:run_phase
|
215 |
|
|
endclass:nop_command_mode
|
216 |
|
|
|
217 |
|
|
class write_command_mode extends uart_base_test;
|
218 |
|
|
|
219 |
|
|
seq_5p1 seq1;
|
220 |
|
|
seq_5p2 seq2;
|
221 |
|
|
seq_5p3 seq3;
|
222 |
|
|
seq_5p4 seq4;
|
223 |
|
|
seq_5p5 seq5;
|
224 |
|
|
seq_5p6 seq6;
|
225 |
|
|
seq_5p7 seq7;
|
226 |
|
|
seq_5p8 seq8;
|
227 |
|
|
seq_5p9 seq9;
|
228 |
|
|
seq_5p10 seq10;
|
229 |
|
|
|
230 |
|
|
`uvm_component_utils(write_command_mode)
|
231 |
|
|
|
232 |
|
|
function new (string name,uvm_component parent);
|
233 |
|
|
super.new(name,parent);
|
234 |
|
|
endfunction:new
|
235 |
|
|
|
236 |
|
|
function void build_phase (uvm_phase phase);
|
237 |
|
|
super.build_phase(phase);
|
238 |
|
|
seq1 = seq_5p1::type_id::create("seq1");
|
239 |
|
|
seq2 = seq_5p2::type_id::create("seq2");
|
240 |
|
|
seq3 = seq_5p3::type_id::create("seq3");
|
241 |
|
|
seq4 = seq_5p4::type_id::create("seq4");
|
242 |
|
|
seq5 = seq_5p5::type_id::create("seq5");
|
243 |
|
|
seq6 = seq_5p6::type_id::create("seq6");
|
244 |
|
|
seq7 = seq_5p7::type_id::create("seq7");
|
245 |
|
|
seq8 = seq_5p8::type_id::create("seq8");
|
246 |
|
|
seq9 = seq_5p9::type_id::create("seq9");
|
247 |
|
|
seq10 = seq_5p10::type_id::create("seq10");
|
248 |
|
|
endfunction:build_phase
|
249 |
|
|
|
250 |
|
|
task run_phase (uvm_phase phase);
|
251 |
|
|
super.run_phase(phase);
|
252 |
|
|
phase.raise_objection(this);
|
253 |
|
|
uvm_test_done.set_drain_time(this,5000);
|
254 |
|
|
seq1.start(env.agent._seq,null);
|
255 |
|
|
seq2.start(env.agent._seq,null);
|
256 |
|
|
seq3.start(env.agent._seq,null);
|
257 |
|
|
seq4.start(env.agent._seq,null);
|
258 |
|
|
seq5.start(env.agent._seq,null);
|
259 |
|
|
seq6.start(env.agent._seq,null);
|
260 |
|
|
seq7.start(env.agent._seq,null);
|
261 |
|
|
seq8.start(env.agent._seq,null);
|
262 |
|
|
seq9.start(env.agent._seq,null);
|
263 |
|
|
seq10.start(env.agent._seq,null);
|
264 |
|
|
phase.drop_objection(this);
|
265 |
|
|
endtask:run_phase
|
266 |
|
|
endclass: write_command_mode
|
267 |
|
|
|
268 |
|
|
class read_command_mode extends uart_base_test;
|
269 |
|
|
|
270 |
|
|
seq_6p1 seq1;
|
271 |
|
|
seq_6p2 seq2;
|
272 |
|
|
seq_6p3 seq3;
|
273 |
|
|
seq_6p4 seq4;
|
274 |
|
|
seq_6p5 seq5;
|
275 |
|
|
seq_6p6 seq6;
|
276 |
|
|
seq_6p7 seq7;
|
277 |
|
|
seq_6p8 seq8;
|
278 |
|
|
seq_6p9 seq9;
|
279 |
|
|
seq_6p10 seq10;
|
280 |
|
|
|
281 |
|
|
`uvm_component_utils(read_command_mode)
|
282 |
|
|
|
283 |
|
|
function new (string name,uvm_component parent);
|
284 |
|
|
super.new(name,parent);
|
285 |
|
|
seq1 = seq_6p1::type_id::create("seq1");
|
286 |
|
|
seq2 = seq_6p2::type_id::create("seq2");
|
287 |
|
|
seq3 = seq_6p3::type_id::create("seq3");
|
288 |
|
|
seq4 = seq_6p4::type_id::create("seq4");
|
289 |
|
|
seq5 = seq_6p5::type_id::create("seq5");
|
290 |
|
|
seq6 = seq_6p6::type_id::create("seq6");
|
291 |
|
|
seq7 = seq_6p7::type_id::create("seq7");
|
292 |
|
|
seq8 = seq_6p8::type_id::create("seq8");
|
293 |
|
|
seq9 = seq_6p9::type_id::create("seq9");
|
294 |
|
|
seq10 = seq_6p10::type_id::create("seq10");
|
295 |
|
|
endfunction:new
|
296 |
|
|
|
297 |
|
|
function void build_phase (uvm_phase phase);
|
298 |
|
|
super.build_phase(phase);
|
299 |
|
|
|
300 |
|
|
endfunction:build_phase
|
301 |
|
|
|
302 |
|
|
task run_phase (uvm_phase phase);
|
303 |
|
|
super.run_phase(phase);
|
304 |
|
|
phase.raise_objection(this);
|
305 |
|
|
seq1.start(env.agent._seq,null);
|
306 |
|
|
seq2.start(env.agent._seq,null);
|
307 |
|
|
seq3.start(env.agent._seq,null);
|
308 |
|
|
seq4.start(env.agent._seq,null);
|
309 |
|
|
seq5.start(env.agent._seq,null);
|
310 |
|
|
seq6.start(env.agent._seq,null);
|
311 |
|
|
seq7.start(env.agent._seq,null);
|
312 |
|
|
seq8.start(env.agent._seq,null);
|
313 |
|
|
seq9.start(env.agent._seq,null);
|
314 |
|
|
seq10.start(env.agent._seq,null);
|
315 |
|
|
phase.drop_objection(this);
|
316 |
|
|
endtask:run_phase
|
317 |
|
|
endclass:read_command_mode
|