This disclosure relates to a calculation circuit, and in particular to a sum of products calculation circuit and a sum of products calculation method thereof.
According to current technology, multiple pairs of coefficients have to be multiplied first to obtain multiple products, and then the multiple products are added when one wishes to add multiple products to find the sum. Therefore, in order to find the sum of products, a large number of multipliers and adders have to be used.
A conventional sum of products calculation circuit often includes multiple resistances connected in series and a transistor switch. This circuit design often has too many resistances connected in series, which results in an excessively large resistance value, and drifting of the resistance value of the transistor switch, which results in erroneous calculation results, and thus increasing the difficulty of circuit implementation.
This disclosure provides a sum of products calculation circuit and a sum of products calculation method thereof, which can greatly reduce the difficulty of circuit implementation.
A sum of products calculation circuit of the disclosure includes a differential amplifier, a first adjustable resistance unit, a first parallel resistance unit, a second adjustable resistance unit, a second parallel resistance unit, and a processing circuit. A first input terminal of the differential amplifier is coupled to a reference voltage. The first parallel resistance unit and the first adjustable resistance unit are connected in parallel between a second input terminal of the differential amplifier and an operating voltage. The second parallel resistance unit and the second adjustable resistance unit are connected in parallel between the second input terminal of the differential amplifier and ground. Resistance values of the first parallel resistance unit and the second parallel resistance unit are associated with a first input parameter and a second input parameter. The resistance value of the first adjustable resistance unit is R/(MK), and the resistance value of the second adjustable resistance unit is R/K, where R is a resistance value, M and K are positive integers, and M is greater than K. The processing circuit is coupled to the differential amplifier, the first parallel resistance unit, and the second parallel resistance unit. The processing circuit adjusts resistance values of the first adjustable resistance unit and the second adjustable resistance unit and calculates a sum of products of the first input parameter and the second input parameter according to the resistance value of the second adjustable resistance unit corresponding to a situation in which an output of the differential amplifier is in transition.
The disclosure also provides a sum of products calculation method of a sum of products calculation circuit. The sum of products calculation circuit includes a differential amplifier, a first adjustable resistance unit, a first parallel resistance unit, a second adjustable resistance unit, and a second adjustable resistance unit. A first input terminal of the differential amplifier is coupled to a reference voltage. The first adjustable resistance unit and the first parallel resistance unit are connected in parallel between a second input terminal of the differential amplifier and an operating voltage. The second adjustable resistance unit and the second parallel resistance unit are connected in parallel between the second input terminal of the differential amplifier and ground. Resistance values of the first parallel resistance unit and the second parallel resistance unit are associated with a first input parameter and a second input parameter. The resistance value of the first adjustable resistance unit is R/(MK), and the resistance value of the second adjustable resistance unit is R/K, where R is a resistance value, M and K are positive integers, and M is greater than K. The sum of products calculation method of the sum of products calculation circuit includes the following steps. The resistance values of the first adjustable resistance unit and the second adjustable resistance unit are adjusted. Whether there is a transition in an output of the differential amplifier is determined. A sum of products of the first input parameter and the second input parameter is calculated according to the resistance value of the second adjustable resistance unit corresponding to a situation in which the output of the differential amplifier is in transition.
Based on the above, the first input terminal of the differential amplifier according to the embodiment of the disclosure is coupled to the reference voltage, the first adjustable resistance unit and the first parallel resistance unit are connected in parallel between the second input terminal of the differential amplifier and the operating voltage, and the second adjustable resistance unit and the second parallel resistance unit are connected in parallel between the second input terminal of the differential amplifier and the ground, and the processing circuit adjusts the resistance values of the first adjustable resistance unit and the second adjustable resistance unit and calculates the sum of products of the first input parameter and the second input parameter according to the resistance value of the second adjustable resistance unit corresponding to the situation in which the output of the differential amplifier is in transition. Since the sum of products calculation circuit is mainly designed as a parallel resistance structure, it can effectively improve the issue of an excessively large resistance value caused by too many resistances connected in series, and can greatly reduce the difficulty of circuit implementation.
To make the abovementioned more comprehensible, several embodiments accompanied by drawings are described in detail as follows.
The processing circuit 110 may adjust resistance values of the adjustable resistance unit 102 and the adjustable resistance unit 106, and determine whether an output VO of the differential amplifier A1 is in transition (such as from a high voltage level to a low voltage level, or from a low voltage level to a high voltage level). Since the resistance values of the parallel resistance unit 104 and the parallel resistance unit 108 are associated with the first input parameter x and the second input parameter w, and a voltage at the second input terminal of the differential amplifier A1 is a voltage generated by dividing the operating voltage VC by the adjustable resistance unit 102, the parallel resistance unit 104, the adjustable resistance unit 106, and the parallel resistance unit 108, the processing circuit 110 may calculate a sum of products of the first input parameter x and the second input parameter w according to a proportional relationship between the resistance value of the adjustable resistance unit 106, a parallel resistance value of the adjustable resistance unit 102 and the parallel resistance unit 104, and a parallel resistance value of the adjustable resistance unit 106 and the parallel resistance unit 108 corresponding to a situation in which the output VO of the differential amplifier is in transition, through appropriately setting the resistance values of the parallel resistance unit 104 and the parallel resistance unit 108.
For example,
Therefore, a resistance value of the resistor R11 may be as follows.
A resistance value of the nth resistor R1n, deduced by analogy, may be as follows.
Similarly, in the parallel resistance unit 108, each resistor R2n may also include two resistors connected in series. For example, a resistor R21 may include a resistor R1′ and a resistor R2′ connected in series, and resistance values of the resistor R1′ and the resistor R2′ may be as follows.
Therefore, a resistance value of the resistor R21 may be as follows.
A resistance value of the nth resistor R1n, deduced by analogy, may be as follows.
In this way, a parallel resistance value RP of the adjustable resistance unit 102 and the parallel resistance unit 104, and a parallel resistance value RS of the adjustable resistance unit 106 and the parallel resistance unit 108 may be as follows.
The processing circuit 110 may adjust a K value to change the resistance values RP and RS, and divide the operating voltage VC. In the embodiment, a voltage level of the reference voltage VR may be set to, for example, 0.5 times of the operating voltage VC, but it is not limited thereto. The processing circuit 110 may determine whether the output VO of the differential amplifier is in transition while adjusting the K value. When the output VO of the differential amplifier is in transition, it means that the resistance value RP is equal to the resistance value RS, and according to the equations (9) and (10), at this time, the resistance value R/K of the adjustable resistance unit 106 may be as follows.
Therefore, a sum of products Σxn·wn of the parameters x1 to xj and the parameters w1 to wj calculated by the processing circuit 110 may be as follows.
As described above, since the sum of products calculation circuit of the embodiment is mainly designed with a parallel resistance structure, it can effectively improve the issue of an excessively large resistance value caused by too many resistances connected in series, and thus, can greatly reduce the difficulty of circuit implementation.
In addition, in some embodiments, the parallel resistance unit 104 and the parallel resistance unit 108 may be implemented by an encoder, multiple resistances, and multiple switches. The multiple switches may be, for example, transistor switches.
In addition, the adjustable resistance unit 106 may also be implemented using a similar concept. As shown in
In addition, in some embodiments, a first resistor coupled between the second input terminal of the differential amplifier and the first parallel resistance unit, and a second resistor coupled between the second input terminal of the differential amplifier and the second parallel resistance unit may be provided to further reduce the influence of the resistance value fluctuation of the switches in the first adjustable resistance unit, the first parallel resistance unit, the second adjustable resistance unit, and the second parallel resistance unit, and the occurrence of a calculation error in the sum of products calculation circuit can be further prevented.
In summary, the first input terminal of the differential amplifier according to the embodiment of the disclosure is coupled to the reference voltage, the first adjustable resistance unit and the first parallel resistance unit are connected in parallel between the second input terminal of the differential amplifier and the operating voltage, and the second adjustable resistance unit and the second parallel resistance unit are connected in parallel between the second input terminal of the differential amplifier and the ground, and the processing circuit adjusts the resistance values of the first adjustable resistance unit and the second adjustable resistance unit and calculates the sum of products of the first input parameter and the second input parameter according to the resistance value of the second adjustable resistance unit corresponding to the situation in which the output of the differential amplifier is in transition. Since the sum of products calculation circuit is mainly designed as a parallel resistance structure, it can effectively improve the issue of an excessively large resistance value caused by too many resistances connected in series, and can greatly reduce the difficulty of circuit implementation. In some embodiments, the sum of products calculation circuit may further include the first resistor coupled between the second input terminal of the differential amplifier and the first parallel resistance unit, and the second resistor coupled between the second input terminal of the differential amplifier and the second parallel resistance unit, so as to further reduce the influence of the resistance value fluctuation of the switches in the first adjustable resistance unit, the first parallel resistance unit, the second adjustable resistance unit, and the second parallel resistance unit, and further prevent the occurrence of a calculation error in the sum of products calculation circuit.
Although the disclosure has been described with reference to the above-mentioned embodiments, it is not intended to be exhaustive or to limit the disclosure to the precise form or to exemplary embodiments disclosed. It is apparent to one of ordinary skill in the art that modifications to the described embodiments may be made without departing from the spirit and the scope of the disclosure. Accordingly, the scope of the disclosure is defined by the claims appended hereto and their equivalents in which all terms are meant in their broadest reasonable sense unless otherwise indicated.
Number | Date | Country | Kind |
---|---|---|---|
202110315010.4 | Mar 2021 | CN | national |
This application claims the priority benefit of U.S. provisional application Ser. No. 63/011,315, filed on Apr. 17, 2020, U.S. provisional application Ser. No. 63/047,890, filed on Jul. 2, 2020 and China application serial no. 202110315010.4, filed on Mar. 24, 2021. The entirety of the above-mentioned patent applications are hereby incorporated by reference herein and made a part of this specification.
Number | Date | Country | |
---|---|---|---|
63047890 | Jul 2020 | US | |
63011315 | Apr 2020 | US |