An output control method of transcranial gaussian random noise stimulation

CN122805975APending Publication Date: 2026-09-25XIAN ZHENTAI INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610957928.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-30
Publication Date
2026-09-25

AI Technical Summary

Technical Problem

[0005]本申请提供了一种经颅高斯随机噪声刺激的输出控制方法,以实现噪声数据的半区级动态交替更新与输出并行执行,解决现有技术因静态数组循环输出导致的波形周期性诱发神经适应及输出接缝无法连续无间断的问题,提升长时程刺激的有效性与输出波形的连续性

Benefits of technology

[0010]本申请实施例提供了一种经颅高斯随机噪声刺激的输出控制方法,该方法包括:应用于具有第一半区存储空间和第二半区存储空间的动态噪声数据缓存区,方法包括:在将动态噪声数据缓存区中存储的噪声数据循环搬运至数模转换器的过程中,获取在开始搬运任一半区存储空间内噪声数据时所产生的半区切换触发信号;基于半区切换触发信号,确定与当前开始搬运的源半区存储空间相对应的另一未输出半区存储空间为待更新半区,并在源半区存储空间处于被搬运输出状态的时间段内,基于硬件真随机数发生器生成的真随机数据流对待更新半区执行噪声数据覆盖填充;其中,覆盖填充包括:基于真随机数据流生成符合高斯分布且经归一化处理的高斯随机噪声数据,并写入待更新半区;基于覆盖填充后的动态噪声数据缓存区,生成用于驱动数模转换器执行电压转换输出的高斯分布调制噪声数据流。本申请的技术方案,通过构建具有第一半区存储空间与第二半区存储空间划分的动态噪声数据缓存区,并依据半区切换触发信号在源半区存储空间输出期间对另一未输出半区执行硬件真随机数据流的覆盖填充,实现了噪声数据的半区级动态交替更新与输出并行执行,解决了现有技术因静态数组循环输出导致的波形周期性诱发神经适应的问题以及输出波形存在接缝而无法连续无间断的问题,提升了长时程刺激的有效性与输出波形的连续性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122805975A_ABST
    Figure CN122805975A_ABST
Patent Text Reader

Abstract

The application provides an output control method of transcranial Gaussian random noise stimulation, which is applied to a dynamic noise data cache area with two half-area storage spaces, and includes the following steps: in the process of circulating carrying noise data stored in the dynamic noise data cache area to a digital-to-analog converter, a half-area switching trigger signal generated when noise data in any half-area storage space starts to be carried is acquired; based on the half-area switching trigger signal, another unoutput half-area storage space corresponding to the source half-area storage space currently starting to be carried is determined as an updated half-area, Gaussian random noise data conforming to a Gaussian distribution and subjected to normalization processing is generated based on a true random data stream, and the Gaussian random noise data is written into the updated half-area; and based on the dynamic noise data cache area after being filled by covering, a Gaussian distribution modulation noise data stream is generated, and the scheme is executed in parallel through dynamic and alternative updating and outputting of the half-areas, so that the effectiveness and continuity of long-term stimulation are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of neuromodulation technology, and in particular to an output control method for transcranial Gaussian random noise stimulation. Background Technology

[0002] Currently, transcranial random noise stimulation, as a non-invasive neuromodulation technique, has been widely used in cognitive neuroscience research and clinical neuropsychiatric disease treatment. It places stringent requirements on the non-periodicity, statistical distribution characteristics, and output continuity of the stimulation waveform.

[0003] Currently, a common approach is to use software pseudo-random number algorithms to generate noise data, combined with a fixed-length array for cyclic output. Specifically, the central processing unit (CPU) pre-generates a set of pseudo-random noise data using a deterministic mathematical recursive formula, stores it in a static array in system memory, and then the direct memory access controller (DMI) cyclically transfers this static array to the digital-to-analog converter (DAC) at a fixed sampling frequency for repeated output to form a continuous analog stimulus waveform.

[0004] The main drawback of the above technical solution is that, since the noise data comes from the recursive operation of the deterministic algorithm and is stored in a static array of fixed length, the output stimulus waveform will inevitably exhibit repetitive waveform characteristics after several array length cycles. This periodicity will inevitably induce an adaptive response in the subject's nervous system, causing the long-term stimulation effect to significantly decay over time. At the same time, since the array content remains static during the output process, there are fixed data seams at the waveform connection between two adjacent cycles output by the digital-to-analog converter, making it difficult to achieve truly infinitely long, uninterrupted, continuous random noise output. Summary of the Invention

[0005] This application provides an output control method for transcranial Gaussian random noise stimulation, which enables the parallel execution of half-zone level dynamic alternating update and output of noise data. This solves the problems of waveform periodicity inducing neural adaptation and the inability to achieve continuous and uninterrupted output seams caused by static array cyclic output in the prior art, thereby improving the effectiveness of long-term stimulation and the continuity of output waveform.

[0006] In a first aspect, embodiments of this application provide an output control method for transcranial Gaussian random noise stimulation, applied to a dynamic noise data buffer having a first half-zone storage space and a second half-zone storage space, the method comprising: During the process of cyclically transferring the noise data stored in the dynamic noise data buffer to the digital-to-analog converter, the half-area switching trigger signal generated when the noise data in any half-area storage space begins to be transferred is acquired. Based on the half-area switching trigger signal, another unoutput half-area storage space corresponding to the source half-area storage space that is currently being moved is determined as the half-area to be updated. During the time period when the source half-area storage space is in the state of being moved and output, noise data overlay filling is performed on the half-area to be updated based on the true random data stream generated by the hardware true random number generator. The overlay filling includes: generating Gaussian random noise data that conforms to a Gaussian distribution and has been normalized based on the true random data stream, and writing it into the half-area to be updated. Based on the dynamic noise data buffer after overlay filling, a Gaussian-modulated noise data stream is generated to drive the digital-to-analog converter to perform voltage conversion output.

[0007] Secondly, embodiments of this application also provide an output control device for transcranial Gaussian random noise stimulation, applied to a dynamic noise data buffer having a first half-zone storage space and a second half-zone storage space, the device comprising: The switching signal acquisition module is used to acquire the half-area switching trigger signal generated when the noise data stored in the dynamic noise data buffer is cyclically transferred to the digital-to-analog converter. The noise data filling module is used to determine, based on the half-area switching trigger signal, another unoutput half-area storage space corresponding to the source half-area storage space that is currently being moved as the half-area to be updated, and to perform noise data overlay filling on the half-area to be updated based on a true random data stream generated by a hardware true random number generator during the time period when the source half-area storage space is in the output state; wherein, the overlay filling includes: generating Gaussian random noise data that conforms to a Gaussian distribution and has been normalized based on the true random data stream, and writing it into the half-area to be updated; The data stream generation module is used to generate a Gaussian-modulated noise data stream for driving the digital-to-analog converter to perform voltage conversion output based on the dynamic noise data buffer after overlay filling.

[0008] Thirdly, embodiments of this application also provide an electronic device, which includes: One or more processors; Storage device for storing one or more programs. When one or more programs are executed by one or more processors, the one or more processors implement the output control method for transcranial Gaussian random noise stimulation as described in any of the embodiments of this application.

[0009] Fourthly, embodiments of this application also provide a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform an output control method for transcranial Gaussian random noise stimulation as described in any of the embodiments of this application.

[0010] This application provides an output control method for transcranial Gaussian random noise stimulation. The method includes: applying a dynamic noise data buffer with a first half-zone storage space and a second half-zone storage space; the method includes: during the process of cyclically transferring noise data stored in the dynamic noise data buffer to a digital-to-analog converter, acquiring a half-zone switching trigger signal generated when transferring noise data in any half-zone storage space begins; based on the half-zone switching trigger signal, determining another non-output half-zone storage space corresponding to the source half-zone storage space currently being transferred as the half-zone to be updated; and, during the time period when the source half-zone storage space is in the state of being transferred and output, performing noise data overlay filling on the half-zone to be updated based on a true random data stream generated by a hardware true random number generator; wherein, the overlay filling includes: generating Gaussian random noise data that conforms to a Gaussian distribution and has been normalized based on the true random data stream, and writing it into the half-zone to be updated; and generating a Gaussian distributed modulated noise data stream for driving the digital-to-analog converter to perform voltage conversion output based on the dynamic noise data buffer after overlay filling. The technical solution of this application constructs a dynamic noise data buffer with a first half-zone storage space and a second half-zone storage space, and performs hardware true random data stream overwriting and filling on the other unoutput half-zone during the output of the source half-zone storage space according to the half-zone switching trigger signal. This realizes the half-zone level dynamic alternation update and parallel output execution of noise data, solves the problem of waveform periodicity inducing neural adaptation caused by static array cyclic output in the prior art, and the problem of output waveform having seams and not being able to be continuous and uninterrupted. This improves the effectiveness of long-term stimulation and the continuity of output waveform. Attached Figure Description

[0011] To more clearly illustrate the technical solutions of the exemplary embodiments of this application, the accompanying drawings used in describing the embodiments are briefly introduced below. Obviously, the accompanying drawings described are only a portion of the embodiments to be described in this application, and not all of them. For those skilled in the art, other drawings can be obtained from these drawings without any creative effort.

[0012] Figure 1 A flowchart illustrating an output control method for transcranial Gaussian random noise stimulation provided in an embodiment of this application; Figure 2 A flowchart illustrating another method for output control of transcranial Gaussian random noise stimulation provided in an embodiment of this application; Figure 3A flowchart illustrating another method for output control of transcranial Gaussian random noise stimulation provided in an embodiment of this application; Figure 4 A flowchart illustrating another method for output control of transcranial Gaussian random noise stimulation provided in an embodiment of this application; Figure 5 This is a schematic diagram of the time-domain waveforms of 2560 sampling points involved in the embodiments of this application; Figure 6 This is a schematic diagram of the amplitude distribution histogram and the normal distribution fitting curve involved in the embodiments of this application; Figure 7 This is a schematic diagram of the power spectral density involved in the embodiments of this application; Figure 8 This is a schematic diagram of the output control device for transcranial Gaussian random noise stimulation provided in an embodiment of the present invention; Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0013] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the application and not intended to limit it. Furthermore, it should be noted that, for ease of description, the accompanying drawings show only the parts relevant to the present application, not the entire structure.

[0014] Before introducing the technical solution provided in this application, the application scenarios of the solution can be described first. This embodiment is applicable to various scenarios that require output control of transcranial Gaussian random noise stimulation. Currently, although the method based on software pseudo-random number algorithm and fixed-length array cyclic output is widely used in the generation of transcranial random noise stimulation waveforms, traditional methods have obvious limitations. In practical applications, due to the characteristics of transcranial random noise stimulation, such as strict requirements for non-periodicity, easy induction of neural adaptation by long-term stimulation, high requirements for output continuity, and the need for independent control of multi-channel stimulation, and the need to consider multiple constraints such as real-time data update and DC offset safety during the stimulation process, traditional fixed array output methods are difficult to achieve truly infinitely long and uninterrupted Gaussian random noise stimulation, which easily leads to problems such as stimulation effect decay, output seams, and DC offset during long-term operation. Therefore, there is an urgent need for an output control method that can coordinate hardware true random number generation and half-zone dynamic alternating update, and comprehensively consider output continuity and safety, so as to improve the generation quality and clinical usability of transcranial Gaussian random noise stimulation waveforms.

