Time service method and system of processor array

文档序号:1295936 发布日期:2020-08-07 浏览:22次 中文

阅读说明:本技术 一种处理器阵列的授时方法及系统 (Time service method and system of processor array ) 是由 张晓丹 赵伟 周广蕴 于 2020-06-17 设计创作,主要内容包括:本发明涉及一种处理器阵列的授时方法及系统,属于授时技术领域,解决了现有技术中授时方法具有芯片资源浪费,增加额外成本的问题。处理器阵列的授时方法包括:从处理器阵列中任意选择一个处理器作为主处理器,并且将主处理器的系统时钟作为参考时钟;由主处理器生成外部中断信号并且每隔预定时间向其他处理器发送外部中断信号;以及通过其他处理器接收外部中断信号并基于所述外部中断信号修正自身时间。在不额外增加硬件成本的情况下,资源能够得到最大限度利用,以达到同步授时的要求。(The invention relates to a time service method and a time service system of a processor array, belongs to the technical field of time service, and solves the problems that in the prior art, the time service method has chip resource waste and increases extra cost. The time service method of the processor array comprises the following steps: randomly selecting one processor from the processor array as a main processor, and taking a system clock of the main processor as a reference clock; generating an external interrupt signal by a main processor and transmitting the external interrupt signal to other processors at predetermined intervals; and receiving an external interrupt signal through the other processor and correcting the self time based on the external interrupt signal. Under the condition of not additionally increasing hardware cost, resources can be utilized to the maximum extent so as to meet the requirement of synchronous time service.)

1. A method of timing a processor array, comprising:

arbitrarily selecting one processor from the processor array as a main processor, and taking a system clock of the main processor as a reference clock;

generating, by the main processor, an external interrupt signal and transmitting the external interrupt signal to the other processors at predetermined intervals; and

and the other processors receive the external interrupt signal and correct self time based on the external interrupt signal.

2. The method of claim 1, wherein the processor array comprises two or more processors coupled to each other via a data bus, and wherein the system clock of each processor is based on an operating system time.

3. The time service method of the processor array according to claim 2, wherein the external interrupt signal is generated by a timer every predetermined time; each processor in the processor array registers an interrupt service routine corresponding to a timer for a timer driver in a board level support package (BSP) before the operating system is cured.

4. The method of claim 3, wherein generating an external interrupt signal and sending the external interrupt signal from the host processor to the other processors at predetermined intervals further comprises:

when the timing of the timer of the main processor reaches the preset time, triggering an external interrupt;

the interrupt service program of the main processor generates the external interrupt signal according to the external interrupt; and

sending the external interrupt signal by the main processor to the other processors through the data bus.

5. The method of claim 2, wherein receiving the external interrupt signal and correcting time by the other processor further comprises:

the other processor receiving the external interrupt signal from the main processor through the data bus;

judging an interrupt source and an interrupt type according to the external interrupt signal;

when the interrupt source is the main processor and the interrupt type is clock synchronization interrupt, the other processors carry out time correction in an interrupt service program; and

clearing all bits of the corresponding timers of the other processors.

6. A method for timing in a processor array according to any of claims 3 to 5, wherein the clock ticks of the operating system have a period of 1ms and the timer is initialised to generate an interrupt every 1 ms.

7. The method of claim 6,

the predetermined time is a multiple of the clock tick of the operating system in the range of 0.5s-2s, where the operating system modifies the clock tick count to a predetermined time/cycle of clock ticks × external interrupt times.

8. The method of claim 7, wherein the operating system is an embedded operating system and the predetermined time is 1 s.

9. The method of claim 5, wherein the lockstep interrupt has a highest priority.

10. A timing system for a processor array, comprising:

a selection module, configured to arbitrarily select one processor from the processor array as a main processor, and use a system clock of the main processor as a reference clock;

an interrupt module for generating an external interrupt signal by the main processor and transmitting the external interrupt signal to other processors at predetermined intervals; and

and the synchronization module is used for receiving the external interrupt signal through the other processors and correcting the self time based on the external interrupt signal.

Technical Field

The invention relates to the technical field of time service, in particular to a time service method and a time service system of a processor array.

Background

