**1. Introduction**

Recently, the number of cyber-physical systems and systems with embedded sensors is increasing. This leads to an increased load on the means of communication between such systems. To minimize the amount of information transferred, a new paradigm of edge computing is being developed. It implies moving data processing as close as possible to the point where it is received [1,2]. In the context of this paradigm, there is a need to develop special devices that provide computations near sensors. These should be compact, energy-efficient and fault-tolerant modules, which can be manufactured as separate chips or integrated with sensing elements in a single chip [3,4]. Hardware implementation of simple functional signal conversions is available in analog, digital, pulse, and mixed formats. Obviously, performing calculations in the formats of signals obtained at the outputs of sensitive elements will allow us to avoid additional operations related to format conversions. Sensors often generate a frequency output signal [5,6]. Also, analogto-frequency converters can be installed in chips of sensors with an analog output [7,8]. The frequency output signal can be represented as a stream of pulses [9] or pulse-width modulated (PWM) signals [10]. In a pulse stream, the carrier of information is the number of pulses per unit time. In a PWM signal, the information is associated with the relative duration of the pulses. In both cases, the amplitude of the signals is the same and can be considered as logic level "1". The considered pulse forms of signal representation, also called bit-stream, allow the application of digital logic elements for primary data

**Citation:** Bureneva, O.; Mironov, S.; Safyannikov, N.; Sukhinets, Z. Functional Converter for Intelligent Sensor and Its Layout Design. *Eng. Proc.* **2023**, *33*, 50. https://doi.org/ 10.3390/engproc2023033050

Academic Editors: Askhat Diveev, Ivan Zelinka, Arutun Avetisyan and Alexander Ilin

Published: 17 July 2023

**Copyright:** © 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/).

processing. In this case, programmable logic-integrated circuits of various levels of complexity can be used as the element base for the implementation of near-sensor computing modules [11,12]. In some cases, it is economically justified to manufacture the sensor signal primary converters in the form of application-specific integrated circuits (ASICs) [13]. If silicon technology allows, the sensing element, analog-to-frequency converter and modules for primary computation can be integrated in a single silicon chip. In both the FPGA basis and the ASIC implementation, various functional transformations can be performed. This can be realized by integrating various signal processing circuits for data reception, primary converters, digital signal processing circuits, memory, and nodes for wired or wireless communication. As a result of this integration, there will be a sensor-on-chip system, such as [14]. Based on the above facts, we can conclude that the development of digital hardware modules that process pulse signals and provide a connection between the pulse output of the sensor and the input of the digital information processing system is factual. In this paper, we focus on a new approach to the organization of calculations in a digital PWM signal converter. The traditional approach to signal processing implies conversion of analog or pulse signal into digital form with subsequent calculations using traditional units (adders, multipliers, dividers, etc.) or using a microcontroller, as shown in [15]. In the proposed transducer, all operations are performed in pulse form on the basis of simple logic elements, binary counters and registers, and the multiplication and division operation of pulse signals is implemented in the basis of operations "+1" and "−1". The proposed solution is effective in terms of simplicity of hardware implementation and can be used to connect sensors with pulse output to digital processing systems.

#### **2. Design of the Converter**

Transformations of pulse signals from sensors can be performed in different ways. Let us consider the implementation of the converter, for example, for a temperature sensor, which forms a signal in PWM form. This signal is formed by a semiconductor sensing element and is digitized with a first-order sigma–delta modulator. The output signal is a periodic signal represented by time intervals *T*<sup>1</sup> (high level) and *T*<sup>2</sup> (low level). The conversion function of the temperature sensor is as follows:

$$T(^{\circ}\text{C}) = a\_1 + a\_2 \frac{T\_1}{T\_2}.\tag{1}$$

where *a*<sup>1</sup> and *a*<sup>2</sup> are constants determined by the sensor model.

#### *2.1. Implementation Based on Traditional Calculations*

