@@ -68,18 +68,10 @@ program test_program (
6868timeunit 1ns ;
6969timeprecision 1ps ;
7070
71- typedef enum { DATA_MODE_RANDOM , DATA_MODE_RAMP , DATA_MODE_PATTERN } offload_test_t ;
72-
7371test_harness_env # (`AXI_VIP_PARAMS (test_harness, mng_axi_vip), `AXI_VIP_PARAMS (test_harness, ddr_axi_vip)) base_env;
7472
75- // set to active debug messages
76- localparam bit DEBUG = 1 ;
77-
78- // dco delay compared to the reference clk
79- localparam DCO_DELAY = 12 ;
80-
81- dmac_api cn0577_dmac_api;
82- pwm_gen_api cn0577_pwm_gen_api;
73+ dmac_api dmac_api_inst;
74+ pwm_gen_api pwm_gen_api_inst;
8375adc_api ltc2387_adc_api;
8476common_api ltc2387_common_api;
8577
@@ -102,12 +94,13 @@ initial begin
10294 `TH .`SYS_RST .inst.IF ,
10395 `TH .`MNG_AXI .inst.IF ,
10496 `TH .`DDR_AXI .inst.IF );
105- cn0577_dmac_api = new (
97+
98+ dmac_api_inst = new (
10699 " CN0577 DMAC API" ,
107100 base_env.mng.sequencer,
108101 `AXI_LTC2387_DMA_BA );
109102
110- cn0577_pwm_gen_api = new (
103+ pwm_gen_api_inst = new (
111104 " CN0577 AXI PWM GEN API" ,
112105 base_env.mng.sequencer,
113106 `AXI_PWM_GEN_BA );
@@ -122,13 +115,13 @@ initial begin
122115 base_env.mng.sequencer,
123116 `AXI_LTC2387_BA );
124117
118+ setLoggerVerbosity (ADI_VERBOSITY_NONE );
119+
125120 base_env.start ();
126121 base_env.sys_reset ();
127122
128123 sanity_tests ();
129124
130- # 100ns ;
131-
132125 data_acquisition_test ();
133126
134127 base_env.stop ();
265258
266259task sanity_tests ();
267260 // ltc2387_common_api.sanity_test();
268- cn0577_dmac_api .sanity_test ();
269- cn0577_pwm_gen_api .sanity_test ();
261+ dmac_api_inst .sanity_test ();
262+ pwm_gen_api_inst .sanity_test ();
270263 `INFO ((" Sanity Tests Done" ), ADI_VERBOSITY_LOW );
271264endtask
272265
@@ -288,45 +281,45 @@ task data_acquisition_test();
288281 end
289282
290283 // Configure AXI PWM GEN
291- cn0577_pwm_gen_api .reset (); // PWM_GEN reset in regmap (ACTIVE HIGH)
284+ pwm_gen_api_inst .reset (); // PWM_GEN reset in regmap (ACTIVE HIGH)
292285
293- cn0577_pwm_gen_api .pulse_period_config (
294- .channel (8'h00 ),
295- .period (32'h1A ));
286+ pwm_gen_api_inst .pulse_period_config (
287+ .channel (8'd0 ),
288+ .period (32'd26 ));
296289
297- cn0577_pwm_gen_api .pulse_width_config (
298- .channel (8'h00 ),
299- .width (32'h01 ));
290+ pwm_gen_api_inst .pulse_width_config (
291+ .channel (8'd0 ),
292+ .width (32'd1 ));
300293
301- cn0577_pwm_gen_api .pulse_period_config (
302- .channel (8'h01 ),
303- .period (32'h1A ));
294+ pwm_gen_api_inst .pulse_period_config (
295+ .channel (8'd1 ),
296+ .period (32'd26 ));
304297
305- cn0577_pwm_gen_api .pulse_width_config (
306- .channel (8'h01 ),
298+ pwm_gen_api_inst .pulse_width_config (
299+ .channel (8'd1 ),
307300 .width (num_of_dco));
308301
309- cn0577_pwm_gen_api .pulse_offset_config (
310- .channel (8'h01 ),
311- .offset (32'h03 ));
302+ pwm_gen_api_inst .pulse_offset_config (
303+ .channel (8'd1 ),
304+ .offset (32'd3 ));
312305
313- cn0577_pwm_gen_api .load_config (); // load AXI_PWM_GEN configuration
314- cn0577_pwm_gen_api .start ();
306+ pwm_gen_api_inst .load_config (); // load AXI_PWM_GEN configuration
307+ pwm_gen_api_inst .start ();
315308 `INFO ((" AXI_PWM_GEN started" ), ADI_VERBOSITY_LOW );
316309
317310 // Configure DMA
318- cn0577_dmac_api .set_irq_mask (
311+ dmac_api_inst .set_irq_mask (
319312 .transfer_completed (1'b0 ),
320313 .transfer_queued (1'b1 ));
321- cn0577_dmac_api .enable_dma ();
322- cn0577_dmac_api .set_flags (
314+ dmac_api_inst .enable_dma ();
315+ dmac_api_inst .set_flags (
323316 .cyclic (1'b0 ),
324317 .tlast (1'b1 ),
325318 .partial_reporting_en (1'b1 ));
326- cn0577_dmac_api .set_lengths (
319+ dmac_api_inst .set_lengths (
327320 .xfer_length_x ((NUM_OF_TRANSFERS * 4 )- 1 ),
328321 .xfer_length_y (32'h0 ));
329- cn0577_dmac_api .set_dest_addr (`DDR_BA );
322+ dmac_api_inst .set_dest_addr (`DDR_BA );
330323
331324 // Configure AXI_LTC2387
332325 ltc2387_adc_api.reset (
@@ -346,7 +339,7 @@ task data_acquisition_test();
346339
347340 transfer_status = 1 ;
348341
349- cn0577_dmac_api .transfer_start ();
342+ dmac_api_inst .transfer_start ();
350343
351344 wait (transfer_cnt == 2 * NUM_OF_TRANSFERS );
352345
@@ -358,12 +351,12 @@ task data_acquisition_test();
358351 // @(posedge system_tb.test_harness.axi_ltc2387_dma.irq);
359352
360353 // Clear interrupt
361- cn0577_dmac_api .clear_irq_pending (
354+ dmac_api_inst .clear_irq_pending (
362355 .transfer_completed (1'b1 ),
363356 .transfer_queued (1'b0 ));
364357
365358 // Stop pwm gen
366- cn0577_pwm_gen_api .reset ();
359+ pwm_gen_api_inst .reset ();
367360 `INFO ((" AXI_PWM_GEN stopped" ), ADI_VERBOSITY_LOW );
368361
369362 // Configure axi_ltc2387
@@ -409,7 +402,6 @@ task data_acquisition_test();
409402
410403 # 2000ns ;
411404 for (int i= 0 ; i<= ((NUM_OF_TRANSFERS ) - 1 ); i= i+ 1 ) begin
412- # 1ns ;
413405 captured_word_arr[i] = base_env.ddr.agent.mem_model.backdoor_memory_read_4byte (xil_axi_uint ' (`DDR_BA + 4 * i));
414406 end
415407
0 commit comments