forked from lowRISC/opentitan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
usbdev_testplan.hjson
1334 lines (1252 loc) · 58.3 KB
/
usbdev_testplan.hjson
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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright lowRISC contributors (OpenTitan project).
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
{
name: "usbdev"
// TODO: remove the common testplans if not applicable
import_testplans: ["hw/dv/tools/dvsim/testplans/csr_testplan.hjson",
"hw/dv/tools/dvsim/testplans/mem_testplan.hjson",
"hw/dv/tools/dvsim/testplans/intr_test_testplan.hjson",
"hw/dv/tools/dvsim/testplans/alert_test_testplan.hjson",
"hw/dv/tools/dvsim/testplans/tl_device_access_types_testplan.hjson",
"usbdev_sec_cm_testplan.hjson"]
testpoints: [
{
name: smoke
desc: '''
Smoke test of data transfers in each direction, on both the CSR interface
(buffer read/write) and the USB (packet transmission/reception).
- DV environment programs CSRs for suitable pin configuration, leaving the device
unconnected by not driving the DP pullup.
- Program CSRs to enable SETUP packet reception, OUT traffic and IN traffic to a chosen
endpoint.
- Present a buffer description in the AvSetup Buffer FIFO, to receive the SETUP packet.
- Enable the interface (assert DP pull up) to indicate device presence.
- DV host-side detects device presence.
- DV host-side transmits a SETUP packet to device address 0, chosen endpoint.
- Check that the description of the SETUP packet appears in the RxFiFo, with the
expected 'setup' indicator, buffer ID, and a packet length of 8 bytes.
- Check that the SETUP packet has been received into the packet buffer memory and
that the buffer holds the expected content.
- DV host-side checks that ACK was received from usbdev in response to the SETUP packet.
- Repeat the above for a regular OUT data packet using the AvOut Buffer FIFO, using the
same endpoint.
- Populate a buffer with known randomized packet data for collection from a
randomly-chosen endpoint.
- Program CSRs to present the packet for collection by the host.
- DV host-side transmits an IN request to device address 0, chosen endpoint.
- DV host-side collect IN DATA packet, and ACKnowledges receipt.
- Check that the received packet matches against that data written into the buffer.
- Check that CSRs indicate that the packet has been sent.
'''
stage: V1
tests: ["usbdev_smoke"]
}
{
name: in_trans
desc: '''
Verify read and write 1 to clear corresponding bits of the 'in_sent' register.
- Configure the device for an IN transaction to a particular endpoint.
- Read the 'in_sent' register value to get current status of sent packets and
then write 1s to the bits which are already high.
- Verify that reading the register shows only those bits high whose corresponding
endpoints have sent a packet, and - for non-Isochronous transfers - received an ACK
from the host.
- Writing ones must clear the corresponding bits of the 'in_sent' register.
'''
stage: V2
tests: ["usbdev_in_trans"]
}
{
name: data_toggle_clear
desc: '''
Verify the ability to clear Data Toggle bits.
- Set any random bit of the data toggle register from bit 0 to bit 11 then
initiate an IN/OUT transaction on the corresponding endpoint whose bit is asserted.
- Verify that writing 0 to a particular bit (bits 0-11) resets the data toggle bit for
that particular IN/OUT endpoint to DATA0, to resynchronize with the USB host.
- But it does not prevent toggling of the flags upon successful transmission/receipt of
subsequent data packets.
'''
stage: V2
tests: ["usbdev_data_toggle_clear"]
}
{
name: phy_pins_sense
desc: '''
Verify that the 'phy_pins_sense' register reflects the current state of the DUT pins.
- Read the 'phy_pins_sense' register via TL-UL interface and sample the input
and output signals of the DUT at that particular instant.
- Verify that the read value of the register reflects the sampled values of the
inputs and outputs.
'''
stage: V2
tests: ["usbdev_phy_pins_sense"]
}
{
name: av_buffer
desc: '''
Verify the behavior of the Available OUT and Available SETUP Buffer FIFOs.
- Choose at random whether to send a SETUP packet or an OUT packet.
- Write a random 5-bit buffer ID into the 'avoutbuffer' or 'avsetupbuffer' as appropriate.
- Send a SETUP/OUT token packet followed by a DATA packet to the DUT.
- Verify that the packet arrives in the RX FIFO with the expected properties
(buffer ID, packet length and setup/non-setup packet).
- Verify that the specified buffer within the packet buffer memory contains the data that
was transmitted.
'''
stage: V2
tests: ["usbdev_av_buffer"]
}
{
name: rx_fifo
desc: '''
Verify the functionality of rx fifo.
- Send an OUT transaction to the DUT with appropriate data packet.
- After successful reception read the buffer id, setup/out flag and size
from the RX FIFO entry.
- Then perform a read operation on the SRAM with address and control info
provided by the rxfifo.
- Verify that the data read from the SRAM matches the data sent to the
device in the data packet of the OUT transaction.
'''
stage: V2
tests: ["usbdev_pkt_buffer"]
}
{
name: phy_config_tx_osc_test_mode
desc: '''
Verify the oscillator test mode when phy_config.tx_osc_test_mode is enabled.
- Set the phy_config.tx_osc_test_mode.
- Verify that the device starts transmitting the J/K pattern continuously.
'''
stage: V2
tests: ["usbdev_phy_config_tx_osc_test_mode"]
}
{
name: phy_config_eop_single_bit_handling
desc: '''
Verify the correct behavior of the phy_config.eop_single_bit configuration in the PHY module
where a single SE0 bit is recognized as an end of packet, while two successive bits are
required otherwise.
- Set eop_single_bit field true in the 'phy_config' register and then send an OUT data packet with
a single SE0 bit interval at the end followed by J state (bus Idle).
- Verify that the device recognizes this EOP as valid, accepts the packet into the RX FIFO and
does not ignore the packet or raise any link_err interrupts.
'''
stage: V2
tests: ["usbdev_phy_config_eop_single_bit_handling"]
}
{
name: phy_config_pinflip
desc: '''
Verify that the 'phy_config.pinflip' bit swaps the use of the DP and DN signals on both
the input and the output sides of the DUT.
- Set up the DUT as normal but ensure that the 'pinflip' bit is instead set to true.
- Ensure that the agent, including driver and monitor are aware of the pins being swapped.
- Connect the device to the USB.
- Verify that USB_DN is pulled high instead of USB_DP, and that USB_DP remains low.
- Verify that OUT and and IN transactions complete normally and with the expected data
being transferred.
'''
stage: V2
tests: ["usbdev_phy_config_pinflip"]
}
{
name: phy_config_rand_bus_type
desc: '''
Choose a random bus configuration and verify that the smoke sequence still passes.
'''
stage: V2
tests: ["usbdev_phy_config_rand_bus_type"]
}
{
name: phy_config_rx_dp_dn
desc: '''
Verify that the DP/DN input signals may be used to decode the USB traffic without an
external differential receiver.
The USBDEV normally relies upon an external differential receiver to ensure USB 2.0
specification compliance but it can receive traffic directly using just DP and DN for
reduced complexity and/or cost.
- This just runs the smoke test with modified PHY configuration.
'''
stage: V2
tests: ["usbdev_phy_config_rx_dp_dn"]
}
{
name: phy_config_tx_use_d_se0
desc: '''
Verify that the D/SE0 outputs can be used to transmit data rather than the DP and DN
signals.
- This just runs the smoke test with modified PHY configuration.
'''
stage: V2
tests: ["usbdev_phy_config_tx_use_d_se0"]
}
{
name: phy_config_usb_ref_disable
desc: '''
Verify the reference signal generation for clock synchronization may be disabled.
- Generate a number of SOF packets to the DUT.
- Check that the 'usb_ref_val_o' rises indicating that valid packets are being detected.
- Check that 'usb_ref_pulse_o' pulses periodically, in time with the transmission of
SOF packets to the DUT.
- Set the usb_ref_disable field true in the phy_config register, but continue to transmit
the SOF packets.
- Verify that the 'usb_ref_val_o' becomes deasserted and 'usb_ref_pulse_o' no longer
pulses in response to the arrival of SOF packets.
'''
stage: V2
tests: ["usbdev_phy_config_usb_ref_disable"]
}
{
name: max_length_out_transaction
desc: '''
Verify the reception of maximum length OUT data packets.
- Configure the endpoint with 'rxenable_out' bit set and 'ep_enable_out' set.
- Host sends an OUT token followed by the data packet with maximum payload length of 64 bytes.
- Verify that the DUT acknowledges through an ACK handshake packet.
- Check that the received data packet within the DUT packet buffer memory matches the
packet data that was transmitted.
'''
stage: V2
tests: ["usbdev_max_length_out_transaction", "usbdev_stream_len_max"]
}
{
name: max_length_in_transaction
desc: '''
Verify the transmission of maximum length IN data packets.
- Configure the DUT to present a known packet of maximum length (64 bytes) for collection
by the host.
- Host sends an IN token, then device sends the data packet with maximum payload length of 64 bytes.
- Verify that the usbdev responds appropriately to the ACK by recording that the IN DATA packet
was successfully transmitted.
- DV host-side shall check that the IN data packet contains the expected data with no
bit stuffing errors and with a correct CRC16.
'''
stage: V2
tests: ["usbdev_max_length_in_transaction"]
}
{
name: min_length_out_transaction
desc: '''
Verify the reception of minimum length OUT data packets.
- Configure the endpoint with 'rxenable_out' bit set and 'ep_enable_out' set.
- Host sends an OUT token followed by the data packet with minimum payload length of 0 bytes.
- Verify that the DUT acknowledges through an ACK handshake packet.
- Check that the received data packet within the DUT packet buffer memory matches the
packet data that was transmitted.
'''
stage: V2
tests: ["usbdev_min_length_out_transaction"]
}
{
name: min_length_in_transaction
desc: '''
Verify the transmission of minimum length IN data packets.
- Configure the DUT to present the known packet of minimum length (0 bytes) for collection
by the host.
- Host sends an IN token, then device sends the data packet with minimum payload length of 0 bytes.
- Verify that the usbdev responds appropriately to the ACK by recording that the IN DATA packet
was successfully transmitted.
- DV host-side shall check that the IN data packet contains the expected data with no
bit stuffing errors and with a correct CRC16.
'''
stage: V2
tests: ["usbdev_min_length_in_transaction"]
}
{
name: random_length_out_transaction
desc: '''
Verify the reception of random length OUT data packets.
- Configure the endpoint with 'rxenable_out' bit set and 'ep_enable_out' set.
- Host sends an OUT token followed by the data packet with random payload length
between 0 and 64 bytes.
- Length from 0 inclusive to 64 inclusive should be supported.
- Verify that the DUT acknowledges receipt with an ACK handshake packet.
'''
stage: V2
tests: ["usbdev_random_length_out_transaction"]
}
{
name: random_length_in_transaction
desc: '''
Verify the transmission of random length IN data packets.
- Configure the DUT to present a packet of known random length (0-64 bytes, inclusive) and
content for collection by the host.
- Host sends an IN token, then device sends the data packet.
- Verify that the DUT records successful transmission of the data packet by setting the
corresponding bit of the 'in_sent' register.
'''
stage: V2
tests: ["usbdev_random_length_in_transaction"]
}
{
name: out_stall
desc: '''
Verify the functionality of OUT endpoint stall.
- Set the 'out_stall' register's bit to 1 for a particular endpoint, then host issues an OUT token packet
followed by data packet for that endpoint.
- Verify that the device responds with the PID STALL Handshake.
'''
stage: V2
tests: ["usbdev_out_stall"]
}
{
name: in_stall
desc: '''
Verify the functionality of IN endpoint stall.
- Set the 'in_stall' register's bit to 1 for a particular endpoint, then host issues an IN token packet
for a particular endpoint.
- Verify that the device responds with the PID STALL Handshake.
'''
stage: V2
tests: ["usbdev_in_stall"]
}
{
name: out_iso
desc: '''
Verify the functionality of isochronous transfer for OUT transaction.
- Set the 'out_iso' register's bit to 1 for a paricular endpoint, then host issues an OUT token to that
endpoint followed by the OUT data packet.
- Verify that the device does not send any handshake packet in response.
'''
stage: V2
tests: ["usbdev_out_iso"]
}
{
name: in_iso
desc: '''
Verify the functionality of isochronous transfer for IN transaction.
- Set the 'in_iso' register's bit to 1 for an endpoint, then host issues an IN token to that endpoint.
- Configure the DUT with a data packet availabile for collection from that endpoint.
- Host sends an IN request and collects the IN data packet, but does not send a handshake response.
- Verify that the device signals successful transmission of the packet via the 'in_sent' register
without awaiting a handshake packet from the host.
'''
stage: V2
tests: ["usbdev_in_iso"]
}
{
name: pkt_received
desc: '''
Verify the interrupt functionality of packet reception.
- Send an OUT/SETUP token packet to an enabled endpoint while enabling the INTR_ENABLE[0] followed by the data.
- Verify that the corresponding interrupt pin goes high after the successful OUT/SETUP packet reception.
'''
stage: V2
tests: ["usbdev_pkt_received"]
}
{
name: pkt_sent
desc: '''
Verify the interrupt functionality of packet transmission.
- Send an IN transaction token packet to an enabled endpoint while INTR_ENABLE[1] is 1.
- Verify that the corresponding interrupt pin goes high after sending the successful IN packet.
'''
stage: V2
tests: ["usbdev_pkt_sent"]
}
{
name: disconnected
desc: '''
Verify that if VBUS is lost then link is disconnected.
- VBUS(sense) is set to 0 while INTR_ENABLE[2] is 0.
- Verify that the corresponding Interrupt pin goes high after the link disconnected.
'''
stage: V2
tests: ["usbdev_disconnected"]
}
{
name: host_lost
desc: '''
Verify that if link is active (i.e. not completely idle) but SOF was not received from
host for 4.096 ms, the 'host lost' interrupt becomes asserted.
- Note that there must be _some_ non-idle signaling on the USB during this time because
otherwise the link state will become suspended, and 'host lost' will not be signaled.
- Send SOF from host after 4.096 ms while INTR_ENABLE [3] is set.
- Verify that the corresponding interrupt pin goes high once the host is lost.
- SOF should normally be received every 1 ms.
'''
stage: V2
tests: ["usbdev_host_lost"]
}
{
name: link_reset
desc: '''
Verify that if the link is at SE0 longer than 10 us indicating a link reset
(host asserts for min 10 ms, device can react after 2.5 us) then link reset
will raise.
- Send an SE0 Signal for close to the 10 ms. while INTR_ENABLE [4] is set.
- Verify that the interrupt pin link_reset goes high once the link reset.
'''
stage: V2
tests: ["usbdev_link_reset"]
}
{
name: link_suspend
desc: '''
Verify that if the line has signaled J (Idle) for longer than 3 ms and is therefore in
suspend state the 'link suspend' will be raised.
- Leave the link in idle state for more than 3 ms while enable the INTR_ENABLE [5] is set and
also set the wake_control.suspend_req afterwards.
- Verify that the interrupt pin goes high once the link suspended.
'''
stage: V2
tests: ["usbdev_link_suspend"]
}
{
name: link_resume
desc: '''
Verify that when the link becomes active again after being suspended link resume will rise.
- First suspend the link by keeping J signal for 3.1ms and then resume it by changing the
polarity for 20ms. While the INTR_ENABLE[6] bit is set, also set the wake_control.wake_ack signal.
- Verify that the interrupt pin link_resume goes high once the link resume.
'''
stage: V2
tests: ["usbdev_link_resume"]
}
{
name: av_empty
desc: '''
Verify the functionality of 'av_out_empty' and 'av_setup_empty' interrupts when the
Av OUT/SETUP Buffer FIFO is empty.
- Choose at random whether to test the AV OUT Buffer FIFO or the AV SETUP Buffer FIFO.
- Enable the interrupt for AV OUT/SETUP empty by setting INTR_ENABLE[7/17] and then send back to back
packets to the device.
- Receive and discard any buffers that appear in the RX FIFO.
- Verify that this interrupt pin goes high once the Av OUT/SETUP Buffer FIFO is empty.
'''
stage: V2
tests: ["usbdev_av_empty"]
}
{
name: rx_full
desc: '''
Verify the functionality of rx_full signal when RX FIFO is full.
- Enable the interrupt for RX full by setting INTR_ENABLE[8] and then send back to back packets
to the device.
- Don't service the packets received by popping out from rx_fifo; leave it to become full.
- Verify that this interrupt pin goes high once the received fifo is full.
'''
stage: V2
tests: ["usbdev_rx_full"]
}
{
name: av_overflow
desc: '''
Verify that if a write was done to either the Available OUT Buffer FIFO or the Available
SETUP Buffer FIFO when the FIFO was full the 'av_overflow' signal becomes high.
- Fill both of the Available buffer FIFOs.
- Choose at random whether to supply an additional OUT buffer or a SETUP buffer.
- Attempt to write a buffer ID to the chosen FIFO.
- Verify that this interrupt pin goes high indicating that the available fifo has
reached the overflowing condition.
'''
stage: V2
tests: ["usbdev_av_overflow"]
}
{
name: link_in_err
desc: '''
Verify that if a packet to an IN endpoint started to be received but was then dropped due to an error
then link_in_err will raise.
- Send an IN token to the device for initiating an IN transaction.
- The device should respond with an IN data packet.
- DV environment returns an invalid crc16 or unexpected PID in the handshake packet.
- Verify that the link_in_err interrupt goes high following the handshake packet sent by the host.
'''
stage: V2
tests: ["usbdev_link_in_err"]
}
{
name: rx_crc_err
desc: '''
Verify that if a CRC error occurred then rx_crc_err will raise.
- Send a token/data packet to the device while intentionally corrupting any of the CRC bits.
- Verify that the rx_crc_err goes high following the reception of the invalid packet.
'''
stage: V2
tests: ["usbdev_rx_crc_err"]
}
{
name: rx_pid_err
desc: '''
Verify that if an invalid packed identifier (PID) was received then rx_pid_err will raise.
- Send an invalid PID to the device with the higher bits not complementing the lower bits.
- Verify that the interrupt pin goes high indicating PID error.
'''
stage: V2
tests: ["usbdev_rx_pid_err"]
}
{
name: rx_bitstuff_err
desc: '''
Verify that if an invalid bit stuffing was received then rx_bitstuffing_err will raise.
- generate a packet with 7 consecutive ones (bypassing bitstufffing) on data line.
- Verify that the interrupt pin goes high indicating bitstuff error.
'''
stage: V2
tests: ["usbdev_bitstuff_err"]
}
{
name: link_out_err
desc: '''
Verify that if a packet to an OUT endpoint started to be received but was then dropped due to an error
then link_out_err will raise.
- send an out packet to the device with invalid crc, token, avbuffer_empty, rx_fifo full conditions.
- Verify that the interrupt pin goes high indicating an error in the link in OUT transaction.
'''
stage: V2
tests: ["usbdev_link_out_err"]
}
{
name: enable
desc: '''
Verify that DUT connects to the USB when enable is set.
- set USB_CTRL_enable pin high.
- Make sure 'phy_config.pinflip' isn't set.
- Verify that the 'usb_dp_pullup_o' pin goes high.
'''
stage: V2
tests: ["usbdev_enable"]
}
{
name: resume_link_active
desc: '''
Verify that the DUT moves from the LinkPowered state to the LinkResuming state in response to
the 'resume_link_active' bit being set.
- Disconnect VBUS.
- Read the link state from `usbstat` register to see if it is in Disconnected state and
restore VBUS and the pull up.
- The DUT should move to the Powered state.
- Send resume signaling (K state) for 20 ms and set the usbctrl.resume_link_active.
- Verify that the DUT moves into the Resuming state and subsequently ActiveNoSOF.
'''
stage: V2
tests: ["usbdev_resume_link_active"]
}
{
name: device_address
desc: '''
Verify that the device ignores all packets with addresses that do not match the
assigned device address.
- Assign device address to (usbctrl[22:16]) and send packets to this address.
- Send packets to other addresses.
- Verify that the device responds to all packets sent by the DV environment (USB side)
to the assigned address.
- Verify that the device ignores all packets that are sent to other addresses.
'''
stage: V2
tests: ["usbdev_device_address"]
}
{
name: invalid_data1_data0_toggle_test
desc: '''
Verify the detection and reporting of unexpected Data Toggle bits.
- Send a sequence of OUT data packets to the device without toggling between DATA0 and
DATA1 PIDs in consecutive data packets.
- Verify that the interrupt pin goes high indicating a link error during OUT
transactions.
'''
stage: V2
tests: ["usbdev_invalid_data1_data0_toggle_test"]
}
{
name: setup_stage
desc: '''
Verify the SETUP stage of enumeration.
- Send a setup token with a valid setup packet followed by a DATA0 packet requesting
information about device i.e. descriptors.
- Verify that the device ACKs the setup packet.
'''
stage: V2
tests: ["usbdev_setup_stage"]
}
{
name: endpoint_access
desc: '''
Verify the accessibility of all endpoints when endpoints are enabled.
- Access all the endpoints of the device in IN and OUT direction by enabling ep_out_enable and
ep_in_enable along with rxenable_out for OUT transaction.
- Verify that the device allows access to all endpoints by responding with ACK for OUT
accesses and data_packet for IN Accesses.
'''
stage: V2
tests: ["usbdev_endpoint_access"]
}
{
name: disable_endpoint
desc: '''
Verify that packet transmission (IN and SETUP) and reception requests (IN) are ignored when
endpoints are disabled.
- Disable an endpoint by clearing bit of ep_out_enable and ep_in_enable.
- Then initiate an IN/OUT transaction to that endpoint.
- Verify that the Out transactions as well as IN transactions sent to the device on the
particular endpoint will be ignored.
'''
stage: V2
tests: ["usbdev_disable_endpoint"]
}
{
name: endpoint_types
desc: '''
Exercise all permutations of endpoint configuration bits with all possible token packets
(SETUP, OUT, IN and PRE).
- Randomize all endpoint configuration bits (ep_out_enable, ep_in_enable,
out_stall, in_stall, rxenable_out, rxenable_setup, set_nak_out, out_iso, in_iso).
- Targeting only the correct device address with randomized traffic, check that only the
expected traffic is received by the DUT and that all other packets are correctly dropped.
'''
stage: V2
tests: ["usbdev_endpoint_types"]
}
{
name: out_trans_nak
desc: '''
Verify the functionality of OUT transaction when rxenable_out is not set.
- clear a particular endpoint bit for rx_enable_out register.
- Then send an out transaction to that endpoint.
- Verify that the OUT transactions shall be NAKED by OUT endpoints.
'''
stage: V2
tests: ["usbdev_out_trans_nak"]
}
{
name: setup_trans_ignored
desc: '''
Verify the functionality of SETUP transaction when rxenable_setup is not set.
- clear a particular endpoint bit for rxenable_setup register.
- Then send a setup transaction to that endpoint.
- Verify that the SETUP transactions shall not be received by enabled OUT endpoints
if rxenable_setup is not set.
'''
stage: V2
tests: ["usbdev_setup_trans_ignored"]
}
{
name: nak_trans
desc: '''
Verify the functionality of OUT transaction when set_nak_out is set.
- Set_nak_out and rxenable_out are both set
- Issue OUT transaction and observe it complete.
- Observe rxenable_out cleared.
- Issue OUT transaction and observe it get NAK'd.
- Verify that the OUT transactions shall be NAKED for disabled endpoint and
the corresponding bit in rxenable_out register will be cleared.
'''
stage: V2
tests: ["usbdev_nak_trans"]
}
{
name: stall_trans
desc: '''
Verify that enabling out_stall shall cause STALL response to
attempted OUT transactions.
- Set out_stall register bits for a particular transaction.
- Verify that we will get STALL response when we try to attempt OUT transactions.
'''
stage: V2
tests: ["usbdev_stall_trans"]
}
{
name: setup_priority_over_stall_response
desc: '''
Verify that enabling STALL response does not prevent the reception of a SETUP
transaction/packet. Receipt of the SETUP packet shall clear both the `in_stall` and
the `out_stall` bits for that endpoint.
- Configure an endpoint for stall response to OUT transactions and then send a SETUP
transaction to the device on the stalled endpoint.
- Verify that the SETUP transaction, being higher in priority, clears both in_stall and
out_stall bits for that endpoint.
'''
stage: V2
tests: ["usbdev_setup_priority_over_stall_response"]
}
{
name: stall_priority_over_nak
desc: '''
Verify that if the configuration has both STALL and NAK enabled the STALL
handshake will take priority.
- Configure an endpoint with STALL as well as NAK responses then issue an OUT
transaction to that endpoint.
- Verify that the STALL being higher in priority will take precedence over NAK responses.
'''
stage: V2
tests: ["usbdev_stall_priority_over_nak"]
}
{
name: pending_in_trans
desc: '''
Verify that the a Link Reset or SETUP transaction cancels any waiting IN transactions
by clearing the rdy bit in the configin register of all endpoints.
- Configure an endpoint for transmission by setting fields in 'configin[ep]' register and
then setting the 'rdy' bit to 1.
- Send a SETUP transaction to that endpoint or issue a link reset.
- Verify that the 'rdy' bit in 'configin[ep]' is cleared and the 'pend' bit is set to 1.
'''
stage: V2
tests: ["usbdev_pending_in_trans"]
}
{
name: streaming_test
desc: '''
Verify the streaming capability of an endpoint in OUT transaction mode.
- Issue back to back data packets to a particular enabled endpoint.
- Read the information from RX FIFO as soon as a packet is received
along with the buffer in the SRAM.
- Send the buffer ID back to Available buffer FIFO after successful buffer read.
- Verify that the device is capable of handling the streaming traffic for a
large number of iterations without Available OUT Buffer FIFO becoming empty or the
RX FIFO becoming full.
'''
stage: V2
tests: ["usbdev_streaming_out"]
}
{
name: max_clock_error_untracked
desc: '''
Verify the functionality of DUT at maximum clock frequency deltas.
This test does not attempt to model the adjustment of the usb_clk oscillator,
in response to SOF packets received from the USB host, and therefore cannot
support the full frequency mismatch required by the USB 2.0 protocol specification.
- Clock the device and the agent with opposite extremes of allowable frequency
ranges and initiate a transaction with maximum data length.
- Verify that the transactions occur successfully between the device and host agent
in both directions, and that all transmitted bytes are decoded correctly.
- Verify that there are no reports of bit stuffing errors or CRC errors.
'''
stage: V2
tests: ["usbdev_freq_loclk",
"usbdev_freq_hiclk"]
}
{
name: max_clock_error_tracking
desc: '''
Verify the functionality of DUT at maximum clock frequency difference, adjusting the
frequency of 'usb_clk' in response to the arrival times of the SOF packets sent
from the USB host agent.
- Implement tracking of the SOF packets from the host, using the 'usb_ref_pulse_o'
signal from the DUT to adjust the USB device clock.
- With the USB host agent operating at the maximum frequency permissible within the
USB 2.0 protocol specification, start the USB device operating at the minimum
permissible frequency and check that SOF packets are still received and decoded
correctly.
- Check that the 'usb_ref_pulse_o' signal is produced as expected, and that the
'usb_clk' signal increases in frequency to match that of the USB host agent.
- Verify that full length packet transmission to and from the host occurs successfully
without reports of bit stuffing errors or CRC errors.
- Repeat the above with the USB host agent at the minimum permissible frequency and
the USB device starting at the maximum frequecy.
'''
stage: V2
tests: ["usbdev_freq_loclk_max",
"usbdev_freq_hiclk_max"]
}
{
name: max_phase_error
desc: '''
Verify that the device and host can work in different phase corners of the 48 MHz clock.
- Clock the device and the agent with opposite corners of phases and initiate a
transaction with maximum data length.
- Verify that the transaction between the host agent and device must be successful by
raising interrupts for succesful packet reception or transmission after the end
of the transaction.
'''
stage: V2
tests: ["usbdev_freq_phase"]
}
{
name: min_inter_pkt_delay
desc: '''
Verify the minimum 2 bit times from the SE0-to-J transition (from EOP) to the
J-to-K transition.
- Send at random either a SETUP token packet or an OUT token packet to the DUT.
- After just 2 bit intervals of Idle state, transmit a DATA packet to the DUT.
- Verify that the packet is received, decoded correctly and ACKnowledged by the DUT.
'''
stage: V2
tests: ["usbdev_min_inter_pkt_delay"]
}
{
name: max_inter_pkt_delay
desc: '''
Verify the maximum 7.5 bit times from the SE0-to-J transition (from EOP) to
the J-to-K transition.
- Send at random either a SETUP token packet or an OUT token packet to the DUT.
- After 7.5 bit intervals of Idle state, transmit a DATA packet to the DUT.
- Verify that the packet is received, decoded correctly and ACKnowledged by the DUT.
'''
stage: V2
tests: ["usbdev_max_inter_pkt_delay"]
}
{
name: device_timeout_missing_host_handshake
desc: '''
Verify that the device times out an IN transaction if it does not receive a
handshake response from the host.
- Configure the DUT to present a single packet for IN collection.
- Collect a non-Isochronous IN packet from the DUT but do not send a handshake packet.
- Host sends a random choice of SETUP, OUT or IN token packet to the DUT.
- Check that the packet is still marked as 'rdy' and that 'in_sent' is not set.
- Retry the IN packet collection and this time send the ACK handshake within the normal
response period.
- Check that that packet is collected, that 'rdy' is cleared and that the
'in_sent' register bit indicates successful transmission of the packet.
'''
stage: V2
tests: ["usbdev_timeout_missing_host_handshake"]
}
{
name: device_timeout
desc: '''
Verify that the device times out transactions when a host response is 18 bit times
after the packet transmitted by the DUT.
- Configure the DUT to present a single packet for IN collection.
- Collect a non-Isochronous IN packet from the DUT but do not send a handshake packet
in response within 18 bit intervals.
- Check that the packet is still marked as 'rdy' and that 'in_sent' is not set.
- Send a delayed ACKnowledge handshake packet to the DUT.
- Check that the packet is still marked as 'rdy' and that 'in_sent' is not set.
- Retry the IN packet collection and this time send the ACK handshake within the normal
response period.
- Check that that packet is collected, that 'rdy' is cleared and that the
'in_sent' register bit indicates successful transmission of the packet.
'''
stage: V2
tests: ["usbdev_device_timeout"]
}
{
name: packet_buffer
desc: '''
Exercise all buffers within the packet buffer memory, performing reads and writes of
packet buffer data from both sides (CSR and USB) simultaneously.
- Randomly choose between IN and OUT packet transfer on the USB side.
- Randomly choose between buffer read and buffer write on the CSR side.
- Ensure, however, that the CSR side and the USB side never access the same buffer
simultaneously; this is guaranteed by the contract that exists between hardware and
software.
- Check all transferred data on both sides.
- Ensure that it is possible for individual read and write accesses to occur at the
packet buffer memory from both sides within the same cycle.
Since the packet buffer memory is now a Single Port RAM implementation, this requires
the CSR-side access to be delayed until the USB side is idle.
'''
stage: V2
tests: ["usbdev_pkt_buffer"]
}
{
name: nak_to_out_trans_when_avbuffer_empty_rxfifo_full
desc: '''
Verify that the device sends out NAK responses to OUT transactions when
available buffer is empty and RX FIFO is full.
- send out packets to the device at such a rate that avbuffer gets empty and
RX Fifo becomes full.
- Verify that the device unable to consume packets at such a rate will set NAK
responses even though endpoint is enabled.
'''
stage: V2
tests: ["usbdev_nak_to_out_trans_when_avbuffer_empty_rxfifo_full"]
}
{
name: aon_wake_resume
desc: '''
Verify that the AON/Wake module is able to detect Resume Signaling and indicate that
via the USB device register interface.
- Connect the USB device to the USB host model.
- Send Suspend Signaling to the USB device.
- Verify that the 'link_suspend' interrupt is raised indicating that the USB has been
Idle (J) for at least 3ms.
- Enable the AON/Wake module, leaving it to maintain the pull up state.
- Initiate Resume Signaling, driving the USB into the 'K' state.
- Check that the 'wake_req_aon_o' signal from the 'usbdev_aon_wake' module becomes
asserted.
- Read from the 'wake_events' CSR of the USB device and check that the 'bus_not_idle'
bit is asserted.
- Disable the AON/Wake module and verify that the USB device is still connected,
i.e. the DP pullup is enabled and DP is high.
'''
stage: V2
tests: ["usbdev_aon_wake_resume"]
}
{
name: aon_wake_reset
desc: '''
Verify that the AON/Wake module is able to detect Reset Signaling and indicate that
via the USB device register interface.
- Connect the USB device to the USB host model.
- Enable the AON/Wake module, leaving it to maintain the pull up state.
- Perform a Bus Reset, driving SE0 state onto the USB for at least 10us; the
specification requires at least 10ms of Reset Signaling for a full reset, but the
AON/Wake module should respond a lot faster, to allow time for chip start up and
software reinitialization.
- Check that the 'wake_req_aon_o' signal from the 'usbdev_aon_wake' module becomes
asserted.
- Read from the 'wake_events' CSR of the USB device and check that the 'bus_reset'
bit is asserted.
- Disable the AON/Wake module and verify that the USB device is still connected,
i.e. the DP pullup is enabled and DP is high.
'''
stage: V2
tests: ["usbdev_aon_wake_reset"]
}
{
name: aon_wake_disconnect
desc: '''
Verify that the AON/Wake module is able to detect Bus Disconnection and indicate that
via the USB device register interface.
- Connect the USB device to the USB host model.
- Enable the AON/Wake module, leaving it to maintain the pull up state.
- Verify that the DP pull up remains asserted, indicating the presence of the device
on the USB.
- Lower the VBUS/SENSE signal.
- Check that the 'wake_req_aon_o' signal from the 'usbdev_aon_wake' module becomes
asserted.
- Read from the 'wake_events' CSR of the USB device and check that the 'disconnected'
bit is asserted.
- Check that the DP pull up is no longer asserted; it shall be dropped by the
usbdev_aon_wake module to protect against spurious reconnection.
- Disable the AON/Wake module and verify that the USB device remains disconnected.
'''
stage: V2
tests: ["usbdev_aon_wake_disconnect"]
}
{
name: invalid_sync
desc: '''
Randomized interspersing of valid and invalid USB traffic. Generate bit-level changes
on the USB that do not constitute valid SYNC signaling, interspersed with valid USB
traffic to/from the device.
- Set up the device with a single IN and a single OUT endpoint.
- Fully populate the Available OUT Buffer FIFO.
- Stream and check known traffic to (OUT) and from (IN) the device, with the CSR
side simply returning unmodified every OUT packet that is received.
- Randomly select whether to send an OUT packet, request an IN packet or generate
invalid noise (never including a valid SYNC signal) on the USB.
- Verify that all data has been streamed successfully, and that the USB device continued
to operate correctly, ignoring all of the invalid signaling.
'''
stage: V2
tests: ["usbdev_invalid_sync"]
}
{
name: spurious_pids_ignored
desc: '''