V
valentin tihomirov
Guest
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);
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
How does it not work? Do you get a compile error? Or do you getA <= (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);
assignment is a statement and not an expression.A <= (X when C else Y) xor Z; -- does not work and I have to write
This does not work because conditional signal
be just fine.A <= (X xor Z) when C else (Y xor Z);
For an FPGA target that has 4 input luts, this should
Imagine a 2^n MUX. I don't care about implementation cos synthesier must beA <= (X xor Z) when C else (Y xor Z);
For an FPGA target that has 4 input luts, this should
be just fine.
I have looked into the proposal and cannot undestand why do you move awayHowever, we are working on an expression with
similar syntax. See FT10A under:
on std_logic family types. I like putting SEL first, but at thisImagine 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)?
Functions work great. I would base all my inputs when possible
That would be my preference too, however, it can't beHowever, we are working on an expression with
similar syntax. See FT10A under:
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.
We are having this discussion in the working group too."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.
I think that things must be kept natural. IMHO, the constructions like "X <=That would be my preference too, however, it can't be
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.
Perhaps I'm just not capable to understand, but I do not see the subtleSince 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
As a Java/Delphi programmer I'm not so offensive against ternary operatorHaving looked at a few things, with the comma, I like it,
but I can also live with else. I just cannot live with "?:".