The sensor output signal is quasi-digital and can be processed by digital elements. Sensor manufacturers recommend two approaches to temperature calculation based on the parameters of the output signal [15]. Firstly, it can be a software implementation oriented to the usage of the microcontrollers. Most microcontrollers allow direct connection of sensitive elements, forming a quasi-digital output signal, to the input ports. Using a microcontroller allows you to implement simple, inexpensive solutions, but errors in the result may occur. The source of such errors is software-dependent effects. The analysis and options for compensating such effects are given in [16]. Secondly, the transformations can be performed by hardware using typical computing units. The schematic recommended by the manufacturer of a temperature sensor with output characteristic (1) is given in [15]. The circuit measures the duration of the output single signals from the sensor with a resolution of ±1 μs. For this purpose, a cascade connection of 8-bit counters is used. The counters start with the rising edge of the sensor signal and count clock pulses from an external 1 MHz oscillator. The counting results are stored in the output registers. The falling edge of the signal from the sensor forms the reset signal for the counters. After that, they start counting the next output phase—the duration of the zero value of the sensor output signal. The calculated value at the beginning of the new period is also stored in the registers. Then, the

obtained values *T*<sup>1</sup> and *T*<sup>2</sup> are used to calculate the temperature by hardware or to transmit it to the software computing core.

#### *2.2. Implementation Based on the Method of Small Increments*

Consider the pulse stream implementation of expression (1). A schematic of the n-digit device realizing this operation is shown in Figure 1a. A reference pulse stream is sent to the input F and the generator G forms n reference pulse streams based on the F. Generation of reference pulse streams is performed as follows (Figure 1b). Each pulse of the F stream increases the value of the CT counter by one. At the same time, one of the outputs of this counter switches from the state "0" to "1". The only exception is the counter change from the state "all ones" to the state "all zeros", when none of the outputs switch from "0" to "1". The output signals of the counter are used as clock signals for the triggers T. In these triggers, a one is written when a rising edge occurs at the counter output. Obviously, for every F-flow pulse a one is written to no more than one trigger. After the falling edge of the F-flow pulse all triggers are reset. Thus, the sum of pulses in all generated streams is equal to 2*n*–1 during the device operation period.

**Figure 1.** (**a**) General circuit diagram of the converter; (**b**) circuit diagram of the reference pulse signal generator G.

The average frequencies of *Pi* streams over the period of device operation are determined as follows:

$$P\_i = \frac{F}{2^n} 2^{n-i-1}$$

where *i* ∈ [0 : *n* – 1].

Logic elements &0 – &*n*−1, connected to the outputs of generator G, implement the function of multiplication of streams *Pi* by bits of binary code *N*. The resulting streams are summed by the OR logic element. The logic expression for the output of this element is as follows:

$$F\_{OR1} = L\_0 \lor L\_1 \lor L\_2 \cdot \cdots \cdot L\_{n-1} \cdot$$

The function *L* in the general case for each *i*-th input of element OR1 is formed on the corresponding elements of &*i*:

$$L\_i = N\_{1\_{n-i-1}} P\_i 2^{-n} \rho$$

where *N*1*n*−*i*−<sup>1</sup> is the logical state of the n-i-1 digit of the code *N*1; *Pi* is the pulse stream from the generator G output.

The pulse streams at the outputs of elements &0 – &*n*˘1 have the following frequencies:

$$L\_0 = N\_{1\_{n-1}} P\_{0\prime} \quad L\_1 = N\_{1\_{n-2}} P\_{1\prime} \quad L\_2 = N\_{1\_{n-3}} P\_{2\prime} \dots, L\_{n-1} = N\_{1\_0} P\_{n-1\prime}$$

The total value of the frequency *FOR*<sup>1</sup> at the output of the OR1 element is determined as follows:

$$F\_{OR1} = N\_{1\_{n-1}}P\_0 + N\_{1\_{n-2}}P\_1 + N\_{1\_{n-3}}P\_2 + \cdots + N\_{1\_0}P\_{n-1} = 1$$

$$F\_2^{-n} \left( N\_{1\_{n-1}}2^{n-1} + N\_{1\_{n-2}}2^{n-2} + N\_{1\_{n-3}}2^{n-3} + \cdots + N\_{1\_0}2^0 \right).$$

In this expression, the sum of the products of the current code bit *N*1*<sup>i</sup>* by the weight of the n-bit code bit is the binary code *N*1. Thus, the average frequency of the pulse stream at the output of the OR1 logic element can be written as follows:

$$F\_{OR1} = \frac{F}{2^n} N\_1$$

Similarly, the value of frequencies *FOR*<sup>2</sup> and *FOR*<sup>3</sup> at the outputs of elements OR2 and OR3, respectively, is determined as:

