T
Tuukka Toivonen
Guest
I'm trying to get Synopsys Design Compiler to synthesize
an adder where I can control the carry-in input. The manual
says:
Compiler replaces the two adders with a simple adder that has a carry
input.
Example: z <= a + b + cin;
<<<<
Now, "cin" can not be of type "bit", because bits can not be added,
right? So I have tried using other types
(natural range 0 to 1, unsigned(0 downto 0))
but I can't get it to work: Synopsys synthesizes always two adders
which is insane.
Does anyone know how to make it to synthesize only one adder
e.g. from the following code:
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.NUMERIC_STD.all;
entity CADD is port(
A: in unsigned(23 downto 0);
B: in unsigned(23 downto 0);
C: in std_ulogic;
R: out unsigned(23 downto 0));
end;
architecture RTL of CADD is
function caddf(A: unsigned(23 downto 0); B: unsigned(23 downto 0); C : std_ulogic) return unsigned is
variable n : natural range 0 to 1;
variable r : unsigned(23 downto 0);
begin
if C='0' then
n := 0;
else
n := 1;
end if;
r := A + B + n;
return r;
end;
begin
R <= caddf(A,B,C);
end;
an adder where I can control the carry-in input. The manual
says:
If your design has two cascaded adders and one has a bit input, VHDLMerging Cascaded Adders With a Carry
Compiler replaces the two adders with a simple adder that has a carry
input.
Example: z <= a + b + cin;
<<<<
Now, "cin" can not be of type "bit", because bits can not be added,
right? So I have tried using other types
(natural range 0 to 1, unsigned(0 downto 0))
but I can't get it to work: Synopsys synthesizes always two adders
which is insane.
Does anyone know how to make it to synthesize only one adder
e.g. from the following code:
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.NUMERIC_STD.all;
entity CADD is port(
A: in unsigned(23 downto 0);
B: in unsigned(23 downto 0);
C: in std_ulogic;
R: out unsigned(23 downto 0));
end;
architecture RTL of CADD is
function caddf(A: unsigned(23 downto 0); B: unsigned(23 downto 0); C : std_ulogic) return unsigned is
variable n : natural range 0 to 1;
variable r : unsigned(23 downto 0);
begin
if C='0' then
n := 0;
else
n := 1;
end if;
r := A + B + n;
return r;
end;
begin
R <= caddf(A,B,C);
end;