WO2011060570A1 - High-speed counter processing method and counter - Google Patents

High-speed counter processing method and counter Download PDF

Info

Publication number
WO2011060570A1
WO2011060570A1 PCT/CN2009/074983 CN2009074983W WO2011060570A1 WO 2011060570 A1 WO2011060570 A1 WO 2011060570A1 CN 2009074983 W CN2009074983 W CN 2009074983W WO 2011060570 A1 WO2011060570 A1 WO 2011060570A1
Authority
WO
WIPO (PCT)
Prior art keywords
memory
value
counter
fifo
counter value
Prior art date
Application number
PCT/CN2009/074983
Other languages
French (fr)
Chinese (zh)
Inventor
陈略
王正波
肖斌
Original Assignee
华为技术有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2009/074983 priority Critical patent/WO2011060570A1/en
Priority to CN200980153967.0A priority patent/CN102203748B/en
Publication of WO2011060570A1 publication Critical patent/WO2011060570A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F5/00Methods or arrangements for data conversion without changing the order or content of the data handled
    • G06F5/06Methods or arrangements for data conversion without changing the order or content of the data handled for changing the speed of data flow, i.e. speed regularising or timing, e.g. delay lines, FIFO buffers; over- or underrun control therefor
    • G06F5/10Methods or arrangements for data conversion without changing the order or content of the data handled for changing the speed of data flow, i.e. speed regularising or timing, e.g. delay lines, FIFO buffers; over- or underrun control therefor having a sequence of storage locations each being individually accessible for both enqueue and dequeue operations, e.g. using random access memory
    • G06F5/12Means for monitoring the fill level; Means for resolving contention, i.e. conflicts between simultaneous enqueue and dequeue operations
    • G06F5/14Means for monitoring the fill level; Means for resolving contention, i.e. conflicts between simultaneous enqueue and dequeue operations for overflow or underflow handling, e.g. full or empty flags

