We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

AR# 35513

ISE Simulator (ISim) - Multiple drivers when using VHDL procedures


I wish to use VHDL procedures to make assignments to signals based on arguments to the procedure. 

For example:

procedure Bus_Connect(    
      Signal mod_in : in m2r_abus_m2b_interface_type;
      Signal mod_out : out m2r_abus_b2m_interface_type;
      Constant MDEF : in ch_amod_def_type;
      Signal b2m_interface : in m2r_abus_b2m_interface_array_type;
      Signal m2b_interface : inout m2r_abus_m2b_interface_array_type) is
            if MDEF.m2r_abusid/=0 then
                m2b_interface(MDEF.m2r_abusid).data(MDEF.m2r_abuspos)(MDEF.m2r_abusport) <= mod_in.data;
            end if;
      end procedure Bus_Connect;

I call the VHDL procedure as follows, expecting to make assignments to only a few of the elements on the m2b_interface record:

Bus_Connect(mod1_in,  mod1_out,   MOD1_MDEF,  b2m_interface, m2b_interface);
Bus_Connect(mod2_in,  mod2_out,   MOD2_MDEF,  b2m_interface, m2b_interface);
Bus_Connect(mod3_in,  mod3_out,   MOD3_MDEF,  b2m_interface, m2b_interface);

where MOD#_MDEF are defined as

constant MOD1_MDEF      : ch_amod_def_type :=(id=>01, m2r_abusid=>01, m2r_abuspos=>01, m2r_abusport=>01);
constant MOD2_MDEF      : ch_amod_def_type :=(id=>02, m2r_abusid=>01, m2r_abuspos=>02, m2r_abusport=>01);
constant MOD3_MDEF      : ch_amod_def_type :=(id=>03, m2r_abusid=>01, m2r_abuspos=>03, m2r_abusport=>01);

However when I simulate this HDL construct, the simulator assigns multiple drivers to each element of the m2b_interface record, resulting in 'X's in the simulation. 

The command "show drivers" displays the following:

# show driver /abus_bus_interface_beh_tb/uut_NOT_working/m2b_interface
Driver for /tb/uut/m2b_interface[1].data[1][1].audio_data[0]
      '1'   : /tb/uut/:117
      '0'   : /tb/uut/:118
      '0'   : /tb/uut:/119

Why is ISim assigning multiple drivers to the signal?


VHDL needs to be able to statically (that is, during static elaboration) determine all drivers of a signal, in order to create a static network topology.

A driver is created for the longest static prefix of each target signal.

During elaboration the compiler analyzes the target of each signal assignment statement to determine the smallest portion of the signal that can be statically determined as being driven by a concurrent statement. 

In the case of m2b_interface, which is assigned within a procedure with a list of arguments, the simulator will determine, from the arguments, the longest static prefix for m2b_interface.

In this case, MDEF is an argument of type "ch_amod_def_type", defined as:

 type ch_amod_def_type is
  id     : ch_amod_id_type;          
  m2r_abusid  : integer range 0 to M2R_ABUS_BUS_CNT;    
  m2r_abuspos  : integer range 1 to M2R_ABUS_STAGE_CNT;   
  m2r_abusport : integer range 1 to M2R_ABUS_PORT_CNT;         
 end record;


 constant M2R_ABUS_BUS_CNT   : integer := 1;
 constant M2R_ABUS_STAGE_CNT : integer := 8;
 constant M2R_ABUS_PORT_CNT   : integer := 4;

The simulator will determine that the static network topology for the m2b_interface signal assignments is based on the different combinations available for MDEF. 

That being said, a single call of the VHDL procedure will result in assigned drivers for all elements of the m2b_interface record covered by the range of MDEF. 

This is the reason for the multiple drivers when attempting to use the procedure 3 times concurrently.

To resolve this issue, either unroll the VHDL procedure using concurrent statements, or provide arguments to the procedure in such a way that the scope of the assignments is specifically defined during static elaboration. 

For more HDL tips and advice, please visit the Simulation and Verification discussion board in the Xilinx User Forums or one of the comp.lang.vhdl user groups.
AR# 35513
Date 01/22/2015
Status Active
Type General Article
  • ISE - 10.1
  • ISE Design Suite - 11.1
  • ISE Design Suite - 11.2
  • More
  • ISE Design Suite - 11.3
  • ISE Design Suite - 11.4
  • ISE Design Suite - 11.5
  • ISE Design Suite - 12.1
  • Less
Page Bookmarked