OpenCores
no use no use 1/1 no use no use
Re: Operations within a vector
by Unknown on Apr 20, 2005
Not available!
"Roberto Ammendola" roberto.ammendola at roma2.infn.it> wrote in message news:42665168.3010505 at roma2.infn.it...
global_b
So, how would you calculate global_b, keeping the parametric feature in
your code?


You could always use the or_reduce function in std_logic_misc if you have
the appropriate data types, or write your own which would be similar to the
other reply already posted:

---------------

function or_reduce ( vec : std_logic_vector ) return std_logic is
variable result : std_logic := '0';
begin
for i in vec'range loop
result := result or vec(i);
end loop;
end function or_reduce;

---------------

global_b
---------------

That's what I do, because I'm usually not working with std_logic_vector data
types.

- hoffer





Re: Operations within a vector
by Unknown on Apr 21, 2005
Not available!
"Roberto Ammendola" roberto.ammendola at roma2.infn.it> wrote in message news:426684A9.7060303 at roma2.infn.it...
David Brochart wrote:

>variable global_b : std_logic;
>...
>global_b := '0';
>for i in PARAMETER downto 0 loop
> for j in VECTOR_SIZE downto 0 loop
> global_b := global_b or b(i, j);
> end loop;
>end loop;


thanks David, that's cool.
I just wonder if there is a concurrent way to do it. But I am afraid
that i am searching for something that (V)HDL can handle only in a
sequential statement like above. And anyway I don't think my synthetizer
will encounter many troubles to fit it in the timing requirements...


The above code is "concurrent," as in there is no notion of a clock
anywhere. Wrapping it a function, you can call the function in a concurrent
signal assignment. Putting it process that is sensistive to the appropriate
will make it a concurrent process. Any decent sythesizer should have any
trouble with the for loop. Remember:

a
is no different than:

process is
begin
a wait on b;
end process;

or:

process (b) is
begin
a end process;

or any of the other dozens of ways it could be coded up.

- hoffer





no use no use 1/1 no use no use
© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.