Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - Using carry-in adders with Synopsys

 
Thread Tools Search this Thread
Old 12-01-2003, 06:45 PM   #1
Default Using carry-in adders with Synopsys


I'm trying to get Synopsys Design Compiler to synthesize
an adder where I can control the carry-in input. The manual
says:

>>>>

Merging Cascaded Adders With a Carry
If your design has two cascaded adders and one has a bit input, VHDL
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;


Tuukka Toivonen
  Reply With Quote
Old 12-01-2003, 08:39 PM   #2
Egbert Molenkamp
 
Posts: n/a
Default Re: Using carry-in adders with Synopsys
The following may help:
res:=(l&'1')+(r&cin);

Notice that the operands, l and r, are extended on the right with '1' and
'cin' rsp.
(types of l, r and res are unsigned)
The LSB bit of res is not be used.

Egbert Molenkamp

"Tuukka Toivonen" <> schreef in
bericht news:...
> I'm trying to get Synopsys Design Compiler to synthesize
> an adder where I can control the carry-in input. The manual
> says:
>
> >>>>

> Merging Cascaded Adders With a Carry
> If your design has two cascaded adders and one has a bit input, VHDL
> 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;





Egbert Molenkamp
  Reply With Quote
Old 12-02-2003, 09:39 AM   #3
Tuukka Toivonen
 
Posts: n/a
Default Re: Using carry-in adders with Synopsys
In article <bqg8ui$88b$>, Egbert Molenkamp wrote:
> The following may help:
> res:=(l&'1')+(r&cin);


Thanks! This made my design 22% smaller. I thought about this myself
too but it feels a bit clumsy compared to if the synthesizer could
infer it more automatically... but this will do it for now.


Tuukka Toivonen
  Reply With Quote
Old 12-02-2003, 12:23 PM   #4
Ian Poole
 
Posts: n/a
Default Re: Using carry-in adders with Synopsys
In Synopsys Design Analyzer, set the variable "hdlin_use_cin" to "TRUE".
When I looked at the full list of variables using the Design Analyzer GUI, I
could only find a variable called "hdlin_use_carry_in". This second variable
appears to have no effect!

There is, of course, an issue with synthesis tool portability if you go
setting variables in the Synopsys tool - the solution Egbert gave is
portable, but slightly harder VHDL...

Ian
--
Ian Poole, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * Perl * Tcl/Tk * Verification * Project Services

Doulos Ltd. Church Hatch, 22 Market Place, Ringwood, Hampshire, BH24 1AW, UK
Tel: +44 (0)1425 471223 mail:
Fax: +44 (0)1425 471573 Web: http://www.doulos.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.


"Tuukka Toivonen" <> wrote in
message news:...
> I'm trying to get Synopsys Design Compiler to synthesize
> an adder where I can control the carry-in input. The manual
> says:
>
> >>>>

> Merging Cascaded Adders With a Carry
> If your design has two cascaded adders and one has a bit input, VHDL
> 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;





Ian Poole
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Carry on dvds ^^artnada^^ DVD Video 8 04-05-2008 07:36 PM
Dazzle Box... swt458 Hardware 2 01-15-2008 06:06 AM
DVD's For Sale Galloping DVD Video 3 09-06-2004 05:11 AM
For Sale Galloping DVD Video 0 08-28-2004 10:08 AM
DVD's For Sale Galloping DVD Video 0 08-23-2004 07:57 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46