prfered style of coding?

B

bxbxb3

Hi,
I just wanted to ask which is prefered style of coding...behavioral or
structural? Which among the two fit into FPGA easily?
Thanks.
 
C

Christian Gelinek

Behavioral is mainly for testbenches and simulation, structural is the style
for implementation on FPGAs/CPLDs/ASICs.
 
R

Ralf Hildebrandt

bxbxb3 wrote:

I just wanted to ask which is prefered style of coding...behavioral or
structural?

If you have got a core of a subcomponent - use it. Somebody has done the
work for you and you don't need to do it again unless you try to do it
better or you try to expand it. -> structural

If you have a huge project - split it into smaller parts. This is more
readable for humans and the parts can be synthesized and tested
separately. -> structural

Don't break down hierarchy to the gates. (Don't try to model an adder
through instantiation of fulladder cells - use the power of your
synthesis tool which can do this better.) Find a balance between
splitting your design in parts and modelling something in one component.
-> behavioral

Try to write target-indipendent code as long as possible. (Do not use
primitive cells (except you /really/ need it). If you use IP cores,
encapsulate them into a common entity making it exchangeable by a
different IP core with the same functionality.) -> behavioral

Which among the two fit into FPGA easily?

Not the target is important but the synthesis tool! (Write
target-indipendent code.) If your code can be synthesized (and it
performs well), everything is o.k..

There are several other facts, that become important after choosing your
target:
* latches allowed?
* (a)synchronous resets? everytime?
* both clock edges?
* divided clocks?
....
But this is indipendent from behavioral / structural design.


Ralf
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top