Definitions

  • the present invention relates to the field of computers, and in particular, to a high-speed counter processing method and a counter. Background technique
  • SRAM Static Random Access Memory
  • DRAM Dynamic Random Access Memory
  • CMA Counter Management Algorithm
  • a counter processing method is: When it is judged whether the counter in the SRAM can be moved to the DRAM, the random threshold is used for judging. That is, a threshold value T is randomly set. When a counting event occurs in the SRAM, the counter value is taken out from the SRAM, and it is judged whether the counter value is greater than or equal to the threshold value T. If it is greater than or equal to, the counter value in the SRAM is used. Moved to DRAM. There is a small FIFO (First In First Out) between the SRAM and the DRAM to buffer the counter value that is not immediately moved to the DRAM due to DRAM performance limitations. Through random thresholds, it is attempted to move from SRAM to DRAM at a relatively uniform rate even when the FIFO depth is small, and the probability of shifting from SRAM to DRAM at a rate is unexpected.
  • FIFO First In First Out
  • the inventor found that: the implementation of random threshold is more cumbersome. In addition, due to the probability and statisticality of random thresholds, it may happen that all SRAM counter values are close to the random threshold in long-term operation; A specific traffic is sent after the random threshold is derived, causing all SRAM counter values to be close to the random threshold, thus causing a FIFO overflow or a large number of SRAM counter values to overflow, eventually resulting in a lost count.
  • Another counter processing method is: Periodic relocation, that is, according to the update rate ratio of SRAM and DRAM, the size of the shift threshold is determined according to the time required to move all the SRAM counter values to the DRAM. Or, to see how long the SRAM overflows, to ensure that the SRAM counter does not overflow. The counter value is moved from the SRAM to the DRAM during the time period; then it is periodically relocated according to this time period. At the same time, using this method, you also need to maintain a large FIFO for caching.
  • the high-speed counter processing method and counter in the prior art occupy a large amount of memory, fail to effectively avoid counting loss, and are difficult to implement, and the equipment cost is high.
  • Embodiments of the present invention provide a high-speed counter processing method and a counter, which can avoid loss of memory count, are easy to implement, and have low equipment cost.
  • a high speed counter processing method includes:
  • the first memory is a memory having a static access function.
  • a high speed counter comprising:
  • a first memory configured to store a counter value, where the first memory is a memory having a static access function
  • a processing unit configured to: when the counter value in the first memory or the converted value obtained by converting the counter value is not less than a depth value of the FIFO data buffer FIFO, the counter value in the first memory Moved into the FIFO;
  • a FIFO configured to receive and buffer a counter value in the first memory.
  • the high-speed counter processing method and the counter provided by the embodiment of the present invention, when the converted value obtained by converting the counter value or the counter value in the first memory is not less than the depth value of the FIFO, the counter value in the first memory is moved into the FIFO.
  • the first memory is a memory having a static access function.
  • the first memory moves data to the FIFO according to the depth of the FIFO. Since the depth of the FI FO changes as it moves the data outward, the threshold for the move is dynamic for the first memory. Therefore, it is impossible to estimate the threshold by statistical calculation, which avoids the possibility that all counter values are close to overflow after the threshold is estimated, and the probability of counting loss is reduced.
  • the embodiment of the present invention also does not require a larger memory of the first memory and the FIFO, and the device cost is low and easy to implement.
  • Figure 1 is a block diagram of a counter based on a hybrid scheme.
  • FIG. 1 is a flow chart of a method for processing a high speed counter according to an embodiment of the present invention
  • FIG. 3 is a block diagram of a high-speed counter processing method according to another embodiment of the present invention
  • FIG. 4 is a schematic diagram of a SRAM and a FIFO of a high-speed counter processing method according to another embodiment of the present invention
  • FIG. 5 is a structural block diagram of a high speed counter according to an embodiment of the present invention.
  • the high-speed counter processing method provided by the embodiment of the present invention is as shown in FIG. 2, and the method steps include:
  • the counter value in the first memory or the converted value obtained by the counter value is not less than the depth value of the FIFO data buffer FIFO, the counter value in the first memory is moved into the FIFO, wherein the A memory is a memory having a static access function.
  • the first memory may be a static memory with higher speed in practical applications, for example: Static random access memory SRAM (Static Random Acces s Memory).
  • Static random access memory SRAM Static Random Acces s Memory
  • the converted value obtained after the counter value is converted may be: a value obtained by subtracting the value obtained from the initial threshold value in the first memory, or as follows: after the counter value is subtracted from the initial threshold, according to the maximum FIFO
  • the value obtained after the depth is converted in proportion is specifically described in the following embodiments.
  • the initial threshold may be a user-defined threshold.
  • the counter value is not shifted into the FIFO.
  • the method may further include:
  • the second memory may be a slower memory such as Dynamic Random Accs DRAM (DRAM).
  • DRAM Dynamic Random Accs DRAM
  • the first memory and the second memory are memories having different update rates.
  • the high-speed counter processing method provided by the embodiment of the present invention moves the counter value in the first memory into the FIFO when the converted value obtained by converting the counter value or the counter value in the first memory is not less than the depth value of the FIFO.
  • the first memory moves data to the FIFO according to the depth of the FIFO. Since the depth of the FIFO changes as the data moves outward, the threshold for the first memory is dynamic. of. Therefore, it is impossible to estimate the threshold by statistical calculation, which avoids the possibility that all counter values are close to overflow after the threshold is estimated, and the probability of counting loss is reduced.
  • the embodiment of the present invention also does not require a larger capacity of the first memory and the FIFO, and the device cost is low and easy to implement.
  • the method steps include: S 30 When a count event occurs in the first memory, the counter value in the first memory is counted and accumulated, and the counter value after the count is obtained.
  • the first memory is a memory having a static access function.
  • the counter value is carried into the FIFO, and the counter value is reset to zero.
  • the transformed value obtained after the counter value is converted may be: a value obtained by subtracting the value obtained by the initial threshold value from the counter value.
  • T is the initial threshold
  • the initial threshold is a user-defined threshold.
  • the current depth of F IFO is D
  • the second memory is a memory with dynamic access function.
  • the second memory is a dynamic random access memory DRAM.
  • DRAM dynamic random access memory
  • the first memory is an SRAM
  • the second memory is a DRAM
  • the embodiment of the present invention is not limited thereto, and any other memory with different update rates may be used.
  • the SRAM and the DRAM are not limited to the off-chip memory in the specific implementation, and may be an on-chip memory.
  • the high-speed counter processing method when the first memory has a counting event, the counting is accumulated, and the counter value after the counting is obtained; when the counter value or the counter value is converted, the converted value is not less than the depth of the FIFO.
  • the counter value in the first memory is moved in In the FIFO; then, when there is a value in the FIFO and there is free bandwidth between the FIFO and the second memory, the value in the FIFO is moved to the second memory.
  • the first memory moves data to the FIFO according to the depth of the FIFO. Since the depth of the FIFO changes as the data moves outward, the threshold for the movement is dynamic for the first memory. of.
  • the embodiment of the present invention also does not require a larger memory of the first memory and the FIFO, and the device cost is low and easy to implement.
  • the total number of counters in the above embodiment is the ratio of the rate at which the counters of the SRAM and the DRAM are updated, and ⁇ is the initial threshold.
  • OneLowerBound x (T + r - ⁇ ) -Mx (T - ⁇ ) - r
  • a reasonable FI F0 depth can be obtained according to the statistical time of the actual application, ensuring that the SRAM counter value will never overflow during the application cycle.
  • the first memory is an SRAM and the second memory is a DRAM.
  • more b i t bit width may be used as the storage counter value, so it is possible to determine whether it can be moved to the FIFO for a set of counter values in the SRAM. That is, it is determined whether the set of counter values obtained by counting the counts in the SRAM is not less than the depth of the current FIFO. If the set of counter values is not less than the depth of the current FIFO, the set of counter values is moved into the FIFO, and the SRAM is The group counter value is zeroed. The subsequent movement between the F IFO and the DRAM is the same as that of the above embodiment, and will not be described herein.
  • the SRAM bit width is 10 bi t
  • the counter value is C
  • the maximum depth of the FIFO is 128.
  • the count value of the SRAM can be carried into the FIFO at ((C- ⁇ ) » 2 ).
  • >> is the right shift operation, and shifting 2 bits to the right is equivalent to dividing by 4.
  • the SRAM median can be equal to the counter value after the FIFO depth, or the counter value can be subtracted from the initial threshold, according to the FIFO depth.
  • the scale is transformed to obtain a counter value transformed value so that the transformed value can still be used to determine the depth of the FIFO.
  • the first memory moves data to the FIFO according to the depth of the FIFO. Since the depth of the FI F0 changes as the data moves outward, the threshold for the first memory is Dynamic. Therefore, it is impossible to estimate the threshold by statistical calculation, which avoids the possibility that all counter values are close to overflow at the same time after the threshold is estimated, and the probability of counting loss is reduced. In addition, the embodiment of the present invention also does not require a larger memory of the first memory and the FIFO, and the device cost is low and easy to implement.
  • this embodiment illustrates that the value section when determining whether the SRAM counter can be moved can be flexibly expanded, but the core using the FIFO depth as the dynamic threshold is unchanged.
  • One decision scenario is: A decision is made while reading the counter and/or the first memory. That is, when the counter and/or the first memory are read, when the counter value obtained by converting the counter value or the counter value in the first memory is not less than the depth value of the FIFO, the counter value in the first memory is used. Move into the FIFO.
  • Another decision scenario is: Periodically scan to determine the counter value in the first memory. That is, the periodic scan determines the counter value or the counter conversion value in the first memory, and when the counter value or the counter conversion value in the first memory is not less than the depth value of the FIFO, the counter value in the first memory is moved into the FIFO.
  • the method provided by the embodiment of the present invention assumes that the first memory is an SRAM and the second memory is a DRAM.
  • the embodiment of the present invention is not limited thereto, and any other memory with different update rates may be used.
  • the first memory and the second memory may be either off-chip memories or on-chip memories.
  • the high-speed counter provided by the embodiment of the present invention, as shown in FIG. 5, includes:
  • the first memory 501 is configured to store a counter value, wherein the first memory 501 is a memory having a static access function.
  • the processing unit 502 is configured to: when the counter value in the first memory 501 or the converted value obtained by the counter value is not less than the depth value of the FIFO 503, move the counter value in the first memory 501 into the FIFO 503;
  • the FIFO 503 is configured to receive and buffer a counter value in the first memory 501.
  • the counter further includes: a second memory 504, wherein the second memory 504 is a memory having a dynamic access function.
  • the processing unit 502 is further configured to move the value in the FIFO 503 to the second memory 504 when there is a value in the FIFO 503 and there is a free bandwidth between the FIFO 503 and the second memory 504.
  • the second memory 504 is configured to receive and store values in the FIFO 503.
  • the high-speed counter provided by the embodiment of the present invention, when the counter value in the first memory or the converted value obtained by the counter value is not less than the depth value of the FIFO, the count in the first memory The value is shifted into the FIFO. Therefore, for the first memory, data is moved to the first memory according to the depth of the FIFO. Since the depth of the FIFO changes as the data moves outward, the threshold for the movement is dynamic for the first memory. Therefore, it is impossible to estimate the threshold by statistical calculation, which avoids the possibility that all counter values are close to overflow after the threshold is estimated, and the probability of counting loss is reduced. In addition, the embodiment of the present invention also does not require a larger memory of the first memory and the FIFO, and the device cost is low and easy to implement.
  • first memory and the second memory implemented by the present invention may be any two memories with different update rates.
  • first memory and the second memory may be either an off-chip memory or an on-chip memory.
  • this counter is not limited to the count of times, but can also be used for other counts, such as the length of the message.

Abstract

A counter processing method and counter are provided by the embodiments of the present invention, which relate to the field of computer, can avoid the loss of the memory count and be realized easily, and have low device cost. The method provided by the embodiment of the present invention includes: when the counter value in a first storage or the transform value transformed from the counter value is not less than the depth value of a first in first out data buffer FIFO, the counter value in the first storage is moved into the FIFO, wherein the first storage is a storage with the function of static access.

Description

