2

total noob here.

Upgraded to a pi 4 recently, checking the BCM2711 ARM Peripherals manual I noticed the memory addresses have an underscore, for example, the physical main address is: 0x4_7C00_0000 to 0x4_7FFF_FFF. When programing for c / asm, is it safe to use these as "0x47C000000" or do you have to use "0x4_7C00_0000"?

Thanks for your time.

boring
  • 21
  • 2

2 Answers2

4

The underscores are placed for your convenience when reading the addresses, since groups of four are comfortable to read, hold in short-term memory, etc, and correspond to a fairly natural amount of binary data, specifically 16 bits.

When programming in C and most assemblers, the underscores are not legal syntax; you will need to remove the underscores. Additionally, some assemblers may use a suffix h for hex rather than the 0x prefix, so you would need to use e.g. 47c000000h.

nanofarad
  • 19,972
  • 2
  • 51
  • 77
2

The underscore is taken from the Verilog language. It has no meaning and in C or assembly code it should be omitted.

The underscore has the same function as the comma in the UK/US number scheme: it makes it easier to count the digits. However the underscore can be placed anywhere.

This is a Verilog example. Compare these two:

32'b00000010000010000001000000000000
32'b00000010_00001000_00010000_00000000
Oldfart
  • 14,380
  • 2
  • 16
  • 41