
๐๐ฎ๐๐ฌ๐ญ๐ข๐จ๐ง: Is it a problem to add all numeric_std, std_logic_arith and std_logic_unsigned packages in a module?
๐๐ง๐ฌ๐ฐ๐๐ซ: Both the std_logic_arith and the numeric_std packages declare unsigned & signed types. When you use both packages and declare unsigned/signed signals, Vivado sees the conflict and gives error during synthesis with the messages:
[๐๐ฆ๐๐กโ 8-2361] ๐๐ข๐๐ก๐๐๐๐ ๐๐๐๐๐๐๐๐ก๐๐๐๐ ๐๐ ๐ข๐๐ ๐๐๐๐๐ ๐๐๐๐๐ข๐๐๐ ๐ฃ๐๐ ๐๐ข๐๐ก๐๐๐๐ ๐ข๐ ๐ ๐๐๐๐ข๐ ๐๐ ; ๐๐๐๐ ๐๐๐ ๐๐๐๐ ๐๐๐๐๐๐ก๐๐ฆ ๐ฃ๐๐ ๐๐๐๐
Most prefer using numeric_std when working with arithmetic operations, especially if you need to define explicitly signed or unsigned numbers. If you are working with both signed and unsigned numbers in a module then numeric_std and unsigned/signed is the preferred way.
Sometimes in practice using std_logic_arith with std_logic_unsigned seems to be easier, since you donโt need to declare extra signals typed unsigned or signed, but you can use arithmetic operations on std_logic_vector types.
Do not forget numeric_std is an IEEE standard, while std_logic_arith and std_logic_unsigned/signed are Synopsys packages, not IEEE standard packages.
What is your preference? ๐ง๐ฎ๐ฆ๐๐ซ๐ข๐_๐ฌ๐ญ๐ or ๐ฌ๐ญ๐_๐ฅ๐จ๐ ๐ข๐_๐๐ซ๐ข๐ญ๐ก?
โ๐บ๐๐๐๐๐๐ ๐๐๐๐๐๐๐ ๐๐ ๐๐ ๐๐๐ ๐๐๐๐ ๐๐๐๐๐๐๐๐๐ ๐๐๐๐๐๐๐๐ ๐๐๐๐๐๐ โ