一种高速计数器处理方法及计数器 技术领域  High-speed counter processing method and counter
本发明涉及计算机领域, 尤其涉及一种高速计数器处理方法及计数器。 背景技术  The present invention relates to the field of computers, and in particular, to a high-speed counter processing method and a counter. Background technique
在 40Gbps和更高速率的统计中, 如高速路由器等, 需要大量的高速的统 计计数器, 此时基本上釆用 SRAM ( Static Random Access Memory, 静态随机 存取存储器) + DRAM ( Dynamic Random Access Memory, 动态随机存取存储 器)混合方案,来利用 SRAM的快速和 DRAM大容量的特点,其结构如图 1所示。  In the statistics of 40 Gbps and higher speeds, such as high-speed routers, a large number of high-speed statistical counters are required. In this case, SRAM (Static Random Access Memory) + DRAM (Dynamic Random Access Memory) is basically used. Dynamic random access memory) hybrid scheme to take advantage of the fastness of SRAM and the large capacity of DRAM. Its structure is shown in Figure 1.
其中, 最关键是计数器的处理方法 (Counter Management Algorithm, CMA), 目前, 现有技术中对此提出了很多不同的解决方案。  Among them, the most important is the Counter Management Algorithm (CMA). At present, many different solutions are proposed in the prior art.
一种计数器处理方法为: 在判断 SRAM 中的计数器是否可以搬移到 DRAM 中时, 釆用随机门限进行判断。 即随机设定一个门限值 T, 当 SRAM有计数事 件发生时, 从 SRAM中取出其中的计数器值, 判断该计数器值是否大于等于门 限值 T , 如果大于等于, 则将 SRAM中的计数器值搬移到 DRAM中。 在 SRAM和 DRAM之间有一个小 FIFO (First In First Out, 先进先出的数据緩存器)来 緩存因为 DRAM性能限制来不及立即搬移到 DRAM的计数器值。 通过随机门限 试图达到即使在 FIFO深度较小的情况下,仍能以比较均匀的速率进行从 SRAM 向 DRAM的搬移, 在概率上避免从 SRAM到 DRAM的搬移在速率上出现突发。  A counter processing method is: When it is judged whether the counter in the SRAM can be moved to the DRAM, the random threshold is used for judging. That is, a threshold value T is randomly set. When a counting event occurs in the SRAM, the counter value is taken out from the SRAM, and it is judged whether the counter value is greater than or equal to the threshold value T. If it is greater than or equal to, the counter value in the SRAM is used. Moved to DRAM. There is a small FIFO (First In First Out) between the SRAM and the DRAM to buffer the counter value that is not immediately moved to the DRAM due to DRAM performance limitations. Through random thresholds, it is attempted to move from SRAM to DRAM at a relatively uniform rate even when the FIFO depth is small, and the probability of shifting from SRAM to DRAM at a rate is unexpected.
但在实现此过程中, 发明人发现: 随机门限的实现较为麻烦, 此外, 由 于随机门限的概率统计性, 在长期运行中有可能出现所有 SRAM计数器值都同 样接近该随机门限的情况; 或者人们在推算出该随机门限后发送特定流量, 从而导致所有 SRAM计数器值都同样接近该随机门限, 因此会造成 FIFO溢出 或大量的 SRAM计数器值溢出, 最终导致计数丟失。  However, in the process of implementing this process, the inventor found that: the implementation of random threshold is more cumbersome. In addition, due to the probability and statisticality of random thresholds, it may happen that all SRAM counter values are close to the random threshold in long-term operation; A specific traffic is sent after the random threshold is derived, causing all SRAM counter values to be close to the random threshold, thus causing a FIFO overflow or a large number of SRAM counter values to overflow, eventually resulting in a lost count.
另一种计数器处理方法为: 定期搬迁, 即根据 SRAM和 DRAM的更新速率 比, 根据将所有 SRAM计数器值全部搬移到 DRAM中的所需时间, 来确定搬移 门限的大小。 或者说, 看多长时间 SRAM溢出, 在保证 SRAM计数器不溢出的 时间段内从 SRAM中将计数器值向 DRAM搬移; 然后按此时间段定期搬迁。 与 此同时, 釆用该方法, 还需要维护一个大的 FIFO来进行緩存。 Another counter processing method is: Periodic relocation, that is, according to the update rate ratio of SRAM and DRAM, the size of the shift threshold is determined according to the time required to move all the SRAM counter values to the DRAM. Or, to see how long the SRAM overflows, to ensure that the SRAM counter does not overflow. The counter value is moved from the SRAM to the DRAM during the time period; then it is periodically relocated according to this time period. At the same time, using this method, you also need to maintain a large FIFO for caching.
但在实现此过程中, 发明人发现: 搬迁时大部分的计数器值都比较小, 但每个计数器值的搬迁都会消耗 SRAM和 DRAM之间的带宽,因此 SRAM和 DRAM 带宽占用高; 另外, 该方法和计数器个数强相关, 当计数器个数比较多时, 需要占用大量的存储资源用做 FIFO緩存才能防止溢出。  However, in the process of implementing this process, the inventor found that: most of the counter values during relocation are relatively small, but the relocation of each counter value consumes the bandwidth between SRAM and DRAM, so the bandwidth of SRAM and DRAM is high; The method is strongly related to the number of counters. When the number of counters is relatively large, a large amount of storage resources are required to be used as a FIFO buffer to prevent overflow.
总而言之, 现有技术中的高速计数器处理方法及计数器, 占用大量内存, 未能有效避免计数丟失, 且难于实现, 设备成本高。  In summary, the high-speed counter processing method and counter in the prior art occupy a large amount of memory, fail to effectively avoid counting loss, and are difficult to implement, and the equipment cost is high.
发明内容 Summary of the invention
本发明的实施例提供一种高速计数器处理方法及计数器, 能够避免内存 计数丟失, 易于实现、 设备成本低。  Embodiments of the present invention provide a high-speed counter processing method and a counter, which can avoid loss of memory count, are easy to implement, and have low equipment cost.
为达到上述目的, 本发明的实施例釆用如下技术方案:  In order to achieve the above object, embodiments of the present invention use the following technical solutions:
一种高速计数器处理方法, 包括:  A high speed counter processing method includes:
当第一存储器中的计数器值或所述计数器值变换后得到的变换值不小于 先进先出数据緩存器 FIFO的深度值时, 将所述第一存储器中的所述计数器值 移入所述 FIFO中, 其中, 所述第一存储器为具有静态存取功能的存储器。  And shifting the counter value in the first memory into the FIFO when a counter value in the first memory or a converted value obtained by converting the counter value is not less than a depth value of the FIFO data buffer FIFO The first memory is a memory having a static access function.
一种高速计数器, 包括:  A high speed counter comprising:
第一存储器, 用于存储计数器值, 其中, 所述第一存储器为具有静态存 取功能的存储器;  a first memory, configured to store a counter value, where the first memory is a memory having a static access function;
处理单元, 用于当第一存储器中的计数器值或所述计数器值变换后得到 的变换值不小于先进先出数据緩存器 FIFO的深度值时, 将所述第一存储器中 的所述计数器值移入所述 FIFO中;  a processing unit, configured to: when the counter value in the first memory or the converted value obtained by converting the counter value is not less than a depth value of the FIFO data buffer FIFO, the counter value in the first memory Moved into the FIFO;
FIFO, 用于接收并緩存所述第一存储器中的计数器值。  a FIFO, configured to receive and buffer a counter value in the first memory.
本发明实施例提供的高速计数器处理方法及计数器, 当第一存储器中的 计数器值或计数器值变换后得到的变换值不小于 FIFO的深度值时, 将第一存 储器中的计数器值移入 FIFO中, 其中, 第一存储器为具有静态存取功能的存 储器。在本发明实施例中,第一存储器是根据 FIFO的深度来向其搬移数据的, 由于 F I FO的深度会随其向外搬移数据而发生变化,所以对于第一存储器来说, 搬移的门限是动态的。 所以无法通过统计计算预估该门限值, 也就避免了在 预估出门限值后所有计数器值同时接近溢出的可能, 减少了计数丟失的概率。 另外, 本发明实施例也不需要较大容量的第一存储器和 FIFO, 设备成本低, 易于实现。 The high-speed counter processing method and the counter provided by the embodiment of the present invention, when the converted value obtained by converting the counter value or the counter value in the first memory is not less than the depth value of the FIFO, the counter value in the first memory is moved into the FIFO. The first memory is a memory having a static access function. In the embodiment of the present invention, the first memory moves data to the FIFO according to the depth of the FIFO. Since the depth of the FI FO changes as it moves the data outward, the threshold for the move is dynamic for the first memory. Therefore, it is impossible to estimate the threshold by statistical calculation, which avoids the possibility that all counter values are close to overflow after the threshold is estimated, and the probability of counting loss is reduced. In addition, the embodiment of the present invention also does not require a larger memory of the first memory and the FIFO, and the device cost is low and easy to implement.
附图说明 DRAWINGS
为了更清楚地说明本发明实施例或现有技术中的技术方案, 下面将对实 施例或现有技术描述中所需要使用的附图作简单地介绍, 显而易见地, 下面 描述中的附图仅仅是本发明的一些实施例, 对于本领域普通技术人员来讲, 在不付出创造性劳动的前提下, 还可以根据这些附图获得其他的附图。  In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the embodiments or the description of the prior art will be briefly described below. Obviously, the drawings in the following description are only It is a certain embodiment of the present invention, and other drawings can be obtained from those skilled in the art without any creative work.
图 1为现有基于混合方案的计数器框图。  Figure 1 is a block diagram of a counter based on a hybrid scheme.
图 1为本发明实施例提供的高速计数器处理方法的流程框图;  1 is a flow chart of a method for processing a high speed counter according to an embodiment of the present invention;
图 3为本发明另一实施例提供的高速计数器处理方法的流程框图; 图 4为本发明又一实施例提供的高速计数器处理方法的 SRAM和 FIFO的 示意图;  3 is a block diagram of a high-speed counter processing method according to another embodiment of the present invention; FIG. 4 is a schematic diagram of a SRAM and a FIFO of a high-speed counter processing method according to another embodiment of the present invention;
图 5为本发明实施例提供的高速计数器的结构框图。  FIG. 5 is a structural block diagram of a high speed counter according to an embodiment of the present invention.
具体实施方式 detailed description
下面将结合本发明实施例中的附图, 对本发明实施例中的技术方案进行 清楚、 完整地描述, 显然, 所描述的实施例仅仅是本发明一部分实施例, 而 不是全部的实施例。 基于本发明中的实施例, 本领域普通技术人员在没有做 出创造性劳动前提下所获得的所有其他实施例 , 都属于本发明保护的范围。  The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
本发明实施例提供的高速计数器处理方法, 如图 2 所示, 该方法步骤包 括:  The high-speed counter processing method provided by the embodiment of the present invention is as shown in FIG. 2, and the method steps include:
S20 当第一存储器中的计数器值或该计数器值变换后得到的变换值不 小于先进先出数据緩存器 FIFO的深度值时, 将第一存储器中的该计数器值移 入 FIFO中, 其中, 该第一存储器为具有静态存取功能的存储器。  S20, when the counter value in the first memory or the converted value obtained by the counter value is not less than the depth value of the FIFO data buffer FIFO, the counter value in the first memory is moved into the FIFO, wherein the A memory is a memory having a static access function.
具体的, 第一存储器在实际应用中可以为速度较高的静态存储器, 例如: 静态随机存取存储器 SRAM ( Stat ic Random Acces s Memory )。 Specifically, the first memory may be a static memory with higher speed in practical applications, for example: Static random access memory SRAM (Static Random Acces s Memory).
计数器值为: 有计数事件发生时, 第一存储器中的计数器值累加后得到 的结果。 假设当前第一存储器中的计数器值为 C, 有计数事件发生, 则累加后 得到的结果即为 C=C+1。  The counter value is: The result obtained by accumulating the counter value in the first memory when a counting event occurs. Assuming that the current counter value in the first memory is C, and a count event occurs, the result obtained after the accumulation is C=C+1.
计数器值变换后得到的变换值可以为: 该第一存储器中的计数器值减去 起始门限值所得的值后得到的值, 或者为: 计数器值减去起始门限后, 根据 FIFO的最大深度按比例进行变换后所得的值, 其具体变换方式在下面的实施 例中进行说明, 另外, 所述起始门限可以为用户自定义的门限值。  The converted value obtained after the counter value is converted may be: a value obtained by subtracting the value obtained from the initial threshold value in the first memory, or as follows: after the counter value is subtracted from the initial threshold, according to the maximum FIFO The value obtained after the depth is converted in proportion is specifically described in the following embodiments. In addition, the initial threshold may be a user-defined threshold.
如果上述第一存储器中的计数器值或计数器值变换后得到的变换值不大 于 FIFO的深度值, 则不向该 FIFO移入计数器值。  If the converted value obtained by the counter value or the counter value in the first memory is not larger than the depth value of the FIFO, the counter value is not shifted into the FIFO.
进一步地, 该方法还可以包括:  Further, the method may further include:
S202 , 当该 FIFO中有值, 且 FIFO与第二存储器之间有空闲带宽时, 将 FIFO 中的值向第二存储器中搬移, 其中, 该第二存储器为具有动态存取功能 的存储器。  S202, when there is a value in the FIFO, and there is a free bandwidth between the FIFO and the second memory, the value in the FIFO is moved to the second memory, wherein the second memory is a memory with dynamic access function.
第二存储器可以为速度较慢的存储器, 例如: 动态随机存取存储器 DRAM ( Dynamic Random Acces s Memory )。  The second memory may be a slower memory such as Dynamic Random Accs DRAM (DRAM).
总之, 第一存储器和第二存储器为更新速率不同的存储器。  In summary, the first memory and the second memory are memories having different update rates.
本发明实施例提供的高速计数器处理方法, 当第一存储器中的计数器值 或计数器值变换后得到的变换值不小于 FIFO的深度值时, 将第一存储器中的 计数器值移入 FIFO中。 在本发明实施例中, 第一存储器是根据 FIFO的深度 来向其搬移数据的, 由于 FIFO的深度会随其向外搬移数据而发生变化, 所以 对于第一存储器来说, 搬移的门限是动态的。 所以无法通过统计计算预估该 门限值, 也就避免了在预估出门限值后所有计数器值同时接近溢出的可能, 减少了计数丟失的概率。 另外, 本发明实施例也不需要较大容量的第一存储 器和 FIFO, 设备成本低, 易于实现。  The high-speed counter processing method provided by the embodiment of the present invention moves the counter value in the first memory into the FIFO when the converted value obtained by converting the counter value or the counter value in the first memory is not less than the depth value of the FIFO. In the embodiment of the present invention, the first memory moves data to the FIFO according to the depth of the FIFO. Since the depth of the FIFO changes as the data moves outward, the threshold for the first memory is dynamic. of. Therefore, it is impossible to estimate the threshold by statistical calculation, which avoids the possibility that all counter values are close to overflow after the threshold is estimated, and the probability of counting loss is reduced. In addition, the embodiment of the present invention also does not require a larger capacity of the first memory and the FIFO, and the device cost is low and easy to implement.
在本发明另一实施例提供的高速计数器处理方法, 如图 3 所示, 该方法 步骤包括: S 30 当第一存储器有计数事件发生时, 该第一存储器中的计数器值进 行计数累加, 得到计数后的计数器值。 其中, 该第一存储器为具有静态存取 功能的存储器。 In the high-speed counter processing method provided by another embodiment of the present invention, as shown in FIG. 3, the method steps include: S 30 When a count event occurs in the first memory, the counter value in the first memory is counted and accumulated, and the counter value after the count is obtained. The first memory is a memory having a static access function.
在本实施例中, 可选地, 第一存储器为高速存储器 SRAM。 4叚设当前第一 存储器中的计数器值为 当该第一存储器有计数事件发生时, 计数器值进行 计数累加, 得到计数后的计数器值, 为 C=C+1。  In this embodiment, optionally, the first memory is a high speed memory SRAM. 4 叚 Set the current counter value in the first memory When the first memory has a counting event, the counter value is counted and accumulated, and the counter value after counting is obtained, which is C=C+1.
5302、 当确定该计数器值或该计数器值变换后得到的变换值不小于 FIFO 的深度值时, 将该计数器值搬入 FIFO , 同时将该计数器值归零。  5302. When it is determined that the counter value or the converted value obtained by the counter value is not less than the depth value of the FIFO, the counter value is carried into the FIFO, and the counter value is reset to zero.
如果该计数器值或变换值不大于 FIFO的深度值, 则不向 FIFO中移入, 将计数后的该计数器值 C仍回写入第一存储器中。  If the counter value or the converted value is not greater than the depth value of the FIFO, no shift is made to the FIFO, and the counter value C after the count is still written back into the first memory.
在此, 计数器值变换后得到的变换值可以为: 该计数器值减去起始门限 值所得的值后得到的值。 具体的, 假设 T为起始门限, 该起始门限为用户自 定义的门限值。假设当前 F IFO的深度为 D, "确定该计数器值变换后得到的变 换值不小于 F IFO的深度值" 可以为确定 -"〉 或者 (^- " A 可以看出, 当 时, 计数器变换值 =计数器值。  Here, the transformed value obtained after the counter value is converted may be: a value obtained by subtracting the value obtained by the initial threshold value from the counter value. Specifically, it is assumed that T is the initial threshold, and the initial threshold is a user-defined threshold. Assume that the current depth of F IFO is D, "determine that the transformed value obtained after the counter value is transformed is not less than the depth value of F IFO" can be determined - "〉 or (^- " A can be seen, at that time, the counter transformation value = Counter value.
5303、 当 FIFO中有值, 且 F IFO与第二存储器之间有空闲带宽时, 将该 FIFO 中的值向第二存储器搬移。 其中, 该第二存储器为具有动态存取功能的 存储器。  5303. When there is a value in the FIFO, and there is an idle bandwidth between the F IFO and the second memory, the value in the FIFO is moved to the second memory. The second memory is a memory with dynamic access function.
在本实施例中,第二存储器为动态随机存取存储器 DRAM。当 FIFO不为空, 且 FIFO与 DRAM之间有空闲带宽时, 将该 FIFO中的值向 DRAM中搬移。  In this embodiment, the second memory is a dynamic random access memory DRAM. When the FIFO is not empty and there is free bandwidth between the FIFO and the DRAM, the value in the FIFO is moved to the DRAM.
需要说明的是, 本发明实施例假设第一存储器为 SRAM , 第二存储器为 DRAM, 只是举例说明, 本发明实施例并不限于此, 其他的任何两个更新速率 不同的存储器都可以。 并且, 在具体实现时 SRAM和 DRAM不限于芯片外存储 器, 也可以是芯片内存储器。  It should be noted that, in the embodiment of the present invention, the first memory is an SRAM, and the second memory is a DRAM. For example, the embodiment of the present invention is not limited thereto, and any other memory with different update rates may be used. Moreover, the SRAM and the DRAM are not limited to the off-chip memory in the specific implementation, and may be an on-chip memory.
本发明实施例提供的高速计数器处理方法, 当第一存储器有计数事件发 生时, 计数累加, 得到计数后的计数器值; 当该计数器值或该计数器值变换 后得到的变换值不小于 FIFO的深度值时, 将第一存储器中的该计数器值移入 FIFO中; 然后, 当 FIFO中有值, 且 FIFO与第二存储器之间有空闲带宽时, 将该 FIFO中的值向第二存储器搬移。 在本发明实施例中, 第一存储器是根据 FIFO的深度来向其搬移数据的,由于 FIFO的深度会随其向外搬移数据而发生 变化, 所以对于第一存储器来说, 搬移的门限是动态的。 所以无法通过统计 计算预估该门限值, 也就避免了在预估出门限值后所有计数器值同时接近溢 出的可能, 减少了计数丟失的概率。 另外, 本发明实施例也不需要较大容量 的第一存储器和 FIFO , 设备成本低, 易于实现。 The high-speed counter processing method provided by the embodiment of the present invention, when the first memory has a counting event, the counting is accumulated, and the counter value after the counting is obtained; when the counter value or the counter value is converted, the converted value is not less than the depth of the FIFO. When the value is, the counter value in the first memory is moved in In the FIFO; then, when there is a value in the FIFO and there is free bandwidth between the FIFO and the second memory, the value in the FIFO is moved to the second memory. In the embodiment of the present invention, the first memory moves data to the FIFO according to the depth of the FIFO. Since the depth of the FIFO changes as the data moves outward, the threshold for the movement is dynamic for the first memory. of. Therefore, it is impossible to estimate the threshold by statistical calculation, which avoids the possibility that all counter values are close to overflow after the threshold is estimated, and the probability of counting loss is reduced. In addition, the embodiment of the present invention also does not require a larger memory of the first memory and the FIFO, and the device cost is low and easy to implement.
进一步地, 假设上述实施例中计数器总数为 , 为 SRAM和 DRAM的计数 器更新的速率比例, 且 Γ为起始门限。 由此可得 DRAM平均带宽占用率 为 β = τΙ Τ。 釆用上述实施例提供的方法, 假设 FIFO的深度为 n , 则可以推 算, 当设置"≥lg 、 ^/lg^^)时, 使 SRAM计数器值能溢出所需的统计时间最 Further, it is assumed that the total number of counters in the above embodiment is the ratio of the rate at which the counters of the SRAM and the DRAM are updated, and Γ is the initial threshold. Thus, the average bandwidth occupancy of the DRAM is β = τΙ Τ. Using the method provided in the above embodiment, assuming that the depth of the FIFO is n, it can be estimated that when the "≥lg, ^/lg^^" is set, the statistical time required for the SRAM counter value to overflow is the most
Μ ) r )  Μ ) r )
大。 Big.
另外,对于特定的 F IFO深度《, 经过推算可以得到一个能够使 SRAM计数 器值溢出为最小的统计次数为:  In addition, for a specific F IFO depth, a calculated number of statistics that can cause the SRAM counter value to overflow to a minimum is:
OneLowerBound = x (T + r - \) -Mx (T - \) - r 此外, 还可以根据实际应用的统计时间得到一个合理的 F I F0深度, 保证 在应用周期内的 SRAM计数器值绝对不会溢出。  OneLowerBound = x (T + r - \) -Mx (T - \) - r In addition, a reasonable FI F0 depth can be obtained according to the statistical time of the actual application, ensuring that the SRAM counter value will never overflow during the application cycle. .
在本发明另一实施例提供的高速计数器处理方法, 假设第一存储器为 SRAM, 第二存储器为 DRAM。  In a high speed counter processing method provided by another embodiment of the present invention, it is assumed that the first memory is an SRAM and the second memory is a DRAM.
在实际中 SRAM为外置时可能有更多的 b i t位宽用作存储计数器值, 所以 可以针对 SRAM中的一组计数器值来判断是否可以搬移到 FIFO中。 即判断该 SRAM中计数累加后得到的一组计数器值是否不小于当前 FIFO的深度,如果该 一组计数器值不小于当前 FIFO的深度, 则将这一组计数器值移入 FIFO , 同时 将 SRAM中该组计数器值归零。 之后的 F IFO与 DRAM之间的搬移与上述实施例 相同, 在此不再赘述。  In practice, when the SRAM is external, more b i t bit width may be used as the storage counter value, so it is possible to determine whether it can be moved to the FIFO for a set of counter values in the SRAM. That is, it is determined whether the set of counter values obtained by counting the counts in the SRAM is not less than the depth of the current FIFO. If the set of counter values is not less than the depth of the current FIFO, the set of counter values is moved into the FIFO, and the SRAM is The group counter value is zeroed. The subsequent movement between the F IFO and the DRAM is the same as that of the above embodiment, and will not be described herein.
下面举一个具体例子, 说明本实施中的判断计数器值变换值。 如图 4 所 示, 假设 SRAM位宽为 10 bi t , 计数器值为 C, 起始门限为 = 512 , FIFO的 最大深度 =128。 按照上述本发明实施例提供的方法, 可在( (C- Γ) » 2 ) 时, 将 SRAM的计数值搬入 FIFO中。 其中, >>为右移位操作, 右移 2位相 当于除以 4。 A specific example will be given below to describe the judgment counter value conversion value in the present embodiment. As shown in Figure 4 It is assumed that the SRAM bit width is 10 bi t , the counter value is C, the starting threshold is = 512, and the maximum depth of the FIFO is 128. According to the method provided by the embodiment of the present invention, the count value of the SRAM can be carried into the FIFO at ((C- Γ) » 2 ). Where >> is the right shift operation, and shifting 2 bits to the right is equivalent to dividing by 4.
从上述实施例可以看出, 当 SRAM位宽较宽, 而 FIFO深度较小时, 可以 将 SRAM中位数等于 FIFO深度以后的计数器值, 或计数器值减去初始门限后 的值, 根据 FIFO深度按比例进行变换, 得到计数器值变换值, 从而使该变换 值仍然能够被用于与该 FIFO的深度进行判断。 上述实施例所进行的变换方法 只是举例说明, 本发明实施例并不限于此, 可以达到使变换后的计数器变换 值仍然能够被用于与该 F I F0的深度进行判断的所有方法都应在本发明的保护 范围之内。  It can be seen from the above embodiment that when the SRAM has a wide bit width and a small FIFO depth, the SRAM median can be equal to the counter value after the FIFO depth, or the counter value can be subtracted from the initial threshold, according to the FIFO depth. The scale is transformed to obtain a counter value transformed value so that the transformed value can still be used to determine the depth of the FIFO. The conversion method performed by the above embodiment is only an example, and the embodiment of the present invention is not limited thereto, and all methods for making the converted counter conversion value still usable for determining the depth of the FI F0 should be used. Within the scope of protection of the invention.
在本发明实施例中, 第一存储器是根据 FIFO的深度来向其搬移数据的, 由于 F I F0的深度会随其向外搬移数据而发生变化,所以对于第一存储器来说, 搬移的门限是动态的。 所以无法通过统计计算预估该门限值, 也就避免了在 预估出门限值后所有计数器值同时接近溢出的可能, 减少了计数丟失的概率。 另外, 本发明实施例也不需要较大容量的第一存储器和 FIFO, 设备成本低, 易于实现。  In the embodiment of the present invention, the first memory moves data to the FIFO according to the depth of the FIFO. Since the depth of the FI F0 changes as the data moves outward, the threshold for the first memory is Dynamic. Therefore, it is impossible to estimate the threshold by statistical calculation, which avoids the possibility that all counter values are close to overflow at the same time after the threshold is estimated, and the probability of counting loss is reduced. In addition, the embodiment of the present invention also does not require a larger memory of the first memory and the FIFO, and the device cost is low and easy to implement.
此外, 本实施例说明, 在判断 SRAM计数器是否可搬移时的数值区段可灵 活扩展, 但利用 FIFO深度作为动态门限的核心不变。  In addition, this embodiment illustrates that the value section when determining whether the SRAM counter can be moved can be flexibly expanded, but the core using the FIFO depth as the dynamic threshold is unchanged.
进一步地, 在上述实施例的基础上, 还可以在以下场景进行判定来进一 步保证第一存储器中的值不会溢出。  Further, based on the above embodiment, it is also possible to make a decision in the following scenario to further ensure that the value in the first memory does not overflow.
一种判定场景是: 在对计数器和 /或第一存储器进行读取的时候进行判 定。 即, 在对计数器和 /或第一存储器进行读取时, 当第一存储器中的计数器 值或计数器值变换后得到的变换值不小于 FIFO的深度值时, 将第一存储器中 的该计数器值移入 FIFO中。  One decision scenario is: A decision is made while reading the counter and/or the first memory. That is, when the counter and/or the first memory are read, when the counter value obtained by converting the counter value or the counter value in the first memory is not less than the depth value of the FIFO, the counter value in the first memory is used. Move into the FIFO.
当然, 除了在对计数器和 /或第一存储器进行读取时, 对其进行判定和处 理之外, 还可以在对该第一存储器进行其他的任何处理时, 对其进行上述计 数器处理方法的判定和处理。 Of course, in addition to the determination and processing of the counter and/or the first memory, it may be subjected to the above calculation when performing any other processing on the first memory. The determination and processing of the digital processing method.
另一种判定场景是: 定期扫描判断第一存储器中的计数器值。 即, 定期 扫描判断第一存储器中的计数器值或计数器变换值, 当第一存储器中的计数 器值或计数器变换值不小于 FIFO的深度值时, 将第一存储器中的该计数器值 移入 FIFO中。  Another decision scenario is: Periodically scan to determine the counter value in the first memory. That is, the periodic scan determines the counter value or the counter conversion value in the first memory, and when the counter value or the counter conversion value in the first memory is not less than the depth value of the FIFO, the counter value in the first memory is moved into the FIFO.
再者, 在向 FIFO中搬运时, 若发现该 FIFO 已满, 还可以暂停向第一存 储器输入计数器值。  Furthermore, when the FIFO is loaded, it is also possible to suspend the input of the counter value to the first memory if the FIFO is found to be full.
通过上述这些补充, 能够进一步有效防止计数丟失。  With the above additions, it is possible to further effectively prevent the count loss.
上述本发明实施例提供的方法, 都假设第一存储器为 SRAM, 第二存储器 为 DRAM, 只是举例说明, 本发明实施例并不限于此, 其他的任何两个更新速 率不同的存储器都可以。 并且, 第一存储器和第二存储器既可以是片外存储 器, 也可以是片内存储器。  The method provided by the embodiment of the present invention assumes that the first memory is an SRAM and the second memory is a DRAM. For example, the embodiment of the present invention is not limited thereto, and any other memory with different update rates may be used. Also, the first memory and the second memory may be either off-chip memories or on-chip memories.
本发明实施例提供的高速计数器, 如图 5所示, 包括:  The high-speed counter provided by the embodiment of the present invention, as shown in FIG. 5, includes:
第一存储器 501 , 用于存储计数器值, 其中, 该第一存储器 501为具有静 态存取功能的存储器。  The first memory 501 is configured to store a counter value, wherein the first memory 501 is a memory having a static access function.
处理单元 502 ,用于当第一存储器 501中的计数器值或该计数器值变换后 得到的变换值不小于 FIFO503的深度值时, 将第一存储器 501 中的该计数器 值移入 FIFO503中;  The processing unit 502 is configured to: when the counter value in the first memory 501 or the converted value obtained by the counter value is not less than the depth value of the FIFO 503, move the counter value in the first memory 501 into the FIFO 503;
FIFO503 , 用于接收并緩存第一存储器 501中的计数器值。  The FIFO 503 is configured to receive and buffer a counter value in the first memory 501.
进一步地, 该计数器还包括: 第二存储器 504 , 其中, 该第二存储器 504 为具有动态存取功能的存储器。  Further, the counter further includes: a second memory 504, wherein the second memory 504 is a memory having a dynamic access function.
处理单元 502 , 还用于当 FIFO503中有值, 且 FIFO503与第二存储器 504 之间有空闲带宽时, 将 FIFO503中的值向第二存储器 504中搬移。  The processing unit 502 is further configured to move the value in the FIFO 503 to the second memory 504 when there is a value in the FIFO 503 and there is a free bandwidth between the FIFO 503 and the second memory 504.
第二存储器 504 , 用于接收并存储 FIFO503中的值。  The second memory 504 is configured to receive and store values in the FIFO 503.
这样一来, 能够减少占用第二存储器的带宽。  In this way, the bandwidth occupied by the second memory can be reduced.
本发明实施例提供的高速计数器, 当第一存储器中的计数器值或该计数 器值变换后得到的变换值不小于 FIFO的深度值时, 将第一存储器中的该计数 器值移入所述 FIFO中。 因此, 针对第一存储器是根据 FIFO的深度来向其搬 移数据的, 由于 FIFO的深度会随其向外搬移数据而发生变化, 所以对于第一 存储器来说, 搬移的门限是动态的。 所以无法通过统计计算预估该门限值, 也就避免了在预估出门限值后所有计数器值同时接近溢出的可能, 减少了计 数丟失的概率。 另外, 本发明实施例也不需要较大容量的第一存储器和 FIFO, 设备成本低, 易于实现。 The high-speed counter provided by the embodiment of the present invention, when the counter value in the first memory or the converted value obtained by the counter value is not less than the depth value of the FIFO, the count in the first memory The value is shifted into the FIFO. Therefore, for the first memory, data is moved to the first memory according to the depth of the FIFO. Since the depth of the FIFO changes as the data moves outward, the threshold for the movement is dynamic for the first memory. Therefore, it is impossible to estimate the threshold by statistical calculation, which avoids the possibility that all counter values are close to overflow after the threshold is estimated, and the probability of counting loss is reduced. In addition, the embodiment of the present invention also does not require a larger memory of the first memory and the FIFO, and the device cost is low and easy to implement.
需要说明的是, 本发明实施的第一存储器和第二存储器可以为任意两个 更新速率不同的存储器。 并且, 在具体实现时第一存储器和第二存储器既可 以是芯片外存储器, 也可以是芯片内存储器。  It should be noted that the first memory and the second memory implemented by the present invention may be any two memories with different update rates. Moreover, in a specific implementation, the first memory and the second memory may be either an off-chip memory or an on-chip memory.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流 程, 是可以通过计算机程序来指令相关的硬件或芯片的逻辑电路来完成。 同 时本计数器不仅限于次数计数, 也可用于其他计数, 如报文长度计数等。  One of ordinary skill in the art will appreciate that implementing all or part of the processes in the above-described embodiments can be accomplished by a computer program that instructs the associated hardware or chip logic. At the same time, this counter is not limited to the count of times, but can also be used for other counts, such as the length of the message.
以上所述, 仅为本发明的具体实施方式, 但本发明的保护范围并不局限 于此, 任何熟悉本技术领域的技术人员在本发明揭露的技术范围内, 可轻易 想到变化或替换, 都应涵盖在本发明的保护范围之内。 因此, 本发明的保护 范围应所述以权利要求的保护范围为准。  The above is only the specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily think of changes or substitutions within the technical scope of the present invention. It should be covered by the scope of the present invention. Therefore, the scope of the invention should be determined by the scope of the claims.

