Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
14 years ago

correct 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's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored 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's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored 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.