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 to
dartanian
Loading thread data ...

^^ 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.

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.

Reply to
Minh Nguyen

First of all, thanks a lot for your reply!

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");

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 to
dartanian

First of all, thanks a lot for your reply!

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");

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 to
dartanian

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.

HTH

Reply to
Minh Nguyen

I see your point Minh thank you very much.

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 to
dartanian

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

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

Reply to
Minh Nguyen

(snip)

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 to
glen herrmannsfeldt

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.