Claims

权 利 要求 书 Claim
1、 一种高速计数器处理方法, 其特征在于, 包括: A high-speed counter processing method, comprising:
当第一存储器中的计数器值或所述计数器值变换后得到的变换值不小于先 进先出数据緩存器 FIFO的深度值时, 将所述第一存储器中的所述计数器值移入 所述 FIFO中, 其中, 所述第一存储器为具有静态存取功能的存储器。  And shifting the counter value in the first memory into the FIFO when a counter value in the first memory or a converted value obtained by converting the counter value is not less than a depth value of the FIFO data buffer FIFO The first memory is a memory having a static access function.
2、 根据权利要求 1所述的高速计数器处理方法, 其特征在于, 所述计数器 值变换后得到的变换值为: 所述计数器值减去起始门限值后得到的值, 或者为: 所述计数器值减去起始门限后, 根据所述 FIFO的深度值按比例进行变换后得到 的值; 其中, 所述起始门限为用户自定义的门限值。  The high-speed counter processing method according to claim 1, wherein the converted value obtained by converting the counter value is: a value obtained by subtracting the initial threshold value from the counter value, or After the value of the counter is subtracted from the initial threshold, the value obtained by scaling according to the depth value of the FIFO is used; wherein the initial threshold is a user-defined threshold.
3、 根据权利要求 1所述的高速计数器处理方法, 其特征在于, 将所述第一 存储器中的计数器值移入所述 FIFO之后, 所述方法还包括:  The high-speed counter processing method according to claim 1, wherein after the counter value in the first memory is moved into the FIFO, the method further includes:
将所述第一存储器中的所述计数器值归零。  The counter value in the first memory is zeroed.
4、 根据权利要求 1至 3中任意一项所述的高速计数器处理方法, 其特征在 于, 所述方法还包括:  The high-speed counter processing method according to any one of claims 1 to 3, wherein the method further comprises:
当所述 FIFO中有值, 且所述 FIFO与第二存储器之间有空闲带宽时, 将所 述 FIFO中的值向所述第二存储器中搬移, 其中, 所述第二存储器为具有动态存 取功能的存储器。  When there is a value in the FIFO, and there is a free bandwidth between the FIFO and the second memory, the value in the FIFO is moved to the second memory, wherein the second memory has dynamic memory Take the function of the memory.
5、 根据权利要求 1所述的高速计数器处理方法, 其特征在于, 所述方法还 包括:  The method of processing a high-speed counter according to claim 1, wherein the method further comprises:
读取计数器和 /或所述第一存储器时, 当所述第一存储器中的计数器值或所 述计数器值变换后得到的变换值不小于所述 FIFO的深度值时, 将所述第一存储 器中的所述计数器值移入所述 FIFO中。  When the counter and/or the first memory are read, when the counter value in the first memory or the converted value obtained by the counter value is not less than the depth value of the FIFO, the first memory is The counter value in is shifted into the FIFO.
6、 根据权利要求 1所述的高速计数器处理方法, 其特征在于, 所述方法还 包括:  The method of processing a high-speed counter according to claim 1, wherein the method further comprises:
定期扫描所述第一存储器中的计数器值或所述计数器值变换后得到的变换 值, 当所述计数器值或所述变换值不小于 FIFO的深度值时, 将所述第一存储器 中的所述计数器值移入所述 FIFO中。 Periodically scanning a counter value in the first memory or a transformed value obtained by converting the counter value, and when the counter value or the converted value is not less than a depth value of the FIFO, the first memory is The counter value is shifted into the FIFO.
7、 根据权利要求 1所述的高速计数器处理方法, 其特征在于, 所述方法还 包括: The method of processing a high-speed counter according to claim 1, wherein the method further comprises:
当所述 FIFO已满时, 暂停向所述第一存储器输入计数器值。  When the FIFO is full, the input of the counter value to the first memory is suspended.
8、 根据权利要求 5所述的高速计数器处理方法, 其特征在于, 所述第一存 储器和所述第二存储器的更新速率不同。  The high-speed counter processing method according to claim 5, wherein the update rates of the first memory and the second memory are different.
9、 一种高速计数器, 其特征在于, 包括:  9. A high speed counter, comprising:
第一存储器, 用于存储计数器值, 其中, 所述第一存储器为具有静态存取 功能的存储器;  a first memory, configured to store a counter value, where the first memory is a memory having a static access function;
处理单元, 用于当第一存储器中的计数器值或所述计数器值变换后得到的 变换值不小于先进先出数据緩存器 FIFO的深度值时, 将所述第一存储器中的所 述计数器值移入所述 FIFO中;  a processing unit, configured to: when the counter value in the first memory or the converted value obtained by converting the counter value is not less than a depth value of the FIFO data buffer FIFO, the counter value in the first memory Moved into the FIFO;
FIFO , 用于接收并緩存所述第一存储器中的计数器值。  a FIFO for receiving and buffering a counter value in the first memory.
10、 根据权利要求 9 所述的高速计数器, 其特征在于, 所述计数器还包括 第二存储器, 其中, 所述第二存储器为具有动态存取功能的存储器;  The high-speed counter according to claim 9, wherein the counter further includes a second memory, wherein the second memory is a memory having a dynamic access function;
所述处理单元, 还用于当所述 FIFO中有值, 且所述 FIFO与所述第二存储 器之间有空闲带宽时, 将所述 FIFO中的值向所述第二存储器中搬移;  The processing unit is further configured to: when a value exists in the FIFO, and a free bandwidth exists between the FIFO and the second memory, move a value in the FIFO to the second memory;
所述第二存储器, 用于接收并存储所述 FIFO中的值。  The second memory is configured to receive and store a value in the FIFO.
11、 根据权利要求 10所述的高速计数器, 其特征在于, 所述第一存储器和 所述第二存储器的更新速率不同。  The high speed counter according to claim 10, wherein the update rates of the first memory and the second memory are different.
PCT/CN2009/074983 2009-11-17 2009-11-17 High-speed counter processing method and counter WO2011060570A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2009/074983 WO2011060570A1 (en) 2009-11-17 2009-11-17 High-speed counter processing method and counter
CN200980153967.0A CN102203748B (en) 2009-11-17 2009-11-17 High-speed counter processing method and counter

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2009/074983 WO2011060570A1 (en) 2009-11-17 2009-11-17 High-speed counter processing method and counter