[0015] Example 1 Figure 1This is a flowchart illustrating an output control method for transcranial Gaussian random noise stimulation provided in an embodiment of this application. This embodiment is applicable to various situations requiring output control of transcranial Gaussian random noise stimulation. The method can be executed by an output control device for transcranial Gaussian random noise stimulation, which can be implemented in the form of software and / or hardware. The hardware can be a controller, such as a mobile terminal, a PC, or a server.

[0016] The output control method for transcranial Gaussian random noise stimulation provided in this application embodiment is applied to a dynamic noise data buffer having a first half-zone storage space and a second half-zone storage space.

[0017] The dynamic noise data buffer refers to a contiguous physical storage space pre-set in the system memory, used to temporarily store noise waveform data to be output to the digital-to-analog converter.

[0018] The first half of the storage space and the second half of the storage space refer to two storage areas with equal capacity and contiguous addresses that are logically divided within the dynamic noise data buffer. Together, they constitute the total storage capacity of the dynamic noise data buffer. The first half of the storage space occupies the first half of the address range of the buffer, and the second half of the storage space occupies the second half of the address range of the buffer.

[0019] In this embodiment, optionally, the total capacity of the dynamic noise data buffer is 4096 data points, the first half of the storage space is the first 2048 data points, and the second half of the storage space is the last 2048 data points.

[0020] This can be understood as follows: the total capacity of the dynamic noise data buffer is determined based on the output sampling period of the digital-to-analog converter and the memory alignment requirements. The first half of the storage space and the second half of the storage space each occupy half of the total capacity. The dynamic noise data buffer can simultaneously hold up to 4096 independent numerical units, each corresponding to the noise amplitude data at a specific sampling time. Within the aforementioned total capacity, the storage area corresponding to the first half of the address interval, which increases continuously from the starting address of the buffer, exactly holds half of the total data volume of the buffer. The storage area corresponding to the second half of the address interval, which extends from the end of the first half of the storage space to the end address of the buffer, has the same capacity as the first half of the storage space.

[0021] like Figure 1 As shown, the output control method for transcranial Gaussian random noise stimulation provided in this embodiment of the invention includes the following steps: S110. During the process of cyclically transferring the noise data stored in the dynamic noise data buffer to the digital-to-analog converter, the half-area switching trigger signal generated when the noise data in any half-area storage space begins to be transferred is obtained.

[0022] Among them, noise data refers to a digital sequence stored in the dynamic noise data buffer, which is a numerical representation of the instantaneous amplitude of the transcranial Gaussian random noise stimulus waveform at each discrete sampling time. This digital sequence is generated by a hardware true random number generator and obtained after calibration processing based on the statistical characteristics of Gaussian distribution. It is used to drive the subsequent digital-to-analog conversion stage to generate an analog stimulus signal that conforms to specific spectral characteristics.

[0023] A digital-to-analog converter (DAC) is an electronic device that converts discrete digital input signals into continuously varying analog voltage or current output signals. In this scheme, the device receives noise data from a dynamic noise data buffer as input and maps the digital quantity point by point to an analog level of corresponding amplitude at a preset fixed sampling frequency, thereby forming a physical stimulation waveform at the output that can be used by transcranial stimulation electrodes.

[0024] The half-zone switching trigger signal is a hardware interrupt flag signal automatically generated by the direct memory access controller (DMC) during the cyclic transfer of noise data from the dynamic noise data buffer to the digital-to-analog converter (DAC). This signal is generated each time the transfer of all noise data in the first or second half-zone of memory is completed. This signal notifies the CPU of the boundary state that the currently outputting half-zone has completed data transfer and is about to switch to the other half-zone for continued output, thereby triggering the CPU to initiate a new round of noise data overlay, filling, and calibration for the already outputting half-zone.

[0025] Specifically, the direct memory access controller (DMC) operates in a cyclic mode, continuously transferring noise data stored in the first and second halves of the dynamic noise data buffer to the input register of the digital-to-analog converter (DAC) according to address order. In each cycle of this cyclic transfer process, at the same moment the DMC's transfer address pointer first points to the starting address of either the first or second half of the storage space and begins reading the first piece of noise data from that half for transmission, the hardware circuit automatically generates a half-segment switching trigger signal to identify a half-segment boundary crossing event. Optionally, the sampling frequency for cyclically transferring the noise data stored in the dynamic noise data buffer to the DAC is 1280 times per second.

[0026] For example, suppose that at a certain moment the Direct Memory Access Controller (DMI) has just completed the transfer of all 2048 noisy data in the second half of the memory space, its internal transfer address pointer automatically turns back and points to the starting address of the first half of the memory space, and then begins to read the first noisy data from the starting address and send it to the digital-to-analog converter (DAC); at the same instant that the transfer of this first noisy data begins, the hardware state machine inside the DMI detects that the address pointer has crossed the boundary between the end of the second half of the memory space and the beginning of the first half of the memory space, and sends a half-segment switching trigger signal to the central processing unit.

[0027] S120. Based on the half-zone switching trigger signal, determine another unoutput half-zone storage space corresponding to the source half-zone storage space that is currently being moved as the half-zone to be updated, and during the time period when the source half-zone storage space is in the state of being moved and output, perform noise data overwriting and filling on the half-zone to be updated based on the true random data stream generated by the hardware true random number generator.

[0028] The source half-area storage space refers to the half-area storage space from which the direct memory access controller is reading noise data and transferring it to the digital-to-analog converter for output during the current transfer cycle. This half-area storage space serves as the source of noise waveform data at the current moment, and the data stored within it is being consumed point by point to generate analog stimulus signals.

[0029] The half-area to be updated refers to another half-area of ​​storage space that, within the current transfer cycle, corresponds to the source half-area and is not currently read by the direct memory access controller. This half-area of ​​storage space has completed its data output process as the source half-area of ​​storage space in the previous transfer cycle, and the data stored within it has become expired. Therefore, it is designated as the target area that needs to be overwritten and filled in the current cycle.

[0030] A hardware true random number generator refers to a physical hardware module that operates independently of the central processing unit. This module generates unpredictable true random number sequences by collecting microscopic random phenomena in physical processes. Its randomness originates from entropy sources at the physical level rather than from recursive relationships in mathematical algorithms; therefore, the generated number sequences are not periodic and cannot be predicted in advance. A true random data stream refers to a continuous sequence of true random numbers generated by the hardware true random number generator and automatically moved to a dynamic noise data buffer via a direct memory access controller.

[0031] In this embodiment, the overwrite process in this step may include: generating Gaussian random noise data that conforms to a Gaussian distribution and has been normalized based on a true random data stream, and writing it into the half-area to be updated. Specifically, this can be understood as follows: the true random data stream generated by the hardware true random number generator can be transformed into random noise data that conforms to the characteristics of a Gaussian distribution through a series of mathematical transformations. Then, the Gaussian random noise data is normalized so that its amplitude range meets the preset output requirements. Finally, the Gaussian random noise data after the above processing is written into the storage space of the half-area to be updated to replace the original old data in the half-area, thereby completing the update of the dynamic noise data cache.

[0032] Specifically, after receiving the half-area switching trigger signal, the address boundary crossing information carried by the signal can be used to parse which half-area of ​​the source storage space has just entered the transfer state. Then, the other half-area of ​​the dynamic noise data buffer, excluding the source half-area, is determined as the half-area to be updated. After the determination is completed, the noise data overwrite operation of the half-area to be updated is started. This overwrite operation overlaps with the noise data transfer and output operation from the source half-area to the digital-to-analog converter and is executed in parallel. Specifically, during the entire time period when the direct memory access controller sequentially reads the noise data stored in each storage unit in the source half-area and sends it to the digital-to-analog converter, the central processing unit synchronously calls the hardware true random number generator to continuously generate a true random data stream. This true random data stream is then automatically written into each storage unit of the half-area to be updated through another direct memory access controller transmission channel, overwriting the expired noise data originally stored in the half-area with new true random values. Furthermore, during the overwrite process, the central processing unit also transforms the true random data stream generated by the hardware true random number generator into random noise data that conforms to the Gaussian distribution characteristics through mathematical transformation. Then, the Gaussian random noise data is normalized so that its amplitude range meets the preset output requirements. Finally, the Gaussian random noise data that has undergone the above processing is filled into each storage unit of the half-area storage space to be updated as the content to be written, thereby ensuring that the half-area after each update contains Gaussian random noise data that conforms to the Gaussian distribution and has been normalized.

[0033] In this process, the data update operation and the data output operation are performed on two different half-area storage spaces in space and are executed completely concurrently in time. As a result, when the direct memory access controller completes the transfer of all data in the source half-area storage space and automatically switches to the half-area to be updated to continue outputting, the noise data in the half-area to be updated has been completely updated and can be put into use immediately. This results in a continuous noise waveform at the output of the digital-to-analog converter that is connected end to end in time without any gaps.

[0034] In this embodiment, optionally, the half-segment switching trigger signal includes a half-transmission completion interrupt signal and a transmission completion interrupt signal; wherein, the half-transmission completion interrupt signal is generated when the direct memory access controller completes the transfer of all noise data in the first half-segment storage space, and the transmission completion interrupt signal is generated when the direct memory access controller completes the transfer of all noise data in the second half-segment storage space and is preparing to return to the starting point of the first half-segment storage space.

[0035] In this embodiment, the half-segment switching trigger signal is a set of signals composed of two interrupt signals corresponding to different half-segment boundary positions. Specifically, the half-transfer completion interrupt signal refers to an interrupt request automatically issued by the direct memory access controller (DMC) hardware to the central processing unit (CPU) at the critical moment when the DMC's internal transfer address pointer has just completed the read and send operations of all 2048 noise data units in the first half-segment (i.e., the first half-segment memory space) and is about to enter the second half-segment (i.e., the second half-segment memory space) to continue the transfer during a complete transfer cycle from the start address to the end address of the dynamic noise data buffer. The transfer completion interrupt signal refers to another interrupt request automatically issued by the DMC hardware to the CPU at the critical moment when the DMC's internal transfer address pointer has reached the end address of the dynamic noise data buffer and is about to return to the start address of the buffer to start a new round of cyclic transfer after completing the transfer operation of all 2048 noise data units in the second half-segment memory space. The two interrupt signals are generated precisely at the half-boundary and the full-boundary of the total capacity of the dynamic noise data buffer, respectively. Each interrupt signal is generated once in each complete cycle of data transfer, alternating between the two. Together, they provide the central processing unit with two precise time reference points, enabling the central processing unit to accurately determine whether the direct memory access controller has just completed the transfer of the first half of the memory space or the second half of the memory space, based on whether it is a half-transfer completion interrupt signal or a transfer completion interrupt signal. Based on this, the central processing unit determines which half of the memory space should be refreshed as the next half of the memory space to be updated, thereby ensuring the accurate execution of the pipelined alternating update mechanism.

