FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > FPGA

FPGA comp.arch.fpga newsgroup (usenet)

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-23-2007, 02:35 PM
dartanian
Guest
 
Posts: n/a
Default can't read/load memory contents

Hello there, one of new members around here.

I've got a problem while i try to retrieve/pass over some values to
memory. I use EDK 9.1 and a system of microblaze, opb bus and opb
bram
memory.
I try to retrieve some values from memory through a vhdl testbench,
which is port mapped in the PORT B of Bram (by making Bram's PORT B
external) and then write back these contents in other blocks - after
some processing.
I use Eclipse SDK 9.1 for that and write the following code (load and
store instructions) within a loop:


asm(" lwi r8,r8,0x7a810001 ");
asm(" sw r8,r8(r8) ");


I don't seem to get the contents of 0x7a810001 address (which is
'bbbbbbbb' - given by vhdl testbench) into the simulation outcome.
Is there sth wrong with the use of instructions? Should i use an OR/
ORI as well? Any problems with 16 or 32 bit values?


Thank you very much guys in advance!
Reply With Quote
  #2 (permalink)  
Old 11-24-2007, 01:17 PM
Minh Nguyen
Guest
 
Posts: n/a
Default Re: can't read/load memory contents

On Fri 23 Nov 2007 15:35 dartanian wrote:

> Hello there, one of new members around here.
>
> I've got a problem while i try to retrieve/pass over some values to
> memory. I use EDK 9.1 and a system of microblaze, opb bus and opb
> bram
> memory.
> I try to retrieve some values from memory through a vhdl testbench,
> which is port mapped in the PORT B of Bram (by making Bram's PORT B
> external) and then write back these contents in other blocks - after
> some processing.
> I use Eclipse SDK 9.1 for that and write the following code (load and
> store instructions) within a loop:
>
>
> asm(" lwi r8,r8,0x7a810001 ");

^^
What is the value of r8? Here you load the contents of address (r8 +
0x7a810001) into register r8.
To load addr's contents you should better write you should write:
lwi r8, r0, addr
So you don't need to set r8 to 0 first.

Unfortunately you cannot load a word from an unaligned location anyway. So
addr must be divisible by 4.

> asm(" sw r8,r8(r8) ");
>
>
> I don't seem to get the contents of 0x7a810001 address (which is
> 'bbbbbbbb' - given by vhdl testbench) into the simulation outcome.
> Is there sth wrong with the use of instructions? Should i use an OR/
> ORI as well? Any problems with 16 or 32 bit values?


As I mentioned above lwi needs a word-aligned address. If you really have to
load a word beginning at 0x7a810001 you coud read the words at 0x7a810000
and 0x7a810004 and do some shift magic than.

> Thank you very much guys in advance!


Reply With Quote
  #3 (permalink)  
Old 11-26-2007, 02:16 PM
dartanian
Guest
 
Posts: n/a
Default Re: can't read/load memory contents

First of all, thanks a lot for your reply!


> What is the value of r8? Here you load the contents of address (r8 +
> 0x7a810001) into register r8.
> To load addr's contents you should better write you should write:
> lwi r8, r0, addr
> So you don't need to set r8 to 0 first.
> Unfortunately you cannot load a word from an unaligned location anyway. So
> addr must be divisible by 4.



I followed your advice and loaded the contents of memory 0x7a810010
which is an address divisible by 4. The contents of that address is
"bbbbbbbb" given through a testbench file. As a result and based on
your instructions, i use the code:

asm(" lwi r8, r0, 0x7a810010");


> > asm(" sw r8,r8(r8) ");
> > I don't seem to get the contents of 0x7a810001 address (which is
> > 'bbbbbbbb' - given by vhdl testbench) into the simulation outcome.
> > Is there sth wrong with the use of instructions? Should i use an OR/
> > ORI as well? Any problems with 16 or 32 bit values?

