Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/23/11 12:26
Read: times


 
#182995 - Hw bit variables normally not available in processors
Responding to: ???'s previous message
The 8051 is one of the few processor architectures that has bit varibles.

So bit variables in C is a specific language extention outside of standard C just because it is valuable to be able to take advantages of this specific 8051 hardware feature.

The ARM processor does not have bit variables. It does not have any processor instructions working on a single bit, so there is no meaning to have a hard-coded specific bit variable data type.

With most normal processors, bit variables are bits stored within a larger integer container. In a struct, you can declare bit fields. But these bit fields are nothing special. The code generated will be standard and/or operations just as if you define yourself the meaning of individual bits in an integer.

The only thing special is that some ARM chips have a special memory-mapping feature where some integer variables also have an alias address where each individual bit in the integer can also be accessed at a different integer at the aliased address. This allows the source code to write to a virtual integer variable that will result in a single-bit access in the actual container integer. Look closer at this feature in Cortex-class ARM chips. Also, some Cortex-based chips have some integer variables and port registers that can be written to where the least significant bits of the access address will work as a mask to specify which bits of the port register that should be accessed.

But the obvious references for this are the ARM documentation. Both about the ARM compiler and about the specific processors. You will be much better off selecting a more suitable forum. This has nothing at all with the bit variables available in the C51 compiler so there are no synergies from asking this question here.

List of 12 messages in thread
TopicAuthorDate
Bit variable in KEIL Arm            01/01/70 00:00      
   Hw bit variables normally not available in processors            01/01/70 00:00      
      Not quite true.            01/01/70 00:00      
         He covered that            01/01/70 00:00      
   Choice of forum            01/01/70 00:00      
   bool            01/01/70 00:00      
      bool is nothing specifically to do with single-bit variables            01/01/70 00:00      
         Not wrong            01/01/70 00:00      
            Yes - wrong!            01/01/70 00:00      
               bit != bool even if nominal storage range is same            01/01/70 00:00      
   Bit Fields            01/01/70 00:00      
      Wrong answer for this question            01/01/70 00:00      

Back to Subject List