[0036] When the half-cell handover trigger signal includes both a half-transmission completion interruption signal and a transmission completion interruption signal, the mechanism for determining the half-cell to be updated and performing overlay filling based on the half-cell handover trigger signal can be illustrated in the following two cases.

[0037] The first scenario corresponds to the triggering of a half-transfer completion interrupt signal. When the Direct Memory Access Controller (DMI) completes the transfer of all noise data in the first half of the memory space, and its internal transfer address pointer reaches the boundary between the end of the first half and the beginning of the second half, the DMI hardware immediately sends a half-transfer completion interrupt signal to the CPU. At this point, after capturing this interrupt signal, based on the address boundary indicated by the signal, it can be determined that the DMI has just finished transferring data from the first half and is about to begin transferring data from the second half. Therefore, the second half is identified as the source half, and the first half is identified as the other un-output half corresponding to the source half, i.e., the half to be updated. Simultaneously after making this determination, the DMI begins sequentially reading noise data from the starting address of the second half and transferring it to the digital-to-analog converter (DAC). The second half then enters a period of being transferred and output. Throughout the entire duration of this time period, the data update process for the first half of the storage space can be initiated synchronously. A hardware true random number generator is invoked to continuously generate a true random data stream, which is then written point-by-point into each storage unit of the first half of the storage space via the background channel of the direct memory access controller. This newly generated true random values ​​overwrite the old noise data previously stored in the first half of the storage space that had been consumed in the previous output cycle. When all noise data in the second half of the storage space has been transferred, the noise data overwriting and filling operation in the first half of the storage space is also completed synchronously, and the first half of the storage space is now ready with new noise data for the next round of output.

[0038] The second scenario corresponds to the triggering of a transfer completion interrupt signal. When the Direct Memory Access Controller (DMI) completes the transfer of all noise data within the second half of the memory space, and its internal transfer address pointer reaches the end address of the dynamic noise data buffer, about to return to the starting address of the first half of the memory space to begin a new round of transfer, the DMI hardware immediately sends a transfer completion interrupt signal to the CPU. Upon capturing this signal, based on the buffer boundary indicated by the signal, it is determined that the DMI has just finished transferring data from the second half of the memory space and is about to return to the first half to begin transferring data. Therefore, the first half of the memory space is identified as the source half of the memory space currently being transferred, and the second half of the memory space is identified as the other unoutput half of the memory space corresponding to the source half, i.e., the half to be updated. At the same moment after making the above determination, the DMI begins sequentially reading noise data from the starting address of the first half of the memory space and transferring it to the digital-to-analog converter (DAC). The first half of the memory space then enters a period of being transferred and output. Throughout this period, the central processing unit (CPU) synchronously initiates a data update process for the second half of the storage space. It calls a hardware true random number generator to continuously generate a true random data stream and writes this stream point-by-point into each storage unit of the second half of the storage space via the background channel of the direct memory access controller. This newly generated true random values ​​overwrite the old noise data previously stored in the second half of the storage space. When all noise data in the first half of the storage space has been transferred, the noise data overwriting and filling operation in the second half of the storage space is also completed simultaneously, and the second half of the storage space is now ready with new noise data for the next round of output.

[0039] The two scenarios described above alternate, with the half-transmission completion interrupt signal and the transmission completion interrupt signal triggering in turn. This corresponds to refreshing the first half of the storage space as the half to be updated in the background and refreshing the second half of the storage space as the half to be updated in the background, respectively. This forms a seamless, pipeline-like data update and output architecture that connects the beginning and the end, ensuring that the digital-to-analog converter can obtain a continuous supply of noise data at any time without waiting for data filling.

[0040] S130. Based on the dynamic noise data buffer after overlay filling, generate a Gaussian-modulated noise data stream to drive the digital-to-analog converter to perform voltage conversion output.

[0041] The Gaussian-distributed modulated noise data stream refers to a continuous data sequence output from a dynamic noise data buffer after overlay filling. Each value in this data sequence originates from Gaussian random noise data that conforms to a Gaussian distribution and has been normalized. Furthermore, when driving a digital-to-analog converter to perform voltage conversion output, this data sequence can directly control the amplitude of the stimulus output to continuously change according to the Gaussian distribution, thereby forming a modulated noise output signal for transcranial stimulation.

[0042] Specifically, the original noise data can be read from the dynamic noise data buffer that has completed true random data refresh and calibration. The original noise data read can be scaled in real time according to the amplitude adjustment coefficient independently configured for each output channel to obtain a Gaussian distribution modulated noise data stream that matches the preset stimulation intensity of each channel. The modulated noise data is then encapsulated into a composite data frame containing control commands and data payloads according to the communication protocol required by the digital-to-analog converter and sent to the digital-to-analog converter to drive the digital-to-analog converter to convert the digital modulated noise data into an analog voltage signal with the corresponding amplitude and output it to the stimulation electrode.

[0043] This application provides an output control method for transcranial Gaussian random noise stimulation, applied to a dynamic noise data buffer having a first half-zone storage space and a second half-zone storage space. The method includes: during the process of cyclically transferring noise data stored in the dynamic noise data buffer to a digital-to-analog converter, acquiring a half-zone switching trigger signal generated when transferring noise data in any half-zone storage space begins; based on the half-zone switching trigger signal, determining another unoutput half-zone storage space corresponding to the currently transferred source half-zone storage space as the half-zone to be updated, and during the time period when the source half-zone storage space is in the transferred output state, performing noise data overwriting and filling on the half-zone to be updated based on a true random data stream generated by a hardware true random number generator; and generating a Gaussian distributed modulation noise data stream for driving the digital-to-analog converter to perform voltage conversion output based on the overwritten and filled dynamic noise data buffer. The technical solution of this application constructs a dynamic noise data buffer with a first half-zone storage space and a second half-zone storage space, and performs hardware true random data stream overwriting and filling on the other unoutput half-zone during the output of the source half-zone storage space according to the half-zone switching trigger signal. This realizes the half-zone level dynamic alternation update and parallel output execution of noise data, solves the problem of waveform periodicity inducing neural adaptation caused by static array cyclic output in the prior art, and the problem of output waveform having seams and not being able to be continuous and uninterrupted. This improves the effectiveness of long-term stimulation and the continuity of output waveform.

[0044] Example 2 Figure 2This is a schematic diagram of an output control method for transcranial Gaussian random noise stimulation provided in an embodiment of this application. Based on the foregoing embodiments, this embodiment will provide a more detailed description of step S120. Specific implementation details can be found in the technical solution of this embodiment. Technical terms that are the same as or corresponding to those in the above embodiments will not be repeated here.

[0045] like Figure 2 As shown, the method specifically includes the following steps: S210. During the process of cyclically transferring the noise data stored in the dynamic noise data buffer to the digital-to-analog converter, the half-area switching trigger signal generated when the noise data in any half-area storage space begins to be transferred is obtained.

[0046] S220. Based on the half-zone switching trigger signal, determine the other unoutput half-zone storage space corresponding to the source half-zone storage space that is currently being moved as the half-zone to be updated.

[0047] S230. During the time period when the source half-area storage space is in the state of being moved and output, establish a data transmission channel from the hardware true random number generator data register to the half-area storage space to be updated.

[0048] The data transmission channel refers to a data transfer path established by the direct memory access controller between the data register of the hardware true random number generator and each memory cell of the half-area memory space to be updated.

[0049] Specifically, when executing the interrupt service routine corresponding to the half-zone switching trigger signal, the Direct Memory Access Controller (DMemory Controller) can be configured. The DMemory Controller's data transfer source address is set to the physical address of the hardware true random number generator's data register, and the DMemory Controller's data transfer target address is set to the starting address of the half-zone memory space to be updated. The length of the data to be transferred is set to the total number of memory units contained in the half-zone memory space to be updated. This allows the DMemory Controller to obtain all the address and length parameters required for autonomous data transfer from the hardware true random number generator to the half-zone memory space to be updated, thus completing the hardware-level path preparation for the subsequent automatic data injection operation without the participation of the central processing unit.

[0050] S240. In a state where the central processing unit does not participate in the execution of data transfer instructions, continuously generated true random numbers are written into each storage unit of the half-area storage space to be updated through the data transfer channel.

[0051] Specifically, once the Direct Memory Access Controller (DMI) has completed the configuration of the source and destination addresses and received the start command, it breaks away from the control of the CPU and enters an autonomous operation mode. Whenever the hardware true random number generator generates a new true random number and places it into the data register, the DMI automatically reads the true random number from the data register and writes it into the memory cell pointed to by the current address pointer in the half-area of ​​memory to be updated via the system bus. Then the address pointer automatically increments to point to the next memory cell to be written, and so on until all memory cells in the half-area of ​​memory to be updated are filled with newly generated true random numbers. During this entire transfer process, the CPU does not execute any machine instructions related to data loading, storage, or movement; the entire data migration operation is completed by the DMI using hardware circuitry.

[0052] S250. Obtain the offset compensation amount based on the arithmetic mean of all currently stored true random data in the half-area storage space to be updated.

[0053] The offset compensation amount is used to characterize the degree of deviation of the center position of the overall distribution of true random data in the current half-area storage space from the zero-value benchmark.

[0054] Specifically, after the central processing unit (CPU) completes the true random data filling of the half-area storage space to be updated, it sequentially reads the true random data values ​​stored in each storage cell within that half-area storage space. All read data values ​​are summed, and the sum is then divided by the total number of storage cells in the half-area storage space. The result is the offset compensation amount. This offset compensation amount is temporarily stored as a quantitative indicator of the overall deviation of the data within that half-area storage space from the zero-value baseline and used in subsequent zero-mean calibration calculations.

[0055] S260. Based on the offset compensation amount and the data values ​​of each storage cell in the half-area storage space to be updated, calibrated noise data with a statistical mean approaching zero is obtained.

[0056] Among them, the calibrated noise data refers to the new set of data values ​​obtained by subtracting the offset compensation amount from the original true random data values ​​stored in each storage cell in the half-area storage space to be updated.

[0057] Specifically, the true random data value currently stored in each storage unit within the half-area storage space to be updated can be subtracted one by one from the previously calculated offset compensation amount. The difference after subtraction is used as the new data value and written back to the original storage unit or temporarily stored in another memory area. All data values ​​after this subtraction operation constitute the calibrated noise data. The arithmetic mean of the calibrated noise data approaches zero, thereby eliminating the DC offset component in the signal path while maintaining the original random distribution pattern of the data, avoiding electrode polarization and skin burns, and complying with the medical safety standards for transcranial electrical stimulation.

[0058] S270. Based on the preset standard deviation ratio threshold, determine the upper limit boundary and lower limit boundary of amplitude.

[0059] The standard deviation multiplier threshold is a preset multiplier parameter that is multiplied by the standard deviation statistics of the calibrated noise data to define the allowable fluctuation range of the noise data amplitude.