>
> As I mentioned above lwi needs a word-aligned address. If you really have to
> load a word beginning at 0x7a810001 you coud read the words at 0x7a810000
> and 0x7a810004 and do some shift magic than.




The following step was to use the 'store' instruction in order to see
the contents of the address "0x7a810010" at register 8.

asm(" sw r8,r8(r8) ");

The problem is that i can see the address value on the opb_abus of the
mb_opb simulation waveform but i cannot see any data on the opb_dbus.
Any idea what could be wrong with the use of instructions? Should i
use an OR/ORI? Any problems with 16 or 32 bit values?

Really appreciate your help guys!
Reply With Quote
  #4 (permalink)  
Old 11-26-2007, 02:39 PM
dartanian
Guest
 
Posts: n/a
Default Re: can't read/load memory contents

First of all, thanks a lot for your reply!


> What is the value of r8? Here you load the contents of address (r8 +
> 0x7a810001) into register r8.
> To load addr's contents you should better write you should write:
> lwi r8, r0, addr
> So you don't need to set r8 to 0 first.
> Unfortunately you cannot load a word from an unaligned location anyway. So
> addr must be divisible by 4.



I followed your advice and loaded the contents of memory 0x7a810010
which is an address divisible by 4. The contents of that address is
"bbbbbbbb" given through a testbench file. As a result and based on
your instructions, i use the code:

asm(" lwi r8, r0, 0x7a810010");



> > asm(" sw r8,r8(r8) ");
> > I don't seem to get the contents of 0x7a810001 address (which is
> > 'bbbbbbbb' - given by vhdl testbench) into the simulation outcome.
> > Is there sth wrong with the use of instructions? Should i use an OR/
> > ORI as well? Any problems with 16 or 32 bit values?


> As I mentioned above lwi needs a word-aligned address. If you really have to
> load a word beginning at 0x7a810001 you coud read the words at 0x7a810000
> and 0x7a810004 and do some shift magic than.




The following step was to use the 'store' instruction in order to see
the contents of the address "0x7a810010" at register 8.

asm(" sw r8,r8(r8) ");


The problem is that i can see the address value on the opb_abus of
the
mb_opb simulation waveform, but i cannot see any data on the opb_dbus
(see only undefined value or series of 'x').
Any idea what could be wrong with the use of instructions? Should i
use an OR/ORI? Any problems with 16 or 32 bit values?


Really appreciate your help guys!
Reply With Quote
  #5 (permalink)  
Old 11-26-2007, 07:22 PM
Minh Nguyen
Guest
 
Posts: n/a
Default Re: can't read/load memory contents

On Mon 26 Nov 2007 15:39 dartanian wrote:

> First of all, thanks a lot for your reply!
>
>
>> What is the value of r8? Here you load the contents of address (r8 +
>> 0x7a810001) into register r8.
>> To load addr's contents you should better write you should write:
>> lwi r8, r0, addr
>> So you don't need to set r8 to 0 first.
>> Unfortunately you cannot load a word from an unaligned location anyway.
>> So addr must be divisible by 4.

>
>
> I followed your advice and loaded the contents of memory 0x7a810010
> which is an address divisible by 4. The contents of that address is
> "bbbbbbbb" given through a testbench file. As a result and based on
> your instructions, i use the code:
>
> asm(" lwi r8, r0, 0x7a810010");
>
>
>
>> > asm(" sw r8,r8(r8) ");
>> > I don't seem to get the contents of 0x7a810001 address (which is
>> > 'bbbbbbbb' - given by vhdl testbench) into the simulation outcome.
>> > Is there sth wrong with the use of instructions? Should i use an OR/
>> > ORI as well? Any problems with 16 or 32 bit values?

>
>> As I mentioned above lwi needs a word-aligned address. If you really have
>> to load a word beginning at 0x7a810001 you coud read the words at
>> 0x7a810000 and 0x7a810004 and do some shift magic than.

