A method for attenuator phase compensation, the method comprising: determining a phase compensation value for an attenuator (102, 302) based on an attenuation configuration of the attenuator; and performing a phase compensation according to the phase compensation value to maintain a constant phase response; wherein the attenuator (102, 302) performs a signal attenuation operation in which an input signal is attenuated to generate an attenuated signal with an amplitude that is lower than the amplitude of the input signal or a signal bypass operation in which the input signal is not attenuated, the attenuator (102, 302) is a programmable resistive voltage divider that includes a resistor with a fixed external resistance (Rext) and a tunable resistor with programmable resistance (Rage), and performing the phase compensation comprises implementing or adjusting a delay element according to the phase compensation value, the delay element being connected in serial with the attenuator (102, 302), wherein determining the phase compensation value is based on a function of an attenuation factor code of the attenuator (102, 302) and comprises the following calculations: Z agc = 1 1 R agc + i 2 πfC agc, wherein Zagc represents the impedance at an output node of the attenuator (102, 302), Ragc represents the resistance value of the tunable resistor, Cagc represents all capacitances in the attenuator system from the output node to ground, H agc = Z agc Z agc + R ext, where Hagc represents a transfer function of the attenuator (102, 302) and Rext represents the fixed external resistance, φ agc = arg H agc = arctan Im H agc Re H agc, where φagc represents the phase of the transfer function, and wherein equation is used to obtain the phase of the transfer function under different attenuation factor codes, and wherein performing the phase compensation includes calculating the difference between the phase of the transfer function under different attenuation factor codes and implementing or adjusting the delay element to compensate for said difference. determining a phase compensation value for an attenuator (102, 302) based on an attenuation configuration of the attenuator; and performing a phase compensation according to the phase compensation value to maintain a constant phase response; wherein the attenuator (102, 302) performs a signal attenuation operation in which an input signal is attenuated to generate an attenuated signal with an amplitude that is lower than the amplitude of the input signal or a signal bypass operation in which the input signal is not attenuated, the attenuator (102, 302) is a programmable resistive voltage divider that includes a resistor with a fixed external resistance (Rext) and a tunable resistor with programmable resistance (Rage), and performing the phase compensation comprises implementing or adjusting a delay element according to the phase compensation value, the delay element being connected in serial with the attenuator (102, 302), wherein determining the phase compensation value is based on a function of an attenuation factor code of the attenuator (102, 302) and comprises the following calculations: Z agc = 1 1 R agc + i 2 πfC agc, wherein Zagc represents the impedance at an output node of the attenuator (102, 302), Ragc represents the resistance value of the tunable resistor, Cagc represents all capacitances in the attenuator system from the output node to ground, H agc = Z agc Z agc + R ext, where Hagc represents a transfer function of the attenuator (102, 302) and Rext represents the fixed external resistance, φ agc = arg H agc = arctan Im H agc Re H agc, where φagc represents the phase of the transfer function, and wherein equation is used to obtain the phase of the transfer function under different attenuation factor codes, and wherein performing the phase compensation includes calculating the difference between the phase of the transfer function under different attenuation factor codes and implementing or adjusting the delay element to compensate for said difference.