OpenCores

The openrisc bugtracker has been moved to: bugzilla.opencores.org. This page is read-only

Problem in Load Word with sign Extend insn.

Back to bugtracker overview.

Information:
Type :: BUG
Status :: CLOSED
Assigned to :: Jeremy, Bennett

Description:
When I tried to compile the insn. l.lws the result is not occuring. only l.lwz is working fine.

Please rply if I need any correction or this is a bug? If but I will try to fix it.

Comments:

Bennett, Jeremy May 9, 2011

Hi Sridharan

You have misunderstood the documentation of the instruction. The immediate value is always sign extended to form a memory address. a 32-bit value is then loaded from that address and either sign extended (l.lws) or zero extended (l.lwz) before placing in the register.

Since the current OR1200 implementation is a 32-bit implementation, it has 32-bit registers, so there is no sign-extension to be done. However the behaviour would be different on a 64-bit system, where the 32-bit value from memory had to sign extended to fill a 64-bit register.

I hope this explains things. I'm marking this bug as closed.

HTH

Jeremy

sridharan, g May 5, 2011
Please help in this regard...
sridharan, g May 3, 2011
What we understand from the arch doc as the difference between them is in the generation of the memory address being:
addr = sign_extended(I[15:0]) + (rA[31:0]) for l.lws
addr = zero_extended(I[15:0]) + (rA[31:0]) for l.lwz

these will be different for offsets > 2^15 (ie, negative offsets).

Is this interpretation of the two instructions wrong?
sridharan, g May 3, 2011
Hi Jeremy,
Thanks for the rply.
Actually while compiling the instruction l.lws the data is not loading into the respective register and stays unfinished while simulating. But while running the l.lwz insn. correct loading happening from the memory to respective register. Once if remove the l.lws insn everything is okay.

I am using modelsim. l.lbs and l.lhs works fine.

Bennett, Jeremy May 3, 2011

Hi sridharan,

l.lws and l.lwz are equivalent on a 32-bit architecture. Can you explain your problem in more detail.

Thanks,

Jeremy

--
Tel: +44 (1590) 610184
Cell: +44 (7970) 676050
SkypeID: jeremybennett
Email: jeremy.bennett@embecosm.com
Web: www.embecosm.com

sridharan, g May 2, 2011
If this is a bug I will try to fix it.

Post a comment:
Login to post comments!

Back to bugtracker overview.

© copyright 1999-2012 OpenCores.org, equivalent to ORSoC AB, all rights reserved. OpenCores®, registered trademark.