>
>
>
> The following step was to use the 'store' instruction in order to see
> the contents of the address "0x7a810010" at register 8.
>
> asm(" sw r8,r8(r8) ");


Ah yes. This should be
sw r8, rA, rB
where the address (rA + rB) must be word-aligned again--and 0xbbbbbbbb * 2
isn't. You could also use an IMM, so you don't need to fill rA and rB:
swi r8, r0, addr

Good luck.

> The problem is that i can see the address value on the opb_abus of
> the
> mb_opb simulation waveform, but i cannot see any data on the opb_dbus
> (see only undefined value or series of 'x').
> Any idea what could be wrong with the use of instructions? Should i
> use an OR/ORI? Any problems with 16 or 32 bit values?
>
>
> Really appreciate your help guys!


HTH

Reply With Quote
  #6 (permalink)  
Old 11-27-2007, 04:47 PM
dartanian
Guest
 
Posts: n/a
Default Re: can't read/load memory contents

I see your point Minh thank you very much.

> Ah yes. This should be
> sw r8, rA, rB
> where the address (rA + rB) must be word-aligned again--and 0xbbbbbbbb * 2
> isn't. You could also use an IMM, so you don't need to fill rA and rB:
> swi r8, r0, addr


One more think. What do you mean that the data 0xbbbbbbbb are not word-
aligned? Should be maximum up to 0x80000000? I'll follow your advice!
Thanks again
Reply With Quote
  #7 (permalink)  
Old 11-27-2007, 10:40 PM
Minh Nguyen
Guest
 
Posts: n/a
Default Re: can't read/load memory contents

On Tue 27 Nov 2007 17:47 dartanian wrote:

> I see your point Minh thank you very much.
>
>> Ah yes. This should be
>> sw r8, rA, rB
>> where the address (rA + rB) must be word-aligned again--and 0xbbbbbbbb *
>> 2 isn't. You could also use an IMM, so you don't need to fill rA and rB:
>> swi r8, r0, addr

>
> One more think. What do you mean that the data 0xbbbbbbbb are not word-
> aligned?


The hardware supported data types for MicroBlaze are byte (8 bits),
half-word (16 bits) and word (32 bits). Data access must be aligned, which
means it must be on boundaries that depend on the type. Since a word has
the size of 4 bytes the boundaries lie at addresses which are divisible by
4.

> Should be maximum up to 0x80000000?


No, each address space has a 32-bit range. So you can handle up to 4 GB of
memory.

> I'll follow your advice!
> Thanks again


Reply With Quote
  #8 (permalink)  
Old 11-28-2007, 12:03 AM
glen herrmannsfeldt
Guest
 
Posts: n/a
Default Re: can't read/load memory contents

Minh Nguyen wrote:
> On Tue 27 Nov 2007 17:47 dartanian wrote:


(snip)

>> One more think. What do you mean that the data 0xbbbbbbbb
>> are not word-aligned?


> The hardware supported data types for MicroBlaze are byte (8 bits),
> half-word (16 bits) and word (32 bits). Data access must be aligned, which
> means it must be on boundaries that depend on the type. Since a word has
> the size of 4 bytes the boundaries lie at addresses which are divisible by
> 4.


Is the address really X'BBBBBBBB'? Or is the b supposed to mean
something else? If it is really the hex digit B then yes, the address
is odd. Otherwise, it doesn't seem like a likely address.

-- glen

Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On


Similar Threads
Thread Thread Starter Forum Replies Last Post
load/read/ commands assembly PowerPC. Help Needed! xenix FPGA 9 10-02-2007 09:00 PM
sysACE load vs bootloader load of vxWorks on ML310 Bo FPGA 3 03-03-2005 02:15 PM
makefile to generate memory contents in Altera SOPC Builder Jeroen FPGA 1 02-17-2004 05:49 PM
What' my mistake? (Load data to memory) Peng Yu Verilog 6 08-08-2003 07:27 PM


All times are GMT +1. The time now is 04:20 PM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved