𝐐𝐮𝐞𝐬𝐭𝐢𝐨𝐧: 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 𝐬𝐭𝐝_𝐥𝐨𝐠𝐢𝐜_𝐚𝐫𝐢𝐭𝐡?
“𝑺𝒉𝒂𝒓𝒊𝒏𝒈 𝒌𝒏𝒐𝒘𝒍𝒆𝒅𝒈𝒆 𝒊𝒔 𝒕𝒉𝒆 𝒎𝒐𝒔𝒕 𝒆𝒇𝒇𝒊𝒄𝒊𝒆𝒏𝒕 𝒍𝒆𝒂𝒓𝒏𝒊𝒏𝒈 𝒎𝒆𝒕𝒉𝒐𝒅”