Timing control method, electronic device, storage medium, and program product
By generating a timing enable signal for the target timing mode, the problem of a single timing mode is solved, realizing the flexibility and automation of timing control, adapting to the timing needs of different events, and improving the accuracy of timing results and the reliability of the system.
Patent Information
- Application Number
- CN202611684994.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-29
- Publication Date
- 2026-11-27
AI Technical Summary
Existing technologies have a single timing mode, which makes it difficult to adapt to different event triggering and stopping conditions. Furthermore, the start and stop of timing require frequent external intervention, resulting in low flexibility and automation of timing control.
By generating a timing enable signal corresponding to the target timing mode, the electronic device can flexibly indicate the target timing mode according to the application scenario and automatically generate a timing enable signal, achieving automatic start and stop of timing without frequent external intervention.
It improves the flexibility and automation of timing control, can adapt to timing modes of different events, simplifies timing operations, and improves the accuracy of timing results and the reliability of the system.
Smart Images

Figure CN123177622A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of integrated circuit design technology, and in particular to a timing control method, electronic device, storage medium, and program product. Background Technology
[0002] In modern high-speed communication systems, such as chips based on high-speed serial interface (Serializer / Deserializer, SerDes) architectures, phase-locked loops (PLLs) and clock-data recovery (CDRs) are critical clock recovery and synchronization modules, and their locking time directly affects the system's startup performance and stability. To monitor and debug these critical modules in real time, electronic devices typically require built-in timing functions to record the time interval between configuration completion and successful locking, or to measure the duration of general signals.
[0003] In related technologies, a common practice is to use a general-purpose timer for timing. General-purpose timers typically only support a single timing mode, and the start and stop of timing require external pre-configuration.
[0004] In the above timing scheme, the timing mode is fixed and single, making it difficult to adapt to different event triggering and stopping conditions. Furthermore, the start and stop of timing require frequent external intervention, resulting in low flexibility and automation of timing control. Summary of the Invention
[0005] This application provides a timing control method, electronic device, storage medium, and program product that can improve the flexibility and automation of timing control.
[0006] A first aspect of this application provides a timing control method applied to an electronic device, comprising: generating a timing enable signal corresponding to a target timing mode in response to receiving a timing mode selection signal; the timing mode selection signal being used to indicate the target timing mode of the electronic device; and timing being performed by the electronic device based on the timing enable signal in the target timing mode.
[0007] A second aspect of this application provides an electronic device, comprising: at least one processor; at least one memory for storing at least one program; and, when the at least one program is executed by the at least one processor, implementing the timing control method provided in any of the above aspects.
[0008] A third aspect of the embodiments of this application provides a computer-readable storage medium storing computer-executable instructions for performing the timing control method provided in any of the above aspects.
[0009] A fourth aspect of the embodiments of this application provides a computer program product, including a computer program that, when executed by a processor, implements the timing control method provided in any of the above aspects.
[0010] In the timing control method provided in this application embodiment, the electronic device, in response to receiving a timing mode selection signal, generates a timing enable signal corresponding to the target timing mode. This allows for flexible indication of the target timing mode based on the application scenario and automatic generation of the timing enable signal corresponding to that target timing mode, without frequent external intervention. The electronic device performs timing based on the timing enable signal in the target timing mode, and can automatically determine the timing value according to the timing enable signal. Therefore, this solves the problems in related technologies such as a single timing mode, difficulty in adapting to different event triggering and stopping conditions, and the need for frequent external intervention in starting and stopping the timing, thus improving the flexibility and automation of timing control. Attached Figure Description
[0011] The accompanying drawings are used to provide a further understanding of the technical solutions of this application and constitute a part of the specification. They are used together with the embodiments of this application to explain the technical solutions of this application and do not constitute a limitation on the technical solutions of this application.
[0012] Figure 1 This is a flowchart illustrating the timing control method provided in an embodiment of this application; Figure 2 This is a structural block diagram of a chip-configurable multi-mode digital timer provided in an embodiment of this application; Figure 3 This is a flowchart illustrating a multi-mode digital timer configurable within a chip, as provided in an embodiment of this application. Figure 4 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0013] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0014] It should be understood that in the description of the embodiments of this application, the use of terms such as "first" and "second" is only for the purpose of distinguishing technical features and should not be construed as indicating or implying relative importance, or implicitly indicating the number of technical features indicated, or implicitly indicating the order of the technical features indicated. "At least one" refers to one or more, and "more" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent the existence of A alone, the simultaneous existence of A and B, or the existence of B alone. A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" and similar expressions refer to any group of these items, including any group of singular or plural items. For example, at least one of a, b, and c can represent: a, b, c, a and b, a and c, b and c, or a and b and c, where a, b, and c can be single or multiple.
[0015] To facilitate understanding of the solutions in the embodiments of this application, some contents involved in the embodiments of this application are described below: In modern high-speed communication systems, the locking time of critical modules such as phase-locked loops (PLLs) and clock data recovery directly affects the system's startup performance and stability. Timing schemes in related technologies typically employ general-purpose timers or software delays, resulting in a single timing mode. Starting and stopping the timing requires frequent external intervention, making it difficult to adapt to different event triggering and stopping conditions, and leading to low automation.
[0016] Based on this, this application provides a timing control method, electronic device, storage medium, and program product that can improve the flexibility and automation of timing control.
[0017] Please see Figure 1 , Figure 1 This is a flowchart illustrating a timing control method provided in an embodiment of this application. The timing control method can be applied to electronic devices and includes at least the following steps S110 to S120.
[0018] S110, in response to receiving the timing mode selection signal, generates a timing enable signal corresponding to the target timing mode; the timing mode selection signal is used to indicate the target timing mode of the electronic device.
[0019] In this step, the aforementioned electronic device refers to a device with timing control function. As one possible implementation, the electronic device can be an integrated circuit such as a chip or a system-on-chip (SoC), or it can be a communication device or terminal device integrating the aforementioned integrated circuit, such as a chip used in a high-speed serial interface. This application does not limit this.
[0020] The aforementioned timing mode selection signal refers to the signal used to indicate the target timing mode of the electronic device. Users can select the target timing mode according to their timing needs and set the corresponding timing mode selection signal so that the signal can indicate the selected target timing mode to the electronic device.
[0021] The aforementioned target timing mode refers to the operating mode currently used by the electronic device for timing. As one possible implementation, the timing mode selection signal can be generated by writing software into the control status register (CSR), or it can be provided by the internal hardware state machine of the electronic device or an external input pin; this application does not impose any restrictions on this.
[0022] The aforementioned timing enable signal refers to a signal used to indicate whether timing is enabled. As one possible implementation, the timing enable signal can include a valid state indicating that timing is enabled and an invalid state indicating that timing is disabled. For example, if the timing enable signal is high, it indicates that timing is enabled; if it is low, it indicates that timing is disabled.
[0023] Specifically, after receiving the timing mode selection signal, the electronic device generates a timing enable signal corresponding to the target timing mode indicated by the timing mode selection signal.
[0024] It should be noted that the generation method of the timing enable signal can be different for different target timing modes. That is, the generation method of the timing enable signal is matched with the target timing mode, so that the electronic device can perform timing according to the triggering and stopping conditions required by the target timing mode.
[0025] S120, in target timing mode, performs timing via electronic devices based on the timing enable signal.
[0026] In this step, the aforementioned timing value refers to the timing result obtained by the electronic device through timing operation in the target timing mode. As one possible implementation, the timing value can be the number of clock cycles obtained by counting clock cycles, or it can be the actual time value calculated based on the number of clock cycles and the frequency of the clock cycles. This application does not limit this to either.
[0027] Specifically, in the target timing mode, the electronic device determines the timing value based on the timing state indicated by the timing enable signal. When the timing enable signal indicates that timing is enabled, the electronic device performs the timing operation and continues to do so; when the timing enable signal indicates that timing is not enabled, the electronic device stops performing the timing operation, thereby determining the timing result obtained during the timing operation as the timing value of the electronic device.
[0028] As one possible implementation, the electronic device counts the clock cycles of the electronic device during the period when the timing enable signal indicates that timing is enabled, and determines the number of clock cycles obtained by counting as the timing value; or, the electronic device converts the number of clock cycles into an actual time value based on the number of clock cycles and the frequency of the clock cycles, and determines it as the timing value. This application does not limit this.
[0029] In this embodiment, the electronic device, upon receiving a timing mode selection signal, generates a timing enable signal corresponding to the target timing mode. This allows for flexible indication of the target timing mode based on the application scenario, and automatic generation of the timing enable signal corresponding to that target timing mode, without frequent external intervention. The electronic device performs timing based on the timing enable signal within the target timing mode, automatically determining the timing value according to the signal. This solves the problems of limited timing modes, difficulty in adapting to different event triggering and stopping conditions, and the need for frequent external intervention to start and stop timing in related technologies, thus improving the flexibility and automation of timing control.
[0030] Furthermore, this application also proposes that the target timing mode includes: a mode for timing measurement of target signals, wherein the target signals include various operating signals of various chips.
[0031] In this embodiment, the target signals mentioned above include various operating signals of various chips, such as operating enable signals, phase-locked loop (PLL) lock signals, clock-data recovery (CDR) lock signals, and other operating signals involved in the operation of various chips.
[0032] Timing measurement of the target signal can refer to measuring the effective duration of the target signal or the duration of the chip state represented by the target signal; this application does not limit this to either.
[0033] Through this implementation method, electronic devices can perform timing measurements on various operating signals of various chips, thereby facilitating real-time monitoring and debugging of the startup performance and stability of key chip modules.
[0034] Furthermore, this application also proposes that S110 includes: Based on the target information corresponding to the target timing mode, a timing enable signal is generated; the target information is the timing conditions received by the electronic device to indicate the target timing mode.
[0035] In this embodiment, the aforementioned target information refers to the timing conditions received by the electronic device for indicating the target timing mode, i.e., reference information corresponding to the target timing mode for generating the timing enable signal. As one possible implementation, the target information may include one or more status signals received by the electronic device, such as a working enable signal, a phase-locked loop (PLL) lock signal, a clock data recovery (CDR) lock signal, etc., which are not limited in this application.
[0036] Specifically, the electronic device acquires target information corresponding to the target timing mode and generates a timing enable signal based on the target information. Generating a timing enable signal based on target information means that the electronic device determines whether the timing enable signal indicates that timing is enabled or disabled, according to the state indicated by the target information.
[0037] For example, if the target information indicates that the preset timing triggering conditions are met, the electronic device generates a timing enable signal indicating that timing is enabled; if the target information indicates that the preset timing triggering conditions are not met, the electronic device generates a timing enable signal indicating that timing is disabled.
[0038] Through this implementation method, the electronic device can automatically generate a timing enable signal based on the target information corresponding to the target timing mode, thereby automatically controlling the start and stop of timing and improving the degree of automation of timing.
[0039] Furthermore, this application also proposes that the target timing mode belongs to any of the following: General signal duration measurement mode; PLL lock-up time measurement mode; CDR lock-in time measurement mode.
[0040] In this embodiment, the general signal duration measurement mode refers to a timing mode used to measure the duration of a general signal, wherein the general signal refers to any signal to be measured in the electronic device.
[0041] The aforementioned PLL lock-in time measurement mode refers to a timing mode used to measure the time elapsed from the start of operation of the phase-locked loop to successful locking.
[0042] The aforementioned CDR lock-in time measurement mode refers to a timing mode used to measure the time elapsed from the start of clock data recovery to successful lock-in.
[0043] Specifically, the timing mode selection signal can be used to indicate any of the target timing modes mentioned above. As one possible implementation, the timing mode selection signal can be a two-bit binary signal (e.g., i_timer_sel[1:0]), and the electronic device can pre-determine the correspondence between the values of the two-bit binary signal and the target timing mode.
[0044] For example, value 2'b00 corresponds to the general signal duration measurement mode, value 2'b01 corresponds to the PLL lock-in time measurement mode, value 2'b10 corresponds to the CDR lock-in time measurement mode, and value 2'b11 corresponds to the disabled mode. The electronic device selects the signal value according to the timing mode and determines the mode corresponding to the value as the target timing mode. It should be noted that the above correspondence is only an illustrative example and is not limited in this application.
[0045] Through this implementation, the target timing modes include a general signal duration measurement mode, a PLL lock time measurement mode, and a CDR lock time measurement mode, enabling users to select signals through timing modes and flexibly instruct electronic devices to adapt to timing modes for different timing events. Thus, a single timer can adapt to multiple timing needs, improving the flexibility of timing control.
[0046] Furthermore, this application also proposes that, when the target timing mode is a general signal duration measurement mode, the target information includes the operating enable signal received by the electronic device; Alternatively, if the target timing mode is PLL lock-in time measurement mode, the target information includes the PLL lock-in signal and the operation enable signal received by the electronic device. Alternatively, if the target timing mode is CDR lock time measurement mode, the target information includes the CDR lock signal received by the electronic device and the operation enable signal.
[0047] In this embodiment, the aforementioned work enable signal (i_timer_work.en) is a signal used to indicate whether the electronic device is in a working state, and can be used to control whether the timer in the electronic device starts working.
[0048] The PLL lock signal (i_pll_lock) mentioned above is a signal used to indicate whether the PLL has been successfully locked. The CDR lock signal (i_cdr_lock) mentioned above is a signal used to indicate whether the CDR has been successfully locked.
[0049] When the target timing mode is a general signal duration measurement mode, the target information includes a working enable signal. The electronic device generates a timing enable signal based on the working enable signal. Specifically, generating the timing enable signal based on the working enable signal means that: when the working enable signal indicates that the electronic device is in a working state, the timing enable signal indicates that timing is enabled; when the working enable signal indicates that the electronic device is not in a working state, the timing enable signal indicates that timing is not enabled. Thus, the electronic device can time the effective duration of the working enable signal, thereby achieving the measurement of the duration of a general signal.
[0050] When the target timing mode is PLL locked time measurement mode, the target information includes a PLL lock signal and a working enable signal. The electronic device generates a timing enable signal based on the PLL lock signal and the working enable signal. Specifically, generating a timing enable signal based on the PLL lock signal and the working enable signal means that: when the working enable signal indicates that the electronic device is in a working state and the PLL lock signal indicates that the PLL is not locked, the timing enable signal indicates that timing is enabled; when the PLL lock signal indicates that the PLL is locked, the timing enable signal indicates that timing is not enabled.
[0051] As one possible implementation, the generation logic of the timing enable signal can be expressed as: timing enable signal = logical AND of working enable signal and (inverted signal of PLL lock signal), that is, timing continues while the working enable signal is valid and the PLL is not locked, and timing stops after the PLL is locked, thereby measuring the time taken for the PLL to start working and lock successfully.
[0052] When the target timing mode is CDR locked time measurement mode, the target information includes a CDR lock signal and a working enable signal. The electronic device generates a timing enable signal based on the CDR lock signal and the working enable signal. Specifically, generating a timing enable signal based on the CDR lock signal and the working enable signal means that: when the working enable signal indicates that the electronic device is in a working state and the CDR lock signal indicates that the CDR is not locked, the timing enable signal indicates that timing is enabled; when the CDR lock signal indicates that the CDR is locked, the timing enable signal indicates that timing is not enabled.
[0053] As one possible implementation, the generation logic of the timing enable signal can be expressed as: timing enable signal = working enable signal AND (the inverted signal of CDR lock signal) logical AND, thereby measuring the time taken for CDR to start working and lock successfully.
[0054] As an example, based on the values of i_timer_sel[1:0], the internal timer enable signal s_timer_en is dynamically generated, which can include the following cases: ① When i_timer_sel = 2'b00 (general signal duration measurement mode): s_timer_en ≤ i_timer_work.en, that is, timing starts as long as the work enable is valid.
[0055] ② When i_timer_sel = 2'b01 (PLL lock time measurement mode): s_timer_en ≤ i_timer_work.en&&(!i_pll_lock), that is, the timer continues while the work is enabled and the PLL is unlocked, and stops once the PLL is locked.
[0056] ③ When i_timer_sel = 2'b10 (CDR locked time measurement mode): s_timer_en ≤ i_timer_work.en&&(!i_cdr_lock), that is, the timer is in operation when the work is enabled and the CDR is not locked, and stops after locking.
[0057] ④ When i_timer_sel = 2'b11 (disabled mode): s_timer_en ≤ 1'b0, the timer function is turned off.
[0058] In this implementation method, the timing enable signal is generated based on the target information corresponding to each target timing mode. The electronic device can automatically generate the timing enable signal according to the hardware status such as the working enable signal, PLL lock signal, and CDR lock signal, so as to realize the automatic start and automatic stop of timing and improve the automation level of timing.
[0059] Furthermore, this application also proposes that the target timing mode includes a disabled mode, which is used to indicate that timing is not enabled.
[0060] In this embodiment, the aforementioned disabled mode refers to a timing mode that disables the timing function. Specifically, when the timing mode selection signal indicates that the target timing mode is disabled, the electronic device generates a timing enable signal that indicates that timing is not enabled, for example, by setting the timing enable signal to an invalid state or a low level, thereby disabling the timing function.
[0061] In disabled mode, the electronic device does not perform timing operations or update the timing value. As one possible implementation, the timing mode selection signal can be a multi-bit binary signal. The electronic device pre-determines the correspondence between the values of the multi-bit binary signal and the target timing mode, where at least one value corresponds to the disabled mode. Based on the value of the timing mode selection signal, the electronic device determines the mode corresponding to that value as the target timing mode.
[0062] This implementation allows the timing function to be turned off in a disabled mode when timing is not required, avoiding unnecessary timing operations and improving the flexibility of timing control.
[0063] Furthermore, this application also proposes that, prior to S120, the following are also included: In response to the detection of a target transition edge of the timing enable signal, the timing value of the electronic device is reset to zero.
[0064] In this embodiment, the aforementioned target transition edge refers to a specific transition edge of the timing enable signal, which is used to trigger the operation of resetting the timing value of the electronic device to zero.
[0065] As one possible implementation, when the timing enable signal is active high, the target transition edge can be the rising edge of the timing enable signal; when the timing enable signal is active low, the target transition edge can be the falling edge of the timing enable signal.
[0066] Specifically, before determining the timing value based on the timing enable signal, the electronic device detects the rising edge of the timing enable signal. When a target rising edge is detected, the electronic device resets the current timing value to zero, for example, setting the timing value to 0. Then, the electronic device starts a new timing cycle based on the reset timing value. This zeroing operation ensures that each new timing cycle starts counting from zero, preventing the accumulation of timing results from different timing cycles.
[0067] In this embodiment, when the electronic device detects the target transition edge of the timing enable signal, it resets the timing value to zero, so that the timing value is automatically reset to zero before the start of each timing cycle, avoiding the cumulative error of timing values between different timing cycles and ensuring the accuracy of timing results.
[0068] Furthermore, this application also proposes that the target transition edge be detected based on the start pulse; The start pulse is generated based on the timing enable signal and the delay signal, which is obtained by delaying the timing enable signal by a preset time.
[0069] In this embodiment, the aforementioned delay signal (s_timer_en_ldly) refers to the signal obtained by delaying the timing enable signal by a preset time. The aforementioned start pulse refers to the pulse signal used to indicate the detection of the target transition edge of the timing enable signal.
[0070] The aforementioned generation of the start pulse (s_start_pulse) based on the timing enable signal and the delay signal specifically refers to: the electronic device delaying the timing enable signal by a preset time to obtain a delayed signal; and then generating the start pulse based on the value relationship between the timing enable signal and the delayed signal. For example, the start pulse can be generated using combinational logic s_start_pulse = s_timer_en&&(!s_timer_en_ldly).
[0071] Specifically, at the moment when the timing enable signal reaches the target transition edge, since the delay signal has not yet followed the change of the target transition edge, the values of the timing enable signal and the delay signal are different. The electronic device generates a start pulse based on the above value difference, thereby detecting the target transition edge of the timing enable signal.
[0072] As one possible implementation, the preset duration can be one clock cycle. Specifically, the electronic device can delay the timing enable signal by one clock cycle through a first-level register delay chain (e.g., a delay register module) to obtain a delayed signal; and perform a bitwise AND operation between the timing enable signal and the inverted signal of the delayed signal to generate a start pulse, i.e., the start pulse = the logical AND of the timing enable signal and (the inverted signal of the delayed signal).
[0073] Taking the timing enable signal being active high and the target transition edge being a rising edge as an example: when the timing enable signal transitions from low to high, the delay signal remains low, the inverted signal of the delay signal is high, and the result of the logical AND of the timing enable signal and the inverted signal of the delay signal is high, thus generating an active start pulse, thereby detecting the rising edge of the timing enable signal; at other times, the start pulse is at an inactive level.
[0074] This implementation method generates a start pulse based on the timing enable signal and its delay signal. It can accurately generate a start pulse every time the timing enable signal has a target transition edge, thereby reliably triggering the operation of clearing the timing value to zero and ensuring the accuracy of the timing cycle.
[0075] Furthermore, this application also proposes that S120 includes: In response to the timing enable signal indicating that timing is enabled, the clock cycles of the electronic device are counted to obtain the count value of the clock cycles; The timing value of the electronic device is determined based on the count value of the clock cycle and the frequency of the clock cycle.
[0076] In this embodiment, the aforementioned clock cycle refers to the cycle of the clock used internally by the electronic device to drive timing operations. As one possible implementation, this clock can be the configuration clock (cfg_clk) of the electronic device.
[0077] The count value mentioned above refers to the number of clock cycles obtained by counting the clock cycles. The frequency of the clock cycle mentioned above refers to the number of times the clock repeats per unit time.
[0078] Specifically, when the timing enable signal indicates that timing is enabled, the electronic device counts the clock cycles of the electronic device. More specifically, during the period when the timing enable signal indicates that timing is enabled, the electronic device increments the count value by 1 in each clock cycle until the timing enable signal indicates that timing is disabled, thereby obtaining the count value of the clock cycles.
[0079] As one possible implementation, the above counting operation can be performed by a counter in an electronic device. This counter can be a parameterized counter, with its bit width defined by the parameter TIMER_WIDTH, a default value of 64 bits, and supports synthesizable configuration to meet timing requirements for different time ranges. Driven by a clock, the counter uses synchronous logic to increment, and stores the counting result in a timing value register.
[0080] The determination of the timing value based on the clock cycle count and the clock cycle frequency specifically refers to the electronic device dividing the clock cycle count by the clock cycle frequency to obtain the timing value. The calculation relationship can be expressed as shown in the following formula (1): T=N / f(1) In formula (1), T is used to represent the timing value, N is used to represent the count value of the clock cycle, and f is used to represent the frequency of the clock cycle.
[0081] For example, suppose that in PLL lock-on time measurement mode, the electronic device reads a clock cycle count of 1000, and the clock cycle frequency is 100MHz, that is, 100× clock cycles per second. If there are 1000 clock cycles, then the timing value = 1000 / (100 × 10 ... 10 microseconds (μs) = 10 seconds, meaning the PLL lockout time is 10 μs. It should be noted that the above count values and frequency values are merely illustrative examples and are not intended to limit the scope of this application.
[0082] As one possible implementation, the timing value can also be determined based on the count value of the clock cycle and the period value of the clock cycle. For example, the timing value can be obtained by multiplying the count value of the clock cycle by the period value of the clock cycle. Here, the period value of the clock cycle is the reciprocal of the frequency of the clock cycle. The above two methods are equivalent calculation methods, and this application does not limit them.
[0083] In this embodiment, the electronic device counts the clock cycle cycle by cycle during the timing enable signal indication period and determines the timing value based on the count value and the frequency of the clock cycle. Since the counting is performed cycle by cycle based on the clock cycle, the timing accuracy can reach the nanosecond level, which can meet the high-precision timing requirements of PLL lock time, CDR lock time, and general signal duration.
[0084] Furthermore, this application also proposes that the method further includes: In response to receiving an asynchronous reset signal instructing a reset to be performed, the timing value of the electronic device is cleared to zero.
[0085] In this embodiment, the aforementioned asynchronous reset signal (rst_n_cfg_clk) refers to a reset signal independent of the clock cycle, used to indicate the execution of a reset operation on the timing value of the electronic device. As one possible implementation, the asynchronous reset signal can be active low, meaning that a low asynchronous reset signal indicates the execution of a reset.
[0086] Specifically, the electronic device receives an asynchronous reset signal and, upon the asynchronous reset signal indicating that a reset should be performed, immediately resets the electronic device's timer value to zero without waiting for the clock cycle to arrive. Resetting the electronic device's timer value to zero may include resetting the count value of the aforementioned clock cycle, or it may include resetting the timer value itself.
[0087] It should be noted that the asynchronous clearing in this embodiment is different from the synchronous clearing based on the target transition edge mentioned above: synchronous clearing is triggered when the target transition edge of the timing enable signal is detected, while asynchronous clearing is directly triggered by the asynchronous reset signal and is not controlled by the clock cycle.
[0088] As one possible implementation, during the timing process, the electronic device can prioritize responding to the asynchronous reset signal. That is, if the asynchronous reset signal indicates that a reset should be performed, the timing value should be cleared to zero regardless of the state of the timing enable signal; if the asynchronous reset signal does not indicate that a reset should be performed and a target transition edge is detected, the timing value should be cleared to zero; if the timing enable signal indicates that timing should be enabled, counting should be performed.
[0089] Through this implementation method, the electronic device can quickly clear the timing value to zero when the system starts up or an abnormality occurs via an asynchronous reset signal, so that the timing value is in a definite initial state after reset, thereby improving the reliability and controllability of the timing control system.
[0090] It should be noted that the various embodiments described in this application can be combined with each other or implemented individually without conflict, and this application does not limit this.
[0091] For ease of understanding, a specific embodiment will be used as an example: like Figure 2 As shown, a block diagram of a configurable multi-mode digital timer based on an internal chip is provided. Figure 3 The diagram illustrates a process flow chart based on a configurable multi-mode digital timer within a chip. Taking the PLL lock-time measurement in a SerDes module as an example, the specific implementation process of this application is explained in detail: S001: After the software completes the PLL-related configuration, set the selection signal i_timer_sel = 2'b01. This signal is the timing mode selection signal mentioned above, used to select the target timing mode, PLL lock time measurement mode.
[0092] S002: The software pulls the i_timer_work.en signal high. This signal is the above-mentioned work enable signal, used to start this timing measurement process.
[0093] S003: The module detects the PLL lock signal i_pll_lock in real time; when i_pll_lock is low, it means that the PLL has not yet completed locking. At this time, the internal timer enable signal s_timer_en is valid, and the counter starts incrementing.
[0094] S004: The counter uses cfg_clk as the counting reference clock. The count value is incremented by 1 for each cfg_clk clock cycle.
[0095] S005: When the PLL completes phase locking, i_pll_lock toggles to high level; at this time, s_timer_en is set to 0, the timing enable signal is disabled, the counter stops counting, and the current count value is latched.
[0096] S006: The software reads the count value o_timer_value of the output clock cycle. For example, if the read o_timer_value is 1000 and the clock frequency of cfg_clk is 100MHz, then according to the timing value calculation formula: timing value = count value / clock frequency, the PLL lock time is calculated to be 1000 / 100MHz = 10μs.
[0097] S007: After a single PLL lock time measurement is completed, i_timer_work.en can be pulled low and then pulled high again to trigger a new round of measurement process, enabling multiple repeated measurements.
[0098] This embodiment relies on the combined control of the enable signal and the PLL lock signal to start and stop the timing, accurately capturing the actual time elapsed from PLL startup to lockout. No external trigger timing signal is required, making it suitable for on-chip measurement scenarios using the chip's internal high-speed clock circuit. Similarly, it can be applied to CDR lockout time measurement or the statistics of arbitrary event durations.
[0099] This application also provides an electronic device, such as... Figure 4 As shown, the electronic device 400 includes: One or more processors 410; The memory 420 stores one or more programs that, when executed by one or more processors 410, enable the one or more processors 410 to implement the timing control method described in any of the above embodiments.
[0100] Memory 420, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory 420 may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory 420 may optionally include remotely located memories 420 relative to processor 410, which can be connected to processor 410 via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0101] The memory 420 can be implemented as a read-only memory (ROM), static storage device, dynamic storage device, or random access memory (RAM). The memory 420 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program code is stored in the memory 420 and is called and executed by the processor 410.
[0102] The processor 410 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application.
[0103] In some embodiments, the electronic device further includes: Input / output interfaces are used to implement information input and output; The communication interface is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.). The bus transmits information between various components of the device (e.g., processor 410, memory 420, input / output interface, and communication interface); The processor 410, memory 420, input / output interface, and communication interface can communicate with each other within the device via a bus.
[0104] One embodiment of this application also provides a computer-readable storage medium storing computer-executable instructions for performing a timing control method as provided in any embodiment of this application.
[0105] An embodiment of this application also provides a computer program product, including a computer program or computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer program or computer instructions from the computer-readable storage medium and executes the computer program or computer instructions, causing the computer device to perform the timing control method provided in any embodiment of this application.
[0106] The system architecture and application scenarios described in this application are intended to more clearly illustrate the technical solutions of this application and do not constitute a limitation on the technical solutions provided in this application. Those skilled in the art will understand that as system architectures evolve and new application scenarios emerge, the technical solutions provided in this application are also applicable to similar technical problems.
[0107] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.
[0108] In hardware implementations, the division between functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed collaboratively by several physical components. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include computer storage media (or non-transitory media) and communication media (or transient media). As is known to those skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, as is known to those skilled in the art, communication media typically contain computer-readable instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.
[0109] As used in this specification, the terms "component," "module," "system," etc., are used to refer to computer-related entities, hardware, firmware, combinations of hardware and software, software, or software in execution. For example, a component can be, but is not limited to, a process running on a processor, a processor, an object, an executable file, an execution thread, a program, or a computer. As illustrated, applications running on computing devices and computing devices can both be components. One or more components may reside in a process or execution thread, and components may be located on a single computer or distributed among two or more computers. Furthermore, these components can be executed from various computer-readable media on which various data structures are stored. Components can communicate, for example, via local or remote processes based on signals having one or more data packets (e.g., data from two components interacting with another component between a local system, a distributed system, or a network, such as the Internet interacting with other systems via signals).
[0110] The above description, with reference to the accompanying drawings, illustrates some embodiments of this application, but does not limit the scope of this application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and spirit of this application shall be within the scope of this application.
Claims
1. A timing control method, characterized in that, Applied to electronic devices, the method includes: In response to receiving a timing mode selection signal, a timing enable signal corresponding to the target timing mode is generated; the timing mode selection signal is used to indicate the target timing mode of the electronic device. In the target timing mode, timing is performed by the electronic device based on the timing enable signal.
2. The method according to claim 1, characterized in that, The target timing mode includes a mode for timing and measuring target signals, wherein the target signals include various operating signals of various chips.
3. The method according to claim 1, characterized in that, The timing enable signal corresponding to the generated target timing mode includes: Based on the target information corresponding to the target timing mode, the timing enable signal is generated; the target information is information received by the electronic device that indicates the timing conditions of the target timing mode.
4. The method according to claim 3, characterized in that, The target timing mode belongs to any of the following: general signal duration measurement mode; phase-locked loop (PLL) lock-in time measurement mode; clock data recovery (CDR) lock-in time measurement mode; When the target timing mode is the general signal duration measurement mode, the target information includes the operating enable signal received by the electronic device; Alternatively, if the target timing mode is the PLL lock time measurement mode, the target information includes the PLL lock signal received by the electronic device and the working enable signal; Alternatively, if the target timing mode is the CDR lock time measurement mode, the target information includes the CDR lock signal received by the electronic device and the operation enable signal.
5. The method according to claim 1, characterized in that, The target timing mode also includes a disabled mode, which indicates that timing is not enabled.
6. The method according to claim 1, characterized in that, Before timing is performed via the electronic device based on the timing enable signal, the method further includes: In response to the detection of a target transition edge of the timing enable signal, the timing value of the electronic device is cleared to zero.
7. The method according to claim 6, characterized in that, The target transition edge is detected based on the start pulse; The start pulse is generated based on the timing enable signal and the delay signal, wherein the delay signal is a signal obtained by delaying the timing enable signal by a preset time.
8. The method according to claim 1, characterized in that, The timing based on the timing enable signal, performed by the electronic device, includes: In response to the timing enable signal indicating that timing is enabled, the clock cycles of the electronic device are counted to obtain the count value of the clock cycles; The timing value of the electronic device is determined based on the count value of the clock cycle and the frequency of the clock cycle.
9. The method according to claim 1, characterized in that, The method further includes: In response to receiving an asynchronous reset signal instructing a reset to be performed, the timing value of the electronic device is cleared to zero.
10. An electronic device, comprising: At least one processor; At least one memory for storing at least one program; The timing control method of any one of claims 1 to 9 is implemented when at least one of the programs is executed by at least one of the processors.
11. A computer-readable storage medium storing computer-executable instructions for performing the timing control method according to any one of claims 1 to 9.
12. A computer program product comprising a computer program, which, when executed by a processor, implements, as follows: The timing control method according to any one of claims 1 to 9.
