Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Ada > Endian-problem/...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 5605 of 5697
Post > Topic >>

Endian-problem/bug with system.bit_ops (gnat3.15)...

by Erik Baigar <erik@[EMAIL PROTECTED] > Mar 15, 2008 at 08:58 AM

Dear Ada users,

in porting an application from Meridian's Ada83 to gnat3.15 I
encountered
some issues with the system.bit_ops. They (especially the Bit_And which 
I used) show behaviour which depends on the processor used:

The code contains expressions of the form
 
  Bit_And ( MEMORY (OPERAND_ADDRESS)'Address,18, ACCUMULATOR'Address,18,
            ACCUMULATOR'Address);

which are used in the simulation of a vintage processor. I used length
18 here since the processor has 18-bit registers. This code works well
on the Intel (little endian) platform but fails on SPARC (big endian).
It required some investigation to locate the problem, but replacing 
the length 18 by 32 (all are integers here), i.e. using

  Bit_And ( MEMORY (OPERAND_ADDRESS)'Address,32, ACCUMULATOR'Address,32,
            ACCUMULATOR'Address);

solved the problem and the code now runs on little and big endian 
systems. I know, system.bit_ops are version dependent and non portable,
but I'd not expect behaviour depending on the target system at the 
first glance... 

   Regards,

      Erik.




 5 Posts in Topic:
Endian-problem/bug with system.bit_ops (gnat3.15)...
Erik Baigar <erik@[EMA  2008-03-15 08:58:12 
Re: Endian-problem/bug with system.bit_ops (gnat3.15)...
Niklas Holsti <niklas.  2008-03-15 14:22:36 
Re: Endian-problem/bug with system.bit_ops (gnat3.15)...
Erik Baigar <erik@[EMA  2008-03-15 19:53:00 
Re: Endian-problem/bug with system.bit_ops (gnat3.15)...
Niklas Holsti <niklas.  2008-03-15 21:26:22 
Re: Endian-problem/bug with system.bit_ops (gnat3.15)...
Erik Baigar <erik@[EMA  2008-03-15 20:45:16 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed May 14 3:33:22 CDT 2008.