A system and method for simulating hardware timing
By designing a system that simulates hardware timing and using the coordinated work of the task distribution unit and the task processing unit, the problems of low simulation and simulation efficiency and poor scalability in the existing technology are solved, and efficient hardware function simulation and simulation on a general platform are realized, and R&D efficiency is improved.
Patent Information
- Application Number
- CN202111623663.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-28
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2041-12-28
AI Technical Summary
The prior art is inefficient, poor scalability when simulating and simulating the hardware functions of network switching chips, and requires special hardware equipment support, resulting in complex and time-consuming development process.
A system that simulates hardware timing is designed, including a user input unit, a task processing unit and a task distribution unit. The task distribution unit determines whether a user command has been received, and clocks are incremented and clocked when no user commands are received, so as to realize scheduling and timing alignment of the task processing unit.
It realizes fast and efficient hardware function simulation and simulation, and can be executed on general computers and servers without the need for special hardware platforms. It has excellent scalability and efficiency, suitable for collaborative development of multiple teams, improving R&D and verification efficiency.
Smart Images

Figure CN114281481B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of network communication, and in particular to a system for simulating hardware timing and a method for simulating hardware timing based on the system. Background Art
[0002] In the process of network communication, the network switching device is used to process the message. The network switching chip is the core component of the network switching device, which includes multiple message processing modules, and these modules are executed concurrently. Figure 1 As shown, the network switching chip includes a message receiving module, a message parsing module, a message searching module, a message editing module and a message sending module that are executed concurrently. These modules execute corresponding functions through clock commands issued by a clock source, and the output of the previous module is the input of the next module. In the design process of the network switching chip, how to quickly and efficiently simulate and emulate the hardware functions is a key link in the chip development process. At present, FGPA and EAD tools are often used for simulation and emulation. However, these two methods have the disadvantages of low efficiency and poor scalability, and most of the time require special hardware equipment support. For example, it takes a long time to make an FPGA program, and when there is a problem with the program, it takes a long time to adjust it. Summary of the invention
[0003] The purpose of the present invention is to provide a system for simulating hardware timing, which can quickly and efficiently simulate and simulate hardware functions. At the same time, a method for simulating hardware timing based on the system is also provided.
[0004] To achieve the above object, the present invention provides a system for simulating hardware timing, the system comprising:
[0005] A user input unit, used for a user to input a user command;
[0006] At least one task processing unit, configured to parse the received command, and execute the user command and feedback a message to the task distribution unit when determining that the command is a user command, and execute a corresponding function and feedback a message to the task distribution unit when determining that the command is a clock command;
[0007] The task distribution unit is used to determine whether a user command has been received, and when a user command is received, traverse all task processing units and send the user command to the task processing unit, and wait for receiving a feedback message, and further send a feedback message to the user input unit when the received feedback message is a feedback message generated when the user command is executed; when no user command is received, increment the clock and generate a clock command, traverse all task processing units and send the clock command to the task processing unit, and wait for receiving a feedback message, and further send a feedback message to the user input unit when the received feedback message is a feedback message generated when the user command is executed.
[0008] Preferably, the task unit increments the clock and generates the clock command when no user command is received, comprising:
[0009] The task distribution unit determines whether all task processing units have completed executing corresponding functions, and after completing executing corresponding functions, performs clock increment and generates a clock command.
[0010] Preferably, the task distribution unit determines whether the corresponding task has been executed according to the feedback message sent by each task processing unit.
[0011] Preferably, the task distribution unit serves as a main process, and each task processing unit serves as a sub-process of the main process.
[0012] Preferably, the task distribution unit serves as a main process, and each task processing unit serves as a sub-thread of the main process.
[0013] The present invention also discloses a method for simulating hardware timing, the method comprising:
[0014] The task distribution unit determines whether a user command is received, and when a user command is received, traverses all task processing units and sends the user command to the task processing unit, and waits to receive a feedback message, and when no user command is received, increments the clock and generates a clock command, traverses all task processing units and sends the clock command to the task processing unit;
[0015] The task processing unit analyzes the received command, and when determining that the command is a user command, executes the user command and feeds back a message to the task distribution unit; when determining that the command is a clock command, executes the corresponding function and feeds back a message to the task distribution unit;
[0016] The task distribution unit receives the feedback message, and sends the feedback message to the user when the received feedback message is a feedback message generated when executing the user command.
[0017] Preferably, the step of incrementing the clock and generating a clock command when no user command is received comprises:
[0018] The task distribution unit determines whether all task processing units have completed executing corresponding functions, and after completing executing corresponding functions, performs clock increment and generates a clock command.
[0019] Preferably, the task distribution unit determines whether the corresponding task has been executed according to the feedback message sent by each task processing unit.
[0020] Preferably, the task distribution unit serves as a main process, and each task processing unit serves as a sub-process of the main process.
[0021] Preferably, the task distribution unit serves as a main process, and each task processing unit serves as a sub-thread of the main process.
[0022] The beneficial effects of the present invention are:
[0023] The present invention can simulate and simulate hardware functions quickly and efficiently without the need for a special hardware platform. It can be executed on general computers and servers, and can be run through the CPU, with good scalability and leading edge. At the same time, high-level languages can be used to simulate and simulate the functions and algorithms of the corresponding hardware, with the advantages of short R&D cycle and rapid iteration. In addition, high-level languages have a wide audience and low entry threshold, making them suitable for collaborative development by multiple teams, thereby improving R&D and verification efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 It is a schematic diagram of the message processing flow in the network switching chip in the prior art;
[0025] Figure 2 is a system block diagram of simulating hardware timing in one embodiment of the present invention;
[0026] Figure 3 It is the processing flow when the user enters a command;
[0027] Figure 4 It is a processing flow chart of the task distribution unit;
[0028] Figure 5 It is a processing flow chart of the task processing unit. DETAILED DESCRIPTION
[0029] The technical solutions of the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings of the present invention.
[0030] Combination Figure 2 to Figure 5As shown, a system for simulating hardware timing disclosed by the present invention includes a user input unit, at least one task processing unit, and a task distribution unit. The user input unit is used for the user to input user commands, and can also return the status and execution results of the simulation program. The task processing unit is used to parse the received command, execute the user command when it is determined that the command is a user command, and feedback a message to the task distribution unit after the execution is completed, and feedback a message to the task distribution unit after executing the corresponding function when it is determined that the command is a clock command. The task distribution unit is connected to the user input unit and is also connected to each task processing unit. It is used to determine whether a user command is received, traverse all task processing units when receiving a user command, send the user command to the task processing unit, and wait for receiving a feedback message, and further send a feedback message to the user input unit when the received feedback message is a feedback message generated when executing the user command; when no user command is received, the clock is incremented and a clock command is generated, traverse all task processing units and send the clock command to the task processing unit, and wait for feedback messages, and further send feedback messages to the user input unit when the received feedback message is a feedback message generated when executing the user command.
[0031] In this embodiment, the number of task processing units can be set according to actual needs. As shown in the figure, five task processing units are required, corresponding to the message receiving module, message parsing module, message search module, message editing module and message sending module in the network switching chip. Each task processing unit is scheduled and time-aligned by the task distribution unit to realize the simulation hardware function.
[0032] Specifically, Figure 3 As shown, during the operation of the system, the user can input corresponding user commands according to actual needs, and the user commands here include but are not limited to configuration commands and positioning commands in the simulation process. In the process of the user inputting the user command through the user input unit, it is necessary to connect the console and register the command line. After completing the operation, the system waits for the user to input. After the user inputs the corresponding content, it is further determined whether the content is a valid input. When it is determined to be an invalid input, it is further waited for the user to input a valid input. When it is determined to be a valid input, it is further determined whether the content is a help command. When it is determined to be a help command, help information is further displayed, and the user is waited for input again. When it is determined not to be a help command, it is further determined whether the content is an exit command. When it is determined to be an exit command, the program is exited. When it is determined to be a non-exit command, the command is sent to the task distribution unit, and the feedback result is further waited and displayed, that is, whether the command is sent successfully, the status of the simulation program is waited, and the execution result is waited, etc. After waiting and displaying the feedback result, it is further determined whether the user has closed the connection. When it is determined that the connection is closed, the program is closed, otherwise, the user input is continued.
[0033] Furthermore, if Figure 4 As shown, the task distribution unit first determines whether the received command is a user command, that is, during the simulation operation, the user can input the user command at any time according to actual needs. When it is determined that the user command has been received, all task processing units are further traversed, and the received user command is sent to all task processing units. After traversing all task processing units, feedback information after the task processing unit executes the user command is further waited.
[0034] When it is determined that no user command has been received, the clock increment processing is performed and a clock command is generated, which can control the task processing unit to execute the corresponding task. After the clock command is generated, all task processing units are further traversed and the clock command is sent to all task processing units. After all task processing units are traversed, feedback information after the task processing unit executes the clock command is further waited.
[0035] After the task distribution unit receives the feedback information, it further determines whether the feedback information is feedback information generated when the task processing unit executes the user command. The feedback information received by the task distribution unit includes feedback information generated when the task processing unit executes the user command and feedback information generated when the task processing unit executes the clock command. After determining that the feedback information is feedback information generated when the task distribution unit executes the user command, the feedback information is further sent to the user input unit, and the user then obtains the status and execution results of the simulation program according to the feedback information.
[0036] Furthermore, if Figure 5 As shown, after the task processing unit receives the command sent by the task distribution unit, it further parses the command to determine whether the command is a user command. When it is determined that the received command is a user command, the user command is further executed, and feedback information is sent to the task distribution unit after the execution is completed. When it is determined that the received command is a clock command, the corresponding task is further executed according to the clock command. For example, when the task processing unit simulates the execution of message parsing, it simulates the execution of the message parsing function after receiving the clock command, and sends feedback information to the task distribution unit after the execution is completed.
[0037] In this embodiment, each task processing unit returns a feedback message to the task distribution unit after executing the corresponding clock command. The task distribution unit can determine whether the corresponding task processing unit has completed the corresponding task based on the received feedback message. When all task processing units have completed the corresponding tasks, the task distribution unit sends the next clock command, thereby ensuring the timing alignment between all task processing units.
[0038] Furthermore, in order to improve the efficiency of the simulation program, the task distribution unit is used as the main process of the program, and each task processing unit is used as a subprocess or subthread of the main process, thereby ensuring that all task processing units are executed in parallel. In addition, by adopting a multi-thread or multi-subprocess mechanism, it can be efficiently executed on a multi-core multi-thread CPU to ensure that all task processing units are executed in parallel. During implementation, after the task distribution unit sends a clock command each time, the time consumed by the entire simulation is the time it takes for the last task processing unit to return a feedback message, rather than the sum of the time it takes for all task processing units to return feedback messages, which greatly improves the efficiency of the simulation program.
[0039] Furthermore, to realize the communication between the main process and the subprocess or between the main process and the subthread, the corresponding communication mechanism can be selected according to the actual needs. The selection of the communication mechanism mainly depends on the selected high-level programming language. For example, when a relatively low-level language such as C / C++ is selected, the Socket communication mechanism can be used. When a relatively high-level language such as Python is selected, the Pipe and Queue mechanisms can be used. For the communication between the main processes, such as the communication between the task distribution unit and the user input unit, the Socket communication mechanism can be used.
[0040] The system for simulating hardware timing described in the present invention can simulate and simulate hardware functions quickly and efficiently, without the need for a special hardware platform, and can be executed on a general-purpose computer and server, that is, it can be run through a CPU, with good scalability and leading performance. At the same time, high-level languages can be used to simulate and simulate the functions and algorithms of the corresponding hardware, with the advantages of a short R&D cycle and rapid iteration, and high-level languages have a wide audience and a low entry threshold, making them suitable for collaborative development by multiple teams, thereby improving R&D and verification efficiency.
[0041] The technical contents and technical features of the present invention have been disclosed as above. However, those skilled in the art may still make various substitutions and modifications based on the teachings and disclosures of the present invention without departing from the spirit of the present invention. Therefore, the protection scope of the present invention should not be limited to the contents disclosed in the embodiments, but should include various substitutions and modifications that do not depart from the present invention and are covered by the claims of this patent application.
Claims
1. A system for simulating hardware timing, characterized in that: The system comprises: A user input unit, used for a user to input a user command; At least one task processing unit, configured to parse the received command, and execute the user command and feedback a message to the task distribution unit when determining that the command is a user command, and execute a corresponding function and feedback a message to the task distribution unit when determining that the command is a clock command; The task distribution unit is used to determine whether a user command has been received, and when a user command is received, traverse all task processing units and send the user command to the task processing unit, and wait for receiving a feedback message, and further send a feedback message to the user input unit when the received feedback message is a feedback message generated when the user command is executed; when no user command is received, increment the clock and generate a clock command, traverse all task processing units and send the clock command to the task processing unit, and wait for receiving a feedback message, and further send a feedback message to the user input unit when the received feedback message is a feedback message generated when the user command is executed.
2. The system according to claim 1, wherein the task distribution unit increments the clock and generates the clock command when no user command is received, comprising: The task distribution unit determines whether all task processing units have completed executing corresponding functions, and after completing executing corresponding functions, performs clock increment and generates a clock command.
3. According to the system of claim 2, the task distribution unit determines whether the corresponding task has been executed based on the feedback message sent by each task processing unit.
4. According to the system of claim 1, the task distribution unit serves as a main process, and each task processing unit serves as a sub-process of the main process.
5. According to the system of claim 1, the task distribution unit serves as a main process, and each task processing unit serves as a sub-thread of the main process.
6. A method for implementing simulated hardware timing based on the system of claim 1, characterized in that: The method comprises: The task distribution unit determines whether a user command is received, and when a user command is received, traverses all task processing units and sends the user command to the task processing unit, and waits to receive a feedback message, and when no user command is received, increments the clock and generates a clock command, traverses all task processing units and sends the clock command to the task processing unit; The task processing unit analyzes the received command, and when determining that the command is a user command, executes the user command and feeds back a message to the task distribution unit; when determining that the command is a clock command, executes the corresponding function and feeds back a message to the task distribution unit; The task distribution unit receives the feedback message, and sends the feedback message to the user when the received feedback message is a feedback message generated when executing the user command.
7. The method according to claim 6, wherein the step of incrementing the clock and generating the clock command when no user command is received comprises: The task distribution unit determines whether all task processing units have completed executing corresponding functions, and after completing executing corresponding functions, performs clock increment and generates a clock command.
8. The method according to claim 6, wherein the task distribution unit determines whether the corresponding task has been executed according to the feedback message sent by each task processing unit.
9. The method according to claim 6, wherein the task distribution unit serves as a main process, and each task processing unit serves as a sub-process of the main process.
10. The method according to claim 6, wherein the task distribution unit serves as a main process, and each task processing unit serves as a sub-thread of the main process.
Citation Information
Patent Citations
Multi-clock multitask parallel real-time simulation system and method
CN107220107A
Method of emulating asynchronous processing
JP2007334392A