Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Procedure and Function

Procedure and Function

Procedure and Function

Hi, I know both procedure and function are subprogram. If I
synthesis them, what is difference?

RE: Procedure and Function

From Ashenden "The Designer's guide to VHDL" :
The difference between the two is that a procedure encapsulates a collection of sequential statements that are executed for their effect, whereas a function encapsulates a collection of statements that compute a result. Thus a procedure is a generalization of a statement, whereas a function is a generalization of an expression.

In other words the function is more generalized, but really to my mind that makes it about the same as a parameterized procedure.  Maybe someone else could give a better explanation.

as far as synthesis goes, it probably depends on what is in your function/procedure.  But, given that a function is more generalized I would have to say that it is more likely to create similar chunks of logic whenever used, but a procedure is more likely to create one chunk of logic that is used in multiple places.  But again, that would depend on what code is in the procedure/function and also where it is used.

Im sure I could write code that would produce the opposite of what I just said, so that is not a hard an fast rule.  Given that, I don't really see much of a difference between the two except for yourself (and future users of your code) to understand that one is a more general than the other.


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close