$$F\_{OR2} = \frac{F}{2^n} N\_2 \quad \text{and} \quad F\_{OR3} = \frac{F}{2^n} N\_{out}.$$

Consider the operation of the converter shown in Figure 1a. Let the initial moment of time zero code be stored in the counter and register, i.e., *Nout* = 0. At digital inputs *N*<sup>1</sup> and *N*2, the binary codes corresponding to constants *a*<sup>1</sup> and *a*<sup>2</sup> of Equation (1) are set. The reference pulse stream is supplied to input *F*; the PWM signal from the sensor output is received at input *T*1. Elements 11 and 12, under the influence of codes *N*<sup>1</sup> and *N*2, form the streams *FOR*<sup>1</sup> and *FOR*2. During the first period, as long as the input *T*<sup>1</sup> holds signal value "1", the stream *FOR*<sup>2</sup> passes through the element &22 and 14 to the counter input marked as "−". When the value at input *T*<sup>1</sup> becomes zero, the stream *FOR*<sup>2</sup> is blocked. At this time, the stream *FOR*<sup>1</sup> starts flowing through element &21 to the counter input marked "+". The stream *FOR*<sup>3</sup> is not generated because of the zero code *Nout*. When the signal "1" appears on the input of *T*<sup>1</sup> again, the counted number of pulses from the counter CT is rewritten into the register RG. While *T*<sup>1</sup> = 1 at the counter input "−" the stream *FOR*<sup>2</sup> passes, when *T*<sup>1</sup> = 0 at the counter input "+" the stream *FOR*<sup>1</sup> passes, and at the counter input "−" the *FOR*<sup>3</sup> stream is formed on the basis of the zero code *Nout* = 0. Negative feedback is used in the device, and as a result, the dynamic equilibrium mode is reached. In this mode, the number of pulses coming to the adding *N*<sup>+</sup> and subtracting *N*<sup>−</sup> inputs of the counter CT during the period T is the same, i.e.,

$$N\_- = N\_+ \quad \text{or} \quad \bar{F}\_- = \bar{F}\_+ \tag{2}$$

where *F*¯ <sup>+</sup> and *F*¯ <sup>−</sup> are the average values of pulse flux frequencies at the counter inputs "−' and "+", respectively.

The "+" counter input receives pulses during the device's operating period T. The number of pulses is determined by the following expression:

$$F\_{+} = F\_{\rm OR1} T\_{2} = \frac{F}{2^{n}} N\_{1} T\_{2}.\tag{3}$$

The number of pulses that come to the input of the counter "−" during the period of operation of the device T is calculated as follows:

$$F\_- = T\_1 F\_{OR2} + T\_2 F\_{OR3} = \frac{F}{2^n} (T\_1 N\_2 + T\_2 N\_{out}) \tag{4}$$

In the dynamic equilibrium mode, the characteristic (2) with regard to (3) and (4) will have the following form:

$$\frac{F}{2^n}N\_1T\_2 = \frac{F}{2^n}(T\_1N\_2 + T\_2N\_{out})$$

From the last expression, we get the equation:

$$N\_{out} = N\_1 - N\_2 \frac{T\_1}{T\_2}$$

That is, the characteristic of the device corresponds to the function of the sensor.

#### **3. Converter Implementation**

To study the functioning of the proposed circuit, we developed a description of the device in VerilogHDL.

#### *3.1. Simulation of the Converter*

The input signals for the program are the reference frequency signal *F* and the input signal *T* consisting of two parts: *T*<sup>1</sup> and *T*2. For the correct operation of the model, an additional reset signal is used to ensure that the counters and registers are set to a zero state. However, given that the device has a steady state and always tends to it, it can start from any random state, so the reset signal is optional. The input signals for the program are the reference frequency signal *F* and the input signal *T*, consisting of two parts: *T*<sup>1</sup> and *T*2. For the correct operation of the model, an additional reset signal is used to ensure that the counters and registers are set to a zero state. However, given that the device has a steady state and always tends to it, it can start from any random state, so the reset signal is optional. The constants in the implemented expression are set at the stage of synthesis; in the program, they are described as parameters. When creating a universal device, additional digital inputs can be provided for these constants. Figure 2 shows the operation of the device configured to process the signal from the AD TMP03 temperature sensor.

