Forum Discussion
Altera_Forum
Honored Contributor
15 years agocorrect writing style
Hi,
What is the correct writing style: "if (a='1' and b='0' and…… z='1') then idan<='1'; or : "if (a& b&C&…..Z)= x"8038" then idan<='1'; ? What will require less logic elements? Idan :)4 Replies
- Altera_Forum
Honored Contributor
looks like he/she is talking about VHDL
- Altera_Forum
Honored Contributor
I think second one is logically more easy.
Because for the first expression,"a==1",that means comparator is needed which can compare "a" with value "1" everytime.And same for other variables, so comparator hardware will be implemented. While in second one,all ANDing operation will be done,if true then body will be executed. Though second one seems logically more easy but quartus hardware will be same for both the code. - Altera_Forum
Honored Contributor
which langguage are you talking about?
but either way, they will produce the same number of logic elements, because its the same thing. And choce whatever style you think is more readable. - Altera_Forum
Honored Contributor
I think its the second expression. I am not sure though.