Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > variables in synthesis

Reply
Thread Tools

variables in synthesis

 
 
Ajay Kumar Mishra
Guest
Posts: n/a
 
      04-12-2004
Dear everybody,

I have got a query regarding treatment of variable during synthsis of
behavioural code. In the given example, would the presence of
redundant variable assignment "dummy:=temp" have any impact on the
synthesis of the code. Also, is there any directives to follow for
variables while coding. How is it treated by synthesiser.

for example:

process (.., input_sig, output_sig)
variable temp: std_logic;
variable dummy: std_logic;

begin

temp:= input_sig;
dummy:= temp;
output_sig:=dummy;

.....

end process;

thanks,
Ajay
 
Reply With Quote
 
 
 
 
valentin tihomirov
Guest
Posts: n/a
 
      04-12-2004

> I have got a query regarding treatment of variable during synthsis of
> behavioural code. In the given example, would the presence of
> redundant variable assignment "dummy:=temp" have any impact on the
> synthesis of the code. Also, is there any directives to follow for
> variables while coding. How is it treated by synthesiser.
>
> for example:
>
> process (.., input_sig, output_sig)
> variable temp: std_logic;
> variable dummy: std_logic;
>
> begin
>
> temp:= input_sig;
> dummy:= temp;
> output_sig:=dummy;
>
> .....
>
> end process;


This will produce dataflow:
output_sig <= input_sig;

Variables are like temporary references to signals. For ex, temp will be
alias for input_sig, then dummy becomes a reference to the same signal;
finally, output is asserted value of input_sig referenced by dummy.


 
Reply With Quote
 
 
 
 
paris
Guest
Posts: n/a
 
      04-12-2004

"Ajay Kumar Mishra" <> escribió en el mensaje
news: m...
> Dear everybody,
>
> I have got a query regarding treatment of variable during synthsis of
> behavioural code. In the given example, would the presence of
> redundant variable assignment "dummy:=temp" have any impact on the
> synthesis of the code. Also, is there any directives to follow for
> variables while coding. How is it treated by synthesiser.
>
> for example:
>
> process (.., input_sig, output_sig)
> variable temp: std_logic;
> variable dummy: std_logic;
>
> begin
>
> temp:= input_sig;
> dummy:= temp;
> output_sig:=dummy;
>
> .....
>
> end process;
>
> thanks,
> Ajay



actually i'd like to know what's the use of variables in synthesis, is it
right to use them? and how?. I mean, i dont think i've ever used variables
in VHDL (not even in non synthesisable code). Just wondering, why would i'd
need them for?, my designs would be better with variables?, am i missing
something good by not using them?. Just asking because i've been seeing a
lot of designs using variables


 
Reply With Quote
 
valentin tihomirov
Guest
Posts: n/a
 
      04-12-2004

> actually i'd like to know what's the use of variables in synthesis, is it
> right to use them? and how?. I mean, i dont think i've ever used variables
> in VHDL (not even in non synthesisable code). Just wondering, why would

i'd
> need them for?, my designs would be better with variables?, am i missing
> something good by not using them?. Just asking because i've been seeing a
> lot of designs using variables


Variables are ok in synthesis. They intended to make life easier. Example of
an adder for synthesis:

FUNCTION "+"(a, b : BIT_VECTOR)RETURN BIT_VECTOR IS
VARIABLE s : BIT_VECTOR (a'RANGE);
VARIABLE carry : BIT;
VARIABLE bi : integer; -- Indexes b.
BEGIN
carry := '0';
FOR i IN a'LOW TO a'HIGH LOOP
bi := b'low + (i - a'low);
s(i) := (a(i) XOR b(bi)) XOR carry;
carry := ((a(i) OR b(bi)) AND carry) OR (a(i) AND b(bi));
END LOOP;
RETURN (s);
END "+";


 
Reply With Quote
 
Jan Decaluwe
Guest
Posts: n/a
 
      04-12-2004
paris wrote:

> actually i'd like to know what's the use of variables in synthesis, is it
> right to use them? and how?. I mean, i dont think i've ever used variables
> in VHDL (not even in non synthesisable code). Just wondering, why would i'd
> need them for?, my designs would be better with variables?, am i missing
> something good by not using them?.


Yes.

You're missing the opportunity to write much better code (without giving
up quality of synthesis results.)

Apart from the obvious "combinatorial" usage of using a variable for an
intermediate result, synthesis tools can also infer flip-flops from
variables when necessary. It's now almost 15 years since this feature
was introduced in Synopsys DC (1.3a or so?).

Real insight comes when you realize you can combine combinatorial
and sequential usage with the same variable.

Do some googling - it has all been discussed before and is available
for those who want to learn.

Regards, Jan

--
Jan Decaluwe - Resources bvba - http://jandecaluwe.com
Losbergenlaan 16, B-3010 Leuven, Belgium
Python is fun, and now you can design hardware with it:
http://jandecaluwe.com/Tools/MyHDL/Overview.html
 
Reply With Quote
 
Ajay Kumar Mishra
Guest
Posts: n/a
 
      04-13-2004
hello Jan,

>synthesis tools can also infer flip-flops from variables when necessary.

Can you give an example Code and little detail about its interpretation by DC?

> Do some googling - it has all been discussed before and is available
> for those who want to learn

Can you tell us about the place where this dicussion has already been held?

thanks and reagrds,
Ajay
 
Reply With Quote
 
Jan Decaluwe
Guest
Posts: n/a
 
      04-13-2004
Ajay Kumar Mishra wrote:
> hello Jan,
>
>
>>synthesis tools can also infer flip-flops from variables when necessary.

>
> Can you give an example Code and little detail about its interpretation by DC?
>
>
>>Do some googling - it has all been discussed before and is available
>>for those who want to learn

>
> Can you tell us about the place where this dicussion has already been held?


Some google ideas (in Discussion Groups):

group:comp.lang.vhdl Bromley on variable in state machine
group:comp.lang.vhdl Treseler on parallel CRCs
group:comp.lang.vhdl Decaluwe on flip-flop inference from variable
group:comp.lang.verilog Decaluwe on blocking assignments


--
Jan Decaluwe - Resources bvba - http://jandecaluwe.com
Losbergenlaan 16, B-3010 Leuven, Belgium
Python is fun, and now you can design hardware with it:
http://jandecaluwe.com/Tools/MyHDL/Overview.html
 
Reply With Quote
 
 
 
Reply

Thread Tools

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Put variables into member variables or function variables? tjumail@gmail.com C++ 9 03-23-2008 04:03 PM
SOS! newbie question about synthesizable VHDL : synthesis run successfully but post-synthesis failed... walala VHDL 4 09-09-2003 08:41 AM
what are the possible reasons that successful pre-synthesis simulation + successful synthesis = failed post-synthes walala VHDL 4 09-08-2003 01:51 PM
std_logic_vector port doesn't work after synthesis. Mike VHDL 3 07-09-2003 09:10 PM
Synthesis of STD_LOGIC Christopher Bunk VHDL 2 07-04-2003 07:08 AM



Advertisments