V
valentin tihomirov
A <= (X when C else Y) xor Z; -- does not work and I have to write
A <= (X xor Z) when C else (Y xor Z);
A <= (X xor Z) when C else (Y xor Z);
valentin said:A <= (X when C else Y) xor Z; -- does not work and I have to write
A <= (X xor Z) when C else (Y xor Z);
This does not work because conditional signalA <= (X when C else Y) xor Z; -- does not work and I have to write
For an FPGA target that has 4 input luts, this shouldA <= (X xor Z) when C else (Y xor Z);
For an FPGA target that has 4 input luts, this should
be just fine.
However, we are working on an expression with
similar syntax. See FT10A under:
Functions work great. I would base all my inputs when possibleImagine a 2^n MUX. I don't care about implementation cos synthesier must be
smart enaught to move XORs from inputs to output of the mux. I have written
a function
function MUX2(I0, I1: std_logic_vector; SEL: boolean) return
std_logic_vector;
that allows XORing its output "N <= MUX(A, B, S) xor C" but I think that the
calculation of expressions should be regulated by VHDL synthax. BTW, what is
the recommendation on the type of mux selection signal, what if it is not
True or False (possible when SEL is std_logic)?
I have looked into the proposal and cannot undestand why do you move away
from "when/else" synthax. Why ... I would just extend
the existing system of conditional assignment.
"A if Sel, B" is better than just going on using "A if C else B" or "A
when C else B". People have adopted this kind of coding, the proposal will
overcomplicate the synthax (for machines and people). Furthermore, I think that
such contractions (like using comma mark instead of "else" keyword)
contradict to the spirit of <<academic>> languages.
done in an unambiguous manner without breaking backward
compatibility - which we are not allowed to do.
We are having this discussion in the working group too.
Some like brief things and wanted "?:". Some like
descriptive. Using "if ," is somewhere between the
two.
If we can allow the else condition to be left off an nnary
expression, my thought is that nnary expressions will replace
conditional signal assignment.
Since it can't be when/else, do you think if we changed
the syntax to if/else that people would get confused and
find the two hard to understand which is which?
From a consistency standpoint,
else is consistent with conditional signal assignment
',' is consistent with selected signal assignment
Having looked at a few things, with the comma, I like it,
but I can also live with else. I just cannot live with "?:".
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.