A method and a device for converting a virtual address of a program
executed by a processor and provided by a program counter into a physical
address in a program memory, the program having been stored in the memory
in at least one segment of consecutive addresses. The method includes
adding to each address provided by the program counter a number
corresponding to the offset between the memory address and the virtual
address provided by the program counter, and detecting a possible
overflow from the current segment by comparing the obtained physical
address with the start and end addresses of the considered segment.