| // Copyright lowRISC contributors. |
| // Licensed under the Apache License, Version 2.0, see LICENSE for details. |
| // SPDX-License-Identifier: Apache-2.0 |
| { |
| name: "i2c" |
| import_testplans: ["hw/dv/tools/dvsim/testplans/csr_testplan.hjson", |
| "hw/dv/tools/dvsim/testplans/alert_test_testplan.hjson", |
| "hw/dv/tools/dvsim/testplans/intr_test_testplan.hjson", |
| "hw/dv/tools/dvsim/testplans/tl_device_access_types_testplan.hjson", |
| "i2c_sec_cm_testplan.hjson"] |
| testpoints: [ |
| //----------------------------------------------- |
| // Tests for I2C DUT in HOST mode |
| //----------------------------------------------- |
| { |
| name: host_smoke |
| desc: ''' |
| Smoke test in which random (rd/wr) transactions are |
| sent to the DUT and received asynchronously with scoreboard checks. |
| |
| Stimulus: |
| - Configure DUT/Agent to Host/Target mode respectively |
| - Enable DUT host |
| - Clear/Enable interrupt (if needed) |
| - Program OVRD, FDATA register |
| - Randomize I2C timing in TIMING 0-4 registers and other parameters such as TL agent |
| delays |
| - Randomize address and data for read/write transactions sent to the agent by the DUT |
| |
| Checking: |
| - Check the timing behavior of START, STOP, ACK, NACK, and "repeated" START |
| - Read and write transfer matching |
| ''' |
| stage: V1 |
| tests: ["i2c_host_smoke"] |
| } |
| { |
| name: host_error_intr |
| desc: ''' |
| Test error interrupts are asserted by the Host DUT due to |
| interference and unstable signals on bus. |
| |
| Stimulus: |
| - Configure DUT/Agent to Host/Target mode respectively |
| - In host transmit mode, device (target/host) forces sda or scl signal low within the |
| clock pulse of host scl that asserts `sda_interference` or `scl_interference` |
| interrupts |
| - In host receiving mode (data or ack bits), SDA signal is changed with the |
| clock pulse of host scl that asserts `intr_sda_unstable` interrupts |
| - When error interrupt assertions are detected, dut, agent, and scoreboard will be |
| reset on-the-fly then new transaction can be continue programming |
| |
| Checking: |
| - Ensure all intr_scl_interference, intr_sda_interference, and |
| intr_sda_unstable interrupts are asserted and stay asserted until cleared |
| - Ensure IP operation get back normal after on-the-fly reset finished |
| ''' |
| stage: V2 |
| tests: ["i2c_host_error_intr"] |
| } |
| { |
| name: host_stress_all |
| desc: ''' |
| Support vseq (context) switching with random reset in between. |
| |
| Stimulus: |
| - Configure DUT/Agent to Host/Target mode respectively |
| - Combine above sequences in one test to run sequentially |
| except csr sequence and i2c_host_rx_oversample_vseq (requires zero_delays) |
| - Randomly add reset between each sequence |
| |
| Checking: |
| - Ensure transactions are transmitted/received correctly, |
| - Ensure reset is handled correctly |
| ''' |
| stage: V2 |
| tests: ["i2c_host_stress_all"] |
| } |
| { |
| name: host_stress_all_with_rand_reset |
| desc: ''' |
| Support random reset in parallel with stress_all and tl_errors sequences. |
| |
| Stimulus: |
| - Configure DUT/Agent to Host/Target mode respectively |
| - Combine above sequences in one test to run sequentially |
| except csr sequence and i2c_host_rx_oversample_vseq (requires zero_delays) |
| - Randomly add reset within the sequences then switch to another one |
| |
| Checking: |
| - Ensure transactions are transmitted/received correctly |
| - Ensure reset is handled correctly |
| ''' |
| stage: V3 |
| tests: ["i2c_host_stress_all_with_rand_reset"] |
| } |
| { |
| name: host_perf |
| desc: ''' |
| The Host DUT sends and receives transactions at max bandwidth. |
| |
| Stimulus: |
| - Configure DUT/Agent to Host/Target mode respectively |
| - Reduce access latency for all fifos |
| - Issue long read/write back-to-back transactions |
| - Read rx_fifo as soon as read data valid |
| - Clear interrupt quickly |
| |
| Checking: |
| - Ensure transactions are transmitted/received correctly |
| ''' |
| stage: V2 |
| tests: ["i2c_host_perf"] |
| } |
| { |
| name: host_override |
| desc: ''' |
| Test SCL/SDA override. |
| |
| Stimulus: |
| - Configure DUT/Agent to Host/Target mode respectively |
| - Program OVRD register |
| |
| Checking: |
| - Ensure scl_o, sda_o are overridden |
| ''' |
| stage: V2 |
| tests: ["i2c_host_override"] |
| } |
| { |
| name: host_fifo_watermark |
| desc: ''' |
| Test the watermark interrupt of fmt_fifo and rx_fifo. |
| |
| Stimulus: |
| - Configure DUT/Agent to Host/Target mode respectively |
| - Program random fmt_fifo and rx_fifo watermark level |
| - Write data quickly to fmt_fifo and rx_fifo for triggering watermark interrupts |
| |
| Checking: |
| - Ensure the fmt_fifo and rx_fifo watermark interrupts are asserted |
| - Ensure the fmt_fifo and rx_fifo watermark interrupts stay asserted until cleared |
| - Ensure receving correct number of fmt_fifo and rx_fifo watermark interrupts |
| ''' |
| stage: V2 |
| tests: ["i2c_host_fifo_watermark"] |
| } |
| { |
| name: host_fifo_overflow |
| desc: ''' |
| Test the overflow interrupt for fmt_fifo and rx_fifo. |
| |
| Stimulus: |
| - Configure DUT/Agent to Host/Target mode respectively |
| - DUT keeps sending a number of format byte higher than the size of fmt_fifo and |
| rx_fifo depth |
| |
| Checking: |
| - Ensure excess format bytes are dropped |
| - Ensure fmt_overflow and rx_overflow interrupt are asserted |
| ''' |
| stage: V2 |
| tests: ["i2c_host_fifo_overflow"] |
| } |
| { |
| name: host_fifo_reset |
| desc: ''' |
| Test fmt_fifo and rx_fifo reset. |
| |
| Stimulus: |
| - Configure DUT/Agent to Host/Target mode respectively |
| - Fill up the fmt_fifo with data to be sent out |
| - Reset the fifo randomly after a number of bytes shows up on fmt_fifo |
| |
| Checking: |
| - Ensure the remaining entries are not show up after fmt_fifo is reset |
| ''' |
| stage: V2 |
| tests: ["i2c_host_fifo_reset_fmt", "i2c_host_fifo_reset_rx", "i2c_host_fifo_fmt_empty"] |
| } |
| { |
| name: host_fifo_full |
| desc: ''' |
| Test fmt_fifo and rx_fifo in full states. |
| |
| Stimulus: |
| - Configure DUT/Agent to Host/Target mode respectively |
| - Send enough read and write requests to fmt_fifo |
| - Hold reading data from rx_fifo until rx fifo is full |
| |
| Checking: |
| - Check fifo full states by reading status register |
| ''' |
| stage: V2 |
| tests: ["i2c_host_fifo_full"] |
| } |
| { |
| name: host_timeout |
| desc: ''' |
| Test stretch_timeout interrupts. |
| |
| Stimulus: |
| - Configure DUT/Agent to Host/Target mode respectively |
| - Set timeout enable bit of TIMEOUT_CTRL register |
| - Program timeout values (higher than host scl clock pulse) into TIMEOUT_CTRL register |
| - Configure agent to pull down target (device) scl after the bit 9 (ACK) is |
| transmitted |
| |
| Checking: |
| - Ensure stretch_timeout is asserted and a correct number is received |
| |
| ''' |
| stage: V2 |
| tests: ["i2c_host_stretch_timeout"] |
| } |
| { |
| name: host_rx_oversample |
| desc: ''' |
| Host mode: test oversampling on received channel. |
| |
| Stimulus: |
| - Use input clock to sample the target sda (sample with baud rate equal to 1) |
| - Drive scl_rx using input clock |
| |
| Checking: |
| - Read rx data oversampled value and ensure it is same as driven value |
| ''' |
| stage: V2 |
| tests: ["i2c_host_rx_oversample"] |
| } |
| |
| //----------------------------------------------- |
| // Tests for I2C DUT in TARGET mode |
| //----------------------------------------------- |
| { |
| name: target_smoke |
| desc: ''' |
| Smoke test in which random (rd/wr) transactions are |
| sent to the DUT and received asynchronously with scoreboard checks. |
| |
| Stimulus: |
| - Configure DUT/Agent to Target/Host mode respectively |
| - Enable DUT target |
| - Clear/Enable interrupt (if needed) |
| - Randomize I2C timing in TIMING 0-4 registers and other parameters such as TL agent |
| delays |
| - Generate random addresses which are programmed to the DUT (target) |
| and used for transaction sent by the agent (host) |
| |
| Checking: |
| - Check the timing behavior of START, STOP, ACK, NACK, and "repeated" START |
| - Read and write transfer matching |
| ''' |
| stage: V1 |
| tests: ["i2c_target_smoke"] |
| } |
| { |
| name: target_error_intr |
| desc: ''' |
| Test unexp_stop interrupt is asserted by the Target DUT, |
| |
| Stimulus: |
| - Configure DUT/Agent to Target/Host mode respectively |
| - Host agent send STOP after ACK |
| |
| Checking: |
| - Ensure all acq_stop is asserted and stay asserted until cleared |
| - Ensure IP operation get back normal after on-the-fly reset finished |
| ''' |
| stage: V2 |
| tests: ["i2c_target_unexp_stop"] |
| } |
| { |
| name: target_stress_all |
| desc: ''' |
| Support vseq (context) switching with random reset in between. |
| |
| Stimulus: |
| - Configure DUT/Agent to Target/Host mode respectively |
| - Combine above sequences in one test to run sequentiall except csr sequence |
| - Randomly add reset between each sequence |
| |
| Checking: |
| - Ensure transactions are transmitted/received correctly, |
| - Ensure reset is handled correctly |
| ''' |
| stage: V2 |
| tests: ["i2c_target_stress_all"] |
| } |
| { |
| name: target_stress_all_with_rand_reset |
| desc: ''' |
| Support random reset in parallel with stress_all and tl_errors sequences. |
| |
| Stimulus: |
| - Configure DUT/Agent to Target/Host mode respectively |
| - Combine above sequences in one test to run sequentially |
| except csr sequence |
| - Randomly add reset within the sequences then switch to another one |
| |
| Checking: |
| - Ensure transactions are transmitted/received correctly |
| - Ensure reset is handled correctly |
| ''' |
| stage: V3 |
| tests: [""] |
| } |
| { |
| name: target_perf |
| desc: ''' |
| The Host Agent sends and receives transactions at max bandwidth. |
| |
| Stimulus: |
| - Configure DUT/Agent to Target/Host mode respectively |
| - Reduce access latency for all fifos |
| - Issue long read/write back-to-back transactions |
| - Make all fifos accessible without any delay |
| - Clear interrupt quickly |
| |
| Checking: |
| - Ensure transactions are transmitted/received correctly |
| ''' |
| stage: V2 |
| tests: ["i2c_target_perf"] |
| } |
| { |
| name: target_fifo_overflow |
| desc: ''' |
| Test the overflow interrupt for tx_fifo overflow. |
| |
| Stimulus: |
| - Configure DUT/Agent to Target/Host mode respectively |
| - Agent keeps sending a number of format byte higher than the size of tx_fifo |
| Checking: |
| - Ensure excess format bytes are dropped |
| - Ensure tx_overflow interrupt are asserted |
| ''' |
| stage: V2 |
| tests: ["i2c_target_tx_ovf"] |
| } |
| { |
| name: target_fifo_empty |
| desc: ''' |
| Test tx_empty and tx_nonempty interrupt. |
| |
| Stimulus: |
| - Configure DUT/Agent to Target/Host mode respectively |
| - Agent sends transaction to the DUT |
| |
| Checking: |
| - During read transaction, ensure tx_empty interrupt is asserted when no data left |
| in tx_fifo otherwise tx_empty interrupt must be de-asserted |
| ''' |
| stage: V2 |
| tests: ["i2c_target_stress_rd", "i2c_target_intr_smoke"] |
| } |
| { |
| name: target_fifo_reset |
| desc: ''' |
| Test tx_fifo and acq_fifo reset. |
| |
| Stimulus: |
| - Configure DUT/Agent to Target/Host mode respectively |
| - Run read write mixed traffic. |
| - Assert reset any period between stop and the next start. |
| |
| Checking: |
| - Ensure the remaining entries are not show up after each fifio is reset, |
| ''' |
| stage: V2 |
| tests: ["i2c_target_fifo_reset_acq", "i2c_target_fifo_reset_tx"] |
| } |
| { |
| name: target_fifo_full |
| desc: ''' |
| Test acq_fifo and tx_fifo in full states. |
| |
| Stimulus: |
| - Configure DUT/Agent to Target/Host mode respectively |
| - Send enough read and write requests to acq_fifo |
| - Slow down acq fifo read process to trigger acq_full interrupt |
| |
| Checking: |
| - Check fifo full states by reading status register |
| ''' |
| stage: V2 |
| tests: ["i2c_target_stress_wr", "i2c_target_intr_stress_wr"] |
| } |
| { |
| name: target_timeout |
| desc: ''' |
| Test host_timeout interrupts. |
| |
| Stimulus: |
| - Configure DUT/Agent to Host/Target mode respectively |
| - Set timeout enable bit of HOST_TIMEOUT_CTRL register |
| - Agent stops sending clock during an ongoing transaction |
| |
| Checking: |
| - Ensure host_timeout is asserted and a correct number is received |
| |
| ''' |
| stage: V2 |
| tests: ["i2c_target_timeout"] |
| } |
| { |
| name: target_clock_stretch |
| desc: ''' |
| Test clock stretch feature of DUT Target mode. |
| For the write and address transaction, when acq fifo is full, DUT starts to stretch clock. |
| For the read transaction, when dut receives read command, the tx fifo is empty, |
| DUT starts to stretch clock. |
| Using read / write mixed traffic, trigger stretch condition by slowing down acq / tx |
| fifo process. |
| |
| Checking: |
| Ensure all read /write data received correct on the other side without dropping any data. |
| ''' |
| stage: V2 |
| tests: ["i2c_target_stretch"] |
| } |
| { |
| name: bad_address |
| desc: ''' |
| Test sends transactions with a randomized address including two legal (programmed) addresses. |
| Run this test with dut target mode. |
| |
| Checking: |
| All transactions with illegal addresses should be dropped silently and should not disturb |
| transactions with legal address |
| ''' |
| stage: V2 |
| tests: ["i2c_target_bad_addr"] |
| } |
| { |
| name: runt_frame |
| desc: ''' |
| Create tests to interrupt normal transaction by a new 'start' or reset. |
| Run those test with dut host and target mode if possible. |
| |
| Checking: |
| Dut can accept a new transaction after discarding interrupted transaction. |
| ''' |
| stage: V2 |
| tests: ["i2c_target_hrst"] |
| } |
| ] |
| } |