• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC Design
  3. How to pass a real array as an input argument to a function...

Stats

  • Locked Locked
  • Replies 2
  • Subscribers 125
  • Views 11778
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to pass a real array as an input argument to a function in Verilog (in AMS simulation)

RFStuff
RFStuff over 4 years ago

Dear All,

I need to write a function (see below) in verilog for AMS transient simulation.

I could pass a real value "delta_t" as an input argument to the function but not the a real array "step_curve_coeff1 [coeff_no:0]".

Is there any way we can pass real array to a function in veriog ?

function real myfunction;

//input real step_curve_coeff1 [coeff_no:0];
input real delta_t;

//real t_fit;
begin
x=0;
//t_fit= (delta_t-mu_1-shift_total+shift_adjust)/mu_2;
t_fit= (delta_t-mu_1-shift_val+0)/mu_2;
if( delta_t <= ( shift_val-1e-12) ) begin
x=0.0;

end else if( (delta_t >= ( shift_val+clip_offset)) & (delta_t <=clip_end)) begin
for (ind_func1 = coeff_no; ind_func1 >= 0; ind_func1 = ind_func1 - 1) begin

x=x + ( step_curve_coeff[ind_func1]* pow(t_fit,ind_func1)) ;

if( ind_func1 ==0) begin

end
end
end else if( (delta_t > ( shift_val-1e-12)) & (delta_t < ( shift_val+clip_offset-0)) ) begin
x=(x_start/clip_offset)*(delta_t-shift_val);

end else if(delta_t > clip_end) begin
x=x_end;

end

myfunction = 1.02*x;
end

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 4 years ago

    DIdn't help too much that the example had lots of things missing so you didn't make checking it very easy (please consider that in future - what should have been a 2 minute answer ended up taking 10-15 minutes).

    This is supported in SystemVerilog, but not in Verilog.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • RFStuff
    RFStuff over 4 years ago in reply to Andrew Beckett

    Dear Andrew,

    Thanks a lot. Actually, the purpose of putting just the portion of the function in the code was just to show the input arguments of the function. However, I will keep that in mind for the future posts.

    Kind Regards,

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information