With the wide application of embedded products, the development of processors in the embedded field is also more and more rapid. Distributed systems have become the preferred architecture for application software systems due to their advantages of easy scalability, high reliability, and flexibility, and it is becoming more common to employ processor arrays to process transactions. The processor arrays are mutually independent and cannot provide a uniform global clock, and each process or module maintains the local clock thereof; due to inconsistency of the timing rate and the operating environment of the local clocks, even if all the local clocks are calibrated at a certain time, the local clocks are inconsistent after a period of time. In order to make these local clocks reach the same time value again, time service operation must be carried out, and only when the system clocks are synchronous, the respective processing tasks between the processors will not conflict, so as to ensure the stability and reliability of the system. Particularly in the embedded field with high reliability requirement, the system clock is the pulse of the embedded system, and all the time-related matters such as the delay of the system, the overtime judgment of the task processing, the scheduling period of the task and the like are related. If the system clocks of the processor array are not synchronous, cycle drift can be generated, and the whole system cannot work normally.

The time service synchronization technology has many implementation methods, one is to synchronize the time of the two by using the process time difference between the signal transmission and the signal reception (such as radio waves); one is to provide an external unified reference clock source to realize synchronous time service, which has high requirements on the external clock source and relatively high hardware cost and resource consumption. In addition, aiming at special scenes, the Network NTP protocol (Network time protocol, which is called Network time protocol) realizes that all equipment time in the local area Network keeps uniform and accurate by automatically judging Network delay.

Aiming at the problem of time service of a processor array based on an operating system and in the face of scenes with low precision requirements, the method can cause waste of chip resources and increase extra cost.

Disclosure of Invention

In view of the foregoing, embodiments of the present invention provide a timing method and system for a processor array, so as to solve the problems of chip resource waste and extra cost increase in the conventional timing method.

In one aspect, an embodiment of the present invention provides a time service method for a processor array, including: arbitrarily selecting one processor from the processor array as a main processor, and taking a system clock of the main processor as a reference clock; generating, by the main processor, an external interrupt signal and transmitting the external interrupt signal to the other processors at predetermined intervals; and receiving the external interrupt signal by the other processor and correcting the self time based on the external interrupt signal.

The beneficial effects of the above technical scheme are as follows: according to the time service method provided by the embodiment of the invention, resources can be utilized to the maximum extent under the condition that hardware cost is not additionally increased, and the requirement of synchronous time service is met.

In a further development of the above method, the processor array comprises more than two processors connected to each other by a data bus, wherein the system clock of each processor records the time based on the operating system.

Based on a further improvement of the above method, the external interrupt signal is generated by a timer every predetermined time; each processor in the processor array registers an interrupt service routine corresponding to a timer for a timer driver in a board level support package (BSP) before the operating system is cured.

Based on a further improvement of the above method, generating an external interrupt signal and transmitting the external interrupt signal from the main processor to the other processors at predetermined time intervals further comprises: when the timing of the timer of the main processor reaches the preset time, triggering an external interrupt; the interrupt service program of the main processor generates the external interrupt signal according to the external interrupt; and transmitting the external interrupt signal from the main processor to the other processors through the data bus.

In a further improvement of the above method, receiving, by the other processor, the external interrupt signal and correcting the time further includes: the other processor receiving the external interrupt signal from the main processor through the data bus; judging an interrupt source and an interrupt type according to the external interrupt signal; when the interrupt source is the main processor and the interrupt type is clock synchronization interrupt, the other processors carry out time correction in an interrupt service program; and clearing all bits of the corresponding timers of the other processors.

Based on a further improvement of the above method, the period of the clock ticks of the operating system is 1ms and the timer is initialized to generate an interrupt every 1 ms.

Based on a further improvement of the above method, the predetermined time is a multiple of the clock ticks of the operating system in the range of 0.5s-2s, wherein the operating system modifies the clock ticks count to (predetermined time/period of clock ticks) × external interrupt times.

Based on a further improvement of the above method, the operating system is an embedded operating system and the predetermined time is 1 s.

Based on a further improvement of the above method, the lockstep interrupt has the highest priority.

In another aspect, an embodiment of the present invention provides a time service system for a processor array, including: a selection module, configured to arbitrarily select one processor from the processor array as a main processor, and use a system clock of the main processor as a reference clock; an interrupt module for generating an external interrupt signal by the main processor and transmitting the external interrupt signal to other processors at predetermined intervals; and the synchronization module is used for receiving the external interrupt signal through the other processors and correcting the self time based on the external interrupt signal.

Compared with the prior art, the invention can realize at least one of the following beneficial effects:

1. the software level meets the sub-microsecond precision, and no additional hardware resource and cost are needed;

2. under the condition that the preset time is a multiple of the clock beat of the operating system, the requirement of time service precision can be met by adjusting the preset time;

3. the clock synchronization interrupt is set to have the highest priority, so that other processors do not need to wait, time is corrected in time, and time service precision is further improved; and

