neocool
Member level 4
Using correct libraries
Hi again,
In the example below, if my vectors contain 2's compliment numbers, what libraries should I use to make the code execute correctly? I don't really care about whether to use TO_SIGNED or CONV_SIGNED. I am just confused when to use which library (std_numeric, std_logic_artith, std_logic_unsigned, std_logic_signed)?
Using these libraries, the code has compiled:
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.all;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
But can I use STD_LOGIC_UNSIGNED in this context of 2's compliment arithmetic?
Should I use std_logic_arith? maybe std_logic_signed?
Can I use std_numeric with std_logic_arith?
Thank you
Hi again,
In the example below, if my vectors contain 2's compliment numbers, what libraries should I use to make the code execute correctly? I don't really care about whether to use TO_SIGNED or CONV_SIGNED. I am just confused when to use which library (std_numeric, std_logic_artith, std_logic_unsigned, std_logic_signed)?
Code:
signal max: sd_logic_vector(9 downto 0);
signal a: sd_logic_vector(9 downto 0);
signal result: sd_logic_vector(10 downto 0);
result <= std_logic_vector(signed(max) - signed(a));
Using these libraries, the code has compiled:
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.all;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
But can I use STD_LOGIC_UNSIGNED in this context of 2's compliment arithmetic?
Should I use std_logic_arith? maybe std_logic_signed?
Can I use std_numeric with std_logic_arith?
Thank you