referring to the accompanying drawings , embodiment modes of the present invention are described . fig1 is a circuit diagram illustrating a voltage regulator according to a first embodiment of the present invention . the voltage regulator according to the present invention includes a vref circuit 101 , an error amplifier 102 , a comparator circuit 130 , a resistor 107 , a resistor 108 , a pch transistor 103 , a pch transistor 104 , a pch transistor 105 , a pch transistor 106 , an nch transistor 109 , a vdd terminal 121 , a vss terminal 123 , and an output terminal 122 . a difference from fig1 resides in that the comparator 1105 and the resistors 1101 , 1102 , 1103 , and 1104 are eliminated and the comparator circuit 130 controls the pch transistors 105 and 106 and the added pch transistor 104 . fig2 illustrates the comparator circuit 130 according to the present invention . the comparator circuit 130 includes a constant current circuit 203 , a constant current circuit 204 , a pch transistor 201 , a pch transistor 202 , an inverter 205 , an inverter 206 , an inverter 208 , and a level shifter 207 . a description is given of connections in the voltage regulator according to the present invention . an output of the vref circuit 101 is connected to an inverting input terminal of the error amplifier 102 . a non - inverting input terminal of the error amplifier 102 is connected to a connection point between the resistor 107 and the resistor 108 , and an output thereof is connected to a gate of the pch transistor 103 and a source of the pch transistor 104 . a source of the pch transistor 103 is connected to the vdd terminal 121 and a drain of the pch transistor 105 . a drain of the pch transistor 103 is connected to the output terminal 122 and a drain of the pch transistor 106 . a back gate of the pch transistor 103 is connected to a source of the pch transistor 105 and a source of the pch transistor 106 . a gate of the pch transistor 105 is connected to a node 111 , and a back gate thereof is connected to the source of the pch transistor 105 . a gate of the pch transistor 106 is connected to a node 110 , and a back gate thereof is connected to the source of the pch transistor 106 . a drain of the pch transistor 104 is connected to the output terminal 122 . a gate of the pch transistor 104 is connected to the node 110 , and a back gate thereof is connected to the output of the error amplifier 102 . one side of the resistor 107 is connected to the output terminal 122 while another side thereof is connected to the resistor 108 . a gate of the nch transistor 109 is connected to the node 110 . a drain of the nch transistor 109 is connected to the resistor 108 , and a source thereof is connected to the vss terminal 123 . the comparator circuit 130 is connected to the output terminal 122 , the vdd terminal 121 , the vss terminal 123 , the node 110 , and the node 111 . the output terminal 122 is connected to a backup battery 112 and a load 113 that are connected in parallel . next , a description is given of connections in the comparator circuit 130 . a gate of the pch transistor 201 is connected to a gate of the pch transistor 202 , a drain of the pch transistor 201 , and the constant current circuit 203 . a source of the pch transistor 201 is connected to the vdd terminal 121 , and a back gate thereof is connected to the vdd terminal 121 . a drain of the pch transistor 202 is connected to the inverter 205 and the constant current circuit 204 . a source of the pch transistor 202 is connected to the output terminal 122 , and a back gate thereof is connected to the output terminal 122 . an output of the inverter 205 is connected to the inverter 206 , and the inverter 205 is connected to the output terminal 122 for its power supply . an output of the inverter 206 is connected to the level shifter 207 and a cont terminal 223 , and the inverter 206 is connected to the output terminal 122 for its power supply . an output of the level shifter 207 is connected to the inverter 208 , and the level shifter 207 is connected to the vdd terminal 121 for its power supply . an output of the inverter 208 is connected to a contx terminal 222 , and the inverter 208 is connected to the vdd terminal 121 for its power supply . the cont terminal 223 is connected to the node 111 of fig1 while the contx terminal 222 is connected to the node 110 of fig1 . next , a description is given of operations of the voltage regulator according to the present invention . when a potential of the vdd terminal 121 is higher than a potential of the output terminal 122 , a gate - source voltage of the pch transistor 201 is higher than a gate - source voltage of the pch transistor 202 . accordingly , a potential of the drain of the pch transistor 202 becomes “ l ” level ( potential of the vss terminal 123 ). with the inverters 205 and 206 for waveform shaping , a voltage of the cont terminal 223 , to which the output of the inverter 206 is connected , becomes “ l ” level . the level shifter 207 converts the potential level of the output terminal 122 to the potential level of the vdd terminal 121 . the inverter 208 inverts an output voltage of the level shifter 207 . when the voltage of the cont terminal 223 is “ l ” level , the contx terminal 222 , which corresponds to the output of the inverter 208 , has the potential level of the vdd terminal 121 . on this occasion , a substrate ( nwell ) potential of the pch transistor 103 illustrated in fig1 becomes the potential of the vdd terminal 121 because the pch transistor 105 is turned on while the pch transistor 106 is turned off . in other words , the substrate ( nwell ) potential of the pch transistor 103 becomes a higher one of the potential of the vdd terminal 121 and the potential of the output terminal 122 . on this occasion , the pch transistor 104 is turned off . when the vdd terminal 121 is connected to a power source , the potential of the vdd terminal 121 normally becomes higher than the potential of the output terminal 122 . on the other hand , when no power source is connected to the vdd terminal 121 , the potential of the vdd terminal 121 becomes lower than the potential of the output terminal 122 because the output terminal 122 is connected to the backup battery 112 . on this occasion , the gate - source voltage of the pch transistor 201 is lower than the gate - source voltage of the pch transistor 202 . accordingly , the potential of the drain of the pch transistor 202 becomes “ h ” level ( potential of the output terminal 122 ). with the inverters 205 and 206 for waveform shaping , the voltage of the cont terminal 223 , which corresponds to the output of the inverter 206 , becomes “ h ” level ( potential of the output terminal 122 ). the level shifter 207 converts the potential level of the output terminal 122 to the potential level of the vdd terminal 121 . the inverter 208 inverts the output voltage of the level shifter 207 . when the voltage of the cont terminal 223 is at “ h ” level ( potential of the output terminal 122 ), the voltage of the contx terminal 222 , which corresponds to the output of the inverter 208 , is “ l ” level ( potential level of the vss terminal 123 ). on this occasion , the substrate ( nwell ) potential of the pch transistor 103 illustrated in fig1 becomes the potential of the output terminal 122 because the pch transistor 106 is turned on while the pch transistor 105 is turned off . in other words , the substrate ( nwell ) potential of the pch transistor 103 becomes a higher one of the potential of the vdd terminal 121 and the potential of the output terminal 122 . on this occasion , the pch transistor 104 is turned on , and accordingly the gate of the pch transistor 103 is allowed to have the same potential as the output terminal 122 so that the pch transistor 103 is turned off . with this , even when the potential of the vdd terminal 121 becomes lower than the potential of the output terminal 122 , a current may be prevented by the pch transistor 103 from flowing from the output terminal 122 to the vdd terminal 121 . next , a description is given of the error amplifier 102 , which is used in fig1 . a configuration of a general error amplifier is as illustrated in fig7 . the error amplifier includes a constant current circuit 705 , nch transistors 701 and 702 , and pch transistors 703 and 704 . the positive input terminal , the negative input terminal , and the output of the error amplifier are respectively represented by inp 721 , inm 722 , and eout 723 . further , fig8 illustrates a cross sectional view of the pch transistor 704 . within an nwell formed on a p - substrate , there exist p - type source and drain regions . the p - substrate is connected to the vss terminal 123 , whose potential is lower . further , the nwell is connected to its source ( vdd terminal 121 ). in a case of using the general error amplifier illustrated in fig7 , when the potential of the output terminal 122 becomes higher than the potential of the vdd terminal 121 , and when the pch transistor 104 is accordingly turned on , the output 723 of the error amplifier 102 is connected to the output terminal 122 . at this time , in the case of the general error amplifier illustrated in fig7 , a pnp transistor whose emitter , base , and collector respectively correspond to the drain , the source , and the substrate of the transistor 704 is turned on . as a result , the backup battery 112 is discharged via the pch transistor 104 . to avoid this phenomenon , it is desirable to adopt such a configuration as illustrated in fig9 for the error amplifier . in fig9 illustrating a second embodiment of the error amplifier 102 , a pch transistor 801 is newly added between the output 723 of the error amplifier and the pch transistor 704 . the pch transistor 801 has a source and an nwell that are connected to the output 723 of the error amplifier , a drain connected to the drain of the pch transistor 704 , and a gate controlled by a signal ( cont signal ) from the node 111 illustrated in fig1 . fig1 illustrates cross sectional views of the pch transistors 704 and 801 . in this case , when the potential of the output terminal 122 becomes higher than the potential of the vdd terminal 121 , and when the pch transistor 104 is accordingly turned on , the output 723 of the error amplifier 102 is connected to the output terminal 122 . however , the signal from the node 111 becomes the same potential as the output terminal 122 , and accordingly the pch transistor 801 is turned off . therefore , a current is not allowed to flow from the drain of the pch transistor 801 to the drain of the pch transistor 704 . further , a difference from fig7 resides in that an nch transistor 802 is inserted between the constant current circuit 705 and a source of a differential input circuit formed of the nch transistors 701 and 702 . a drain of the nch transistor 802 is connected to the sources of the nch transistors 701 and 702 . a source of the nch transistor 802 is connected to the constant current circuit 705 , and a gate thereof is connected to a signal ( contx signal ) from the node 110 illustrated in fig1 to be controlled . when the potential of the output terminal 122 becomes higher than the potential of the vdd terminal 121 , and when the pch transistor 104 is accordingly turned on , the output 723 of the error amplifier 102 is connected to the output terminal 122 so that the nch transistor 702 enters an on state . then , the output terminal 122 and the sources of the nch transistors 701 and 702 are brought into an electrically - connected state , but the nch transistor 802 is turned off to interrupt a current path of the constant current circuit 705 . in this way , a current may be prevented from flowing from the output terminal 122 to the vss terminal 123 via the nch transistor 702 . in the description of fig9 , the nch transistor 802 is inserted between the sources of the nch transistors 701 and 702 and the constant current circuit 705 . however , it should be understood that a similar effect can also be obtained when the nch transistor 802 is inserted between the constant current circuit 705 and the vss terminal 123 . further , in the description of fig9 , the pch transistor 801 is inserted between the output 723 of the error amplifier 102 and the pch transistor 704 . however , it should be understood that a similar effect can also be obtained when the pch transistor 801 is inserted between the vdd terminal 121 and the pch transistor 704 . in fig9 , the description has been given taking a one - stage amplifier circuit as an example of the error amplifier , but the error amplifier may be a multi - stage amplifier circuit with two or more stages . in this case , as in fig9 , the pch transistor 801 having a function of interrupting a current path may be inserted between the output of the error amplifier and the vdd terminal , and the nch transistor 802 having a function of interrupting a current path may be inserted between the output of the error amplifier and the vss terminal . as described above , compared to the conventional voltage regulator illustrated in fig1 , the resistor 1101 , the resistor 1102 , the resistor 1103 , and the resistor 1104 are not provided for comparing the potential of the vdd terminal 121 with the potential of the output terminal 122 . as a result , current consumption may be reduced correspondingly . for example , when it is assumed that the voltage of the backup battery 112 is 3 v and a total resistance of the resistor 1103 and the resistor 1104 is 3 meg ω , a current of 1 μa from the backup battery 112 is consumed by the resistor 1103 and the resistor 1104 . however , in the voltage regulator illustrated in fig1 , there is no element equivalent to those resistors , resulting in no consumption corresponding thereto . it is assumed that the comparator 1105 illustrated in fig1 and the comparator circuit 130 illustrated in fig2 have the same current consumption of 0 . 5 μa . on this occasion , the voltage regulator illustrated in fig1 consumes 1 . 5 μa from the backup battery 112 , whereas the voltage regulator illustrated in fig1 consumes only 0 . 5 μa therefrom , which is one - third of 1 . 5 μa . as a result , an operation time period with the backup battery 112 may be extended significantly . fig3 illustrates a second embodiment of the comparator circuit 130 of the voltage regulator according to the present invention illustrated in fig1 . the comparator circuit 130 according to the second embodiment includes a constant current circuit 303 , a constant current circuit 304 , the pch transistor 201 , a pch transistor 301 , a pch transistor 302 , a pch transistor 305 , the inverter 205 , the inverter 206 , the inverter 208 , and the level shifter 207 . differences from fig2 reside in that an element equivalent to the pch transistor 202 is formed of the two transistors , that is , the pch transistor 301 and the pch transistor 302 , and that the pch transistor 305 is added for realizing a hysteresis function . further , each of the constant current circuit 203 and the constant current circuit 204 is specifically illustrated as an n - channel depletion type mos transistor whose gate and source are connected to the vss terminal 123 . next , a description is given of connections in the comparator circuit 130 . the gate of the pch transistor 201 is connected to a gate of the pch transistor 301 , a gate of the pch transistor 302 , a drain of the pch transistor 201 , and the constant current circuit 303 . the source of the pch transistor 201 is connected to the vdd terminal 121 , and the back gate thereof is connected to the vdd terminal 121 . a drain of the pch transistor 302 is connected to the inverter 205 and the constant current circuit 304 . a source of the pch transistor 302 is connected to a drain of the pch transistor 301 and a drain of the pch transistor 305 , and a back gate thereof is connected to the output terminal 122 . a source of the pch transistor 301 is connected to the output terminal 122 , and a back gate thereof is connected to the output terminal 122 . a gate of the pch transistor 305 is connected to the output of the inverter 205 . a source of the pch transistor 305 is connected to the output terminal 122 , and a back gate thereof is connected to the output terminal 122 . the output of the inverter 205 is connected to the inverter 206 , and the inverter 205 is connected to the output terminal 122 for its power supply . the output of the inverter 206 is connected to the level shifter 207 and the cont terminal 223 , and the inverter 206 is connected to the output terminal 122 for its power supply . the output of the level shifter 207 is connected to the inverter 208 , and the level shifter 207 is connected to the vdd terminal 121 for its power supply . the output of the inverter 208 is connected to the contx terminal 222 , and the inverter 208 is connected to the vdd terminal 121 for its power supply . the n - channel depletion type mos transistors are used as the constant current circuit 303 and the constant current circuit 304 . each of the n - channel depletion type mos transistors has the gate and the source that are connected to the vss terminal 123 , and a drain used as its output . the cont terminal 223 is connected to the node 111 of fig1 while the contx terminal 222 is connected to the node 110 of fig1 . next , a description is given of operations of the voltage regulator , which uses the comparator circuit according to the second embodiment . when the potential of the vdd terminal 121 is sufficiently higher than the potential of the output terminal 122 , the gate - source voltage of the pch transistor 201 is sufficiently higher than gate - source voltages of the pch transistor 301 and the pch transistor 302 . accordingly , a potential of the drain of the pch transistor 302 becomes “ l ” level ( potential of the vss terminal 123 ). with the inverters 205 and 206 for waveform shaping , the output of the inverter 205 becomes “ h ” ( potential of the output terminal 122 ). then , the pch transistor 305 is turned off , and the voltage of the cont terminal 223 , which corresponds to the output of the inverter 206 , becomes “ l ” level . the level shifter 207 converts the potential level of the output terminal 122 to the potential level of the vdd terminal 121 . the inverter 208 inverts the output voltage of the level shifter 207 . when the voltage of the cont terminal 223 is “ l ” level , the contx terminal 222 , which corresponds to the output of the inverter 208 , has the potential level of the vdd terminal 121 . on this occasion , the substrate ( nwell ) potential of the pch transistor 103 becomes the potential of the vdd terminal 121 because the pch transistor 105 is turned on while the pch transistor 106 is turned off . in other words , the substrate ( nwell ) potential of the pch transistor 103 becomes a higher one of the potential of the vdd terminal 121 and the potential of the output terminal 122 . on this occasion , the pch transistor 104 is turned off . when the vdd terminal 121 is connected to a power source , the potential of the vdd terminal 121 normally becomes higher than the potential of the output terminal 122 . subsequently , when the potential of the vdd terminal 121 decreases , because the pch transistor 305 is turned off , the voltage of the vdd terminal 121 is compared with the voltage of the output terminal 122 by means of the pch transistor 201 and a compound transistor formed of the pch transistor 301 and the pch transistor 302 . when the potential of the vdd terminal 121 decreases to a potential lower by δv 1 than the potential of the output terminal 122 , the gate - source voltage of the pch transistor 201 becomes lower by δv 1 than the gate - source voltages of the pch transistor 301 and the pch transistor 302 . accordingly , the potential of the drain of the pch transistor 302 becomes “ h ” level ( potential of the output terminal 122 ). with the inverters 205 and 206 for waveform shaping , the output of the inverter 205 becomes “ l ” level . then , the pch transistor 305 is turned on , and the voltage of the cont terminal 223 , which corresponds to the output of the inverter 206 , becomes “ h ” level ( potential of the output terminal 122 ). the level shifter 207 converts the potential level of the output terminal 122 to the potential level of the vdd terminal 121 . the inverter 208 inverts the output voltage of the level shifter 207 . when the voltage of the cont terminal 223 is at “ h ” level , the contx terminal 222 , which corresponds to the output of the inverter 208 , is “ l ” level . on this occasion , the substrate ( nwell ) potential of the pch transistor 103 illustrated in fig1 becomes the potential of the output terminal 122 because the pch transistor 106 is turned on while the pch transistor 105 is turned off . in other words , the substrate ( nwell ) potential of the pch transistor 103 becomes a higher one of the potential of the vdd terminal 121 and the potential of the output terminal 122 . on this occasion , the pch transistor 104 is turned on , and accordingly the gate of the pch transistor 103 is allowed to have the same potential as the output terminal 122 so that the pch transistor 103 is turned off . the voltage of δv 1 is determined by expression ( 1 ). in expression ( 1 ), i represents a current value of the constant current circuits 303 and 304 ; μ , mobility of the pch transistor 201 , the pch transistor 301 , and the pch transistor 302 ; l 6 , a total transistor l - length of the pch transistor 301 and the pch transistor 302 ; l 5 , a transistor l - length of the pch transistor 201 ; w 6 , a total transistor w - length of the pch transistor 301 and the pch transistor 302 ; and w 5 , a transistor w - length of the pch transistor 201 . subsequently , when the potential of the vdd terminal 121 increases , because the pch transistor 305 is turned on , the voltage of the vdd terminal 121 is compared with the voltage of the output terminal 122 by means of the transistors of the pch transistor 201 and the pch transistor 302 . in the cases where the constant current circuits 303 and 304 have the same current value , and where the pch transistor 201 and the pch transistor 302 have the same transistor types ( vth , mobility , etc . ), the same l - length , and the same w - length , δv 1 in expression ( 1 ) satisfies “ δv 1 = 0 ”. therefore , when the voltage of the vdd terminal 121 and the voltage of the output terminal 122 are substantially equal to each other , the voltage of the cont terminal 223 and the voltage of the contx terminal 222 are inverted . fig4 illustrates voltage waveforms of the cont terminal 223 and the contx terminal 222 of when the voltage of the output terminal 122 is constant while the voltage of the vdd terminal 121 changes , in which the horizontal axis represents time and the vertical axis represents voltage . when the voltage of the vdd terminal 121 decreases to a voltage lower by δv 1 than the voltage of the output terminal 122 , the voltage of the cont terminal 223 and the voltage of the contx terminal 222 are inverted . after that , the voltage of the vdd terminal 121 is raised , and when the voltage of the vdd terminal 121 becomes equal to the voltage of the output terminal 122 , the voltage of the cont terminal 223 and the voltage of the contx terminal 222 are inverted . as described above , hysteresis is provided between the voltage of the vdd terminal 121 and the voltage of the output terminal 122 , between which the substrate ( nwell ) potential of the pch transistor 103 is switched over . this enables the switching - over of the substrate ( nwell ) potential of the pch transistor 103 to be securely performed without a malfunction even when the voltage of the vdd terminal 121 and the voltage of the output terminal 122 become approximate to each other . note that , in order to prevent a parasitic diode formed between the output terminal 122 and the substrate of the pch transistor 103 from being turned on when the voltage of the vdd terminal 121 decreases , the value of δv 1 needs to be set to a forward on voltage ( about 0 . 6 v ) or lower of the parasitic diode . in general , the value of δv 1 is set to about 50 mv to 200 mv . further , the pch transistor 305 is connected in parallel to the pch transistor 301 in fig3 , but it should be understood that a similar effect can also be obtained when the pch transistor 305 is connected in parallel to the pch transistor 302 . further , as has been described in the first embodiment , with regard to the error amplifier , it is desirable to adopt the configuration illustrated in fig9 similarly to the first embodiment . fig5 illustrates a third embodiment of the comparator circuit 130 of the voltage regulator according to the present invention illustrated in fig1 . the comparator circuit 130 according to the third embodiment includes the constant current circuit 303 , the constant current circuit 304 , the pch transistor 202 , a pch transistor 501 , a pch transistor 502 , a pch transistor 503 , the inverter 205 , the inverter 206 , the inverter 208 , and the level shifter 207 . differences from fig2 reside in that an element equivalent to the pch transistor 201 is formed of the two transistors , that is , the pch transistor 501 and the pch transistor 502 , and that the pch transistor 503 is added for realizing a hysteresis function . further , similarly to fig3 , each of the constant current circuits 203 and 204 is specifically illustrated as the n - channel depletion type mos transistor whose gate and source are connected to the vss terminal 123 . next , a description is given of connections in the comparator circuit 130 . a gate of the pch transistor 501 is connected to the gate of the pch transistor 202 , a gate of the pch transistor 502 , a drain of the pch transistor 502 , and the constant current circuit 303 . a source of the pch transistor 501 is connected to the vdd terminal 121 . a drain of the pch transistor 501 is connected to a source of the pch transistor 502 and a drain of the pch transistor 503 , and a back gate thereof is connected to the vdd terminal 121 . a gate of the pch transistor 503 is connected to the output of the level shifter 207 . a source of the pch transistor 503 is connected to the vdd terminal 121 , and a back gate thereof is connected to the vdd terminal 121 . the drain of the pch transistor 202 is connected to the inverter 205 and the constant current circuit 304 . a source of the pch transistor 202 is connected to the output terminal 122 , and a back gate thereof is connected to the output terminal 122 . the output of the inverter 205 is connected to the inverter 206 , and the inverter 205 is connected to the output terminal 122 for its power supply . the output of the inverter 206 is connected to the level shifter 207 and the cont terminal 223 , and the inverter 206 is connected to the output terminal 122 for its power supply . the output of the level shifter 207 is connected to the inverter 208 , and the level shifter 207 is connected to the vdd terminal 121 for its power supply . the output of the inverter 208 is connected to the contx terminal 222 , and the inverter 208 is connected to the vdd terminal 121 for its power supply . the n - channel depletion type mos transistors are used as the constant current circuit 303 and the constant current circuit 304 . each of the n - channel depletion type mos transistors has the gate and the source that are connected to the vss terminal 123 , and a drain used as its output . the cont terminal 223 is connected to the node 111 of fig1 while the contx terminal 222 is connected to the node 110 of fig1 . next , a description is given of operations of the voltage regulator , which uses the comparator circuit according to the third embodiment . when the potential of the vdd terminal 121 is sufficiently higher than the potential of the output terminal 122 , the pch transistor 501 and the pch transistor 502 are turned on while the pch transistor 202 is turned off . accordingly , the potential of the drain of the pch transistor 202 becomes “ l ” level ( potential of the vss terminal 123 ). with the inverters 205 and 206 for waveform shaping , the voltage of the cont terminal 223 , which corresponds to the output of the inverter 206 , becomes “ l ” level . the level shifter 207 converts the potential level of the output terminal 122 to the potential level of the vdd terminal 121 . the inverter 208 inverts the output voltage of the level shifter 207 . when the voltage of the cont terminal 223 is “ l ” level , the output of the level shifter 207 is “ l ” level . accordingly , the pch transistor 503 is turned on , and the contx terminal 222 , which corresponds to the output of the inverter 208 , has the potential level of the vdd terminal 121 . on this occasion , the substrate ( nwell ) potential of the pch transistor 103 illustrated in fig1 becomes the potential of the vdd terminal 121 because the pch transistor 105 is turned on while the pch transistor 106 is turned off . in other words , the substrate ( nwell ) potential of the pch transistor 103 becomes a higher one of the potential of the vdd terminal 121 and the potential of the output terminal 122 . on this occasion , the pch transistor 104 is turned off . when the vdd terminal 121 is connected to a power source , the potential of the vdd terminal 121 normally becomes higher than the potential of the output terminal 122 . subsequently , when the potential of the vdd terminal 121 decreases , because the pch transistor 503 is turned on , the voltage of the vdd terminal 121 is compared with the voltage of the output terminal 122 by means of the pch transistor 502 and the pch transistor 202 . in the cases where the constant current circuits 303 and 304 have the same current value , and where the pch transistor 502 and the pch transistor 202 have the same transistor types ( vth , mobility , etc . ), the same l - length , and the same w - length , when the potential of the vdd terminal 121 decreases to substantially the same value as the potential of the output terminal 122 , the pch transistor 502 is turned off while the pch transistor 202 is turned on . accordingly , the potential of the drain of the pch transistor 202 becomes “ h ” level ( potential of the output terminal 122 ). with the inverters 205 and 206 for waveform shaping , the voltage of the cont terminal 223 , which corresponds to the output of the inverter 206 , becomes “ h ” level ( potential of the output terminal 122 ). the level shifter 207 converts the potential level of the output terminal 122 to the potential level of the vdd terminal 121 . the inverter 208 inverts the output voltage of the level shifter 207 . when the voltage of the cont terminal 223 is at “ h ” level , the output of the level shifter 207 corresponds to the voltage of the vdd terminal 121 . accordingly , the pch transistor 503 is turned off , and the voltage of the contx terminal 222 , which corresponds to the output of the inverter 208 , becomes “ l ” level . on this occasion , the substrate ( nwell ) potential of the pch transistor 103 becomes the potential of the output terminal 122 because the pch transistor 106 is turned on while the pch transistor 105 is turned off . in other words , the substrate ( nwell ) potential of the pch transistor 103 becomes a higher one of the potential of the vdd terminal 121 and the potential of the output terminal 122 . on this occasion , the pch transistor 104 is turned on , and accordingly the gate of the pch transistor 103 is allowed to have the same potential as the output terminal 122 so that the pch transistor 103 is turned off . subsequently , when the potential of the vdd terminal 121 increases , because the pch transistor 503 is turned off , the voltage of the vdd terminal 121 is compared with the voltage of the output terminal 122 by means of the pch transistor 202 and a compound transistor formed of the pch transistor 501 and the pch transistor 502 . when the voltage of the vdd terminal 121 increases to a voltage higher by δv 2 than the voltage of the output terminal 122 , the voltage of the cont terminal 223 and the voltage of the contx terminal 222 are inverted . the voltage of δv 2 is determined by expression ( 2 ). in expression ( 2 ), i represents a current value of the constant current circuits 303 and 304 ; μ , mobility of the pch transistor 202 , the pch transistor 501 , and the pch transistor 502 ; l 6 , a transistor l - length of the pch transistor 202 ; l 5 , a total transistor l - length of the pch transistor 501 and the pch transistor 502 ; w 6 , a transistor w - length of the pch transistor 202 ; and w 5 , a total transistor w - length of the pch transistor 501 and the pch transistor 502 . fig6 illustrates voltage waveforms of the cont terminal 223 and the contx terminal 222 of when the voltage of the output terminal 122 is constant while the voltage of the vdd terminal 121 changes , in which the horizontal axis represents time and the vertical axis represents voltage . when the voltage of the vdd terminal 121 decreases to be equal to the voltage of the output terminal 122 , the voltage of the cont terminal 223 and the voltage of the contx terminal 222 are inverted . after that , the voltage of the vdd terminal 121 is raised , and when the voltage of the vdd terminal 121 becomes higher by δv 2 than the voltage of the output terminal 122 , the voltage of the cont terminal 223 and the voltage of the contx terminal 222 are inverted . as described above , hysteresis is provided between the voltage of the vdd terminal 121 and the voltage of the output terminal 122 , between which the substrate ( nwell ) potential of the pch transistor 103 is switched over . this enables the switching - over of the substrate ( nwell ) potential of the pch transistor 103 to be securely performed without a malfunction even when the voltage of the vdd terminal 121 and the voltage of the output terminal 122 become approximate to each other . note that , in order to prevent a parasitic diode formed between the vdd terminal 121 and the substrate of the pch transistor 103 from being turned on when the voltage of the vdd terminal 121 increases , the value of δv 2 needs to be set to a forward on voltage ( about 0 . 6 v ) or lower of the parasitic diode . in general , the value of δv 2 is set to about 50 mv to 200 mv . further , the pch transistor 503 is connected in parallel to the pch transistor 501 in fig5 , but it should be understood that a similar effect can also be obtained when the pch transistor 503 is connected in parallel to the pch transistor 502 . further , as has been described in the first embodiment , with regard to the error amplifier , it is desirable to adopt the configuration illustrated in fig9 similarly to the first embodiment . fig1 illustrates a circuit diagram of a voltage regulator according to a second embodiment mode of the present invention . differences from fig1 reside in that the back gate of the pch transistor 104 is connected to the back gate of the pch transistor 103 , and that a delay circuit 1201 is added to the outputs of the comparator circuit 130 . connections are made such that the outputs of the comparator circuit 130 are connected to the delay circuit 1201 , and the outputs of the delay circuit 1201 correspond to the outputs of the node 110 and the node 111 . next , a description is given of operations of the voltage regulator according to the second embodiment mode . when the voltage of the vdd terminal 121 is higher than the voltage of the output terminal 122 , the voltage of the node 111 is at “ l ” level while the voltage of the node 110 is at “ h ” level . accordingly , the pch transistor 105 is turned on while the pch transistor 106 is turned off . on this occasion , the substrate ( nwell ) potential of the pch transistor 104 becomes the voltage of the vdd terminal 121 , and hence the pch transistor 104 can be turned off without fail . the delay circuit 1201 uses a timer circuit to prevent the voltages of the node 110 and the node 111 from becoming “ l ” level simultaneously . this prevents the pch transistors 105 and 106 from being turned on simultaneously and a current from flowing from the vdd terminal 121 to the output terminal 122 or from the output terminal 122 to the vdd terminal 121 . note that , the voltage regulator according to the second embodiment mode may be allowed to operate without the delay circuit 1201 , though in this case there is a problem that the pch transistors 105 and 106 may be turned on simultaneously . fig1 illustrates a third embodiment of the error amplifier 102 of the voltage regulator according to the present invention illustrated in fig1 . a difference from fig9 resides in that a pch transistor 803 is inserted downstream of the constant current circuit 705 , which has a gate connected to a cont terminal 823 . next , a description is given of an operation . when the potential of the output terminal 122 becomes higher than the potential of the vdd terminal 121 , and when the pch transistor 104 is accordingly turned on , the output 723 of the error amplifier 102 is connected to the output terminal 122 . because the nch transistor 702 is in the on state , the output terminal 122 and the sources of the nch transistors 701 and 702 are brought into the electrically - connected state . then , the nch transistor 802 and the pch transistor 803 are turned off , to thereby interrupt the current path of the constant current circuit 705 to prevent a current from flowing from the output terminal 122 to the vss terminal 123 via the nch transistor 702 . in fig1 , the description has been given taking a one - stage amplifier circuit as an example of the error amplifier , but the error amplifier may be a multi - stage amplifier circuit with two or more stages . in this case , as in fig1 , the pch transistor 801 having a function of interrupting a current path may be inserted between the output of the error amplifier and the vdd terminal , and the nch transistor 802 and the pch transistor 803 having a function of interrupting a current path may be inserted between the output of the error amplifier and the vss terminal . fig1 illustrates a fourth embodiment of the error amplifier 102 of the voltage regulator according to the present invention illustrated in fig1 . differences from fig1 reside in that the nch transistor 802 and the pch transistor 803 are eliminated , and that the cont terminal 823 is connected to the constant current circuit 705 . next , a description is given of an operation . when the potential of the output terminal 122 becomes higher than the potential of the vdd terminal 121 , and when the pch transistor 104 and the pch transistor 801 are accordingly turned on and off , respectively , the output 723 of the error amplifier 102 is connected to the output terminal 122 . because the nch transistor 702 is in the on state , the output terminal 122 and the sources of the nch transistors 701 and 702 are brought into the electrically - connected state . then , by the signal from the cont terminal 823 , the constant current circuit 705 is turned off to interrupt a current path so that a current is prevented from flowing from the output terminal 122 to the vss terminal 123 via the nch transistor 702 . in fig1 , the description has been given taking a one - stage amplifier circuit as an example of the error amplifier , but the error amplifier may be a multi - stage amplifier circuit with two or more stages . in this case , the constant current circuit may be configured to be turned off by the signal from the cont terminal 823 .