4. the hardware resources of the processor can be utilized to the maximum extent, and the energy consumption ratio is improved.

In the invention, the technical schemes can be combined with each other to realize more preferable combination schemes. Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and drawings.

Drawings

The drawings are only for purposes of illustrating particular embodiments and are not to be construed as limiting the invention, wherein like reference numerals are used to designate like parts throughout.

FIG. 1 is a flow chart of a method for timing a processor array according to an embodiment of the invention;

FIG. 2 is a platform for performing a timing method of a processor array according to an embodiment of the present invention; and

FIG. 3 is a block diagram of a timing system for a processor array according to an embodiment of the invention.

Reference numerals:

202-a power supply; 204-a main processor; 206. 208, 210-a processor; 212-other peripheral devices; 302-a selection module; 304-an interrupt module; and 306-a synchronization module;

Detailed Description

The accompanying drawings, which are incorporated in and constitute a part of this application, illustrate preferred embodiments of the invention and together with the description, serve to explain the principles of the invention and not to limit the scope of the invention.

One embodiment of the present invention discloses a timing method for a processor array, as shown in FIG. 1. The time service method of the processor array comprises the following steps: step S102, arbitrarily selecting one processor from the processor array as a main processor, and taking a system clock of the main processor as a reference clock; step S104, generating an external interrupt signal by the main processor and sending the external interrupt signal to other processors at preset time intervals; and step S106, the other processors receive the external interrupt signal and revise their own time based on the external interrupt signal.

Compared with the prior art, the time service method provided by the embodiment can utilize resources to the maximum extent without additionally increasing hardware cost, and meets the requirement of synchronous time service.

Hereinafter, a timing method of a processor array according to an embodiment of the present invention will be described in detail with reference to fig. 1 and 2.

Referring to fig. 1, a timing method of a processor array includes: step S102, one processor in the processor array is arbitrarily selected as a main processor, and the system clock of the main processor is used as a reference clock. The processor array includes two or more processors connected to each other by a data bus, wherein a system clock of each processor records time based on an operating system. In fig. 2, the processor array includes a main processor 204 and other processors, such as a processor 206, a processor 208, and a processor 210. The operating platform is powered by a power supply 202. In other embodiments, the processor array includes a main processor and one or more other processors. The number of processor arrays in fig. 2 is for illustrative purposes only and is not intended to limit the present invention. The clock ticks of the operating system have a period of 1ms and the timer is initialized to generate an interrupt every 1 ms.

With continued reference to fig. 1, after the main processor is selected, it proceeds to step S104, where an external interrupt signal is generated by the main processor and transmitted to other processors at predetermined time intervals. Specifically, generating the external interrupt signal and transmitting the external interrupt signal from the main processor to the other processors at every predetermined time further includes: when the timing of the timer of the main processor reaches the preset time, triggering external interruption; the interrupt service program of the main processor generates an external interrupt signal according to the external interrupt; and sending an external interrupt signal from the main processor to the other processors through the data bus. The external interrupt signal is generated by a timer every the predetermined time; each processor in the processor array registers an interrupt service routine corresponding to a timer for a timer driver in the board level support packet BSP before the operating system is solidified. The predetermined time is a multiple of the clock ticks of the operating system, wherein the predetermined time is a multiple of the clock ticks of the operating system in the range of 0.5s-2 s. Different time service precision requirements can be met by adjusting the preset time.

With continued reference to FIG. 1, after sending the external interrupt signal, proceeding to step S106, receiving the external interrupt signal and correcting the time by the other processors, the receiving the external interrupt signal and correcting the time by the other processors further includes the other processors receiving the external interrupt signal from the main processor through the data bus, determining an interrupt source and an interrupt type according to the external interrupt signal, the other processors performing time correction at the corresponding interrupt service program when the interrupt source is the main processor and the interrupt type is the clock-synchronous interrupt, and clearing all bits of the corresponding timers of the other processors, preferably, the predetermined time is a multiple of a clock tick of the operating system in a range of 0.5S-2S, wherein the operating system modifies a clock tick count to (a period of the predetermined time/clock tick) × external interrupt times, i.e., 1000 × external interrupt times.

Hereinafter, referring to fig. 2, a time service method of a processor array based on the hawk-winged operating system is described in detail by taking the processor array as an example.

