Blocks RAM in HandelC

G

Gerardo Sosa

Guest
I want to test the example in page 217 of DK2 Handel-C Language
Reference Manual.

-------
ram unsigned 8 RAM1[4] = {0,1,2,3} with {block="BlockRAM"};
ram unsigned 8 RAM2[4] with {block="BlockRAM"};
signal s;
unsigned x;
unsigned i;
while(1)
{
par
{
s = RAM1;
RAM2 = s;
x = s;
i++;
}
}
-------

BUt it doesn't compile, I get the following error: Illegal
initializer. I suppose that I can't initialize the RAM, then why
Celoxica give examples that doesn't works? or what's missing?

Thanks

Gerardo
 
i is used before it is set. Maybe
unsigned i = 0;
as the declaration.

Steve

"Gerardo Sosa" <gerardo_sr@yahoo.com> wrote in message
news:f4ee0441.0310160852.5e4ecb48@posting.google.com...
I want to test the example in page 217 of DK2 Handel-C Language
Reference Manual.

-------
ram unsigned 8 RAM1[4] = {0,1,2,3} with {block="BlockRAM"};
ram unsigned 8 RAM2[4] with {block="BlockRAM"};
signal s;
unsigned x;
unsigned i;
while(1)
{
par
{
s = RAM1;
RAM2 = s;
x = s;
i++;
}
}
-------

BUt it doesn't compile, I get the following error: Illegal
initializer. I suppose that I can't initialize the RAM, then why
Celoxica give examples that doesn't works? or what's missing?

Thanks

Gerardo
 
Thanks Steve, but I don't think that this be the error, because the
error put the cursor in the line:
ram unsigned 8 RAM1[4] = {0,1,2,3} with {block="BlockRAM"};


Anyway I probed:

unsigned i=0;

and

unsigned i;
i=0;

But, both either don't work.

Regards

Gerardo
 
all you need to do is add the static keyword to the ram declaration

A

gerardo_sr@yahoo.com (Gerardo Sosa) wrote in message news:<f4ee0441.0310161428.71d317a0@posting.google.com>...
Thanks Steve, but I don't think that this be the error, because the
error put the cursor in the line:
ram unsigned 8 RAM1[4] = {0,1,2,3} with {block="BlockRAM"};


Anyway I probed:

unsigned i=0;

and

unsigned i;
i=0;

But, both either don't work.

Regards

Gerardo
 

Welcome to EDABoard.com

Sponsor

Back
Top