hughes@eng3.hep.uiuc.edu (eric hughes) (03/12/91)
I have a vhdl entity that contains several copies of the same behavioral statements. These statements contain signal assignments and waits. Is there some way I can group them into a subprogram? I would like to have parameters to the subprogram if possible.
davidb@inmet.inmet.com (03/13/91)
/* Written 9:40 am Mar 12, 1991 by hughes@eng3.hep.uiuc.edu */ >I have a vhdl entity that contains several copies of the same >behavioral statements. These statements contain signal assignments >and waits. Is there some way I can group them into a subprogram? I >would like to have parameters to the subprogram if possible. I am not sure what the problem is; I am tempted to answer, "Sure! Just do it!" A couple of common errors to avoid: o The subprogram must be a procedure. Inout parameters to functions are not allowed. o Make sure that the parameter list in the procedure declaration specifies the class of the parameter as signal. This is often omitted, as the class of subprogram parameters is usually defaulted and the modes usually give enough information as to use. o Pass all the signals to which you will be assigning values as parameters. Inheriting visibility to signals is tricky; the only place you can really do it is in a process statement. With these caveats, you should be able to simply drop the process code into the statement part of the procedure. Good luck! Dave Barton barton@i2wash.com
savel@hoss.unl.edu (Bharat P. Savel) (03/15/91)
In article <381900009@inmet> davidb@inmet.inmet.com writes: > >/* Written 9:40 am Mar 12, 1991 by hughes@eng3.hep.uiuc.edu */ | | stuff deleted | | > >A couple of common errors to avoid: > >o The subprogram must be a procedure. Inout parameters to functions >are not allowed. > >o Make sure that the parameter list in the procedure declaration >specifies the class of the parameter as signal. This is often >omitted, as the class of subprogram parameters is usually defaulted >and the modes usually give enough information as to use. > >o Pass all the signals to which you will be assigning values as >parameters. Inheriting visibility to signals is tricky; the only >place you can really do it is in a process statement. ---------- another point is the side effects of a sub-program; try to avoid the same signal names in the subprogram and in the architecture-calling-it; seems that things get screwy then; -- ------------------------------------------------------------------------------- Bharat P. Savel EE Dept. E-mail : savel@hoss.unl.edu Univ of Nebraska-Lincoln Ph : (617) 983-0850