The embodiment discloses a processor array sub-microsecond time service method based on a Haiying wing-glow operating system, and the time service method is a mode of synchronizing system clocks of the processor array on the basis of the Haiying wing-glow operating system. The method is based on the platform operation as shown in FIG. 2, the processor array is mainly composed of 4 ARM chips and other peripheral devices 212, the platform is uniformly powered by the same power supply, the interrupt controllers among the processors are connected, the clocks of the processors are in microsecond level, and the time service precision of the embodiment is also in microsecond level. The sea eagle wing glow embedded real-time operating system is suitable for an embedded system, has high safety and high reliability, and is well applied to the field of aerospace.

The implementation flow of the method comprises the following steps:

step S1 is selecting a master processor in the processor array with its clock as the unified reference clock.

Preferably, the system clock of the main processor is used as the unified reference clock, and one processor in the processor array is selected as the main processor, and the clock of the main processor is used as the unified reference clock.

In the processor array, the system clock of each processor is based on the operating system to record time, the period of clock beat in the operating system is set to be 1ms, after the initialization of the timer, an interruption is generated every 1ms, the time is increased by 1ms, the counter bit is reset, when the time is acquired, the system time can be accurately recorded to nanosecond through the clock beat number 1ms and the value of the counter at the moment.

Step S2: the main processor sends an external interrupt to the other processors every 1 s. And the system clock of the main processor serves as a uniform reference clock and sends external interrupts to other processors every 1 s. The interrupt is generated by a timer, and further, an interrupt service program is registered in a BSP (Board Support Package) to a timer driver before the operating system is solidified, so that an external interrupt is sent every 1 s.

The main processor sends external interrupt to other processors every 1s, wherein the external interrupt is triggered by a timer, and once the timer counts 1s, the external interrupt is triggered; specifically, an interrupt service routine is registered in the BSP for the timer driver before the operating system is cured, which initiates, configures, and enables the interrupt controller accordingly.

When the platform is powered on to run, the operating system can initialize the interrupt vector table and some hardware, the timer interrupt triggers the external interrupt of other processors, and the other processors judge the interrupt source and execute the corresponding interrupt service programs.

Step S3: and the other processors receive the external interrupt and correct the self time.

The other processors receive the external interrupt, and the correction of the self time means that in the interrupt service program, the clock beat count is modified to 1000 times of the external interrupt times, and then all bits of the counter of the current processor are cleared to ensure the time consistency, namely, the aim of time service synchronization is achieved.

The other processors get the modified clock tick count, i.e., get their own time.

Specifically, the other processors receive the external interrupt, that is, after receiving a timer interrupt signal sent by the main processor, the slave processors find and execute a corresponding interrupt service program according to an interrupt vector number; in particular, this interrupt needs to be handled in time, with the highest priority. The time for correcting the own time by the respective operating systems is that time correction is specifically carried out in the interrupt service program, the clock beat count is modified to 1000 times of external interrupt times, and then all bits of the counter of the current processor are cleared to ensure the time consistency.

The processor array time service method based on the operating system has the advantages that the precision can reach a sub-microsecond level, and the error is less than 1 microsecond.

The invention discloses a time service system of a processor array. Hereinafter, a timing system of a processor array will be described with reference to fig. 3.

Referring to FIG. 3, a timing system for a processor array includes: a selection module 302, configured to arbitrarily select one processor from the processor array as a master processor, and use a system clock of the master processor as a reference clock; an interrupt module 304 for generating an external interrupt signal by the main processor and transmitting the external interrupt signal to the other processors at predetermined time intervals; and a synchronization module 306 for receiving an external interrupt signal through the other processor and correcting its own time based on the external interrupt signal.

In addition, the time service system of the processor array also comprises a plurality of other modules. Since the timing system of the processor array corresponds to the timing method of the processor array, the detailed description of other modules is omitted to avoid redundancy.

Compared with the prior art, the invention can realize at least one of the following beneficial effects:

1. the software level meets the sub-microsecond precision, and no additional hardware resource and cost are needed;

2. under the condition that the preset time is a multiple of the clock beat of the operating system, the requirement of time service precision can be met by adjusting the preset time;

3. the clock synchronization interrupt is set to have the highest priority, so that other processors do not need to wait, time is corrected in time, and time service precision is further improved; and

4. the hardware resources of the processor can be utilized to the maximum extent, and the energy consumption ratio is improved.

Those skilled in the art will appreciate that all or part of the flow of the method implementing the above embodiments may be implemented by a computer program, which is stored in a computer readable storage medium, to instruct related hardware. The computer readable storage medium is a magnetic disk, an optical disk, a read-only memory or a random access memory.

The above description is only for the preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention.

9页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:显示屏和电子设备

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!