[0060] The upper limit of amplitude refers to the maximum permissible positive amplitude determined based on the statistical characteristics and standard deviation multiple threshold of the calibrated noise data. Data values ​​exceeding this limit are considered outliers outside the safe range. The lower limit of amplitude refers to the maximum permissible negative amplitude determined based on the statistical characteristics and standard deviation multiple threshold of the calibrated noise data. Data values ​​below this limit are considered outliers outside the safe range.

[0061] Specifically, the standard deviation of all data values ​​in the calibrated noise data can be calculated first. Then, the standard deviation value is multiplied by the preset standard deviation multiplier threshold. The product is used as the absolute value of the amplitude boundary. The upper limit of the amplitude is obtained by adding the absolute value to the zero value, and the lower limit of the amplitude is obtained by subtracting the absolute value from the zero value. This determines the numerical constraint range on which the calibrated noise data is subjected to safe amplitude limiting processing.

[0062] S280. Based on the comparison results between each data value in the calibrated noise data and the upper and lower limits of amplitude, the data values ​​exceeding the upper limit of amplitude are corrected to the upper limit of amplitude, and the data values ​​below the lower limit of amplitude are corrected to the lower limit of amplitude.

[0063] Specifically, each data value in the calibrated noise data is compared with the upper and lower amplitude limits one by one. If the current data value is greater than the upper amplitude limit, it is replaced with the upper amplitude limit; if the current data value is less than the lower amplitude limit, it is replaced with the lower amplitude limit; if the current data value is between the upper and lower amplitude limits, it is kept unchanged. This achieves amplitude limiting constraint on the calibrated noise data, ensuring that all noise data used to generate the Gaussian distributed modulation noise data stream are within the preset safe amplitude range.

[0064] By forcibly correcting data values ​​in the calibrated noise data that exceed the upper limit of amplitude or fall below the lower limit of amplitude to the corresponding boundary values, it can be ensured that the amplitude of the noise data finally output to the digital-to-analog converter is always constrained within the preset safe range, thereby preventing discomfort or tissue damage to the stimulated object due to excessive instantaneous amplitude.

[0065] S290. Based on the dynamic noise data buffer after overlay filling, a Gaussian-modulated noise data stream is generated to drive the digital-to-analog converter to perform voltage conversion output.

[0066] In this embodiment, when multiple output channels are included, the specific implementation of generating a Gaussian-modulated noise data stream for driving the digital-to-analog converter to perform voltage conversion output based on the dynamic noise data buffer after overlay filling may include the following steps: (1) Assign an independent amplitude adjustment coefficient to each of the multiple output channels, wherein the multiple output channels share the same physical storage space of the dynamic noise data buffer.

[0067] The amplitude adjustment coefficient is a numerical scaling factor configured independently for each output channel. This scaling factor is used to perform a multiplication operation with the original noise data value read from the dynamic noise data buffer. By adjusting the value of this scaling factor, the final stimulus intensity of the corresponding output channel can be controlled. The amplitude adjustment coefficients of each channel are independent of each other and can be dynamically modified separately, thereby achieving differentiated and independent control of the output amplitude of different stimulus channels while sharing the same set of original noise data.

[0068] In this embodiment, a unique storage entity, namely a dynamic noise data buffer, is reserved in memory for the noise data substrate. For each channel that needs to output a stimulus signal, a unique amplitude adjustment coefficient variable is set. The amplitude adjustment coefficients of each channel can be the same or different in value and are stored and modified independently. When the system needs to generate stimulus waveforms for multiple channels, each channel reads the same original noise data value from the same storage unit of the same dynamic noise data buffer, but uses its own unique amplitude adjustment coefficient to perform scaling calculations on the original noise data value, thereby achieving independent control of the stimulus intensity of each channel without copying multiple copies of the noise data.

[0069] (2) Based on the amplitude adjustment coefficients corresponding to each output channel, the original noise data values ​​read from the dynamic noise data buffer are scaled in real time to obtain the Gaussian distribution modulated noise data stream corresponding to each output channel.

[0070] Specifically, whenever the direct memory access controller reads a raw noise data value from the dynamic noise data buffer, it can perform a multiplication operation on the raw noise data value with the amplitude adjustment coefficient corresponding to each output channel. The product values ​​obtained from the multiplication operation are the modulation noise data values ​​of each output channel at the current sampling time. These modulation noise data values ​​are encapsulated and sent according to the independent subsequent processing paths of each channel, thus forming the Gaussian distributed modulation noise data stream corresponding to each output channel. This allows the output waveform of each channel to have an independently adjustable stimulation intensity while maintaining the consistency of the spectral characteristics.

[0071] In this embodiment, optionally, the amplitude adjustment coefficient can be updated according to the actual situation, and the update operation of the amplitude adjustment coefficient is performed synchronously with the coverage and filling operation of the half-area to be updated.

[0072] The technical solution of this application embodiment, when performing noise data overwriting and filling on the half-zone to be updated based on the truly random data stream generated by the hardware truly random number generator, establishes a data transmission channel directly pointing from the data register of the hardware truly random number generator to the storage space of the half-zone to be updated. This allows for continuous writing of truly random numbers without the central processing unit (CPU) participating in the execution of data transfer instructions, achieving fully automatic injection of the truly random data stream from its generation source to its storage target. This mechanism completely liberates the CPU from the tedious point-by-point data transfer task, enabling the CPU to focus solely on performing safety operations such as zero-mean calibration and amplitude limiting on the noise data in the half-zone to be updated within the limited time window opened by the half-zone switching trigger signal, without consuming any instruction cycles for data loading or storage operations. This significantly reduces the overall CPU occupancy rate and ensures the system's real-time response capability and output stability under long-term continuous stimulation conditions.

[0073] The technical solution of this application embodiment, after performing noise data overlay filling on the half-area to be updated based on the true random data stream generated by the hardware true random number generator, further includes: obtaining an offset compensation amount based on the arithmetic mean of all currently stored true random data in the storage space of the half-area to be updated; obtaining calibrated noise data with a statistical mean close to zero based on the offset compensation amount and the data values ​​of each storage unit in the storage space of the half-area to be updated; determining the upper limit boundary and the lower limit boundary of the amplitude based on a preset standard deviation ratio threshold; and correcting data values ​​exceeding the upper limit boundary of the amplitude to the upper limit boundary and data values ​​below the lower limit boundary of the amplitude to the lower limit boundary of the amplitude based on the comparison results of each data value in the calibrated noise data with the upper limit boundary and the lower limit boundary of the amplitude. The technical solution provided in this embodiment eliminates the DC offset component that may be introduced during the generation and transport of true random data streams by performing segmented zero-mean calibration and amplitude limiting processing on the data within each half-zone after each half-zone coverage and filling. This ensures that the noise data in each half-zone strictly approaches zero in terms of statistical mean, thereby effectively avoiding electrode polarization and skin burn risks caused by the accumulation of DC components. At the same time, the amplitude boundary determined based on the standard deviation ratio threshold is used to forcibly correct data outliers, strictly constraining the instantaneous amplitude of the output noise within a preset safe range. This preserves the Gaussian distribution statistical characteristics and effective stimulation bandwidth of the noise signal, while fundamentally eliminating the safety hazards of tissue damage or subjective discomfort to the stimulated object caused by exceeding the instantaneous amplitude limit, fully meeting the safety specifications for transcranial electrical stimulation medical devices.

[0074] Example 3 Figure 3This is a schematic diagram of an output control method for transcranial Gaussian random noise stimulation provided in an embodiment of this application. Based on the foregoing embodiments, this embodiment will provide a more detailed description of S130. Specific implementation methods can be found in the technical solution of this embodiment. Technical terms that are the same as or corresponding to those in the above embodiments will not be repeated here.

[0075] like Figure 3 As shown, the method specifically includes the following steps: S310. During the process of cyclically transferring the noise data stored in the dynamic noise data buffer to the digital-to-analog converter, the half-area switching trigger signal generated when the noise data in any half-area storage space begins to be transferred is obtained.

[0076] S320. Based on the half-zone switching trigger signal, determine another unoutput half-zone storage space corresponding to the source half-zone storage space that is currently being moved as the half-zone to be updated, and during the time period when the source half-zone storage space is in the state of being moved and output, perform noise data overwriting and filling on the half-zone to be updated based on the true random data stream generated by the hardware true random number generator.

[0077] In this embodiment, optionally, before the noise data overlay filling is performed on the half-region to be updated based on the true random data stream generated by the hardware true random number generator, the method further includes: performing validity verification on the original true random data stream generated by the hardware true random number generator based on preset randomness verification rules, and removing abnormal data points that do not conform to the randomness verification rules.

[0078] Specifically, after the hardware true random number generator generates a new true random number and places it into the data register, but before the true random number is written into the half-area storage space to be updated, the central processing unit or dedicated hardware verification logic performs a quality judgment on the true random number according to a pre-set randomness statistical test criterion. If the judgment result shows that the true random number meets the qualified conditions defined by the randomness test rules, it is allowed to enter the subsequent data transmission channel and be written into the half-area storage space to be updated. If the judgment result shows that the true random number does not meet the randomness test rules, it is judged as an abnormal data point and discarded. At the same time, the hardware true random number generator is triggered to regenerate a new true random number to replace the discarded abnormal data point, thereby ensuring that the true random data stream finally filled into the half-area storage space to be updated has a stable and expected random distribution quality in a statistical sense.

[0079] S330: Based on the serial communication frame format required by the digital-to-analog converter, determine the combined structure of a one-byte instruction field and a two-byte data field.

[0080] Specifically, based on the serial interface communication protocol specifications defined in the technical specifications of the selected digital-to-analog converter chip, each data unit sent to the digital-to-analog converter can be defined as a fixed-length data frame consisting of three consecutive bytes. The first byte is designated as an instruction field to carry the operation type identifier code, and the following two bytes are designated as data fields to carry the noise data value to be converted. This three-byte combination structure strictly matches the bit width and data latching timing requirements of the input shift register inside the digital-to-analog converter, thereby ensuring that the digital-to-analog converter can correctly parse and execute each output voltage update operation.

[0081] S340. The content of the instruction field is determined as the opcode that controls the digital-to-analog converter to perform an output voltage update operation.

[0082] The instruction field refers to a specific functional field that occupies the first byte position in each three-byte composite data frame sent to the digital-to-analog converter.

[0083] In this embodiment, when constructing a composite data frame, a predefined specific value can be written into the first byte of the three-byte structure, namely the instruction field. This specific value corresponds to a special command code in the internal instruction set of the digital-to-analog converter used to instruct the immediate refresh of the analog output voltage. After receiving the value, the digital-to-analog converter will parse and identify that the current operation is a voltage output update rather than other configuration operations. Thus, after completing the reception of the data field, it will immediately convert the noise data value carried in the data field into the corresponding analog voltage level and drive the output pin to update.

[0084] S350: The high byte and low byte of the noise data value read from the dynamic noise data buffer are mapped to a data field of two bytes in length, respectively, to generate a composite data frame of three bytes in length.

[0085] In this context, the high-order byte refers to the eight-bit binary data unit that occupies a higher bit weight in the memory storage or transmission order of a multi-byte data value. Changes in each bit of the high-order byte have a significantly greater impact on the overall value than those of the low-order byte. The low-order byte refers to the eight-bit binary data unit that occupies a lower bit weight in the same multi-byte data value.

