Re: How to "or" a generic array of std_logic_vector ?



On Jun 9, 2:07 pm, Andy <jonesa...@xxxxxxxxxxx> wrote:
On Jun 8, 6:52 pm, "KJ" <kkjenni...@xxxxxxxxxxxxx> wrote:





<HansWernerMarsc...@xxxxxx> wrote in message

news:1fdcc58c-906c-4ec7-ad33-c9de3f635e34@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

I want to "or" the "bits" of std_logic_vector for each element of the
vector like this.
data_out(i) shall be '1' if one of the elements of the vector has set
this bit to one.

Somewhat similar to the process approach already covered in this thread is
to use a generate statement...basically the same amount of typing and debug

Gen_This : for i in data_out'range generate
    data_out(i) <= '1' when unsigned(data_out_array(i)) /= 0;
end generate Gen_This;

KJ

The problem (latches) with this solution as well as that in the OP is
that there is no assignment to data_out when the row is 0.

Try:

  data_out(i) <= '1' when unsigned(data_out_array(i)) /= 0 else '0';


That's what I had intended to type...good catch.

KJ
.



Relevant Pages

  • Re: Why use properties?
    ... Funny thing is --- I was just about to post a very similar question to the ... now) is simple assignment?". ... Basically, it comes down to doing more typing now, to potentially save the ... > I believe the main reason why to code in a skeleton property with just a> get/set is to provide future-proofing and easier maintenance in the long> run. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: State Variable latch error
    ... of a combinatorial process, right up front in that process, is a much ... create latches. ... I did in fact go back and do the default assignment style for the ...
    (comp.lang.vhdl)
  • Re: State Variable latch error
    ... I've found that having default assignment statements for every output ... But that's only if I have to use a combinatorial process. ... create latches. ... I did in fact go back and do the default assignment style for the ...
    (comp.lang.vhdl)
  • Re: State Variable latch error
    ... I've found that having default assignment statements for every output ... But that's only if I have to use a combinatorial process. ... create latches. ...
    (comp.lang.vhdl)
  • Re: Explicit variable declaration
    ... typing can be appreciated by some people. ... type declarations can't be enforced without losing a lot of the power ... the names listed in it could be assigned in the local namespace, and assignment to other names wasn't allowed. ...
    (comp.lang.python)