Difference Between the uvm_analysis ports

uvm
haykp picture haykp · Mar 1, 2016 · Viewed 8.1k times · Source

Can you please help to understand the functionality and clear difference between:

  1. uvm_analysis_export
  2. uvm_analysis_port
  3. uvm_analysis_imp

I have searched in internet, there are some explanations, like those:

But still I feel that need more explanation. Can someone help please.

Answer

Ashley Winn picture Ashley Winn · Mar 1, 2016

uvm_analysis_port's are the publisher, they broadcast transactions

uvm_analysis_imp's are the subscriber, they receive transactions and call a function named 'write' in the class in which they are defined.

uvm_analysis_export's can be more confusing, they are used to expose 'imp' ports at higher level of the hierarchy. For example if you have an agent which contains a component with an analysis_imp and you want to make that 'imp' available at the agent's interface level. In this situation you declare and instantiate the analysis_export in the agent class, then in the connect_phase connect the agent's analysis_export to your internal component's analysis_imp.

Its worth noting, exports are for the subscribing side, but on the publishing side regular uvm_analysis_port's can be used in the same way. So agent's can instantiate analysis_ports and connect them to an internal component's analysis_port.

This is good because it allows you to avoid reaching down into the hierarchy when you are connecting components (which makes maintenance easier):

bad:

bus_agent.internal_monitor.packet_port.connect(checker.ref_model.packet_imp) 

good:

bus_agent.packet_port.connect(checker.packet_export)

Its also good to become familiar with the macro uvm_analysis_imp_decl(). It allows you to use more than one analysis_imp in a component.