Reply by Jim Thomas February 7, 20072007-02-07
chojny wrote:
> Jim Thomas napisa�(a): >> chojny wrote: >>> BUT I have some questions: >>> 1) How can I define variable (pointer to) in asm on a specific >>> address? (like in C above) >> >> i4 = 0xFFD00000; > > So I don't have to declare variable for example: .VAR data_noise? I can > read directly from memory where stream should be? >
Right. You don't even need to load it into an index register if you don't want to: f0 = dm(0xFFD00000); [snip]
> I don't know whether simulator throws an error. I get only message in > console. I found in AD technical note EE-104: > > http://www.analog.com/UploadedFiles/Application_Notes/887550658ee_104.pdf > > in point 6 that I should see an dialog box after hiting a EOF but in > VisualDSP 4.5 Debugger i don't get any box. I can set stream options > like: circular, rewind on reset or restart but not stop simulation after > EOF:). > I was looking in Project/Debug options but without result.
I dunno if that is an option either. I'd use a loop counter. How did you intend to stop the program "in real life" (that is, when it's not running in a simulation)?
> Thanks. > chojny
You're welcome. -- Jim Thomas Principal Applications Engineer Bittware, Inc jthomas@bittware.com http://www.bittware.com (603) 226-0404 x536 A pessimist is an optimist with experience
Reply by chojny February 6, 20072007-02-06
Jim Thomas napisa�(a):
> chojny wrote: >> BUT I have some questions: >> 1) How can I define variable (pointer to) in asm on a specific >> address? (like in C above) > > i4 = 0xFFD00000;
So I don't have to declare variable for example: .VAR data_noise? I can read directly from memory where stream should be?
> > You can also place it manually in the ldf file, but that's an exercise > left for the reader. > >> 2) How can I detect EOF (end of stream file)? I get in Console >> information "Encountered end of file: ...., Rewind" and get last data >> from the stream. I'd like to stop simulation after EOF. > > You could set up a variable that tells you how many samples to expect > from your data file and decrement it as you read the samples. Stop when > it goes to zero. Or you could use a "special" value in your data file > as a null-terminator. This will only work if you can guarantee that the > null-terminator value will never appear in your data. You could also > make the first word of the data file a number-of-samples count. Or you > could wait until the simulator throws an error because of reading an EOF > (assuming it does that) and then hand-edit an end-of-data flag. >
You're right. The simplest way is to read stream in a loop. And it's enough for me. I don't know whether simulator throws an error. I get only message in console. I found in AD technical note EE-104: http://www.analog.com/UploadedFiles/Application_Notes/887550658ee_104.pdf in point 6 that I should see an dialog box after hiting a EOF but in VisualDSP 4.5 Debugger i don't get any box. I can set stream options like: circular, rewind on reset or restart but not stop simulation after EOF:). I was looking in Project/Debug options but without result. Thanks. chojny
Reply by Jim Thomas February 6, 20072007-02-06
chojny wrote:
> BUT I have some questions: > 1) How can I define variable (pointer to) in asm on a specific address? > (like in C above)
i4 = 0xFFD00000; You can also place it manually in the ldf file, but that's an exercise left for the reader.
> 2) How can I detect EOF (end of stream file)? I get in Console > information "Encountered end of file: ...., Rewind" and get last data > from the stream. I'd like to stop simulation after EOF.
You could set up a variable that tells you how many samples to expect from your data file and decrement it as you read the samples. Stop when it goes to zero. Or you could use a "special" value in your data file as a null-terminator. This will only work if you can guarantee that the null-terminator value will never appear in your data. You could also make the first word of the data file a number-of-samples count. Or you could wait until the simulator throws an error because of reading an EOF (assuming it does that) and then hand-edit an end-of-data flag. -- Jim Thomas Principal Applications Engineer Bittware, Inc jthomas@bittware.com http://www.bittware.com (603) 226-0404 x536 Dyslexics of the world, UNTIE!
Reply by chojny February 5, 20072007-02-05
chojny napisa�(a):
> Hello, > I'm debugging some simple algorithms on ADSP-21161 Simulator and I need > to simulate input data from A/C (audio stream, 400k samples). > What's the simplest way to do it? > > Until now, I put some array into program or data memory (initilize using > file.dat) but array length is limited by internal memory. I tried to > change memory range but I get error: "Invalid memory range and/or width > for memory ..". > > I found "Settings->Streams" option where I can define source file. How > can I read this stream in my asm code? Do I have to use SPORT0 ISR? > > Thanks for help. > chojny
I solved my problem almost completly so I'll share my experience. To simulate stream input I use variable definition in C file: ///////////////variable.c///////////// ... volatile float* data_noise = (volatile float*) 0xFFD00000; ... ////////////////////////////////////// and then in main.asm I just use it: ///////////////main.asm/////////////// .extern _data_noise; ... i4 = dm(_data_noise); m5 = 0; f0 = dm(m5, i4); ////////////////////////////////////// Next, I define stream: Settings->Streams like this: Source: -File: path to file.dat -Format: in my case Floating point 32bit Destination: -Device: 32-bit mem Map Port I/0 -Address: 0xFFD00000 And every read from data_noise I get data from stream file (!!!!:)) BUT I have some questions: 1) How can I define variable (pointer to) in asm on a specific address? (like in C above) 2) How can I detect EOF (end of stream file)? I get in Console information "Encountered end of file: ...., Rewind" and get last data from the stream. I'd like to stop simulation after EOF. Thanks for any help. chojny
Reply by chojny February 3, 20072007-02-03
Hello,
I'm debugging some simple algorithms on ADSP-21161 Simulator and I need 
to simulate input data from A/C (audio stream, 400k samples).
What's the simplest way to do it?

Until now, I put some array into program or data memory (initilize using 
file.dat) but array length is limited by internal memory. I tried to 
change memory range but I get error: "Invalid memory range and/or width 
for memory ..".

I found "Settings->Streams" option where I can define source file. How 
can I read this stream in my asm code? Do I have to use SPORT0 ISR?

Thanks for help.
chojny