[0086] Among them, a composite data frame refers to a complete minimum communication data unit formed by combining and encapsulating the instruction field and the data field according to the serial communication frame format specified by the digital-to-analog converter.

[0087] Specifically, each raw noise data value or modulated noise data value after scaling can be split into two parts, a high octet and a low octet, according to the byte order of its internal binary representation. The high octet is filled into the first data byte position after the instruction field in the three-byte composite data frame, and the low octet is filled into the second data byte position immediately following it. This, together with the pre-filled instruction field, constitutes a complete three-byte composite data frame. This composite data frame can be directly sent to the digital-to-analog converter through the serial interface and automatically parsed by its internal hardware to complete a voltage output update.

[0088] The technical solution of this application, when generating a Gaussian-modulated noise data stream for driving a digital-to-analog converter (DAC) to perform voltage conversion output based on a dynamic noise data buffer after overlay filling, determines a combined structure of a one-byte instruction field and a two-byte data field based on the serial communication frame format required by the DAC; the content of the instruction field is determined as the opcode controlling the DAC to perform an output voltage update operation; the high-order and low-order bytes of the noise data value read from the dynamic noise data buffer are respectively mapped to the two-byte data field to generate a three-byte composite data frame. The technical solution provided in this embodiment, by pre-integrating and encapsulating the instruction field and noise data field into a three-byte composite data frame structure, achieves synchronous transmission of control instructions and data to be converted within a single serial communication cycle, eliminating the additional communication overhead and time gap caused by sending instructions first and then data in traditional solutions. After receiving each composite data frame, the digital-to-analog converter can directly parse and execute the voltage output update operation without waiting for the independent instruction pre-send. This significantly shortens the response path length from reading noise data to establishing the analog voltage, improves the real-time performance of the output end in following changes in the dynamic noise data buffer, and ensures the timing accuracy and stability of the waveform output under high-frequency continuous stimulation conditions.

[0089] Example 4 Figure 4 This diagram illustrates an output control method for transcranial Gaussian random noise stimulation provided in this application embodiment. Based on the aforementioned embodiments, this embodiment will provide a detailed explanation of the generation method of Gaussian random noise data. Specific implementation methods can be found in the technical solution of this embodiment. Technical terms that are the same as or corresponding to those in the above embodiments will not be repeated here.

[0090] like Figure 4 As shown, the output control method for transcranial Gaussian random noise stimulation provided in this embodiment of the invention includes the following steps: S410. During the process of cyclically transferring the noise data stored in the dynamic noise data buffer to the digital-to-analog converter, the half-area switching trigger signal generated when the noise data in any half-area storage space begins to be transferred is obtained.

[0091] S420. Based on the half-zone switching trigger signal, determine another unoutput half-zone storage space corresponding to the source half-zone storage space that is currently being moved as the half-zone to be updated. During the time period when the source half-zone storage space is in the state of being moved and output, generate Gaussian random noise data that conforms to a Gaussian distribution and has been normalized based on the true random data stream, and write it into the half-zone to be updated.

[0092] To ensure that the hardware true random number source can be stably and efficiently converted into Gaussian distributed noise data that meets the requirements of transcranial stimulation, this embodiment provides three different levels of conversion implementation methods.

[0093] In one implementation, generating Gaussian random noise data that conforms to a Gaussian distribution and has been normalized based on a true random data stream may include the following steps: (1) Based on the true random data stream output by the hardware true random number generator, extract multiple sets of mutually independent first uniform random number pairs and second uniform random number pairs.

[0094] The first uniform random number pair refers to a pair of independent, uniformly distributed random numbers extracted from a true random data stream. The second uniform random number pair refers to another pair of uniformly distributed random numbers that are independent of the first uniform random number pair.

[0095] Specifically, a true random data stream generated by a hardware true random number generator can be used as the original data source. The data stream is continuously sampled bit by bit or byte by byte, and the sampled binary data sequence is divided into multiple data units according to a preset grouping rule. Each data unit is further divided into pairs of mutually independent data pairs that each follow a uniform distribution. One part of the data pairs is defined as the first uniform random number pair, and the other part of the data pairs that are mutually independent in terms of source from the first uniform random number pair are defined as the second uniform random number pair. This yields multiple sets of basic random input sources for subsequent Gaussian transform processing.

[0096] It should be noted that the first uniform random number pair and the second uniform random number pair originate from the true random data stream output by the hardware true random number generator. Each uniform random number is statistically independent and follows a uniform distribution. Its power spectral density exhibits a flat characteristic in the frequency domain, that is, it has the statistical properties of white noise. This ensures that the Gaussian random noise data generated after subsequent variance normalization transformation and splicing processing has ideal random excitation characteristics in both the time and frequency domains, providing the digital-to-analog converter with a modulation noise data source that conforms to a Gaussian distribution and has excellent statistical characteristics.

[0097] (2) Perform variance normalization transformation on each of the first uniform random number pairs and the second uniform random number pairs to generate a first Gaussian random noise component associated with the first uniform random number pair and a second Gaussian random noise component associated with the second uniform random number pair.

[0098] The first Gaussian random noise component refers to a noise component value that conforms to a standard normal distribution, obtained by normalizing the variance of a first uniform random number pair. The second Gaussian random noise component refers to another noise component value that conforms to a standard normal distribution, obtained by normalizing the variance of a second uniform random number pair.

[0099] Specifically, for each pair of first uniform random numbers and each pair of second uniform random numbers, the same variance normalization transformation is performed independently. That is, the two values ​​contained in each pair of uniform random numbers are used to jointly determine the position information in polar coordinates. Then, based on the position information, the variance difference caused by the original uniform distribution is eliminated through transformation operation, so that the final value conforms to the statistical characteristics of the standard normal distribution. The value obtained by the first uniform random number pair after the above transformation is called the first Gaussian random noise component, and the value obtained by the second uniform random number pair after the same transformation is called the second Gaussian random noise component. These two components are the two sources of the final Gaussian random noise data points to be spliced ​​in the subsequent process.

[0100] In this embodiment, the variance normalization transformation process includes: determining the radial length and polar angle within the unit circle based on uniform random number pairs; performing a negative two-logarithmic transformation based on the standard normal distribution variance on the radial length to obtain an amplitude scaling factor; performing a trigonometric function transformation on the polar angle to obtain an angle factor; and determining a Gaussian random noise component based on the product of the amplitude scaling factor and the angle factor.

[0101] The radial length refers to the radial distance in polar coordinates determined by a set of uniformly random numbers within the unit circle. The polar angle refers to the polar angle in polar coordinates determined by the same set of uniformly random numbers within the unit circle. The amplitude scaling factor is the value used to scale the amplitude after performing a negative two-logarithmic transformation on the radial length based on the standard normal distribution variance. The angle factor is the value used to determine the direction after performing a trigonometric function transformation on the polar angle.

[0102] Specifically, for any set of uniform random numbers, firstly, the two values ​​in the set are used to jointly determine a radial length and a polar angle within the unit circle, thus mapping the original uniform distribution values ​​to polar coordinate space; then, a negative two-logarithmic transformation based on the variance of the standard normal distribution is performed on the obtained radial length, thereby generating an amplitude scaling factor; simultaneously, a trigonometric function transformation is performed on the obtained polar angle, thereby generating an angle factor; finally, the amplitude scaling factor and the angle factor are multiplied together, and the product is used as the final determined Gaussian random noise component, thus completing the transformation from uniform distribution to standard normal distribution.

[0103] (3) Based on the single storage bit width of the dynamic noise data buffer, determine the target bit width, extract the first high-bit valid data segment from the first Gaussian random noise component and the second low-bit valid data segment from the second Gaussian random noise component, and splice the first high-bit valid data segment and the second low-bit valid data segment to generate a complete Gaussian random noise data point that conforms to the target bit width.

[0104] The target bit width refers to the number of bits in the final Gaussian random noise data point, determined based on the single storage bit width of the dynamic noise data buffer. The first high-bit valid data segment refers to the high-bit portion of the data extracted from the first Gaussian random noise component. The second low-bit valid data segment refers to the low-bit portion of the data extracted from the second Gaussian random noise component. The two segments are concatenated according to their high and low bits to form a complete Gaussian random noise data point that meets the target bit width.

[0105] Specifically, the target bit width can be set based on the single storage bit width supported by the dynamic noise data buffer. This target bit width determines the number of bits of data required for each Gaussian random noise data point generated. Based on this, the high-order part of the first Gaussian random noise component is extracted as the first high-order valid data segment, and the low-order part of the second Gaussian random noise component is extracted as the second low-order valid data segment. The first high-order valid data segment as the high-order part and the second low-order valid data segment as the low-order part are then concatenated and combined to form a complete Gaussian random noise data point that meets the target bit width, which is then written into the unupdated half-area of ​​the dynamic noise data buffer.

[0106] In another implementation, generating Gaussian random noise data that conforms to a Gaussian distribution and has been normalized based on a true random data stream may include the following steps: (1) Obtain two original random numbers generated each time based on a hardware true random number generator.

[0107] Raw random numbers refer to values ​​generated directly by a hardware true random number generator without any processing.

[0108] Specifically, a hardware true random number generator can be directly invoked. Utilizing its inherent thermal noise or quantum effects as sources of physical entropy, it generates two independent and unpredictable values ​​at each sampling time. These two values ​​are read directly from the output register of the hardware true random number generator, without undergoing any software-level mathematical transformations or statistical adjustments, thus preserving the original random bit information and serving as the foundational input data for all subsequent noise generation processes. Each acquisition operation yields two original random numbers, which together constitute a complete random number sampling unit, supporting subsequent Gaussian distribution transformation processing.

[0109] (2) Map the two original random numbers to the horizontal and vertical coordinates of the unit circle, respectively, and calculate the squared distance from the corresponding coordinate point to the center of the circle based on the horizontal and vertical coordinates.

[0110] The squared distance value is the sum of the squares of the horizontal and vertical coordinates, used to determine whether a point is located inside the unit circle.

[0111] Specifically, the two raw random numbers provided by the hardware true random number generator each time can undergo a linear transformation of their numerical range. This repositions each raw random number from its original value interval to a closed interval between -1 and +1. One of the transformed values ​​is used as the horizontal axis coordinate, and the other as the vertical axis coordinate. These two coordinates together determine a coordinate point located within the unit circle. Further, the horizontal axis coordinate is squared to obtain the horizontal axis square value, and the vertical axis coordinate is squared to obtain the vertical axis square value. The horizontal axis square value and the vertical axis square value are then added together. The sum is the squared distance from this coordinate point to the center of the unit circle. This squared distance is used to subsequently determine whether the coordinate point is inside the unit circle and whether the sampling acceptance condition is met.

[0112] (3) When the squared distance value is less than one and not zero, calculate the logarithmic transformation result and the square root transformation result based on the squared distance value, and multiply the coordinate value by the ratio of the square root transformation result to the squared distance value to obtain two independent Gaussian distributed random samples.

