B
Bibi69
Guest
Hi,
I've a question concerning variable types :
I want to add two 4 bits signed values and a one-bit value.
What seems to be the most efficient method to me is to use a 4-bit adder
with a carry-in bit.
If I write
i1 : in std_logic_vector(3 downto 0);
i2 : in std_logic_vector(3 downto 0);
ci : in std_logic;
o : out std_logic_vector(3 downto 0);
o <= i1+i2+ci;
the synthesis (with xilinx ise 8.1) is ok but people have said me it's
bad to add std_logic_vector and std_logic.
When I use signed and bit types, the synthesizer tells '+' isn't a
correct operator...
Does someone have a piece of advice on what I should do ?
Moreover I want to have three such adders making a tree structure.
If I write :
i1 : in std_logic_vector(3 downto 0);
i2 : in std_logic_vector(3 downto 0);
i3 : in std_logic_vector(3 downto 0);
i4 : in std_logic_vector(3 downto 0);
c1 : in std_logic;
c2 : in std_logic;
c3 : in std_logic;
o : out std_logic_vector(3 downto 0);
I tried o <= (i1+i2+c1)+(i3+i4+c2)+c3;
That doesn't give an efficient result, no adder tree.
To have a good tree structure I have to write :
signal t1 : std_logic_vector(3 downto 0);
signal t2 : std_logic_vector(3 downto 0);
t1 <= i1+i2+c1;
t2 <= i3+i4+c2;
o <= t1+t2+c3;
Does someone know why it's different.
Thx
I've a question concerning variable types :
I want to add two 4 bits signed values and a one-bit value.
What seems to be the most efficient method to me is to use a 4-bit adder
with a carry-in bit.
If I write
i1 : in std_logic_vector(3 downto 0);
i2 : in std_logic_vector(3 downto 0);
ci : in std_logic;
o : out std_logic_vector(3 downto 0);
o <= i1+i2+ci;
the synthesis (with xilinx ise 8.1) is ok but people have said me it's
bad to add std_logic_vector and std_logic.
When I use signed and bit types, the synthesizer tells '+' isn't a
correct operator...
Does someone have a piece of advice on what I should do ?
Moreover I want to have three such adders making a tree structure.
If I write :
i1 : in std_logic_vector(3 downto 0);
i2 : in std_logic_vector(3 downto 0);
i3 : in std_logic_vector(3 downto 0);
i4 : in std_logic_vector(3 downto 0);
c1 : in std_logic;
c2 : in std_logic;
c3 : in std_logic;
o : out std_logic_vector(3 downto 0);
I tried o <= (i1+i2+c1)+(i3+i4+c2)+c3;
That doesn't give an efficient result, no adder tree.
To have a good tree structure I have to write :
signal t1 : std_logic_vector(3 downto 0);
signal t2 : std_logic_vector(3 downto 0);
t1 <= i1+i2+c1;
t2 <= i3+i4+c2;
o <= t1+t2+c3;
Does someone know why it's different.
Thx