**Figure 2.** Result of the converter simulation.

The diagram shows the transient process, during which the transducer reaches the equilibrium mode. Starting from the fifth period of the input signal *T*1, the transducer keeps the output code unchanged. This code is the result of the execution of transformations. At the moment of 14.243 ns, an interference occurs, which leads to a shortening of the signal duration *T*1. After three periods, the converter returns to the equilibrium mode, compensating for the failure by triggering the feedback.

#### *3.2. Custom Circuit Design*

Despite the fact that the layout design of elements such as registers, counters, or logic primitives is quite well developed, research on topology optimization continues. This research is related to the search for original solutions in order to optimize the chip area, power and speed [17,18]. When minimizing the circuit layout design, we are looking for solutions that minimize the main component of pulse stream information processing devices—the binary counter. Solutions based on the principle of "first-zero search" are proposed. The circuit diagram of the counter cell based on the "first zero search" principle is shown in Figure 3. Its current–discharge inversion control circuit is built on pass-through keys (as in Manchester adder transfer circuits). The cells are combined into four-digit sections with an inverter at the input and at the output. At the input of each *i*-th bit from the previous one comes the *INV*\_*IN*\_*i* signal to invert the value of the current bit. If the inversion control signal is changed, the pass-through key in the circuit is opened. This cuts off the low-order bits and generates a new *INV*\_*OUT*\_*i* control signal value (cancelling the inversion of the current bit) in the cell. This value is sent to the next (high) counter digit.

The considered circuit solution provides not only high speed and low hardware costs, but also a linear dependence of the delay time and on-chip area on the bit resolution of the device. Moreover, if necessary, the proposed circuit solution can significantly increase the speed of circuits with a relatively small increase in the area on the chip. Figure 4 shows an example of topological implementation of the converter considered above (Figure 1) for 4-bit data. Matrixing of the presented topology along the ordinate axis with an appropriate matrixing coefficient makes it possible to obtain a device of the required digit capacity (a multiple of four). The topology was developed using the original computer-aided design tools [19] in a technologically invariant concept, which allows the design to be adjusted to the design and technological requirements of the chosen manufacturing enterprise.

**Figure 4.** Layout design of the 4-digit calculator section.

From the presented material, we can see that the implementation of such calculators in the form of independent fragments of integrated circuits is compact and simple. In addition, it has greater speed than devices based on universal computing units.

#### **4. Conclusions**

A large number of sensors provide information in pulse form. This is due to the simplicity of obtaining a pulse signal at the output of the sensing element, as well as the following advantages of the pulse form:


In this paper, we proposed a new method of functional processing of pulse streams based on elementary logical and arithmetic operations (increment/decrement) and implemented using simple digital elements: logic primitives, counters and registers without using an adder, multiplier, divider or other complex nodes. The considered device provides division of PWM signals directly in pulse form without additional conversion into digital binary codes. This device can be implemented based on PLD and used as an interface for sensors that generate PWM output signal and require multiplying and dividing operations. Small corrections will allow the proposed structure to be used to process signals of a large number of existing quasi-digital sensors with frequency and pulse-width modulated outputs, which are available at the moment.

**Author Contributions:** Conceptualization, O.B. and N.S.; methodology, O.B.; software, S.M.; validation, S.M., Z.S. and N.S.; formal analysis, O.B.; investigation, S.M. and Z.S.; resources, N.S.; writing—original draft preparation, O.B.; writing—review and editing, Z.S.; visualization, S.M.; supervision, N.S.; project administration, O.B.; funding acquisition, O.B. All authors have read and agreed to the published version of the manuscript

**Funding:** This work was supported by the Ministry of Science and Higher Education of the Russian Federation by the Agreement No. 075-15-2022-291 dated 15 April 2022 on the provision of a grant in the form of subsidies from the federal budget for the implementation of state support for the establishment and development of the world-class scientific center «Pavlov center Integrative physiology for medicine, high-tech healthcare, and stress-resilience technologies».

**Institutional Review Board Statement:** Not applicable.

**Informed Consent Statement:** Not applicable.

**Data Availability Statement:** Not applicable.

**Conflicts of Interest:** The authors declare no conflict of interest.

#### **References**


**Disclaimer/Publisher's Note:** The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.
