Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > sum of array

Reply
Thread Tools

sum of array

 
 
VHDL_HELP
Guest
Posts: n/a
 
      03-13-2007
hi every body ,

please please how to calculate the sum of an array ( for example an
array of std_logic_vector(3 downto 0) )

thank you

 
Reply With Quote
 
 
 
 
Jonathan Bromley
Guest
Posts: n/a
 
      03-13-2007
On 13 Mar 2007 06:22:17 -0700, "VHDL_HELP"
<> wrote:

>please please how to calculate the sum of an array ( for example an
>array of std_logic_vector(3 downto 0) )


This is the third time you have asked the same,
very trivial, question. On one of the occasions I offered
a frivolous (but correct) response.

Which part of it have you already tried to do yourself?
Which part of it do you find difficult?

I don't expect any meaningful response, because the
last time I gave a detailed answer to one of your
questions you completely ignored it.
--
Jonathan Bromley, Consultant

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

Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK

http://www.MYCOMPANY.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
 
Reply With Quote
 
 
 
 
VHDL_HELP
Guest
Posts: n/a
 
      03-13-2007
On 13 mar, 14:48, Jonathan Bromley <jonathan.brom...@MYCOMPANY.com>
wrote:
> On 13 Mar 2007 06:22:17 -0700, "VHDL_HELP"
>
> <abai...@gmail.com> wrote:
> >please please how to calculate the sum of an array ( for example an
> >array of std_logic_vector(3 downto 0) )

>
> This is the third time you have asked the same,
> very trivial, question. On one of the occasions I offered
> a frivolous (but correct) response.
>
> Which part of it have you already tried to do yourself?
> Which part of it do you find difficult?
>
> I don't expect any meaningful response, because the
> last time I gave a detailed answer to one of your
> questions you completely ignored it.
> --
> Jonathan Bromley, Consultant
>
> DOULOS - Developing Design Know-how
> VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services
>
> Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
> jonathan.brom...@MYCOMPANY.comhttp://www.MYCOMPANY.com
>
> The contents of this message may contain personal views which
> are not the views of Doulos Ltd., unless specifically stated.


hi im sorry really sorry ,
first off all i did repeat the same question coz it apprear late on
the discussions
what i did is :
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity somme is
Port ( clk : in STD_LOGIC;
din : in STD_LOGIC_VECTOR (3 downto 0);
taille : in STD_LOGIC_VECTOR (2 downto 0);

dout : out STD_LOGIC_VECTOR (3 downto 0)
);
end somme;

architecture Behavioral of somme is
type tab is array(3 downto 0) of STD_LOGIC_VECTOR(3 DOWNTO 0);
signal s : tab;
begin
process(clk)
begin
if clk'event and clk ='1' then
s(conv_integer(taille)) <= din;
end if;
end process;
dout <= s(0) + s(1) + s(2) + s(3);
end Behavioral;


-------------------------------------------------------------------------------------------------------------------
it is correct with syntax but not synthetisable , i want a clear idea
that means how to think with a correct way
sorry again and i didnt mean to nelgect your anwsers but i m working
to find solutions

 
Reply With Quote
 
Mike Treseler
Guest
Posts: n/a
 
      03-13-2007
VHDL_HELP wrote:

> please please how to calculate the sum of an array ( for example an
> array of std_logic_vector(3 downto 0) )


http://www.rixort.com/tutorials/smart-questions.php
 
Reply With Quote
 
D Stanford
Guest
Posts: n/a
 
      03-13-2007
> architecture Behavioral of somme is
> type tab is array(3 downto 0) of STD_LOGIC_VECTOR(3 DOWNTO 0);
> signal s : tab;
> begin
> process(clk)
> begin
> if clk'event and clk ='1' then
> s(conv_integer(taille)) <= din;
> end if;
> end process;
> dout <= s(0) + s(1) + s(2) + s(3);
> end Behavioral;
>



You're problem is probably in using the signal taille as an index into
s. Instead, use taille in a case statement, or as a selector for a
demux.

 
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
Easy task, Sum array element... Why doesn't it work? Walle Wallen Ruby 6 03-29-2010 07:26 PM
Array Sum ElissaT@gmx.de C++ 4 03-18-2009 11:58 AM
Sum of array VHDL_HELP VHDL 10 03-19-2007 02:28 PM
Sum of element array VHDL_HELP VHDL 1 03-15-2007 03:33 AM
Sum of array VHDL_HELP VHDL 0 03-13-2007 11:18 AM



Advertisments
 



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 47 48 49 50 51 52 53 54 55 56 57