[0113] The logarithmic transformation result refers to the value obtained by taking the natural logarithm of the squared distance. The square root transformation result refers to the value obtained by taking the square root of the squared distance. A Gaussian distributed random sample refers to two independent values ​​that follow a Gaussian distribution, obtained by multiplying the coordinate values ​​by the ratio of the square root transformation result to the squared distance.

[0114] Specifically, when the squared distance value is less than one and not zero, it means that the coordinate point determined by the current horizontal and vertical coordinate values ​​is located inside the unit circle but not at the center. In this case, the coordinate point is accepted for subsequent Gaussian distribution transformation. The logarithm of the squared distance value can be obtained by taking its natural logarithm, and the root value can be obtained by taking its square root. Further, the quotient obtained by dividing the square root transformation result by the squared distance value is calculated, and then this quotient is multiplied by the horizontal and vertical coordinate values ​​respectively. The two new values ​​obtained after this multiplication operation are two independent Gaussian distributed random samples. These two samples have no statistical correlation with each other and each follows a Gaussian distribution.

[0115] (4) During startup initialization, an initial Gaussian reference array of full length is generated based on Gaussian distributed random samples. After performing a global deDC operation on the initial Gaussian reference array, it is used as the initial data content for constructing a dynamic noise data buffer area from Gaussian random noise data.

[0116] The initial Gaussian reference array refers to a data set composed of multiple Gaussian distributed random samples arranged in order, which is used to construct the initial data content when the dynamic noise data buffer is started.

[0117] Specifically, in the initial stage of the entire process, random Gaussian samples obtained through coordinate transformation are continuously filled according to the total number of points supported by the dynamic noise data buffer, forming a complete array covering the entire buffer capacity. This array is called the initial Gaussian reference array. The arithmetic mean of all values ​​in the initial Gaussian reference array is calculated, and each value in the array is subtracted from this arithmetic mean, making the overall mean of the entire array zero, eliminating any possible DC components. Then, the entire initial Gaussian reference array, after the above deDC processing, is directly loaded into the dynamic noise data buffer as the initial data content stored in the buffer at startup, used to support the initial data transfer and output to the digital-to-analog converter.

[0118] (5) During operation, random samples based on Gaussian distribution are normalized and mapped and written as Gaussian random noise data into the half-region to be updated.

[0119] Specifically, after completing the startup initialization phase and entering the continuous operation phase, for each of the two independent Gaussian distributed random samples obtained through polar coordinate transformation, they are not directly written into the buffer. Instead, a normalization mapping process is first performed on each Gaussian distributed random sample. That is, the value of the Gaussian distributed random sample is linearly transformed into the complete value range corresponding to the signed integer data according to the preset amplitude range, so that the transformed value meets the requirements of the subsequent digital-to-analog converter for the input data format. Then, the integer value obtained after the normalization mapping process is used as the final Gaussian random noise data and written point by point into each storage unit of the dynamic noise data buffer that is determined to be the half-area to be updated, thereby completing the overwriting and updating of the expired noise data in the half-area.

[0120] In this embodiment, the above implementation generates Gaussian distributed random samples by mapping the original random numbers generated by the hardware true random number generator to coordinates within a unit circle and transforming them to polar coordinates. This efficiently obtains two independent Gaussian distributed random samples without calling trigonometric functions, reducing the computational load on the floating-point unit. Simultaneously, by performing a global deDC operation on the full-length initial Gaussian reference array during the startup initialization phase, the zero-mean characteristic of the initial data content of the dynamic noise data buffer is ensured, eliminating the adverse effects of DC components on the stimulus output. During operation, only the Gaussian distributed random samples are normalized and mapped before being directly written to the half-region to be updated, avoiding the computational overhead caused by repeatedly performing deDC operations during the operation phase. This maintains the natural fluctuation variance of the half-region data, thereby improving the real-time update efficiency of the double-buffered pipeline while ensuring the statistical characteristics of the output noise.

[0121] In another optimized implementation, Gaussian random noise data that conforms to a Gaussian distribution and has been normalized is generated based on a truly random data stream, including: (1) Two raw random numbers are continuously obtained based on a hardware true random number generator, and a bit-level XOR operation is performed on the two raw random numbers to obtain whitened random numbers.

[0122] Specifically, two unprocessed random values ​​can be sequentially read from the output of a hardware true random number generator. These two raw random numbers are temporally adjacent and each carries unpredictable information from a physical entropy source. Each bit of the first raw random number is XORed with the corresponding bit of the second raw random number. If the two bits are the same, the result is false; if they are different, the result is true. This results in a new value, where each bit is composed of the XOR operation result. After this bit-level XOR operation, a whitened random number is obtained. This whitened random number has a more uniform bit distribution than the original random value, eliminating the slight bit correlation between adjacent samples that may exist in a hardware true random number generator.

[0123] (2) Determine the first coordinate value in the positive and negative one interval based on the first value in the whitened random number, determine the second coordinate value in the positive and negative one interval based on the second value in the whitened random number, and determine the squared distance from the corresponding coordinate point to the center of the circle based on the first coordinate value and the second coordinate value.

[0124] The first coordinate value refers to the horizontal axis coordinate value obtained by linearly transforming the first value in the whitened random number from the original value range to the range of negative one to positive one. The second coordinate value refers to the vertical axis coordinate value obtained by linearly transforming the second value in the whitened random number to the range of negative one to positive one. The squared distance value is the sum of the squares of the first coordinate value and the squares of the second coordinate value, used to determine whether the corresponding coordinate point is located inside the unit circle.

[0125] Specifically, the whitened random number obtained after a bit-level XOR operation is split into two independent values. The first value is taken and transformed from its original integer range to a closed interval of negative one to positive one using a linear mapping. The resulting floating-point value is the first coordinate value. The second value of the whitened random number is also taken and transformed to the same interval using a linear mapping. The resulting floating-point value is the second coordinate value. The first and second coordinate values ​​together constitute a coordinate point located within the unit circle. The square of the first coordinate value is obtained by multiplying the first coordinate value by itself, and the square of the second coordinate value is obtained by multiplying the second coordinate value by itself. The square of the first and second coordinate values ​​is then added together. The sum is the squared distance from this coordinate point to the center of the unit circle. This squared distance is used to subsequently determine whether the coordinate point meets the acceptance criteria.

[0126] (3) When the squared distance value is less than one and greater than the preset lower threshold, the logarithmic transformation result and the square root transformation result are determined based on the squared distance value, and the transformation factor is determined based on the ratio of the square root transformation result to the squared distance value.

[0127] The preset lower threshold is a pre-defined positive number close to zero, used to exclude cases where the squared distance value is zero or too small. The transformation factor is the quotient obtained by dividing the square root transformation result by the squared distance value, used to multiply the coordinate values ​​to achieve the transformation from a uniform distribution to a Gaussian distribution.

[0128] Specifically, when the squared distance value is less than one but greater than a preset lower threshold, it means that the coordinate point determined by the first and second coordinate values ​​is located inside the unit circle and far enough from the center, avoiding the situation where the coordinate point falls near or on the center. In this case, the coordinate point is accepted for subsequent transformations. The natural logarithm of the currently accepted squared distance value is taken to obtain the corresponding logarithmic value. Determining the square root transformation result based on the squared distance value means taking the square root of the squared distance value to obtain the corresponding root value. The quotient obtained by dividing the square root transformation result by the squared distance value is calculated; this quotient is the transformation factor. This transformation factor is used to multiply the first and second coordinate values ​​respectively to achieve the mathematical transformation from a uniform distribution within the unit circle to a Gaussian distribution. The preset lower threshold is a pre-set positive number close to zero, used to exclude cases where the squared distance value is too small, thus avoiding the logarithmic transformation result from approaching infinity due to the squared distance value approaching zero, and also preventing the occurrence of denormalized floating-point numbers.

[0129] (4) Based on the transformation factor, multiply by the first coordinate value and the second coordinate value respectively to obtain two independent Gaussian distributed random samples.

[0130] Specifically, the calculated transformation factor is used as a multiplier and multiplied by the first and second coordinate values ​​respectively. First, the transformation factor is multiplied by the first coordinate value to obtain a product, and then the transformation factor is multiplied by the second coordinate value to obtain another product. The two products obtained after these two multiplication operations are two independent Gaussian distributed random samples. These two Gaussian distributed random samples are not statistically correlated with each other and each follows a Gaussian distribution, meaning that sample values ​​have a higher probability of appearing near the mean and a lower probability of appearing far from the mean. By scaling the first and second coordinate values ​​with the transformation factor, the probability distribution transformation from a uniform distribution within the unit circle to a Gaussian distribution is achieved.

[0131] (5) Determine the normalization coefficient based on the threshold of a limiting factor greater than three, and map the Gaussian distributed random sample to signed integer data based on the normalization coefficient, and write it into the half-zone to be updated as Gaussian random noise data.

[0132] Among them, signed integer data refers to integer data that can represent positive and negative values, obtained by scaling a Gaussian distributed random sample through normalization coefficients.

[0133] Specifically, a threshold value greater than three is first set as the amplitude limiting factor. This threshold controls the range of Gaussian distributed random samples that are truncated during the mapping process. Then, the maximum value that the signed integer data can represent is divided by this amplitude limiting factor, and the result is the normalization coefficient. Each Gaussian distributed random sample is multiplied by the normalization coefficient to obtain a scaled value. This scaled value is then rounded to an integer according to the rounding rules, ensuring that the integer falls within the allowed range of values ​​for signed integer data, thus obtaining the signed integer data. Each integer value obtained after the above mapping is sequentially stored in the storage units of the half-area identified as needing to be updated in the dynamic noise data buffer, completing the overwrite and update of the original data in that half-area for subsequent output.

[0134] In this embodiment, the above-mentioned optimized implementation introduces a bit-level XOR operation to whiten adjacent raw random numbers output by the hardware true random number generator, effectively eliminating possible bit correlation in the underlying random source and improving the statistical uniformity of the random numbers. By setting a lower limit threshold to exclude cases where the squared distance value is too small, numerical anomalies caused by the logarithmic transformation tending to infinity are avoided, while preventing denormalized floating-point numbers from dragging down the processing efficiency of the floating-point arithmetic unit. Gaussian distributed random samples are generated by directly multiplying the conversion factor by the scalar value, without calling trigonometric functions throughout the process, further reducing the overhead of floating-point operations. A normalization coefficient is determined by using a limiting multiple threshold greater than three, mapping the Gaussian distributed random samples to signed integer data, which expands the range while reducing the truncation probability at the tail of the Gaussian distribution. Thus, while ensuring the Gaussian statistical characteristics of the output noise, the generation efficiency and numerical stability of Gaussian random noise data on the embedded platform are improved.

[0135] S430: Based on the dynamic noise data buffer after overlay filling, a Gaussian-modulated noise data stream is generated to drive the digital-to-analog converter to perform voltage conversion output.