Publications (1)

Publication Number Publication Date
WO2011060570A1 true WO2011060570A1 (en) 2011-05-26

Family

ID=44059174

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2009/074983 WO2011060570A1 (en) 2009-11-17 2009-11-17 High-speed counter processing method and counter

Country Status (2)

Country Link
CN (1) CN102203748B (en)
WO (1) WO2011060570A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105786718A (en) * 2014-12-26 2016-07-20 中兴通讯股份有限公司 Counting processing method and device

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105119768A (en) * 2015-06-26 2015-12-02 华为技术有限公司 Field-programmable gate array FPGA and data storage method

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1641791A (en) * 2004-01-15 2005-07-20 国际商业机器公司 Concurrent refresh mode with distributed row address counters in an embedded DRAM
CN1726459A (en) * 2002-12-12 2006-01-25 皇家飞利浦电子股份有限公司 Counter based stride prediction for data prefetch
CN101515898A (en) * 2009-03-25 2009-08-26 华为技术有限公司 Method and device for managing statistical data of chip

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8417810B2 (en) * 2007-01-10 2013-04-09 Broadcom Corporation System and method for managing counters

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1726459A (en) * 2002-12-12 2006-01-25 皇家飞利浦电子股份有限公司 Counter based stride prediction for data prefetch
CN1641791A (en) * 2004-01-15 2005-07-20 国际商业机器公司 Concurrent refresh mode with distributed row address counters in an embedded DRAM
CN101515898A (en) * 2009-03-25 2009-08-26 华为技术有限公司 Method and device for managing statistical data of chip

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105786718A (en) * 2014-12-26 2016-07-20 中兴通讯股份有限公司 Counting processing method and device

