Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Passing Signals to Procedure

Reply
Thread Tools

Passing Signals to Procedure

 
 
Analog_Guy
Guest
Posts: n/a
 
      10-03-2005
I am having difficulty with what seems to be a very simple thing.

I want to code a generic testbench procedure to automatically check any
n-input combinatorial function in my design.

Currently, I used a quick and dirty way just to get the automatic
checking working. For example, I have a separate combinatorial
procedure to handle 6-input functions, and another to handle 9-input
functions. This works fine, but now a requirements changes converted
one of my outputs to a 7-input function. With my current approach,
this means I now have to code a separate procedure to handle 7-input
combinatorial functions. This does not seem like a good way of
handling things.

What I would like is if someone knows how to pass a variable number of
input signals to a generic procedure?

I know I can send an unconstrained vector to a procedure, and use a
'range to determine the length inside the procedure, but am not sure if
this would work with a concatenated vector of inputs? I think I would
have to declare unique vectors for each of my different combinatorial
functions. Example:

Current Approach
================
test_comb_6ip(ip_1, ip_2, ip_3, ip_4, ip_5, ip_6, output_function);

Can I do this?
==============
signal vector_6ip : STD_LOGIC_VECTOR(5 DOWNTO 0);
vector_6ip <= ip_1 & ip_2 & ip_3 & ip_4 & ip_5 & ip_6;
test_comb(vector_6ip, output_function);

I have not yet convinced myself that the second approach will work?

Note that the input signals are declared as INOUT in my PROCEDURE, so
that I may force the various input combinations on my output_function.

Any help would be appreciated.

 
Reply With Quote
 
 
 
 
Reiner Huober
Guest
Posts: n/a
 
      10-03-2005
When you say functions, you mean procedures, don't you.

As you say, you can declare an array (natural range<>) of type. You can
use concatiation or aggregates:

test_comb((ip_1,ip_2,ip_3,ip_4,ip_5,ip_6),output_f unction);

If you use inout signals, you cannot assign to vector_6ip, which is
another signal. You must pass the signals you mean.

Hubble.

 
Reply With Quote
 
 
 
 
Mike Treseler
Guest
Posts: n/a
 
      10-03-2005
Analog_Guy wrote:

> I want to code a generic testbench procedure to automatically check any
> n-input combinatorial function in my design.


Functions are timeless and can be verified using assertions:

assert my_function("10101010") = 170
report "my_function: error in case 170.";

> What I would like is if someone knows how to pass a variable number of
> input signals to a generic procedure?


I would leave time and signals out of it.
Just loop through a constant array of
stim and expected values.


-- Mike Treseler
 
Reply With Quote
 
Analog_Guy
Guest
Posts: n/a
 
      10-04-2005

Mike Treseler wrote:
> Analog_Guy wrote:
>
> > I want to code a generic testbench procedure to automatically check any
> > n-input combinatorial function in my design.

>
> Functions are timeless and can be verified using assertions:
>
> assert my_function("10101010") = 170
> report "my_function: error in case 170.";
>
> > What I would like is if someone knows how to pass a variable number of
> > input signals to a generic procedure?

>
> I would leave time and signals out of it.
> Just loop through a constant array of
> stim and expected values.
>
>
> -- Mike Treseler


For a 9-input combinatorial gate, wouldn't I have to create a constant
array with 512 elements? I wanted to cycle through every combination
of inputs. I was just trying to implement a 9-bit counter in a
procedure, whereby ip_1 <= count(, ip_2 <= count(7), etc.. I thought
that by passing an unconstrained array, I could make a generic width
counter to automatically adapt to the number of inputs. I just can't
figure how to send the variable number of inputs to the procedure.

 
Reply With Quote
 
Mike Treseler
Guest
Posts: n/a
 
      10-04-2005
Analog_Guy wrote:

> For a 9-input combinatorial gate, wouldn't I have to create a constant
> array with 512 elements?


Yes, to cover n inputs you would need
2**n constant vectors of expected data
for the assertion.

> I wanted to cycle through every combination
> of inputs. I was just trying to implement a 9-bit counter in a
> procedure, whereby ip_1 <= count(, ip_2 <= count(7), etc.. I thought
> that by passing an unconstrained array, I could make a generic width
> counter to automatically adapt to the number of inputs. I just can't
> figure how to send the variable number of inputs to the procedure.


I would use an unconstrained unsigned arg then
declare a variable of the proper length in the process:
variable vec : unsigned(arg'range) := arg;

Or you could use access types (pointers). See:
http://groups.google.com/groups?q=vhdl+load_test_data

-- Mike Treseler
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
procedure as argument in procedure AlexWare VHDL 2 10-23-2009 09:14 AM
driving "external" signals from a procedure Eli Bendersky VHDL 15 04-28-2007 08:16 PM
signals in Procedure Ved VHDL 2 09-12-2006 12:59 PM
'Procedure or function <stored procedure name> has too many arguments specified',,,ARGH! Mike P ASP .Net 0 06-19-2006 01:19 PM
Driving signals from a procedure Andy Peters VHDL 4 05-20-2005 08:51 AM



Advertisments