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

Reply

VHDL - Initialization

 
Thread Tools Search this Thread
Old 05-24-2004, 05:40 AM   #1
Default Initialization


Hi everybody,
In the following code I need to (and have to) initialize "sum1" and "sum2"
signals. the first idea was to initialize it when rst='1' but I got the
synthesis failure because of this warning: "Multi-source in Unit <test> on
signal <sum1_8> not replaced by logic. Signal is stuck at GND". Of course
I am using ISE 6.02.
Any idea what is wrong with the code? Or how I can initialize "sum1" and
"sum2"?
Thanks a lot.

Library IEEE;
Use ieee.std_logic_1164.all;
Use ieee.std_logic_arith.all;

entity test is
Port ( clk,rst :in std_logic;
I :in std_logic_vector(7 downto 0);
w1,w2 ut std_logic_vector(8 downto 0));
end test;

architecture Behavioral of test is
signal w1i, w2i : signed(8 downto 0);
signal sum1,sum2 : signed(8 downto 0);
begin
process(I,w1i,w2i)
constant alpha : signed(8 downto 0):= "010000000";
variable IC : signed(7 downto 0);
variable d1,d2,ad1,ad2 : signed(8 downto 0);
variable prod1, prod2 : signed(17 downto 0);
variable prodt1, prodt2: signed(8 downto 0);
begin
IC := signed(I);
d1 := conv_signed(IC,9) - conv_signed(w1i,9);
d2 := conv_signed(IC,9) - conv_signed(w2i,9);
ad1:= abs(d1);
ad2:= abs(d2);
if ad1 <= ad2 then
prod1 := alpha * d1;
prodt1:= prod1 (16 downto ;
sum1 <= w1i+ prodt1;
else
prod2 := alpha * d2;
prodt2:= prod2 (16 downto ;
sum2 <= w2i+ prodt2;
end if;
end process;


process(clk,rst)
begin
if clk'event and clk='1' then
if rst='1' then
w1i<= "000000000";
w2i<= "000001010";
sum1<= "000000000";
sum2<= "000001010";
else
w1i <= sum1;
w2i <= sum2;
end if;
end if;
end process;
w1<= std_logic_vector(w1i);
w2<= std_logic_vector(w2i);
end Behavioral;



spartan
  Reply With Quote
Old 05-24-2004, 06:41 AM   #2
deep
 
Posts: n/a
Default Re: Initialization
You are using two proceses...and assigning some values to sum1 and sum2 in
both ...this should be avoided...try assigning values in one process
only...

--deep



deep
  Reply With Quote
Old 05-24-2004, 02:05 PM   #3
Thomas Stanka
 
Posts: n/a
Default Re: Initialization
Hello,

"deep" <> wrote:
> You are using two proceses...and assigning some values to sum1 and sum2 in
> both ...this should be avoided...try assigning values in one process


It is not only "to be avoided", this is _evil_ until you know exactly
what you are doing.
This construct leads to internal tristate buses which are very nasty
even if you intended to use them.

BTW initialisations in the VHDL-code are only for simulations, they
won't be synthesised.
The OP should rewrite the code in one sequential process with
initialisations done with reset.

bye Thomas


Thomas Stanka
  Reply With Quote
Old 05-24-2004, 06:12 PM   #4
Samuel Fuhrer
 
Posts: n/a
Default Re: Initialization
On Mon, 24 May 2004 01:41:52 -0400, deep <> wrote:

> You are using two proceses...and assigning some values to sum1 and sum2
> in
> both ...this should be avoided...try assigning values in one process
> only...
>
> --deep
>



One way to avoid this kind of mistake is to clearly separate combinatorial
and sequential processes.

Example:

signal sum_present : signed(8 downto 0);
signal sum_next : signed(8 downto 0);

-- sequential process, describing flip flops
process(Clk, Rst)
begin
if Clk'event and Clk='1' then
if rst='1' then
sum_present <= "000000000";
else
sum_present <= sum_next;
end if;
end if;
end process;

-- combinatorial process, describing logic between flip flops
process(sum_present, other_signals)
begin
if ... then
sum_next <= function(sum_present, other_signals);
...
else
sum_next <= ...
...
end if;
end process;


Samuel Fuhrer
  Reply With Quote
Old 05-24-2004, 06:56 PM   #5
ivero
 
Posts: n/a
Default Re: Initialization
Initialize it when rst='1' but in the first process you write.

And one more thing, if signal rst is synchronous you probably do not want to
put it in the sensitivity list of the process (the second you write).

"spartan" <> escribió en el mensaje
news: lkaboutprogramming.com...
> Hi everybody,
> In the following code I need to (and have to) initialize "sum1" and "sum2"
> signals. the first idea was to initialize it when rst='1' but I got the
> synthesis failure because of this warning: "Multi-source in Unit <test> on
> signal <sum1_8> not replaced by logic. Signal is stuck at GND". Of course
> I am using ISE 6.02.
> Any idea what is wrong with the code? Or how I can initialize "sum1" and
> "sum2"?
> Thanks a lot.
>
> Library IEEE;
> Use ieee.std_logic_1164.all;
> Use ieee.std_logic_arith.all;
>
> entity test is
> Port ( clk,rst :in std_logic;
> I :in std_logic_vector(7 downto 0);
> w1,w2 ut std_logic_vector(8 downto 0));
> end test;
>
> architecture Behavioral of test is
> signal w1i, w2i : signed(8 downto 0);
> signal sum1,sum2 : signed(8 downto 0);
> begin
> process(I,w1i,w2i)
> constant alpha : signed(8 downto 0):= "010000000";
> variable IC : signed(7 downto 0);
> variable d1,d2,ad1,ad2 : signed(8 downto 0);
> variable prod1, prod2 : signed(17 downto 0);
> variable prodt1, prodt2: signed(8 downto 0);
> begin
> IC := signed(I);
> d1 := conv_signed(IC,9) - conv_signed(w1i,9);
> d2 := conv_signed(IC,9) - conv_signed(w2i,9);
> ad1:= abs(d1);
> ad2:= abs(d2);
> if ad1 <= ad2 then
> prod1 := alpha * d1;
> prodt1:= prod1 (16 downto ;
> sum1 <= w1i+ prodt1;
> else
> prod2 := alpha * d2;
> prodt2:= prod2 (16 downto ;
> sum2 <= w2i+ prodt2;
> end if;
> end process;
>
>
> process(clk,rst)
> begin
> if clk'event and clk='1' then
> if rst='1' then
> w1i<= "000000000";
> w2i<= "000001010";
> sum1<= "000000000";
> sum2<= "000001010";
> else
> w1i <= sum1;
> w2i <= sum2;
> end if;
> end if;
> end process;
> w1<= std_logic_vector(w1i);
> w2<= std_logic_vector(w2i);
> end Behavioral;
>





ivero
  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
.net framework initialization erro Horvath3081 General Help Related Topics 1 06-22-2009 01:51 AM
Error occurred during initialization of VM java/lang/NoClassDefFoundError: java/lang/ emerald Software 3 05-14-2006 04:47 AM




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