Also Published As

Publication number Publication date
CN102203748A (en) 2011-09-28
CN102203748B (en) 2014-07-30

Similar Documents

Publication Publication Date Title
US10248350B2 (en) Queue management method and apparatus
US20120278400A1 (en) Effective Circuits in Packet-Switched Networks
US20080192765A1 (en) Apparatus and method for packet buffer management in IP network system
US11425057B2 (en) Packet processing
CN111124270A (en) Method, apparatus and computer program product for cache management
RU2641250C2 (en) Device and method of queue management
CN102882809B (en) Network speed-limiting method and device based on message buffering
CN105681864B (en) IP-based transport stream jitter removal method and device
US20110292795A1 (en) System and method for fair shared de-queue and drop arbitration in a buffer
CN104778132A (en) Multi-core processor directory cache replacement method
WO2011060570A1 (en) High-speed counter processing method and counter
WO2019109902A1 (en) Queue scheduling method and apparatus, communication device, and storage medium
WO2021259321A1 (en) Storage scheduling method, device, and storage medium
CN111949422B (en) Data multi-level cache and high-speed transmission recording method based on MQ and asynchronous IO
CN101227689A (en) Method and apparatus for reporting information
US10031884B2 (en) Storage apparatus and method for processing plurality of pieces of client data
CN111913815A (en) Call request processing method and device, electronic equipment and readable storage medium
CN108521611B (en) Anti-jitter video data access method and computer equipment
CN113378194B (en) Encryption and decryption operation acceleration method, system and storage medium
WO2020248857A1 (en) Data congestion control and bandwidth prediction method
CN113225263B (en) Flow request processing method and device and network chip
WO2018090573A1 (en) Buffer space management method and device, electronic apparatus, and storage medium
CN111126584B (en) Data write-back system
US20020003839A1 (en) MPEG picture processing apparatus and data transferring method using the apparatus
CN102158416A (en) Method and equipment for processing messages based on memory allocation

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 200980153967.0

Country of ref document: CN

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 09851362

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 09851362

Country of ref document: EP

Kind code of ref document: A1