Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
21615 Discussions

correct writing style

Altera_Forum
Honored Contributor II
1,370 Views

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 

:)
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
664 Views

I think its the second expression. I am not sure though.

0 Kudos
Altera_Forum
Honored Contributor II
664 Views

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.
0 Kudos
Altera_Forum
Honored Contributor II
664 Views

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.
0 Kudos
Altera_Forum
Honored Contributor II
664 Views

looks like he/she is talking about VHDL

0 Kudos
Reply