Part 5: Directed and Randomized Tests – RTL Design Success

Author: Craig Maiman, Principal RTL Design Consultant

Welcome to the RTL Design Success series — Part 5 of 9

5.6 Directed and Randomized Tests

A good unit-level test (and system-level for that matter) generally consists of two distinct sections: Directed tests and randomized tests.

Directed tests are non-random tests of all the functions of the block, including:

  • All normal functions from all interfaces (e.g., All request types, all pertinent addresses, etc.)
  • Any potential corner cases (see Section 7 below)

Randomized tests are useful for fully stressing a block in an automated manner.  Good, randomized tests randomize everything concerning any inputs to the block.  Random request types, addresses, data, gaps between requests and random responses the block is expecting from its interfaces.  You can also control how the randomization is distributed.  For example, randomized gaps between requests, but control that in a way that forces the gaps to be mostly on the shorter side.

A well designed randomized self-checking testbench should be able to run indefinitely.

A typical testbench will first do all the directed tests which are then followed by the randomized test section.  The testbench ends after some number of iterations of the randomized tests and prints out the results.

One additional feature that is often added to testbenches is performance calculations so any performance goals can be confirmed.  This is usually done in the directed test section during a test that maximizes any data throughput (e.g., zero gap between requests).

If there are multiple clock domains, you might consider running with different frequencies to find any clock domain crossing issues.

Further testing might include combinations of directed and randomized tests to more adequately cover specific parts of the design to satisfy coverage requirements.

5.7 Corner Cases

Corner cases are situations that would “stress” the RTL (could be areas of the block that are of greater concern to the designer due to the complexity of the design).  Cases such as:

  • Race conditions (e.g., Request or response alignment between interfaces, state machine transitions, functional loops, etc.)
  • Potential lock conditions (e.g., two requestors competing for a resource) and any other input combinations that the designer believes could “stress” the RTL
  • Backpressure: State machine handling, FIFO overflow, etc.

Backpressure testing is particularly important for testing designs containing pipelines (stall conditions) and/or FIFOs.  FIFO overflows (and underflows!) must be handled properly with no loss of data.

Backpressure can be created on block interfaces if there are wait-type signals on an interface bus or by delaying bus request acknowledgements.  For directed tests I suggest a test which is guaranteed to causes your block to back up to the point that there are either extended periods of pipeline stalls and/or FIFOs overflow.

For randomized tests, build in randomized long and short waits and/or bus acknowledgements.  For example, try to make it so there will be long periods with lots of backpressure on one interface and blasting requests on another.

Along with the varying backpressure on the block, you should have varied “forward pressure” on the request inputs to the block.  No gap between requests and long gaps between requests.  Varying pressure from all sides will really push the corner case testing.

With total self-checking, your testbench shouldn’t skip a beat in hours of runs.

Stress the block!

5.8 Example Testbench Output

An example of testbench output (This shows 3 different stimulus processes starting up):

# Starting Get Complete Interface…

# Starting RX Side…

# Starting TX Side…

# TX’s and GO’s Match!  TX:          10  GO’s:          10


# TX Count:    10  ACK Count:     0  Timeout Count:    10  Get Timeout Count:     0

# CMD Complete Count:    10  Fail Count:    10

# All Drops accounted for! Expected:          10  Retries:           0  FailRetries:          10


# OPB Unit-Level Test PASSES!


5.9 Protocol Checkers

If your block interfaces to standard busses, you may want to create a state machine which just watches the protocol to ensure that all the activity on the bus are legal (assertion commands can also be used for this purpose).  The FPGA or ASIC vendor may have such protocol checkers, so it’s worth looking into, but if not, these are easy to build and can save much grief later.

These checkers are not checking for correct data or any higher-level protocol, but just the low-level bus protocol.

XtremeEDA is an experienced partner you can trust!!

Cadence Design Systems helps engineers pick up the development tempo. A leader in the market for electronic design automation (EDA) software, Cadence sells and leases software and hardware products used to design integrated circuits (ICs), printed circuit boards (PCBs), and other electronic systems. Semiconductor and electronics systems manufacturers use its products to build components for wireless devices, networking equipment, and other applications. The company also provides maintenance and support, and offers design and methodology consulting services. Customers have included Pegatron, Silicon Labs, and Texas Instruments. Cadence gets more than half of its sales from customers outside the US.

Synopsys, Inc. (Nasdaq:SNPS) provides products and services that accelerate innovation in the global electronics market. As a leader in electronic design automation (EDA) and semiconductor intellectual property (IP), Synopsys’ comprehensive, integrated portfolio of system-level, IP, implementation, verification, manufacturing, optical and field-programmable gate array (FPGA) solutions help address the key challenges designers face such as power and yield management, system-to-silicon verification and time-to-results. These technology-leading solutions help give Synopsys customers a competitive edge in quickly bringing the best products to market while reducing costs and schedule risk. For more than 25 years, Synopsys has been at the heart of accelerating electronics innovation with engineers around the world having used Synopsys technology to successfully design and create billions of chips and systems. The company is headquartered in Mountain View, California, and has approximately 90 offices located throughout North America, Europe, Japan, Asia and India.

asicNorth was established in January 2000 with one purpose in mind: deliver the highest quality design services possible. In an industry that can be quite volatile at times, it is important to have a design partner that you can depend upon to deliver the skills you need when you need them. A project can only be successful if there are:

Top quality skills on the team
Communication with the customer
Attention to detail
Cost sensitivity
Focus on the schedule

Today, asicNorth is enabling high-tech industry leaders and startups alike with a combination of digital, analog, and mixed-signal design capabilities. Driven to produce successful results, asicNorth is Making Chips Happen™.

Codasip delivers leading-edge RISC-V processor IP and high-level processor design tools, providing IC designers with all the advantages of the RISC-V open ISA, along with the unique ability to customize the processor IP. As a founding member of RISC-V International and a long-term supplier of LLVM and GNU-based processor solutions, Codasip is committed to open standards for embedded and application processors. Formed in 2014 and headquartered in Munich, Germany, Codasip currently has R&D centers in Europe and sales representatives worldwide. For more information about our products and services, visit For more information about RISC-V, visit

Founded in 1999, Avery Design Systems, Inc. enables system and SOC design teams to achieve dramatic functional verification productivity improvements through the use of

Formal analysis applications for RTL and gate-level X verification;

Robust Verification IP for PCI Express, USB, AMBA, UFS, MIPI, DDR/LPDDR, HBM, HMC, ONFI/Toggle, NVM Express, SCSI Express, SATA Express, eMMC, SD/SDIO, Unipro, CSI/DSI, Soundwire, and CAN FD standards.

Siemens EDA
The pace of innovation in electronics is constantly accelerating. To enable our customers to deliver life-changing innovations to the world faster and to become market leaders, we are committed to delivering the world’s most comprehensive portfolio of electronic design automation (EDA) software, hardware, and services.