[0136] Based on the Gaussian random noise data generated by the above technical solution, after actual testing and verification, under the condition of 2560 effective sampling points, its statistical characteristics are as follows: the mean is approximately 0, indicating that there is almost no DC component in the data, which meets the basic requirement of zero mean for the output signal of transcranial random noise stimulation; the standard deviation, after conversion, corresponds to 4 times the standard deviation, which is approximately 8281.45, consistent with the design expectation of using a threshold of greater than 3 for normalization mapping in the solution; the skewness is approximately -0.037, and its absolute value is close to 0, indicating that the data distribution has good symmetry; the kurtosis is approximately 3.079, which is very close to the kurtosis value of 3 of the theoretical normal distribution, further confirming that the data is highly consistent with the Gaussian distribution in terms of peak and tail morphology.

[0137] Regarding the normality test, the Kolmogorov-Smirnov test yielded a goodness-of-fit value of 0.961, which is close to the theoretical maximum of 1, indicating that there is no significant difference between the sample distribution and the theoretical Gaussian distribution, thus passing the normality test. The above statistical indicators collectively demonstrate that the generated noise data perfectly conforms to the theoretical characteristics of a Gaussian distribution in terms of mean, standard deviation, skewness, kurtosis, and distribution shape.

[0138] From a temporal perspective, Figure 5 The time-domain waveform diagram shown illustrates the amplitude variation over time at all 2560 sampling points. The waveform exhibits irregular yet uniform random fluctuations, with no periodic components or abrupt jumps detected. From a probability distribution perspective, Figure 6 The amplitude distribution histogram shown highly coincides with the normal distribution fitting curve. The data points are concentrated around the mean and decrease symmetrically to both sides, visually confirming the aforementioned analysis conclusions regarding skewness and kurtosis. From a frequency domain perspective, Figure 7 The power spectral density plot shown remains flat across the entire frequency band without any obvious peaks or dips, indicating that the power of the noise signal is uniformly distributed across all frequencies, consistent with the spectral characteristics of white noise.

[0139] Based on the above analysis of the time domain, statistical distribution, and frequency domain, it can be confirmed that the noise data output by this technical solution has excellent characteristics such as mean approaching 0, standard deviation meeting the design expectation of 4 times the standard deviation, skewness approaching 0, kurtosis approaching 3, and flat spectrum without bias. It is a perfect true Gaussian white noise, which fully meets the qualified requirements of transcranial random noise stimulation for the Gaussianity and white noise characteristics of the output signal.

[0140] Example 5 Figure 8 This is a schematic diagram of an output control device for transcranial Gaussian random noise stimulation provided in an embodiment of this application. It is applied to a dynamic noise data buffer having a first half-area storage space and a second half-area storage space. The output control device for transcranial Gaussian random noise stimulation provided in this embodiment of the application includes: The switching signal acquisition module 510 is used to acquire the half-area switching trigger signal generated when the noise data stored in the dynamic noise data buffer is cyclically transferred to the digital-to-analog converter. The noise data filling module 520 is used to determine, based on the half-zone switching trigger signal, another unoutput half-zone storage space corresponding to the source half-zone storage space that is currently being moved as the half-zone to be updated, and to perform noise data overlay filling on the half-zone to be updated based on the true random data stream generated by the hardware true random number generator during the time period when the source half-zone storage space is in the state of being moved and output. The data stream generation module 530 is used to generate a Gaussian-modulated noise data stream for driving the digital-to-analog converter to perform voltage conversion output based on the dynamic noise data buffer after overlay filling.

[0141] This application provides an output control device for transcranial Gaussian random noise stimulation, applied to a dynamic noise data buffer having a first half-zone storage space and a second half-zone storage space. When in use, the device: during the process of cyclically transferring noise data stored in the dynamic noise data buffer to the digital-to-analog converter, acquires a half-zone switching trigger signal generated when noise data in any half-zone storage space begins to be transferred; based on the half-zone switching trigger signal, determines another unoutput half-zone storage space corresponding to the currently transferred source half-zone storage space as the half-zone to be updated; and during the time period when the source half-zone storage space is in the transferred output state, performs noise data overwriting and filling on the half-zone to be updated based on a true random data stream generated by a hardware true random number generator; and based on the overwritten and filled dynamic noise data buffer, generates a Gaussian distributed modulation noise data stream to drive the digital-to-analog converter to perform voltage conversion output. The technical solution of this application constructs a dynamic noise data buffer with a first half-zone storage space and a second half-zone storage space, and performs hardware true random data stream overlay and filling on the other unoutput half-zone during the output of the source half-zone storage space according to the half-zone switching trigger signal. This realizes the half-zone level dynamic alternation update and parallel output of noise data, solves the problem of waveform periodicity inducing neural adaptation caused by static array cyclic output in the prior art, and the problem of output waveform having seams and not being able to be continuous and uninterrupted. It significantly improves the effectiveness of long-term stimulation and the continuity quality of output waveform.

[0142] Based on the above device, optionally, a noise data filling module 520 is used to establish a data transmission channel from the hardware true random number generator data register to the half-area storage space to be updated; when the central processing unit does not participate in the execution of data transfer instructions, the continuously generated true random numbers are written into each storage unit of the half-area storage space to be updated through the data transmission channel.

[0143] Based on the above-mentioned device, optionally, the noise data filling module 520 is further configured to extract multiple sets of independent first uniform random number pairs and second uniform random number pairs from the true random data stream output by the hardware true random number generator; perform variance normalization transformation on each set of the first uniform random number pair and the second uniform random number pair respectively, and generate a first Gaussian random noise component associated with the first uniform random number pair and a second Gaussian random noise component associated with the second uniform random number pair; wherein, the variance normalization transformation includes: determining the radial length and polar axis angle within the unit circle based on the uniform random number pair, and then processing the... The radial length is transformed by a negative two-logarithmic transformation based on the variance of the standard normal distribution to obtain an amplitude scaling factor. The polar axis angle is transformed by a trigonometric function to obtain an angle factor. The Gaussian random noise component is determined based on the product of the amplitude scaling factor and the angle factor. Based on the single storage bit width of the dynamic noise data buffer, the target bit width is determined. A first high-bit valid data segment is extracted from the first Gaussian random noise component, and a second low-bit valid data segment is extracted from the second Gaussian random noise component. The first high-bit valid data segment and the second low-bit valid data segment are concatenated to generate a complete Gaussian random noise data point that meets the target bit width.

[0144] Based on the above-mentioned device, optionally, the noise data filling module 520 is further used to obtain two original random numbers generated each time based on a hardware true random number generator; map the two original random numbers to the horizontal axis coordinate value and the vertical axis coordinate value within a unit circle, respectively, and calculate the squared distance from the corresponding coordinate point to the center of the circle based on the horizontal axis coordinate value and the vertical axis coordinate value; when the squared distance value is less than one and not zero, calculate the logarithmic transformation result and the square root transformation result based on the squared distance value, and multiply the coordinate value by the ratio of the square root transformation result to the squared distance value to obtain two independent Gaussian distributed random samples; during startup initialization, generate an initial Gaussian reference array of full length based on the Gaussian distributed random samples, perform a global deDC operation on the initial Gaussian reference array, and use it as the initial data content for constructing the dynamic noise data buffer area based on the Gaussian random noise data; during operation, write the Gaussian distributed random samples, after normalization mapping, as the Gaussian random noise data into the half-region to be updated.

[0145] Based on the above-mentioned device, optionally, the noise data filling module 520 is further configured to continuously acquire two original random numbers based on a hardware true random number generator, and perform a bit-level XOR operation on the two original random numbers to obtain whitened random numbers; determine a first coordinate value within a positive-negative-one interval based on the first value of the whitened random numbers, determine a second coordinate value within a positive-negative-one interval based on the second value of the whitened random numbers, and determine the squared distance from the corresponding coordinate point to the center of the circle based on the first coordinate value and the second coordinate value; when the squared distance value is less than one and greater than a preset lower threshold, determine a logarithmic transformation result and a square root transformation result based on the squared distance value, and determine a conversion factor based on the ratio of the square root transformation result to the squared distance value; multiply the first coordinate value and the second coordinate value by the conversion factor respectively to obtain two independent Gaussian distributed random samples; determine a normalization coefficient based on a limiting multiple threshold greater than three, and map the Gaussian distributed random samples to signed integer data based on the normalization coefficient, and write them as Gaussian random noise data into the half-region to be updated.

[0146] Based on the above-mentioned device, optionally, the output control device for transcranial Gaussian random noise stimulation further includes: a data adjustment module, used to obtain an offset compensation amount based on the arithmetic mean of all currently stored true random data in the half-area storage space to be updated; to obtain calibrated noise data with a statistical mean close to zero based on the offset compensation amount and the data values ​​of each storage unit in the half-area storage space to be updated; to determine the upper limit boundary and the lower limit boundary of amplitude based on a preset standard deviation ratio threshold; and to correct data values ​​exceeding the upper limit boundary of amplitude to the upper limit boundary of amplitude and data values ​​below the lower limit boundary of amplitude to the lower limit boundary of amplitude based on the comparison results of each data value in the calibrated noise data with the upper limit boundary of amplitude and the lower limit boundary of amplitude.

[0147] Based on the above-described device, optionally, in the case of multiple output channels, the noise data filling module 520 is specifically used to assign an independent amplitude adjustment coefficient to each of the multiple output channels; wherein, the multiple output channels share the same physical storage space of the dynamic noise data buffer; based on the amplitude adjustment coefficient corresponding to each output channel, the original noise data value read from the dynamic noise data buffer is scaled in real time to obtain the Gaussian distribution modulated noise data stream corresponding to each output channel.

[0148] Based on the above-mentioned device, optionally, the data stream generation module 530 is specifically used to determine the combined structure of a one-byte instruction field and a two-byte data field based on the serial communication frame format required by the digital-to-analog converter; determine the content of the instruction field as the opcode for controlling the digital-to-analog converter to perform an output voltage update operation; and map the high byte and low byte of the noise data value read from the dynamic noise data buffer to the two-byte data field respectively to generate a three-byte composite data frame.

[0149] Based on the above-mentioned device, the output control device for transcranial Gaussian random noise stimulation may optionally include: an abnormal data removal module, used to perform validity verification on the original true random data stream generated by the hardware true random number generator based on a preset randomness verification rule, and remove abnormal data points that do not conform to the randomness verification rule.

[0150] Based on the above device, optionally, the total capacity of the dynamic noise data buffer is 4096 data points, the first half of the storage space is the first 2048 data points, and the second half of the storage space is the last 2048 data points.

[0151] Based on the above device, optionally, the half-zone switching trigger signal includes a half-transmission completion interrupt signal and a transmission completion interrupt signal; wherein, the half-transmission completion interrupt signal is generated when the direct memory access controller completes the transfer of all noise data in the first half-zone storage space, and the transmission completion interrupt signal is generated when the direct memory access controller completes the transfer of all noise data in the second half-zone storage space and is preparing to return to the starting point of the first half-zone storage space.

[0152] The output control device for transcranial Gaussian random noise stimulation provided in this application can execute the output control method for transcranial Gaussian random noise stimulation provided in any embodiment of this application, and has the corresponding functional modules and beneficial effects of the execution method.

[0153] It is worth noting that the various units and modules included in the above system are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the protection scope of the embodiments of this application.

