comp.lang.ada
 help / color / mirror / Atom feed
From: pvanbell@cloud9.net (Paul Van Bellinghen)
Subject: Logical operators with bitmasks
Date: 1997/01/26
Date: 1997-01-26T00:00:00+00:00	[thread overview]
Message-ID: <32ebd9db.14078958@NEWS.CLOUD9.NET> (raw)


I have an unusual Ada story to relate which still has me second
guessing myself. As I wrote in an earlier posting, I am new to the Ada
language (~6 mo.). 

I was on a job interview the other day and was asked by another
software engineer what I had done in Ada.
I explained that I had configured Rational's VADScross (Ada 83) kernel
and TDM to run on our target processor (IDT R4700) and EEPROM. The
kernel TDM, and user programs are all slotted to be loaded into
EEPROM. I explained that the EEPROM was a flash module which required
erasing the entire 64x64K sector before any memory locations within
the sector can be modified. Thus before the TDM can modify user memory
or perform break pointing, the entire sector where the memory
locations reside must be buffered, erased, and written back to with
the modified memory changed in the buffer. 

When I told him that I used a sector mask to determine the sector
boundary of the  EEPROM location(s) to be modified, he asked me how I
performed the masking. I told him that I used the "and" function. He
said that I couldn't have since the logical operators in Ada are only
used to operate on boolean types. However, I knew that I had debugged
that portion of the TDM on my desktop PC using GNAT.

I believe what happened was that GNAT is an Ada 95 compiler which
allows the logical operators to operate on modular types as a bit wise
operation. Thus,  for:

  C := A and B;

where

Type Internal_address is mod 2**32 
C,A : Internal_Address;
B : constant := 16#FF80_0000#;

applies the mask B  to the variable A.

However, while I have not debugged the TDM yet on the target
processor, it did use a.make of VADScross to compile without errors. I
can't explain why. 


Paul Van Bellinghen
Software Engineer
home: 914 737-6998
bus:  914 968-2500




             reply	other threads:[~1997-01-26  0:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-01-26  0:00 Paul Van Bellinghen [this message]
1997-01-27  0:00 ` Logical operators with bitmasks Robert A Duff
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox