Electronic – a BFM, what does it do in a simulation

bfmbusdesigndigital-logic

When we want to test a digital system and verify its working, we just write a testbench and put in some stimulus for a DUT. Basically this would invovle assigning a value to a signal followed by a wait statement followed by another signal assignment and a wait statement and so on, this is done until we have tried all possible inputs that we want after which the simulation reaches its end.

Now I have come across something called BFM and want to know where does it fit in the scenario. Are there different type of BFMs that exist for different type of tests as there are going to be (occasionally) dozens of signals on a DUT? What I expect that is that a BFM (which stands for bus functional model) contains instructions within it for stimulating the signals of DUT. Thus, in a testbench we shall simply instantiate the BFM and it's corresponding DUT and connect them. Nothing else needs to be done and the DUT shall be simulated without us having to write any lines for signal assignments or wait statements, is my understanding (guess) correct?

Best Answer

BFMs are SW modules which encapsulate the functionality of a HW component (behavioral model). BFMs are not synthesiseable.

The employment of BFMs allows:

  1. To simulate a behavior of HW component when its RTL description is either not available, or the component replaced by BFM has already been verified.
  2. Simplify the verification process by converting a simple commands into complicated sequences of signals inside BFM.

#1 applies when designing a few modules in parallel - BFM is much easier to write and test than a complete RTL design. You can use BFMs in simulation of other modules until the RTL of the modules replaced with BFMs will be ready.

#1 also applies when the module represented by BFM has already been tested (like 3rd party IP) - you don't want to waste time on simulating its internal implementation, but just need some model which can "mimic" the behavior of this IP while consuming less computational time.

#2 says that BFMs might be employed in order to translate simple commands (like write(pcie_prim, mem_rd32, data, ...)) into a (complicated) sequence of signals' assignments which represent some complex protocol (like PCIe).

You are welcome to read this SNUG paper for much broader discussion.

Related Topic