[0154] Example 6 Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 9 A block diagram is shown of an exemplary electronic device 60 suitable for implementing embodiments of the present application. Figure 9The electronic device 60 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.

[0155] like Figure 9 As shown, the electronic device 60 is presented in the form of a general-purpose computing device. The components of the electronic device 60 may include, but are not limited to: one or more processors or processing units 601, system memory 602, and bus 603 connecting different system components (including system memory 602 and processing unit 601).

[0156] Bus 603 represents one or more of several bus architectures, including memory buses or memory electronics, peripheral buses, graphics acceleration ports, processors, or local buses using any of the various bus architectures. For example, these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnect (PCI) bus.

[0157] Electronic device 60 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by electronic device 60, including volatile and non-volatile media, removable and non-removable media.

[0158] System memory 602 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 604 and / or cache memory 605. Electronic device 60 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 606 may be used to read and write non-removable, non-volatile magnetic media (… Figure 9 Not shown (usually referred to as a hard drive). Although Figure 9 As not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a floppy disk) and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 603 via one or more data media interfaces. Memory 602 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of this application.

[0159] A program / utility 608 having a set (at least one) of program modules 607 may be stored, for example, in memory 602. Such program modules 607 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 607 typically perform the functions and / or methods described in the embodiments of this application.

[0160] Electronic device 60 can also communicate with one or more external devices 609 (e.g., keyboard, pointing device, display 610, etc.), and with one or more devices that enable a user to interact with the electronic device 60, and / or with any device that enables the electronic device 60 to communicate with one or more other computing devices (e.g., network card, modem, etc.). This communication can be performed via input / output (I / O) interface 611. Furthermore, electronic device 60 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 612. As shown, network adapter 612 communicates with other modules of electronic device 60 via bus 603. It should be understood that, although... Figure 9 As not shown, other hardware and / or software modules may be used in conjunction with electronic device 60, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0161] The processing unit 601 executes various functional applications and page processing by running programs stored in the system memory 602, such as implementing the output control method for transcranial Gaussian random noise stimulation provided in the embodiments of this application.

[0162] Example 7 This application embodiment also provides a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform an output control method for transcranial Gaussian random noise stimulation, applied to a dynamic noise data buffer having a first half-zone storage space and a second half-zone storage space. The method includes: During the process of cyclically transferring the noise data stored in the dynamic noise data buffer to the digital-to-analog converter, the half-area switching trigger signal generated when the noise data in any half-area storage space begins to be transferred is acquired. Based on the half-zone switching trigger signal, another unoutput half-zone storage space corresponding to the source half-zone storage space that is currently being moved is determined as the half-zone to be updated. During the time period when the source half-zone storage space is in the state of being moved and output, noise data overlay and filling is performed on the half-zone to be updated based on the true random data stream generated by the hardware true random number generator. Based on the dynamic noise data buffer after overlay filling, a Gaussian-modulated noise data stream is generated to drive the digital-to-analog converter to perform voltage conversion output.

[0163] The computer storage medium in this application embodiment can be any combination of one or more computer-readable media. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0164] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.

[0165] Program code contained on a computer-readable medium may be transmitted using any suitable medium, including—but not limited to—wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0166] Computer program code for performing the operations of the embodiments of this application can be written in one or more programming languages ​​or a combination thereof. Programming languages ​​include object-oriented programming languages—such as Java, Smalltalk, and C++—and conventional procedural programming languages—such as C or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0167] Note that the above description is merely a preferred embodiment and the technical principles employed in this application. Those skilled in the art will understand that this application is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of this application. Therefore, although this application has been described in detail through the above embodiments, this application is not limited to the above embodiments. Many other equivalent embodiments may be included without departing from the concept of this application, and the scope of this application is determined by the scope of the appended claims.

Claims

1. A method for output control of transcranial Gaussian random noise stimulation, characterized in that, The method, applied to a dynamic noisy data buffer having a first half-space and a second half-space, includes: During the process of cyclically transferring the noise data stored in the dynamic noise data buffer to the digital-to-analog converter, the half-area switching trigger signal generated when the noise data in any half-area storage space begins to be transferred is acquired. Based on the half-area switching trigger signal, another unoutput half-area storage space corresponding to the source half-area storage space that is currently being moved is determined as the half-area to be updated. During the time period when the source half-area storage space is in the state of being moved and output, noise data overlay filling is performed on the half-area to be updated based on the true random data stream generated by the hardware true random number generator. The overlay filling includes: generating Gaussian random noise data that conforms to a Gaussian distribution and has been normalized based on the true random data stream, and writing it into the half-area to be updated. Based on the dynamic noise data buffer after overlay filling, a Gaussian-modulated noise data stream is generated to drive the digital-to-analog converter to perform voltage conversion output.

2. The method according to claim 1, characterized in that, The true random data stream generated by the hardware true random number generator performs noise data overlay filling on the half-region to be updated, including: Establish a data transmission channel from the hardware true random number generator data register to the storage space of the half-area to be updated; When the central processing unit is not involved in the execution of data transfer instructions, continuously generated true random numbers are written into each storage unit of the half-area storage space to be updated through the data transmission channel.

3. The method according to claim 1, characterized in that, The generation of Gaussian random noise data that conforms to a Gaussian distribution and has been normalized based on the true random data stream includes: Based on the true random data stream output by the hardware true random number generator, multiple sets of mutually independent first uniform random number pairs and second uniform random number pairs are extracted. For each pair of the first and second uniform random numbers, a variance normalization transformation is performed to generate a first Gaussian random noise component associated with the first uniform random number pair and a second Gaussian random noise component associated with the second uniform random number pair. The variance normalization transformation includes: determining the radial length and polar angle within the unit circle based on the uniform random number pair; performing a negative two-logarithmic transformation based on the standard normal distribution variance on the radial length to obtain an amplitude scaling factor; performing a trigonometric function transformation on the polar angle to obtain an angle factor; and determining the Gaussian random noise component based on the product of the amplitude scaling factor and the angle factor. Based on the single storage bit width of the dynamic noise data buffer, the target bit width is determined. A first high-bit valid data segment is extracted from the first Gaussian random noise component, and a second low-bit valid data segment is extracted from the second Gaussian random noise component. The first high-bit valid data segment and the second low-bit valid data segment are concatenated to generate a complete Gaussian random noise data point that conforms to the target bit width.

4. The method according to claim 1, characterized in that, The generation of Gaussian random noise data that conforms to a Gaussian distribution and has been normalized based on the true random data stream includes: Two raw random numbers are generated each time based on a hardware true random number generator; The two original random numbers are mapped to the horizontal and vertical coordinates of the unit circle, respectively, and the squared distance from the corresponding coordinate point to the center of the circle is calculated based on the horizontal and vertical coordinates. When the squared distance value is less than one and not zero, the logarithmic transformation result and the square root transformation result are calculated based on the squared distance value. The coordinate value is then multiplied by the ratio of the square root transformation result to the squared distance value to obtain two independent Gaussian distributed random samples. During startup initialization, an initial Gaussian reference array of full length is generated based on the Gaussian distributed random samples. After performing a global deDC operation on the initial Gaussian reference array, it is used as the initial data content to construct the dynamic noise data buffer area based on the Gaussian random noise data. During operation, the Gaussian distributed random samples are normalized and mapped, and then written into the half-region to be updated as Gaussian random noise data.

5. The method according to claim 1, characterized in that, The generation of Gaussian random noise data that conforms to a Gaussian distribution and has been normalized based on the true random data stream includes: Two raw random numbers are continuously acquired using a hardware true random number generator, and a bit-level XOR operation is performed on the two raw random numbers to obtain a whitened random number. The first coordinate value within the positive and negative one interval is determined based on the first value of the whitened random number, the second coordinate value within the positive and negative one interval is determined based on the second value of the whitened random number, and the squared distance from the corresponding coordinate point to the center of the circle is determined based on the first coordinate value and the second coordinate value. When the squared distance value is less than one and greater than a preset lower threshold, the logarithmic transformation result and the square root transformation result are determined based on the squared distance value, and the transformation factor is determined based on the ratio of the square root transformation result to the squared distance value. Based on the transformation factor, multiplying the first coordinate value and the second coordinate value respectively, two independent Gaussian distributed random samples are obtained; The normalization coefficient is determined based on a limiting factor threshold greater than three. Based on the normalization coefficient, the Gaussian distributed random sample is mapped to signed integer data and written as Gaussian random noise data into the half-region to be updated.

6. The method according to claim 1, characterized in that, After the truly random data stream generated by the hardware true random number generator performs noise data overlay filling on the half-region to be updated, the process further includes: The offset compensation amount is obtained based on the arithmetic mean of all currently stored true random data in the half-area storage space to be updated. Based on the offset compensation amount and the data values ​​of each storage unit in the half-area storage space to be updated, calibrated noise data with a statistical mean close to zero is obtained. Based on a preset standard deviation ratio threshold, the upper limit boundary and lower limit boundary of the amplitude are determined; Based on the comparison results between each data value in the calibrated noise data and the upper and lower amplitude boundaries, data values ​​exceeding the upper amplitude boundary are corrected to the upper amplitude boundary, and data values ​​below the lower amplitude boundary are corrected to the lower amplitude boundary.

7. The method according to claim 1, characterized in that, In the case of multiple output channels, the generation of a Gaussian-modulated noise data stream for driving the digital-to-analog converter to perform voltage conversion output, based on the overlay-filled dynamic noise data buffer, includes: Each of the plurality of output channels is assigned an independent amplitude adjustment coefficient; wherein the plurality of output channels share the same physical storage space of the dynamic noise data buffer. Based on the amplitude adjustment coefficients corresponding to each output channel, the original noise data values ​​read from the dynamic noise data buffer are scaled in real time to obtain the Gaussian distributed modulated noise data stream corresponding to each output channel.

8. The method according to claim 1, characterized in that, The generation of a Gaussian-modulated noise data stream for driving the digital-to-analog converter to perform voltage conversion output, based on the dynamic noise data buffer after overlay filling, includes: Based on the serial communication frame format required by the digital-to-analog converter, determine the combined structure of a one-byte instruction field and a two-byte data field; The content of the instruction field is determined as the opcode that controls the digital-to-analog converter to perform an output voltage update operation; The high-order and low-order bytes of the noise data value read from the dynamic noise data buffer are mapped to the two-byte data field to generate a composite data frame of three bytes.

9. The method according to claim 1, characterized in that, Before the truly random data stream generated by the hardware true random number generator performs noise data overlay filling on the half-region to be updated, the following steps are also included: Based on preset randomness verification rules, the validity of the original true random data stream generated by the hardware true random number generator is verified, and abnormal data points that do not conform to the randomness verification rules are removed.

10. The method according to claim 1, characterized in that, The half-cell switching trigger signal includes a half-transmission completion interrupt signal and a transmission completion interrupt signal; Specifically, the half-transfer completion interrupt signal is generated when the direct memory access controller completes the transfer of all noise data in the first half-area storage space, and the transfer completion interrupt signal is generated when the direct memory access controller completes the transfer of all noise data in the second half-area storage space and is preparing to return to the starting point of the first half-area storage space.