Electronic – Type name conflict between FPGA libraries

fpgavhdl

I've procured FPGA cores from two different vendors, both written in VHDL. Both cores have a type defined called ahb_slv_out_vector but the two types are not compatible. I need to use both types in my top-level module but there is an obvious conflict.

The libraries are imported from

work.amba.all

and

<vendorname>.amba.all

How can I disambiguate the two type names in my top level module while allowing other files that import them to continue using them with their current name?

Best Answer

The libraries are imported from
work.amba.all
and
vendorname.amba.all

No they aren't.

They are imported from work.amba and vendorname.amba. The all in the use clauses simply pollutes your namespace with everything in both of those libraries.

So, don't do that.

Instead, use fully qualified names

Use work.amba;  
Use vendorname.amba;  
... 
signal Mine   : work.amba.ahb_slv_out_vector;
signal Theirs : vendorname.amba.ahb_slv_out_vector;

and the two signals will coexist quite happily. Note they are completely different types, so you'll probably have to write type conversion functions between them if they should ever meet.

If most of your code involves the Work library with a few rare exceptions from the other, then you can happily use work.amba.all; to reduce the number of fully qualified names, only using them for the other library.