UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor dicler
Visitor
205 Views
Registered: ‎10-19-2018

Hold previous value inside IP

Jump to solution

I want a IP in which a signal holds its previous value from one iteration to another, like the variable X here:

void top(float in[1], float out[1])
{

float X;

out[0] = in[0] + X;

X = in[0];
}

For in[0] = 10, out[0] is 10, then 20, 30 and so. C simulation gives expected result, but in RTL co-simulation, X is always 0 making out[0] always 10.

I don't want to put X in port, because there is a lot of 32bits signals like X in the IP.

Example files are attached.

Thanks.

 

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Xilinx Employee
Xilinx Employee
178 Views
Registered: ‎09-05-2018

Re: Hold previous value inside IP

Jump to solution

Hey @dicler,

It sounds like you want to declare the variable X as static. The static keyword is used to preserve variable values between function iterations. So:

static float X;

Nicholas Moellers

Xilinx Worldwide Technical Support
1 Reply
Highlighted
Xilinx Employee
Xilinx Employee
179 Views
Registered: ‎09-05-2018

Re: Hold previous value inside IP

Jump to solution

Hey @dicler,

It sounds like you want to declare the variable X as static. The static keyword is used to preserve variable values between function iterations. So:

static float X;

Nicholas Moellers

Xilinx Worldwide Technical Support