operation in procdure

I

IcYdRIP

Guest
I have to reuse the same call many times. so I plan to use a procedure.
I've read the reference manual and some books, But I still don't know
if it's possible to use a clock signal from entity in the procedure. I
mean, if there's a clk signal in the entity, and I define a procedure
in the package, the declaration as follow for example:

procedure dm9000_rd_data(signal clk : in std_logic; reg : in
std_logic_vector(7 downto 0); signal daBus : inout std_logic_vector(7
downto 0); signal cmd, cs, iowait, rd : out std_logic;);

and can I use the clk as it's in a entity? such as clk's events and
values. or I can just read the clk value only?

thanks!
 
The signals declared in the procedure declaration are local to the
procedure. So, you can have a clock signal for using within the
procedure.
When invoking the procedure you will associate a signal to the
procedure's clock signal. That associated signal can be the clock that
you have declared in the entity.
Since clock is declared as signal you can use all the attributes
available for signals.

rgds,

cristian
 
thank you !
since signal declaration is not allowed in the procedure. so the
signals used in a procedure must be passed from others.

but I have a doubt. if I invoke a procedure in a process, and the
process with a clock sensitive signal. since in a process, all sentence
are executed step by step. when invoking a procedure, the clock signal
maybe had a stabel value, not in the up edge or down edge. so what
about the clk's event property? or because the executing time is very
very short and is always lower than the smallest standard time scale,
the procedure will still use the event property? or all the property
will delayed for 1 clock cycle?
thank you!
 
Mike,
you are right based on what I wrote, but what I wrote is actually not
what I mean... :)
Based on the Procedure definition:
"Formal parameters are separated by semicolons in the formal parameter
list. Each formal parameter is essentially a declaration of an
object that is local to the procedure. "
I was refering to the formal parameter that may be declared as a
signal. Therefore, it's local to the procedure. If the formal
parameter is associated with an 'actual' signal that is a clock signal,
the clock can be used within the procedure.
Sorry, about not being clear on my writting.

rgds,

cristian
 
that's ok, cristian. thank you! :)

and Mike, I've read the uart code.
It seems all procedures(not in testbench vhdl file) have no parameters.
and all variables declared in the process are all visible in the
procedures which are invoked in the process.

but as book wrote, a procedure doesn't return any result, just change
the parameter value which will affect the actual parameters when
invoking. and all variables in a procedure are dynamic, they don't
store values during two calls. or this rule just affect the variables
which are declared in the procedure.

so, as the example uart code wrote, if the variables are declared in
the process which invokes the procedure, then the procedure can use
these variables and pass the changed values to the process?

thank you!
 

Welcome to EDABoard.com

Sponsor

Back
Top