Previous Section Next Section

13.8 Test Scenarios

This section discusses the requirements and the e code required to implement the tests in the "Test Plan" on page 241. Each test is simply a small file containing e code. To run the test, compile the test file with the rest of the e files.

13.8.1 Requirements for Test Scenario 1 (Distribution of Packets)

In this scenario, create packets with a certain probability distribution. There should be a mix of packets of different lengths. There should also be a mix of good and bad parity packets. To do so, extend the struct sbt_packet as follows:

Extend the struct sys as follows:

13.8.2 e Code for Test Scenario 1 (Distribution of Packets)

Example 13-9 presents e code for the test scenario 1 (distribution of packets).

Example 13-9 e Code for Test Scenario 1 (Distribution of Packets)
File contains test that distributes the types
of packets in a probabilistic distribution.
10% SMALL, 20% MEDIUM, 70% LARGE
70% Good parity, 30% Bad parity
<'
import sbt_env; -- Import all units instantiated in the environment.

extend sbt_packet {
    keep soft payload_size == select {  -- Weighted constraint for the
                                        -- payload_size field
        10: SMALL; -- Probability 10%
        20: MEDIUM; -- Probability 20%
        70: LARGE; -- Probability 70%
    };

    keep soft packet_kind == select {-- Weighted constraint for the
                                     -- packet_kind field
        70: GOOD; -- Probability 70%
        30: BAD; -- Probability 30%
    };
};

extend sys {
   keep sbt_env.sbt_driver.no_of_pkts == 50; -- Set number of packets
   -- This field will decide how many packets get generated in the
   -- sbt_driver and are injected into the DUT.
};
'>

13.8.3 Requirements for Test Scenario 2 (Protocol Violation)

In this scenario, create a test that will make the sbt_receiver assert the read_enb_X (read_enb_0, read_enb_1 or read_enb_2) more than 30 clock cycles after vld_chan_X (vld_chan_0, vld_chan_1 or vld_chan2) is asserted. This will violate the protocol. To do so, extend the struct sbt_receiver as follows:

Note the simplicity of e tests. The test files are simply small files with constraints.

13.8.4 e Code for Test Scenario 2 (Protocol Violation)

e code for test scenario 2 (protocol violation) is show in Example 13-10.

Example 13-10 e Code for Test Scenario 2 (Protocol Violation)
File contains test that violates the protocol.
This is done by setting a simple constraint
that will violate the protocol for the latency
between vld_chan_X and read_enb_X.
<'
extend sbt_receiver {
    keep rcv_delay == 40;   -- Violate the DUT output protocol rule
                            -- Latency is 40, violates the maximum
                            -- limit of 30
};
'>
Previous Section Next Section