J
Jim Lewis
KJ,
There is an error in your statement here.
In your example, the to_std_logic is required because
conditionals ("=" ...) return type boolean which
in all definitions of the language is incompatible with
std_ulogic, so you are obligated to convert it and in some
instances (assignments) loose information.
The new overloading requires a condition, in its entirety,
to evaluate to either boolean, std_ulogic, or bit, otherwise
it is an error. The strong typing is still there.
The addition of the "?=" family of operators does not
disturb strong typing either.
to boolean, std_ulogic, or bit, the strong typing
is still there - and it is not any weaker.
For years people have used similar arguments to
keep changes like reading output ports (because
ADA does this - although it was removed in ADA-95),
expressions in port maps, use of the key word
all in place of signals in the sensitivity list
(because having all the signals there is good
documentation), only being able to do conditional
assignments concurrently (because this language
feature is only for dataflow type code and because
you can do it with an if statement in sequential code),
....
Someone always has an argument against one thing or another.
As a result, compromise is the only way to move forward.
The quote I have heard about working on standards is you
do not always get what you want, but you usually end up
with something you can live with.
The problem I see is that while some are attached to
converting std_ulogic/std_logic to boolean using "=",
many others desire not to have to do this.
If you had it all to do over again, doesn't seem odd
to have to fight with the language to convert to boolean
and back again, when many things are more naturally a
bit value (0, 1, X)? So why not make some language
design corrections that account of this.
Overloading a condition to understand std_ulogic and bit
seems to be a reasonable solution. Providing conditionals
that return bit/std_ulogic seems to another logical
extension.
Keep in mind the intent of a strongly typed language is
help you write correct code. I think the more uniform
and consistent you make a language, the easier it is to
compose code and get it right. Since logic designers
often work in one of the bit types (std_ulogic, ...),
I think having a condition accept a bit type
makes the language more uniform and as a result makes
one less likely to make errors.
I don't think the current situation of having to
add "=" and to_std_logic to a condition is going
to make your code any safer from errors. Actually
I think that since it differs from the syntax one
commonly uses for assignments to bit values, that
it actually makes one more likely to make errors.
However, since the change is fully backward compatible,
you are free to keep composing your conditions so they
result in boolean.
Cheers,
Jim
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jim Lewis
Director of Training mailto:[email protected]
SynthWorks Design Inc. http://www.SynthWorks.com
1-503-590-4787
Expert VHDL Training for Hardware Design and Verification
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Taking some liberties in mixing old speak and new speak VHDL, it 'seems'
like these "if" statements are in someway roughly equivalent to
if To_X01(D_sel and Addr ?= X"A5A5") = '1' then
if To_X01(D_sel and To_Std_Logic(Addr = X"A5A5")) = '1' then
or
if To_X01(D_sel) = '1' then
Yes.
> where 'To_Std_Logic' is my previously mentioned boolean to std_ulogic
> conversion function which maintains strong typing
There is an error in your statement here.
In your example, the to_std_logic is required because
conditionals ("=" ...) return type boolean which
in all definitions of the language is incompatible with
std_ulogic, so you are obligated to convert it and in some
instances (assignments) loose information.
The new overloading requires a condition, in its entirety,
to evaluate to either boolean, std_ulogic, or bit, otherwise
it is an error. The strong typing is still there.
The addition of the "?=" family of operators does not
disturb strong typing either.
Since the condition must evaluate in its entiretyand where if the std_ulogic happens to evalutate to '1' (or 'H') that the
'yes' path is taken otherwise the 'no' path is taken. Yes.
> If this is the case,
then it seems to be a poor reason for weakening the strong typing.
to boolean, std_ulogic, or bit, the strong typing
is still there - and it is not any weaker.
For years people have used similar arguments to
keep changes like reading output ports (because
ADA does this - although it was removed in ADA-95),
expressions in port maps, use of the key word
all in place of signals in the sensitivity list
(because having all the signals there is good
documentation), only being able to do conditional
assignments concurrently (because this language
feature is only for dataflow type code and because
you can do it with an if statement in sequential code),
....
Someone always has an argument against one thing or another.
As a result, compromise is the only way to move forward.
The quote I have heard about working on standards is you
do not always get what you want, but you usually end up
with something you can live with.
The problem I see is that while some are attached to
converting std_ulogic/std_logic to boolean using "=",
many others desire not to have to do this.
If you had it all to do over again, doesn't seem odd
to have to fight with the language to convert to boolean
and back again, when many things are more naturally a
bit value (0, 1, X)? So why not make some language
design corrections that account of this.
Overloading a condition to understand std_ulogic and bit
seems to be a reasonable solution. Providing conditionals
that return bit/std_ulogic seems to another logical
extension.
Nope.alternative would be that conditions would now need to have three paths so
an if statement would be of the form
if D_sel
-- Do stuff as if To_X01(D_Sel) = '1'
mostlyelse
-- Do stuff as if To_X01(D_Sel) = '0'
unknownelse
-- Do stuff as if To_X01(D_Sel) = 'X'
end if;
Keep in mind the intent of a strongly typed language is
help you write correct code. I think the more uniform
and consistent you make a language, the easier it is to
compose code and get it right. Since logic designers
often work in one of the bit types (std_ulogic, ...),
I think having a condition accept a bit type
makes the language more uniform and as a result makes
one less likely to make errors.
I don't think the current situation of having to
add "=" and to_std_logic to a condition is going
to make your code any safer from errors. Actually
I think that since it differs from the syntax one
commonly uses for assignments to bit values, that
it actually makes one more likely to make errors.
However, since the change is fully backward compatible,
you are free to keep composing your conditions so they
result in boolean.
Cheers,
Jim
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jim Lewis
Director of Training mailto:[email protected]
SynthWorks Design Inc. http://www.SynthWorks.com
1-503-590-4787
Expert VHDL Training for Hardware Design and Verification
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~