CN117110707B - SOC integrated chip, frequency measurement circuit and frequency measurement method - Google Patents
SOC integrated chip, frequency measurement circuit and frequency measurement method Download PDFInfo
- Publication number
- CN117110707B CN117110707B CN202311376291.XA CN202311376291A CN117110707B CN 117110707 B CN117110707 B CN 117110707B CN 202311376291 A CN202311376291 A CN 202311376291A CN 117110707 B CN117110707 B CN 117110707B
- Authority
- CN
- China
- Prior art keywords
- clock
- period
- counting result
- measurement
- frequency
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000005259 measurement Methods 0.000 title claims abstract description 208
- 238000000691 measurement method Methods 0.000 title claims abstract description 15
- 238000005070 sampling Methods 0.000 claims abstract description 6
- 230000000737 periodic effect Effects 0.000 claims description 49
- 230000003044 adaptive effect Effects 0.000 claims description 25
- 238000000034 method Methods 0.000 claims description 18
- 238000004422 calculation algorithm Methods 0.000 claims description 11
- 238000012545 processing Methods 0.000 claims description 6
- 238000013461 design Methods 0.000 abstract description 10
- 238000012360 testing method Methods 0.000 abstract description 9
- 238000004891 communication Methods 0.000 description 14
- 238000004590 computer program Methods 0.000 description 5
- 230000008569 process Effects 0.000 description 5
- 230000000630 rising effect Effects 0.000 description 4
- 230000005540 biological transmission Effects 0.000 description 3
- 238000013024 troubleshooting Methods 0.000 description 3
- 238000004364 calculation method Methods 0.000 description 2
- 230000008878 coupling Effects 0.000 description 2
- 238000010168 coupling process Methods 0.000 description 2
- 238000005859 coupling reaction Methods 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000011156 evaluation Methods 0.000 description 2
- 230000006978 adaptation Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 230000007812 deficiency Effects 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 238000009434 installation Methods 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01R—MEASURING ELECTRIC VARIABLES; MEASURING MAGNETIC VARIABLES
- G01R23/00—Arrangements for measuring frequencies; Arrangements for analysing frequency spectra
- G01R23/02—Arrangements for measuring frequency, e.g. pulse repetition rate; Arrangements for measuring period of current or voltage
- G01R23/10—Arrangements for measuring frequency, e.g. pulse repetition rate; Arrangements for measuring period of current or voltage by converting frequency into a train of pulses, which are then counted, i.e. converting the signal into a square wave
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F1/00—Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
- G06F1/04—Generating or distributing clock signals or signals derived directly therefrom
- G06F1/06—Clock generators producing several clock signals
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F15/00—Digital computers in general; Data processing equipment in general
- G06F15/76—Architectures of general purpose stored program computers
- G06F15/78—Architectures of general purpose stored program computers comprising a single central processing unit
- G06F15/7807—System on chip, i.e. computer system on a single chip; System in package, i.e. computer system on one or more chips in a single package
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Computer Hardware Design (AREA)
- Computing Systems (AREA)
- Microelectronics & Electronic Packaging (AREA)
- Measuring Frequencies, Analyzing Spectra (AREA)
Abstract
Description
技术领域Technical field
本发明涉及电子与时频测量技术领域,尤其是涉及一种SOC集成芯片、频率测量电路及频率测量方法。The invention relates to the technical fields of electronics and time-frequency measurement, and in particular to a SOC integrated chip, a frequency measurement circuit and a frequency measurement method.
背景技术Background technique
由于目前超大规模数据中心需要12.8Tbps甚至更高的网络交换带宽,因此,数据中心对高速光电收发芯片的需求也越来越紧迫。而随着收发芯片承载的业务速率越来越高,尤其是高速业务信号对时钟频率和种类有更高的要求。所以,高速SOC需要支持更广泛的时钟速率。Since current ultra-large-scale data centers require network switching bandwidth of 12.8Tbps or even higher, the demand for high-speed photoelectric transceiver chips in data centers is becoming increasingly urgent. As the service rates carried by transceiver chips are getting higher and higher, especially high-speed service signals have higher requirements for clock frequency and type. Therefore, high-speed SOCs need to support a wider range of clock rates.
时钟频率是指芯片内部运行的基准时钟信号的频率,它决定了芯片内部各个功能模块的操作速度。在高速芯片中,时钟频率的测量是非常重要的,原因如下:1、性能评估:时钟频率是评估芯片性能的关键指标之一。通过测量芯片的时钟频率,可以了解芯片能够达到的最高工作频率,从而评估芯片的性能是否符合设计要求;2、故障排查: 高速芯片中,时钟信号的准确性对芯片的正常运行至关重要。通过时钟频率的测量,可以确定时钟信号是否稳定,以及是否存在时钟偏移或时钟抖动等问题,这对于故障排查和调试是至关重要的;3、同步和协议: 高速芯片通常需要进行复杂的同步和协议处理,而这些操作通常是基于时钟信号的。通过精确测量时钟频率,可以确保各个功能模块之间的时序关系的正确性,从而保证芯片的正常工作。因此,时钟频率测量在高速芯片中非常重要,它涉及到芯片性能评估、故障排查以及同步和协议等关键方面。准确的时钟频率测量可以确保芯片的正常运行和优化性能。The clock frequency refers to the frequency of the reference clock signal running inside the chip, which determines the operating speed of each functional module inside the chip. In high-speed chips, the measurement of clock frequency is very important for the following reasons: 1. Performance evaluation: Clock frequency is one of the key indicators for evaluating chip performance. By measuring the clock frequency of the chip, you can understand the highest operating frequency that the chip can achieve, thereby evaluating whether the chip's performance meets the design requirements; 2. Troubleshooting: In high-speed chips, the accuracy of the clock signal is crucial to the normal operation of the chip. By measuring the clock frequency, it can be determined whether the clock signal is stable and whether there are problems such as clock offset or clock jitter, which is crucial for troubleshooting and debugging; 3. Synchronization and protocol: High-speed chips usually require complex Synchronization and protocol processing, and these operations are usually based on clock signals. By accurately measuring the clock frequency, the correctness of the timing relationship between various functional modules can be ensured, thereby ensuring the normal operation of the chip. Therefore, clock frequency measurement is very important in high-speed chips and involves critical aspects such as chip performance evaluation, troubleshooting, and synchronization and protocols. Accurate clock frequency measurement ensures proper chip operation and optimized performance.
然而,随着收发芯片设计复杂度的提升,时钟的频率也越来越高,因此,如何有效的对各个高速时钟进行检测和频率测量也成为了本领域技术人员有待解决的一个难点。However, as the design complexity of transceiver chips increases, the frequency of clocks becomes higher and higher. Therefore, how to effectively detect and measure the frequency of each high-speed clock has become a difficulty to be solved by those skilled in the art.
发明内容Contents of the invention
本发明所要解决的技术问题是克服现有技术的不足,以提出一种适应性更强、可自适应学习调整测量周期、能够兼容多种测量范围、能够提高测量精度的软硬件结合的SOC集成芯片、频率测量电路及频率测量方法。The technical problem to be solved by the present invention is to overcome the deficiencies of the existing technology and propose a SOC integration that combines software and hardware with greater adaptability, can adaptively learn to adjust the measurement cycle, is compatible with a variety of measurement ranges, and can improve measurement accuracy. Chip, frequency measurement circuit and frequency measurement method.
第一方面,为了解决上述技术问题,频率测量电路,其特征在于,包括:In the first aspect, in order to solve the above technical problems, the frequency measurement circuit is characterized by including:
测量周期产生模块,连接测量周期自适应调整模块,以用于在根据参考时钟的周期产生并输出测量周期的初始值后,基于所述测量周期自适应调整模块所产生的调整周期产生并输出调整后的测量周期。A measurement period generation module, connected to the measurement period adaptive adjustment module, for generating and outputting an adjustment based on the adjustment period generated by the measurement period adaptive adjustment module after generating and outputting an initial value of the measurement period according to the period of the reference clock. subsequent measurement period.
周期脉冲生成模块,接入所述参考时钟并与所述测量周期产生模块和跨时钟域电路连接,以用于间隔性的生成并向所述跨时钟域电路输出与所述参考时钟的时钟域相同的第一周期脉冲信号,其中,所述第一周期脉冲信号的周期为所述测量周期。A periodic pulse generation module, connected to the reference clock and connected with the measurement period generation module and the cross-clock domain circuit, for intermittent generation and outputting to the cross-clock domain circuit a clock domain consistent with the reference clock. The same first periodic pulse signal, wherein the period of the first periodic pulse signal is the measurement period.
跨时钟域电路,接入一待测时钟并与计数器连接,以用于将所述第一周期脉冲信号适配成与所述待测时钟的时钟域相同的第二周期脉冲信号,其中,所述第二周期脉冲信号的周期为所述测量周期。A cross-clock domain circuit is connected to a clock to be tested and connected to a counter for adapting the first periodic pulse signal to a second periodic pulse signal that is the same as the clock domain of the clock to be tested, wherein the The period of the second periodic pulse signal is the measurement period.
计数器,接入所述待测时钟并与所述比较存储器连接,以用于利用所述第二周期脉冲信号对所述待测时钟进行多次采样计数,并将计数结果送至所述比较存储器进行存储。A counter, connected to the clock to be tested and connected to the comparison memory, for using the second periodic pulse signal to sample and count the clock to be tested multiple times, and sending the counting results to the comparison memory for storage.
比较存储器,连接判决模块,以用于在接收到所述计数结果后,先与已存储的计数结果的最大值和/或最小值进行比较,若其比已存储的计数结果的最大值大则将该计数结果作为计数结果的新的最大值,若其比已存储的计数结果的最小值小则将该计数结果作为计数结果的新的最小值,之后再将计数结果的新的最大值和最小值存储并送至所述判决模块。A comparison memory, connected to the decision module, is used to compare with the maximum value and/or minimum value of the stored counting result after receiving the counting result. If it is greater than the maximum value of the stored counting result, The counting result is used as the new maximum value of the counting result. If it is smaller than the stored minimum value of the counting result, the counting result is used as the new minimum value of the counting result, and then the new maximum value of the counting result is summed. The minimum value is stored and sent to the decision module.
判决模块,连接所述测量周期自适应调整模块,以用于将所述计数结果的新的最大值和最小值进行差异比较,若差异值未在预设范围内,则向所述测量周期自适应调整模块发送启动指令。A decision module connected to the measurement cycle adaptive adjustment module for comparing the difference between the new maximum value and the minimum value of the counting result. If the difference value is not within the preset range, automatically adjust the measurement cycle to the measurement cycle. The adaptation adjustment module sends a start command.
测量周期自适应调整模块,用于在接收到所述启动指令后,根据预设的自适应算法形成一调整周期,并将所述调整周期发送至所述测量周期产生模块。The measurement period adaptive adjustment module is configured to form an adjustment period according to a preset adaptive algorithm after receiving the startup instruction, and send the adjustment period to the measurement period generation module.
在一些可选的实施例中,所述频率测量电路还可以包括:测量启动模块,连接所述测量周期产生模块,以用于在接收到上位机发送的频率测量启动指令后,向所述测量周期产生模块发送所述参考时钟的参数信息,所述参数信息包括周期。In some optional embodiments, the frequency measurement circuit may further include: a measurement start module connected to the measurement cycle generation module, and configured to send the frequency measurement start instruction to the measurement cycle after receiving the frequency measurement start instruction sent by the host computer. The period generation module sends parameter information of the reference clock, where the parameter information includes a period.
在一些可选的实施例中,所述频率测量电路具体可以应用于SOC集成芯片,而所述SOC集成芯片则具体可以包括多个时钟信号。In some optional embodiments, the frequency measurement circuit may be applied to a SOC integrated chip, and the SOC integrated chip may include multiple clock signals.
在一些可选的实施例中,所述频率测量电路还可以包括:时钟选择模块,接入所述多个时钟信号并与所述跨时钟域电路和所述计数器连接,以用于从所述多个时钟信号中选择一时钟信号作为所述待测时钟,且将该选择出的待测时钟发送至所述跨时钟域电路和所述计数器。In some optional embodiments, the frequency measurement circuit may further include: a clock selection module that accesses the multiple clock signals and is connected to the cross-clock domain circuit and the counter for selecting from the Select a clock signal from multiple clock signals as the clock to be tested, and send the selected clock to be tested to the cross-clock domain circuit and the counter.
在一些可选的实施例中,所述频率测量电路还包括:计数测量模块,连接所述判决模块,以用于在所述判决模块比较出所述计数结果的新的最大值和最小值的差异值处于所述预设范围时,计算并输出所述待测时钟的频率。In some optional embodiments, the frequency measurement circuit further includes: a counting measurement module, connected to the decision module, for comparing the new maximum value and minimum value of the counting result in the decision module. When the difference value is within the preset range, the frequency of the clock to be measured is calculated and output.
第二方面,基于同一发明构思,本发明还提出一种SOC集成芯片,具体的,所述SOC集成芯片可以包括如上所述的频率测量电路。In a second aspect, based on the same inventive concept, the present invention also proposes a SOC integrated chip. Specifically, the SOC integrated chip may include the frequency measurement circuit as described above.
第三方面,基于同一发明构思,本发明还提出一种频率测量方法,可以包括如下步骤:In a third aspect, based on the same inventive concept, the present invention also proposes a frequency measurement method, which may include the following steps:
确定参考时钟的周期,形成测量周期。Determine the period of the reference clock to form the measurement period.
基于所述测量周期、参数时钟,形成与所述参考时钟的时钟域相同的第一周期脉冲信号。Based on the measurement period and the parameter clock, a first periodic pulse signal that is the same as the clock domain of the reference clock is formed.
确定待测时钟,并基于所述待测时钟对所述第一周期脉冲进行跨时钟域处理,以得到与所述待测时钟的时钟域相同的第二周期脉冲信号。The clock to be tested is determined, and the first periodic pulse is processed across clock domains based on the clock to be tested, to obtain a second periodic pulse signal that is the same as the clock domain of the clock to be tested.
利用所述第二周期脉冲信号对所述待测时钟进行采样计数,以得到本次计数结果。The second periodic pulse signal is used to sample and count the clock to be measured to obtain the current counting result.
将本次计数结果与预存的计数结果的最大值和/或最小值进行比较,并根据比较结果确定计数结果的更新后的最大值和最小值。Compare the current counting result with the maximum value and/or minimum value of the pre-stored counting result, and determine the updated maximum value and minimum value of the counting result based on the comparison result.
比较所述计数结果的更新后的最大值和最小值,若所述最大值和最小值的差异值未在预设范围内,则利用自适应学习算法形成一调整周期,并返回执行所述形成测量周期的步骤,以基于所述调整周期形成调整后的测量周期。Compare the updated maximum value and minimum value of the counting result. If the difference between the maximum value and the minimum value is not within the preset range, use an adaptive learning algorithm to form an adjustment cycle, and return to execute the forming process. The step of measuring a period to form an adjusted measurement period based on the adjustment period.
在一些可选的实施例中,所述第一周期脉冲信号、第二周期脉冲信号的周期相同,且均为所述测量周期。In some optional embodiments, the first periodic pulse signal and the second periodic pulse signal have the same period, and both are the measurement period.
在一些可选的实施例中,所述根据比较结果确定计数结果的更新后的最大值和最小值的步骤,具体可以包括:In some optional embodiments, the step of determining the updated maximum value and minimum value of the counting result based on the comparison result may specifically include:
若所述本次计数结果比预存的计数结果的最大值大,则将所述本次计数结果作为所述计数结果的更新后的最大值。If the current counting result is greater than the maximum value of the pre-stored counting result, the current counting result is used as the updated maximum value of the counting result.
若所述本次计数结果比预存的计数结果的最小值小,则将所述本次计数结果作为所述计数结果的更新后的最小值。If the current counting result is smaller than the minimum value of the pre-stored counting result, the current counting result is used as the updated minimum value of the counting result.
在一些可选的实施例中,所述频率测量方法还可以包括:若所述计数结果的更新后的最大值和最小值的差异值处在预设范围内,则基于所述计数结果的更新后的最大值或最小值,得到所述待测时钟的频率的步骤。In some optional embodiments, the frequency measurement method may further include: if the difference between the updated maximum value and the minimum value of the counting result is within a preset range, updating the counting result based on the The step of obtaining the frequency of the clock to be measured from the maximum or minimum value.
在一些可选的实施例中,所述差异值的所述预设范围具体可以为:1~2,而优选为1。In some optional embodiments, the preset range of the difference value may specifically be: 1~2, and is preferably 1.
第四方面,本发明还提供了一种电子设备,包括处理器、通信接口、存储器和通信总线,其中,处理器,通信接口,存储器通过通信总线完成相互间的通信;In a fourth aspect, the present invention also provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete communication with each other through the communication bus;
存储器,用于存放计算机程序;Memory, used to store computer programs;
处理器,用于执行存储器上所存放的程序时,实现如上所述的频率测量方法的步骤。The processor is used to implement the steps of the frequency measurement method as described above when executing the program stored in the memory.
与现有技术相比,本发明具有以下有益效果:Compared with the prior art, the present invention has the following beneficial effects:
在本发明提供的一种频率测量电路中,其在测量周期产生模块的一输入端连接一测量周期自适应调整模块,以通过所述测量周期自适应调整模块所输出的用于调整测量周期的调整周期,得到调整后的测量周期,进而基于不断调整的测量周期,对待测时钟进行多次上升沿或下降沿计数,且在计数结果的最大值和最小值的差异值在预设范围内时,才停止循环计数,并最终得到所述待测时钟的频率。In a frequency measurement circuit provided by the present invention, an input end of the measurement period generation module is connected to a measurement period adaptive adjustment module, so that the measurement period output by the measurement period adaptive adjustment module is used to adjust the measurement period. Adjust the cycle to obtain the adjusted measurement cycle, and then based on the continuously adjusted measurement cycle, count the rising edge or falling edge of the clock to be measured multiple times, and when the difference between the maximum value and the minimum value of the counting result is within the preset range , only then the cycle counting is stopped, and the frequency of the clock under test is finally obtained.
由于本发明中所提供的频率测量电路并不限定待测量的频率范围,其既可以对高速SOC集成芯片中的高速时钟进行测量,其还可以对其他任何不同频率时钟进行测量,因此,本发明所提供的频率测量电路具有适应性更强、可自适应学习调整测量周期、兼容多种测量范围以及提高测量精度的特性。Since the frequency measurement circuit provided in the present invention does not limit the frequency range to be measured, it can not only measure the high-speed clock in the high-speed SOC integrated chip, but also can measure any other clocks with different frequencies. Therefore, the present invention The frequency measurement circuit provided is more adaptable, can adaptively learn to adjust the measurement period, is compatible with a variety of measurement ranges, and improves measurement accuracy.
并且,由于本发明在进行待测时钟的频率测量时,其用于确定待测时钟的频率的计数结果的最大值或最小值会随着测量周期的调整而不过更新,直至所述计数结果的最大值和最小值之间的差异为1时,即代表调整后的测量周期达到目标测量周期,且基于该目标测量周期所计算得到频率最为准确。Moreover, when the present invention measures the frequency of the clock to be measured, the maximum or minimum value of the counting result used to determine the frequency of the clock to be measured will not be updated as the measurement cycle is adjusted, until the counting result reaches When the difference between the maximum value and the minimum value is 1, it means that the adjusted measurement period reaches the target measurement period, and the frequency calculated based on the target measurement period is the most accurate.
进一步的,由于本发明将大量的运算均放在测量周期自适应调整模块和比较存储器的软件层面去执行,进而本发明提供的频率测量电路的主要设计思路即为软硬件结合,而基于该设计思路的频率测量电路能有效的降低IC电路设计的复杂度、有效减少芯片的调试时间、节约时间成本以及加速芯片的尽快商用和更新效率。Furthermore, since the present invention places a large number of operations on the software level of the measurement cycle adaptive adjustment module and the comparison memory, the main design idea of the frequency measurement circuit provided by the present invention is the combination of software and hardware, and based on this design The frequency measurement circuit of Idea can effectively reduce the complexity of IC circuit design, effectively reduce chip debugging time, save time and cost, and accelerate the commercialization and update efficiency of chips as soon as possible.
附图说明Description of the drawings
图1为本发明一些实施例中提供的一种频率测量电路的电路示意图。Figure 1 is a circuit schematic diagram of a frequency measurement circuit provided in some embodiments of the present invention.
图2为本发明一些实施例中提供的一种频率测量方法的流程示意图。Figure 2 is a schematic flow chart of a frequency measurement method provided in some embodiments of the present invention.
具体实施方式Detailed ways
为使本发明的目的、优点和特征更加清楚,以下结合附图和具体实施例对本发明作进一步详细说明。需说明的是,附图均采用非常简化的形式且未按比例绘制,仅用以方便、明晰地辅助说明本发明实施例的目的。此外,附图所展示的结构往往是实际结构的一部分。特别的,各附图需要展示的侧重点不同,有时会采用不同的比例。In order to make the purpose, advantages and features of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that the drawings are in a very simplified form and are not drawn to scale, and are only used to conveniently and clearly assist in explaining the embodiments of the present invention. In addition, the structures shown in the drawings are often part of the actual structure. In particular, each drawing needs to display different emphasis, and sometimes uses different proportions.
如在本发明中所使用的,单数形式“一”、“一个”以及“该”包括复数对象,术语“或”通常是以包括“和/或”的含义而进行使用的,术语“若干”通常是以包括“至少一个”的含义而进行使用的,术语“至少两个”通常是以包括“两个或两个以上”的含义而进行使用的,此外,术语“第一”、“第二”、“第三”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”、“第三”的特征可以明示或者隐含地包括一个或者至少两个该特征,“一端”与“另一端”以及“近端”与“远端”通常是指相对应的两部分,其不仅包括端点,术语“安装”、“相连”、“连接”应做广义理解,例如,可以是固定连接,也可以是可拆卸连接,或成一体;可以是机械连接,也可以是电连接;可以是直接相连,也可以通过中间媒介间接相连,可以是两个元件内部的连通或两个元件的相互作用关系。此外,如在本发明中所使用的,一元件设置于另一元件,通常仅表示两元件之间存在连接、耦合、配合或传动关系,且两元件之间可以是直接的或通过中间元件间接的连接、耦合、配合或传动,而不能理解为指示或暗示两元件之间的空间位置关系,即一元件可以在另一元件的内部、外部、上方、下方或一侧等任意方位,除非内容另外明确指出外。对于本领域的普通技术人员而言,可以根据具体情况理解上述术语在本发明中的具体含义。As used in this invention, the singular forms "a", "an" and "the" include plural referents, the term "or" is generally used in its sense including "and/or", and the term "several" The term "at least two" is usually used in a meaning including "at least one", and the term "at least two" is usually used in a meaning including "two or more". In addition, the terms "first" and "th "Second" and "third" are used for descriptive purposes only and cannot be understood as indicating or implying the relative importance or implicitly indicating the quantity of the technical features indicated. Therefore, the features defined as "first", "second" and "third" may explicitly or implicitly include one or at least two of these features, "one end" and "other end" and "proximal end" and "Remote" usually refers to the two corresponding parts, which not only includes the endpoints. The terms "installation", "connection" and "connection" should be understood in a broad sense. For example, it can be a fixed connection or a detachable connection, or Integrated; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium; it can be an internal connection between two elements or an interaction between two elements. In addition, as used in the present invention, one element is disposed on another element, which usually only means that there is a connection, coupling, matching or transmission relationship between the two elements, and the relationship between the two elements may be direct or indirect through an intermediate element. connection, coupling, cooperation or transmission, and cannot be understood as indicating or implying the spatial positional relationship between two elements, that is, one element can be in any position inside, outside, above, below or to one side of another element, unless the content Also clearly stated. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
诚如背景技术所述,在电子技术中,频率一直是最基本参数之一,并且与许多电参量的测量方案、测量结果都有非常密切的关系,因此频率的测量也尤为重要。然而,随着收发芯片设计复杂度的提升,时钟的频率也越来越高,因此,如何有效的对各个高速时钟进行检测和频率测量也成为了本领域技术人员有待解决的一个难点。As mentioned in the background art, frequency has always been one of the most basic parameters in electronic technology, and is closely related to many electrical parameter measurement plans and measurement results. Therefore, frequency measurement is also particularly important. However, as the design complexity of transceiver chips increases, the frequency of clocks becomes higher and higher. Therefore, how to effectively detect and measure the frequency of each high-speed clock has become a difficulty to be solved by those skilled in the art.
因此,本发明提出了一种适应性更强、可自适应学习调整测量周期、能够兼容多种测量范围、能够提高测量精度的软硬件结合的SOC集成芯片、频率测量电路及频率测量方法。Therefore, the present invention proposes a SOC integrated chip, a frequency measurement circuit and a frequency measurement method that are more adaptable, can adaptively learn to adjust the measurement cycle, are compatible with a variety of measurement ranges, and can improve measurement accuracy by combining software and hardware.
以下将对本发明的一种频率测量电路作进一步的详细描述。下面将参照附图1对本发明进行更详细的描述,其中表示了本发明的优选实施例,应该理解本领域技术人员可以修改在此描述的本发明而仍然实现本发明的有利效果。因此,下列描述应当被理解为对于本领域技术人员的广泛知道,而并不作为对本发明的限制。A frequency measurement circuit of the present invention will be described in further detail below. The invention will now be described in more detail with reference to Figure 1, in which a preferred embodiment of the invention is shown, it being understood that those skilled in the art may modify the invention described herein while still achieving the advantageous effects of the invention. Therefore, the following description should be understood as being widely known to those skilled in the art and is not intended to limit the present invention.
参阅图1,本发明实施例中所提供的一种频率测量电路具体可以包括:测量启动电路10、测量周期产生模块20、周期脉冲生成模块30、跨时钟域电路40、时钟选择模块50、计数器60、比较存储器70、判决模块80、测量周期自适应调整模块90和计数测量模块100;其中,Referring to Figure 1, a frequency measurement circuit provided in an embodiment of the present invention may specifically include: a measurement start circuit 10, a measurement period generation module 20, a periodic pulse generation module 30, a cross-clock domain circuit 40, a clock selection module 50, and a counter. 60. Comparison memory 70, decision module 80, measurement period adaptive adjustment module 90 and counting measurement module 100; wherein,
所述测量启动电路10包括输入端和输出端,其输入端用于接收上位机发送的频率测量启动指令和参考时钟的参数信息,例如参考时钟的周期(周期值),其输出端与所述测量周期产生模块20连接,并用于将接收到的参考时钟的周期发送至所述测量周期产生模块20。The measurement startup circuit 10 includes an input terminal and an output terminal. The input terminal is used to receive the frequency measurement startup command sent by the host computer and the parameter information of the reference clock, such as the period (period value) of the reference clock. The output terminal is connected to the The measurement period generation module 20 is connected and used to send the received period of the reference clock to the measurement period generation module 20 .
所述测量周期产生模块20包括第一输入端、第二输入端和输出端,所述第一输入端与所述测量启动电路10的输出端连接,所述第二输入端与所述测量周期自适应调整模块90的输出端连接,而其输出端则与所述周期脉冲生成模块30连接,以用于在根据参考时钟的周期产生并输出测量周期的初始值后,基于所述测量周期自适应调整模块90所产生的调整周期产生并输出调整后的测量周期。The measurement period generation module 20 includes a first input terminal, a second input terminal and an output terminal. The first input terminal is connected to the output terminal of the measurement start circuit 10 , and the second input terminal is connected to the measurement period. The output end of the adaptive adjustment module 90 is connected, and its output end is connected to the periodic pulse generation module 30, so as to generate and output the initial value of the measurement period according to the period of the reference clock, and automatically adjust the measurement period based on the measurement period. Adapting the adjustment period generated by the adjustment module 90 generates and outputs an adjusted measurement period.
所述周期脉冲生成模块30包括第一输入端、第二输入端和输出端,所述第一输入端与所述参考时钟连接,所述第二输入端与所述测量周期产生模块20的输出端连接,而其输出端则与所述跨时钟域电路40连接,以用于间隔性的生成一与所述参考时钟的时钟域相同的第一周期脉冲信号,并通过其输出端将生成的所述第一周期脉冲信号发送至所述跨时钟域电路40,其中,所述第一周期脉冲信号的周期为所述测量周期。The periodic pulse generation module 30 includes a first input terminal, a second input terminal and an output terminal. The first input terminal is connected to the reference clock, and the second input terminal is connected to the output of the measurement period generation module 20 . terminal is connected, and its output terminal is connected to the cross-clock domain circuit 40 for intermittently generating a first periodic pulse signal that is the same as the clock domain of the reference clock, and the generated signal is passed through its output terminal. The first periodic pulse signal is sent to the cross-clock domain circuit 40 , wherein the period of the first periodic pulse signal is the measurement period.
所述跨时钟域电路40包括第一输入端、第二输入端和输出端,所述第一输入端与所述周期脉冲生成模块30的输出端连接,所述第二输入端与所述时钟选择模块50的输出端连接,以通过该第二输入端接入所述时钟选择模块50从多个时钟信号中所选择出且作为所述待测时钟的一时钟信号,而其输出端则与所述计数器60的输入端连接,以用于根据所述待测时钟的时钟域,对所述第一周期脉冲信号进行跨时钟域处理,即将所述第一周期脉冲信号适配成与所述待测时钟的时钟域相同的第二周期脉冲信号,其中,所述第二周期脉冲信号的周期为所述测量周期。The cross-clock domain circuit 40 includes a first input terminal, a second input terminal and an output terminal. The first input terminal is connected to the output terminal of the periodic pulse generation module 30 , and the second input terminal is connected to the clock The output terminal of the selection module 50 is connected to a clock signal selected by the clock selection module 50 from a plurality of clock signals and used as the clock to be measured through the second input terminal, and its output terminal is connected to The input end of the counter 60 is connected to perform cross-clock domain processing on the first periodic pulse signal according to the clock domain of the clock to be measured, that is, to adapt the first periodic pulse signal to the clock domain of the clock to be measured. A second periodic pulse signal with the same clock domain of the clock to be measured, wherein the period of the second periodic pulse signal is the measurement period.
所述时钟选择模块50包括输入端、第一输出端和第二输出端,所述输入端可以接入多个时钟信号,所述第一输出端与所述跨时钟域电路40的第二输入端连接,所述第二输出端与所述计数器60的一输入端连接,以用于从其输入端所接入的所述多个时钟信号中选择一时钟信号作为所述待测时钟,并将该选择出的待测时钟分别发送至所述跨时钟域电路40和所述计数器60。The clock selection module 50 includes an input terminal, a first output terminal and a second output terminal. The input terminal can receive multiple clock signals. The first output terminal and the second input of the cross-clock domain circuit 40 terminal is connected, the second output terminal is connected to an input terminal of the counter 60 for selecting a clock signal from the plurality of clock signals connected to its input terminal as the clock to be measured, and The selected clock to be measured is sent to the cross-clock domain circuit 40 and the counter 60 respectively.
所述计数器60包括第一输入端、第二输入端和输出端,所述第一输入端与所述跨时钟域电路40的输出端连接,所述第二输入端与所述时钟选择模块50的第二输出端连接,而其输出端则与所述比较存储器70连接,以用于利用所述第二周期脉冲信号对所述待测时钟进行多次采样计数,并将计数结果送至所述比较存储器70进行存储。The counter 60 includes a first input terminal, a second input terminal and an output terminal. The first input terminal is connected to the output terminal of the cross-clock domain circuit 40 , and the second input terminal is connected to the clock selection module 50 is connected to the second output terminal, and its output terminal is connected to the comparison memory 70 for using the second periodic pulse signal to perform multiple sampling and counting of the clock to be measured, and sending the counting results to the The comparison memory 70 performs storage.
所述比较存储器70包括一输入端和一输出端,其输入端与所述计数器60的输出端连接,其输出端与所述判决模块80的输入端连接,以用于在接收到所述计数器60在每个测量周期所计数出的计数结果后,将其最大值和/或最小值调整,并将调整后的最大值和最小值进行存储。具体的,所述比较存储器70可以在接收到所述每个测量周期所对应的计数结果后,先与已存储的计数结果的最大值和/或最小值进行比较,若其比已存储的计数结果的最大值大则将该计数结果作为计数结果的新的最大值,若其比已存储的计数结果的最小值小则将该计数结果作为计数结果的新的最小值,之后再将计数结果的新的最大值和最小值存储并送至所述判决模块80。The comparison memory 70 includes an input terminal and an output terminal. The input terminal is connected to the output terminal of the counter 60 and the output terminal is connected to the input terminal of the decision module 80 for receiving the counter. 60 After counting the counting results in each measurement cycle, adjust the maximum value and/or minimum value, and store the adjusted maximum value and minimum value. Specifically, after receiving the counting results corresponding to each measurement cycle, the comparison memory 70 may first compare the maximum value and/or the minimum value of the stored counting results, and if it is greater than the stored count If the maximum value of the result is larger, the counting result will be used as the new maximum value of the counting result. If it is smaller than the minimum value of the stored counting result, the counting result will be used as the new minimum value of the counting result, and then the counting result will be used as the new minimum value of the counting result. The new maximum value and minimum value are stored and sent to the decision module 80.
所述判决模块80包括一输入端、第一输出端和第二输出端,所述输入端与所述比较存储器70的输出端连接,所述第一输出端与所述测量周期自适应调整模块90的输入端连接,所述第二输出端则与所述计数量测模块100的输入端连接,以用于将所述计数结果的新的最大值和最小值进行差异比较,若差异值未在预设范围内,则向所述测量周期自适应调整模块90发送启动指令,若所述差异值处于所述预设范围内,则直接将本次比较的所述计数结果的新的最大值和最小值发送至所述计数测量模块100。The decision module 80 includes an input terminal, a first output terminal and a second output terminal. The input terminal is connected to the output terminal of the comparison memory 70 . The first output terminal is connected to the measurement period adaptive adjustment module. 90 is connected to the input terminal, and the second output terminal is connected to the input terminal of the counting measurement module 100 to compare the difference between the new maximum value and the minimum value of the counting result. If the difference value is not Within the preset range, a start instruction is sent to the measurement period adaptive adjustment module 90. If the difference value is within the preset range, the new maximum value of the counting result of this comparison is directly and the minimum value is sent to the count measurement module 100 .
所述测量周期自适应调整模块90包括一输入端和一输出端,其中其输入端与所述判决模块80的第一输出端连接,而其输出则与所述测量周期产生模块20的第二输入端连接,以用于在接收到所述判决模块80发送的所述启动指令后,即在所述计数结果的新的最大值和最小值的差异值未在预设范围内时,根据预设的自适应算法形成一调整周期,并将所述调整周期发送至所述测量周期产生模块20,以使所述测量周期产生模块20在接收到该调整周期后,将该调整周期作为所述参考时钟的周期,再次形成新的测量周期(即调整后的测量周期),并基于该调整后的测量周期再次进行待测时钟的采样计数。The measurement period adaptive adjustment module 90 includes an input terminal and an output terminal. The input terminal is connected to the first output terminal of the decision module 80 , and the output terminal is connected to the second output terminal of the measurement period generation module 20 . The input terminal is connected for receiving the start instruction sent by the decision module 80, that is, when the difference between the new maximum value and the minimum value of the counting result is not within the preset range, the predetermined The adaptive algorithm is assumed to form an adjustment period, and the adjustment period is sent to the measurement period generation module 20, so that after receiving the adjustment period, the measurement period generation module 20 uses the adjustment period as the The period of the reference clock is used to form a new measurement period (that is, the adjusted measurement period) again, and based on the adjusted measurement period, the sampling and counting of the clock to be measured is performed again.
所述计数测量模块100包括一输入端和一输出端,所述输入端与所述判决模块80的第二输出端连接,以用于在所述判决模块80比较出所述计数结果的新的最大值和最小值的差异值处于所述预设范围时,基于该最大值或最小值计算并输出所述待测时钟的频率。The counting measurement module 100 includes an input terminal and an output terminal. The input terminal is connected to the second output terminal of the decision module 80 for comparing the new counting result in the decision module 80 . When the difference between the maximum value and the minimum value is within the preset range, the frequency of the clock to be measured is calculated and output based on the maximum value or minimum value.
其中,所述差异值的所述预设范围具体可以为:1~2,而优选为1。The preset range of the difference value may specifically be: 1 to 2, and is preferably 1.
需要说明的是,在本发明的一些实施例中,可以将所述图1中所示的频率测量电路作为一个单独频率测量测试电路,以通过外置上位机的控制,启动所述频率测量电路;而在本发明的另一些实施例中,还可以将所述图1中所示的频率测量电路作为某一需要测量频率的电路中的一子电路,例如,可以将所述图1中所示的频率测量电路接入包括多个时钟信号的SOC集成芯片,以用于对该SOC集成芯片中的某一时钟信号进行测量,即本发明对所述图1中所示的频率测量电路的具体使用不做限定,只要实现频率测量即可。It should be noted that in some embodiments of the present invention, the frequency measurement circuit shown in Figure 1 can be used as a separate frequency measurement test circuit, so that the frequency measurement circuit can be started under the control of an external host computer. ; In other embodiments of the present invention, the frequency measurement circuit shown in Figure 1 can also be used as a sub-circuit in a circuit that needs to measure frequency. For example, the frequency measurement circuit shown in Figure 1 can be The frequency measurement circuit shown in FIG. 1 is connected to a SOC integrated chip including multiple clock signals to measure a certain clock signal in the SOC integrated chip. That is, the frequency measurement circuit shown in FIG. 1 is used by the present invention. There are no restrictions on specific use, as long as frequency measurement is achieved.
显然,由于本发明实施例中所提供的频率测量电路,其是在测量周期产生模块的一输入端连接一测量周期自适应调整模块,以通过所述测量周期自适应调整模块所输出的用于调整测量周期的调整周期,得到调整后的测量周期,进而基于不断调整的测量周期,对待测时钟进行多次上升沿或下降沿计数,且在计数结果的最大值和最小值的差异值在预设范围内时,才停止循环计数,并最终得到所述待测时钟的频率。Obviously, due to the frequency measurement circuit provided in the embodiment of the present invention, a measurement period adaptive adjustment module is connected to an input end of the measurement period generation module, so that the frequency measurement circuit output by the measurement period adaptive adjustment module is used. Adjust the adjustment period of the measurement period to obtain the adjusted measurement period. Then, based on the continuously adjusted measurement period, count multiple rising edges or falling edges of the clock to be measured, and the difference between the maximum value and the minimum value of the counting result is in the preset value. When it is within the set range, the cycle counting is stopped, and the frequency of the clock under test is finally obtained.
由于本发明中所提供的频率测量电路并不限定待测量的频率范围,其既可以对高速SOC集成芯片中的高速时钟进行测量,其还可以对其他任何不同频率时钟进行测量,因此,本发明实施例中所提供的所述频率测量电路可以得到的意想不到的技术效果至少有:适应性更强、可自适应学习调整测量周期、兼容多种测量范围以及提高测量精度。Since the frequency measurement circuit provided in the present invention does not limit the frequency range to be measured, it can not only measure the high-speed clock in the high-speed SOC integrated chip, but also can measure any other clocks with different frequencies. Therefore, the present invention The frequency measurement circuit provided in the embodiment can achieve at least unexpected technical effects: greater adaptability, adaptive learning and adjustment of the measurement period, compatibility with multiple measurement ranges, and improved measurement accuracy.
并且,由于本发明实施例中所提供的频率测量电路将将大量运算量均卸载到软件层面去执行,从而还可以达到有效降低芯片的复杂度、节约频率计算时间成本,以及有效降低芯片功耗和降低数字逻辑的复杂度的目的。Moreover, since the frequency measurement circuit provided in the embodiment of the present invention offloads a large amount of calculations to the software level for execution, it can also effectively reduce the complexity of the chip, save frequency calculation time and cost, and effectively reduce the power consumption of the chip. and reduce the complexity of digital logic.
基于图1所示的频率测量电路,本发明实施例中还提供了一种频率测量方法,如图2所示,所述图2为本发明实施例中所提供的一种频率测量方法的流程示意图。Based on the frequency measurement circuit shown in Figure 1, the embodiment of the present invention also provides a frequency measurement method, as shown in Figure 2. Figure 2 is a flow chart of a frequency measurement method provided in the embodiment of the present invention. Schematic diagram.
参阅图2,所述频率测量方法具体可以包括如下步骤:Referring to Figure 2, the frequency measurement method may specifically include the following steps:
步骤S201,确定参考时钟的周期,形成测量周期。Step S201: Determine the period of the reference clock to form a measurement period.
步骤S202,基于所述测量周期、参数时钟,形成与所述参考时钟的时钟域相同的第一周期脉冲信号。Step S202: Based on the measurement period and parameter clock, form a first periodic pulse signal that is the same as the clock domain of the reference clock.
步骤S203,确定待测时钟,并基于所述待测时钟对所述第一周期脉冲进行跨时钟域处理,以得到与所述待测时钟的时钟域相同的第二周期脉冲信号。Step S203: Determine the clock to be tested, and perform cross-clock domain processing on the first periodic pulse based on the clock to be tested, to obtain a second periodic pulse signal that is the same as the clock domain of the clock to be tested.
步骤S204,利用所述第二周期脉冲信号对所述待测时钟进行采样计数,以得到本次计数结果。Step S204: Use the second periodic pulse signal to sample and count the clock to be measured to obtain this counting result.
步骤S205,将本次计数结果与预存的计数结果的最大值和/或最小值进行比较,并根据比较结果确定计数结果的更新后的最大值和最小值。Step S205: Compare the current counting result with the maximum value and/or minimum value of the pre-stored counting result, and determine the updated maximum value and minimum value of the counting result based on the comparison result.
步骤S206,比较所述计数结果的更新后的最大值和最小值是否处于预设范围内。Step S206: Compare whether the updated maximum value and minimum value of the counting result are within a preset range.
步骤S207,若所述最大值和最小值的差异值未在预设范围内,则利用自适应学习算法形成一调整周期,并返回执行所述形成测量周期的步骤,以基于所述调整周期形成调整后的测量周期。Step S207, if the difference between the maximum value and the minimum value is not within the preset range, use an adaptive learning algorithm to form an adjustment period, and return to the step of forming a measurement period to form a measurement period based on the adjustment period. Adjusted measurement period.
步骤S208,若所述计数结果的更新后的最大值和最小值的差异值处在预设范围内,则基于所述计数结果的更新后的最大值或最小值,得到所述待测时钟的频率。Step S208: If the difference between the updated maximum value and the minimum value of the counting result is within the preset range, then based on the updated maximum value or minimum value of the counting result, obtain the value of the clock to be measured. frequency.
其中,所述第一周期脉冲信号、第二周期脉冲信号的周期相同且均为所述测量周期。Wherein, the periods of the first periodic pulse signal and the second periodic pulse signal are the same and both are the measurement period.
在上述步骤S201中,所述图1中的测量周期产生模块20在接收到频率测试启动指令之后,先根据同时接收到的参考时钟的周期,形成一测量周期的初始值,然后,基于该测量周期的初始值依次执行步骤S202~步骤S208,得到计数结果的最大值和最小值的初始值,然而,由于此时的计数结果只有一个,因此其对应的最大值和最小值相等,即计数结果的最大值和最小值的差异值为0,未在预设范围内,因此,所述测量周期自适应调整模块90会根据预置的自适应学习算法(例如迫零算法、最陡下降算法、LMS算法或RLS算法)得到一调整周期,而所述测量周期产生模块20则将该调整周期作为新的参考时钟的周期再次执行所述步骤S202~步骤S208,以此类推,直至当基于某一调整后的测量周期得到的更新后的计数结果的最大值和最小值的差异值为1时,停止输出调整后的测量周期,即停止迭代计数。In the above step S201, after receiving the frequency test start instruction, the measurement period generation module 20 in FIG. 1 first forms an initial value of a measurement period based on the period of the reference clock received at the same time, and then, based on the measurement The initial value of the period executes steps S202 to S208 in sequence to obtain the initial values of the maximum value and minimum value of the counting result. However, since there is only one counting result at this time, the corresponding maximum value and minimum value are equal, that is, the counting result The difference between the maximum value and the minimum value is 0, which is not within the preset range. Therefore, the measurement period adaptive adjustment module 90 will adjust the measurement cycle according to the preset adaptive learning algorithm (such as zero-forcing algorithm, steepest descent algorithm, LMS algorithm or RLS algorithm) to obtain an adjustment period, and the measurement period generation module 20 uses the adjustment period as the period of the new reference clock to execute the steps S202 to S208 again, and so on, until based on a certain When the difference between the maximum value and the minimum value of the updated counting result obtained by the adjusted measurement period is 1, the output of the adjusted measurement period is stopped, that is, iterative counting is stopped.
在上述步骤S202中,所述周期脉冲生产模块30根据接入的参考时钟和每次接收的测量周期(测量周期的初始值和后续的调整后的测量周期),在每个测量周期内形成一与所述参考时钟的时钟域相同而其周期则为测量周期的第一周期脉冲信号。In the above step S202, the periodic pulse production module 30 forms a pulse in each measurement cycle based on the accessed reference clock and each received measurement cycle (the initial value of the measurement cycle and the subsequent adjusted measurement cycle). A first periodic pulse signal whose clock domain is the same as that of the reference clock and whose period is the measurement period.
在上述步骤S203中,在每个测量周期内,所述跨时钟域电路40根据接收到的待测时钟的时钟域将所述第一周期脉冲信号进行跨时钟域处理,以得到与所述待测时钟的时钟域相同的第二周期脉冲信号,其中,所述待测时钟和所述参考时钟的时钟域不同。In the above step S203, in each measurement cycle, the cross-clock domain circuit 40 performs cross-clock domain processing on the first periodic pulse signal according to the received clock domain of the clock to be measured, so as to obtain the same result as the clock domain to be measured. The clock domain of the clock under test is the same as the second periodic pulse signal, wherein the clock domains of the clock to be measured and the reference clock are different.
在上述步骤S204~步骤S205中,在每个测量周期内,所述计数器60利用每次形成的所述第二周期脉冲信号的时钟域与所述待测时钟的时钟域相同可以避免采样出现亚稳态问题的原理,对所述待测时钟进行测量周期内的上升沿或下降沿的计数,然后得到一个计数结果,并与基于之前至少两次测量所得到的计数结果的最大值和最小值(已预存在所述比较存储器70中)进行比较,若所述计数结果比预存的计数结果的最大值大,则将所述计数结果作为所述计数结果的更新后的最大值;若所述计数结果比预存的计数结果的最小值小,则将所述本次计数结果作为所述计数结果的更新后的最小值,即确定出计数结果的更新后的最大值和最小值。In the above-mentioned steps S204 to S205, in each measurement period, the counter 60 uses the clock domain of the second periodic pulse signal formed each time to be the same as the clock domain of the clock to be measured to avoid sub-sampling. The principle of the steady-state problem is to count the rising edges or falling edges of the clock under test within the measurement period, and then obtain a counting result, and compare it with the maximum and minimum values based on the counting results obtained from at least two previous measurements. (Pre-stored in the comparison memory 70), if the counting result is greater than the maximum value of the pre-stored counting result, then the counting result is used as the updated maximum value of the counting result; if the If the counting result is smaller than the minimum value of the pre-stored counting result, the current counting result is used as the updated minimum value of the counting result, that is, the updated maximum value and minimum value of the counting result are determined.
在上述步骤S206~步骤S208中,在每个测量周期内,所述判决模块80均会接收到计数结果的一最大值和一最小值,并将所述最大值和最小值进行比较,若所述最大值和最小值的差异值为1,则代表本次调整后的测量周期达到目标测量周期,且基于该目标测量周期所计算得到频率最为准确,便可停止迭代计数,直接通过所述计数测量模块100输出待测时钟的频率即可,若所述最大值和最小值的差异值大于2,则代表本次调整后的测量周期未达到目标测量周期,而基于此次测量周期所计算出的计数结果存在误差,即计算得到待测时钟的频率与该待测时钟的频率有误差,因此,需要重新调整测量周期,并重新执行上述步骤S201~步骤S208。In the above steps S206 to S208, in each measurement cycle, the decision module 80 will receive a maximum value and a minimum value of the counting result, and compare the maximum value and the minimum value. If If the difference between the maximum value and the minimum value is 1, it means that the adjusted measurement period has reached the target measurement period, and the frequency calculated based on the target measurement period is the most accurate, then the iterative counting can be stopped and the counting can be directly performed. The measurement module 100 only needs to output the frequency of the clock to be measured. If the difference between the maximum value and the minimum value is greater than 2, it means that the adjusted measurement period has not reached the target measurement period, and the calculated value based on this measurement period There is an error in the counting result, that is, there is an error between the calculated frequency of the clock to be measured and the frequency of the clock to be measured. Therefore, it is necessary to readjust the measurement period and re-execute the above steps S201 to S208.
综上所述,在本发明提供的一种频率测量电路中,其在测量周期产生模块的一输入端连接一测量周期自适应调整模块,以通过所述测量周期自适应调整模块所输出的用于调整测量周期的调整周期,得到调整后的测量周期,进而基于不断调整的测量周期,对待测时钟进行多次上升沿或下降沿计数,且在计数结果的最大值和最小值的差异值在预设范围内时,才停止循环计数,并最终得到所述待测时钟的频率。To sum up, in the frequency measurement circuit provided by the present invention, a measurement period adaptive adjustment module is connected to an input end of the measurement period generation module, so that the user outputted by the measurement period adaptive adjustment module can be In order to adjust the adjustment period of the measurement period, the adjusted measurement period is obtained, and then based on the continuously adjusted measurement period, the clock under test is counted for multiple rising edges or falling edges, and the difference between the maximum value and the minimum value of the counting result is When the frequency is within the preset range, the cycle counting is stopped, and the frequency of the clock under test is finally obtained.
由于本发明中所提供的频率测量电路并不限定待测量的频率范围,其既可以对高速SOC集成芯片中的高速时钟进行测量,其还可以对其他任何不同频率时钟进行测量,因此,本发明所提供的频率测量电路具有适应性更强、可自适应学习调整测量周期、兼容多种测量范围以及提高测量精度的特性。Since the frequency measurement circuit provided in the present invention does not limit the frequency range to be measured, it can not only measure the high-speed clock in the high-speed SOC integrated chip, but also can measure any other clocks with different frequencies. Therefore, the present invention The frequency measurement circuit provided is more adaptable, can adaptively learn to adjust the measurement period, is compatible with a variety of measurement ranges, and improves measurement accuracy.
并且,由于本发明在进行待测时钟的频率测量时,其用于确定待测时钟的频率的计数结果的最大值或最小值会随着测量周期的调整而不过更新,直至所述计数结果的最大值和最小值之间的差异为1时,即代表调整后的测量周期达到目标测量周期,且基于该目标测量周期所计算得到频率最为准确。Moreover, when the present invention measures the frequency of the clock to be measured, the maximum or minimum value of the counting result used to determine the frequency of the clock to be measured will not be updated as the measurement cycle is adjusted, until the counting result reaches When the difference between the maximum value and the minimum value is 1, it means that the adjusted measurement period reaches the target measurement period, and the frequency calculated based on the target measurement period is the most accurate.
进一步的,由于本发明将大量的运算均放在测量周期自适应调整模块和比较存储器的软件层面去执行,进而本发明提供的频率测量电路的主要设计思路即为软硬件结合,而基于该设计思路的频率测量电路能有效的降低IC电路设计的复杂度、有效减少芯片的调试时间、节约时间成本以及加速芯片的尽快商用和更新效率。Furthermore, since the present invention places a large number of operations on the software level of the measurement cycle adaptive adjustment module and the comparison memory, the main design idea of the frequency measurement circuit provided by the present invention is the combination of software and hardware, and based on this design The frequency measurement circuit of Idea can effectively reduce the complexity of IC circuit design, effectively reduce chip debugging time, save time and cost, and accelerate the commercialization and update efficiency of chips as soon as possible.
本发明实施例还提供了一种电子设备,包括处理器、通信接口、存储器和通信总线,其中,处理器,通信接口,存储器通过通信总线完成相互间的通信,An embodiment of the present invention also provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete communication with each other through the communication bus,
存储器,用于存放计算机程序;Memory, used to store computer programs;
处理器,用于执行存储器上所存放的程序时,实现本发明实施例提供的一种频率测量方法。The processor is configured to implement a frequency measurement method provided by an embodiment of the present invention when executing a program stored in the memory.
另外,处理器执行存储器上所存放的程序而实现的辅助图形的添加方法的其他实现方式,与前述方法实施例部分所提及的实现方式相同,这里也不再赘述。In addition, other implementation methods of the method for adding auxiliary graphics implemented by the processor executing the program stored in the memory are the same as the implementation methods mentioned in the foregoing method embodiments, and will not be described again here.
上述控制终端提到的通信总线可以是外设部件互连标准(Peripheral ComponentInterconnect,PCI)总线或扩展工业标准结构(Extended Industry StandardArchitecture,EISA)总线等。该通信总线可以分为地址总线、数据总线、控制总线等。为便于表示,图中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The communication bus mentioned in the above control terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into address bus, data bus, control bus, etc. For ease of presentation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
通信接口用于上述电子设备与其他设备之间的通信。The communication interface is used for communication between the above-mentioned electronic devices and other devices.
存储器可以包括随机存取存储器(Random Access Memory,RAM),也可以包括非易失性存储器(Non-Volatile Memory,NVM),例如至少一个磁盘存储器。可选的,存储器还可以是至少一个位于远离前述处理器的存储装置。The memory may include random access memory (Random Access Memory, RAM) or non-volatile memory (Non-Volatile Memory, NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located far away from the aforementioned processor.
上述的处理器可以是通用处理器,包括中央处理器(Central Processing Unit,CPU)、网络处理器(Network Processor,NP)等;还可以是数字信号处理器(Digital SignalProcessing,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (Network Processor, NP), etc.; it can also be a digital signal processor (Digital SignalProcessing, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.
在本发明提供的又一实施例中,还提供了一种计算机可读存储介质,该计算机可读存储介质中存储有指令,当其在计算机上运行时,使得计算机执行上述实施例中任一所述的一种频率测量方法。In yet another embodiment provided by the present invention, a computer-readable storage medium is also provided. The computer-readable storage medium stores instructions, which when run on a computer, cause the computer to execute any one of the above embodiments. A frequency measurement method.
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本发明实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘Solid State Disk (SSD))等。In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in accordance with the embodiments of the present invention are generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another, e.g., the computer instructions may be transferred from a website, computer, server, or data center Transmission to another website site, computer, server or data center by wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains one or more available media integrated. The available media may be magnetic media (eg, floppy disk, hard disk, magnetic tape), optical media (eg, DVD), or semiconductor media (eg, Solid State Disk (SSD)), etc.
需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that these entities or operations are mutually exclusive. any such actual relationship or sequence exists between them. Furthermore, the terms "comprises," "comprises," or any other variations thereof are intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus that includes a list of elements includes not only those elements, but also those not expressly listed other elements, or elements inherent to the process, method, article or equipment. Without further limitation, an element defined by the statement "comprises a..." does not exclude the presence of additional identical elements in a process, method, article, or apparatus that includes the stated element.
本说明书中的各个实施例均采用相关的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于装置、电子设备以及计算机可读存储介质实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。Each embodiment in this specification is described in a related manner. The same and similar parts between the various embodiments can be referred to each other. Each embodiment focuses on its differences from other embodiments. In particular, for the apparatus, electronic equipment and computer-readable storage medium embodiments, since they are basically similar to the method embodiments, the descriptions are relatively simple. For relevant details, please refer to the partial description of the method embodiments.
以上所述仅为本发明的较佳实施例而已,并非用于限定本发明的保护范围。凡在本发明的精神和原则之内所作的任何修改、等同替换、改进等,均包含在本发明的保护范围内。The above descriptions are only preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention are included in the protection scope of the present invention.
Claims (9)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311376291.XA CN117110707B (en) | 2023-10-24 | 2023-10-24 | SOC integrated chip, frequency measurement circuit and frequency measurement method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311376291.XA CN117110707B (en) | 2023-10-24 | 2023-10-24 | SOC integrated chip, frequency measurement circuit and frequency measurement method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN117110707A CN117110707A (en) | 2023-11-24 |
CN117110707B true CN117110707B (en) | 2024-01-30 |
Family
ID=88805963
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311376291.XA Active CN117110707B (en) | 2023-10-24 | 2023-10-24 | SOC integrated chip, frequency measurement circuit and frequency measurement method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117110707B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118837619A (en) * | 2024-07-02 | 2024-10-25 | 上海为旌半导体有限公司 | Clock frequency measuring circuit and measuring method |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH10170564A (en) * | 1996-12-13 | 1998-06-26 | Nec Eng Ltd | Clock frequency measurement circuit, and method therefor |
US5930294A (en) * | 1997-08-07 | 1999-07-27 | Cisco Technology, Inc. | Frequency measurement circuit |
CN1925329A (en) * | 2006-08-08 | 2007-03-07 | 华为技术有限公司 | Method and device for clock detection |
CN102692563A (en) * | 2012-05-18 | 2012-09-26 | 大唐微电子技术有限公司 | Clock frequency detector |
CN106130547A (en) * | 2016-06-20 | 2016-11-16 | 大唐微电子技术有限公司 | A kind of clock frequency calibration steps and device |
CN112992023A (en) * | 2021-01-29 | 2021-06-18 | 苏州华兴源创科技股份有限公司 | Self-checking method and self-checking circuit of input signal |
CN113031695A (en) * | 2021-03-19 | 2021-06-25 | 维沃移动通信有限公司 | Control circuit device, electronic apparatus, control method, and readable storage medium |
CN115357094A (en) * | 2022-09-15 | 2022-11-18 | 中国科学院微电子研究所 | A clock monitoring circuit and clock monitoring method |
CN115913185A (en) * | 2022-12-23 | 2023-04-04 | 上海芯联芯智能科技有限公司 | Clock detection circuit and detection method thereof |
-
2023
- 2023-10-24 CN CN202311376291.XA patent/CN117110707B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH10170564A (en) * | 1996-12-13 | 1998-06-26 | Nec Eng Ltd | Clock frequency measurement circuit, and method therefor |
US5930294A (en) * | 1997-08-07 | 1999-07-27 | Cisco Technology, Inc. | Frequency measurement circuit |
CN1925329A (en) * | 2006-08-08 | 2007-03-07 | 华为技术有限公司 | Method and device for clock detection |
CN102692563A (en) * | 2012-05-18 | 2012-09-26 | 大唐微电子技术有限公司 | Clock frequency detector |
CN106130547A (en) * | 2016-06-20 | 2016-11-16 | 大唐微电子技术有限公司 | A kind of clock frequency calibration steps and device |
CN112992023A (en) * | 2021-01-29 | 2021-06-18 | 苏州华兴源创科技股份有限公司 | Self-checking method and self-checking circuit of input signal |
CN113031695A (en) * | 2021-03-19 | 2021-06-25 | 维沃移动通信有限公司 | Control circuit device, electronic apparatus, control method, and readable storage medium |
CN115357094A (en) * | 2022-09-15 | 2022-11-18 | 中国科学院微电子研究所 | A clock monitoring circuit and clock monitoring method |
CN115913185A (en) * | 2022-12-23 | 2023-04-04 | 上海芯联芯智能科技有限公司 | Clock detection circuit and detection method thereof |
Also Published As
Publication number | Publication date |
---|---|
CN117110707A (en) | 2023-11-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7853837B2 (en) | Memory controller and method for operating a memory controller having an integrated bit error rate circuit | |
CN117110707B (en) | SOC integrated chip, frequency measurement circuit and frequency measurement method | |
CN110515822B (en) | Interrupt response time test method, device, equipment and storage medium | |
CN115268564B (en) | Method, system, apparatus, and medium for calibrating chip circuits | |
JPWO2018146747A1 (en) | Information processing apparatus, information processing method, and information processing program | |
CN115085829B (en) | Sensitivity testing method and electronic equipment under multipath fading interference | |
CN114325534A (en) | Signal testing method, device, equipment and readable storage medium | |
CN110520745A (en) | Use the critical sensor circuit estimating timing relaxation of endpoint | |
CN114586417A (en) | Method and device for measuring neighboring cells | |
US12198773B2 (en) | Memory chip test method and apparatus, medium, and device | |
CN117388673A (en) | ATE equipment and chip testing method thereof, electronic equipment and storage medium | |
CN114623939A (en) | A method, device, equipment and medium for determining pulse frequency | |
US20160254872A1 (en) | Systems and methods for measurement of electrical channel loss | |
US11112456B2 (en) | Signal skew measurement method, apparatus, medium, and electronic device | |
CN103076494B (en) | Power consumption measuring device and method | |
WO2023245762A1 (en) | Memory chip test method and apparatus, and medium and device | |
CN115240752A (en) | Device and method for analyzing flash memory signal in chip and electronic equipment | |
TWI668453B (en) | Circuit and method for measuring signal period | |
CN116126766A (en) | Asynchronous communication data sampling method, device, equipment and medium | |
CN116107187B (en) | Time interval measurement method, chip and device | |
Ko et al. | PCB-level Jitter Sensitivity Measurement and Hierarchical PDN-Z based PSIJ Estimation for PCIe Gen5 SSD | |
CN118689831A (en) | Data sampling method and device | |
CN118758388A (en) | A method, device and equipment for determining instantaneous sound velocity based on ultrasonic flowmeter | |
CN118884173A (en) | A calibration method, system, device, equipment and medium for domestic AD chip | |
CN118819385A (en) | Data receiving method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
TR01 | Transfer of patent right | ||
TR01 | Transfer of patent right |
Effective date of registration: 20241031 Address after: No. 03, 04, 29th Floor, T2 Building, Phase II of Fanyue City, No. 21 Guanshan Avenue, Donghu New Technology Development Zone, Wuhan City, Hubei Province 430000 Patentee after: Xinchao (Wuhan) Microelectronics Co.,Ltd. Country or region after: China Address before: Room 127-128, Building 17, No. 1889 Huandao East Road, Hengqin New District, Zhuhai City, Guangdong Province, 519031 Patentee before: Core Tide (Zhuhai) Technology Co.,Ltd. Country or region before: China |