Part 6: Bus Functional Models (BFMs) – RTL Design Success

Author: Craig Maiman – Principal RTL Design Consultant

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

5.10 Bus Functional Models

A Bus Functional Model imitates an interface that interacts with your block.  It doesn’t necessarily do all the functions behind the interface, but just enough to act like the real block would act in interfacing with your block.  For instance, a BFM of another custom block that your block interfaces to, likely has just enough functionality to fake that interface.

If your block interfaces to vendor IP, you should investigate whether a behavioral model is available which you could instantiate into your testbench.

Note that the stimulus into your design may itself have to be a BFM in the sense that there may be a protocol involved (e.g., a standard interface with a handshake).

5.11 Debugging Techniques

For simple testbenches looking through waves should be fine for debugging, but for long-running randomized testbenches it can be very difficult to wade through so much output.

An alternative I’ve used is to instrument my code to help narrow down the issue.  This could be done any number of ways, but an example would be to put print statements in state machines and/or conditional statements so, instead of looking at waves, you can use a text editor to look through the text output to see what might be going wrong.

Doing that can at least narrow down where and when the issue might be happening and allow you to bring up the waves and quickly focus on the problem area.

Also, both VHDL and SystemVerilog have assertion commands that you can Imbed in your code to check for illegal states and protocol violations.

The testbench itself can output very useful debugging information.  An example of this is in Section 7 above.

RTL Recommendations

6.1 Follow a Consistent Language and Style

I suggest you code in a consistent and readable style of one language version.  I’ve looked at too much code that is a mix of language versions and unreadable – don’t be that person.  Code using SystemVerilog constructs such as always_comb, always_ff, logic, etc.  Don’t mix in older style Verilog constructs such as always, wire, reg, etc.

Here’s a good SystemVerilog style guide to consider.  Also to be considered as overriding any of your preferences for coding style is what your development team or company specifies as the official coding style.

6.2 Comment Your RTL

The next thing I’d recommend is just as important as the style and that is commenting.  You need to consider that either you or someone will someday look at your code and need to understand how it works.  Again, I’ve seen way too much code that has almost no commenting.

Every complex process should have a header comment describing everything about that process.  The more information you include, the better.

Comment every line that is not simple and make sure it describes the function and reasoning behind that line.  Don’t just restate what the expression is, explain it.

I can’t tell you how many times I’ve looked at my own code a few months after I’ve written it and had no idea of the thinking behind the code.  It may be obvious when you are writing it, but trust me, it won’t necessarily be so obvious later.  This is even more important if someone else will eventually have to look at and understand your code.  When writing the comments assume the reader has no understanding.  I’ve been in this exact situation of having to debug someone else’s code with no comments and it’s no fun.

Also, make sure that the comments get updated if the function changes (also put your initials if multiple people are or have edited the code).

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 www.codasip.com. For more information about RISC-V, visit www.riscv.org.

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.