CN113962063B - Simulation experiment method and system for Web3D virtual single-chip microcomputer - Google Patents

Simulation experiment method and system for Web3D virtual single-chip microcomputer Download PDF

Info

Publication number
CN113962063B
CN113962063B CN202111129301.0A CN202111129301A CN113962063B CN 113962063 B CN113962063 B CN 113962063B CN 202111129301 A CN202111129301 A CN 202111129301A CN 113962063 B CN113962063 B CN 113962063B
Authority
CN
China
Prior art keywords
virtual
chip microcomputer
development board
virtual single
code
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111129301.0A
Other languages
Chinese (zh)
Other versions
CN113962063A (en
Inventor
王进
邹电
王静
张应宝
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Changsha University of Science and Technology
Original Assignee
Changsha University of Science and Technology
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 Changsha University of Science and Technology filed Critical Changsha University of Science and Technology
Priority to CN202111129301.0A priority Critical patent/CN113962063B/en
Publication of CN113962063A publication Critical patent/CN113962063A/en
Application granted granted Critical
Publication of CN113962063B publication Critical patent/CN113962063B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/20Design optimisation, verification or simulation
    • GPHYSICS
    • G09EDUCATION; CRYPTOGRAPHY; DISPLAY; ADVERTISING; SEALS
    • G09BEDUCATIONAL OR DEMONSTRATION APPLIANCES; APPLIANCES FOR TEACHING, OR COMMUNICATING WITH, THE BLIND, DEAF OR MUTE; MODELS; PLANETARIA; GLOBES; MAPS; DIAGRAMS
    • G09B9/00Simulators for teaching or training purposes

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • Educational Administration (AREA)
  • Educational Technology (AREA)
  • Computer Hardware Design (AREA)
  • Evolutionary Computation (AREA)
  • Geometry (AREA)
  • General Engineering & Computer Science (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application discloses a simulation experiment method of a Web3D virtual single-chip microcomputer, which comprises the following steps: s1, entering a virtual single-chip microcomputer 3D simulation system, and carrying out simulation experiments after initializing simulation experiments on a virtual single-chip microcomputer development board of the virtual single-chip microcomputer 3D simulation system; s2, connecting the virtual external power supply with a virtual single-chip microcomputer development board, and starting a first timing state detection of the virtual single-chip microcomputer development board; s3, judging and detecting whether a C language control code is configured in the simulation system; s4, converting codes written into the system into JavaScript codes, and synchronizing the JavaScript codes into a CPU of a virtual single chip microcomputer development board; and S5, switching on a power switch to supply power to the virtual component, so that the virtual component is scheduled to start working according to a code program running and recording or a CPU default program, and a simulation experiment is carried out. According to the technical scheme, the virtual simulation experiment of the singlechip can be realized, a hardware circuit can be simulated, dynamic embedded code programming can be performed, and the cost of the singlechip experiment teaching is saved.

Description

Simulation experiment method and system for Web3D virtual single-chip microcomputer
Technical Field
The application relates to the technical field of virtual single-chip microcomputer, in particular to a simulation experiment method and system of a Web3D virtual single-chip microcomputer.
Background
The principle and application of the singlechip are a course with strong practicability, and the theory knowledge abstract involved by the principle and application is difficult to understand. The experimental operation is usually needed, and the independent design research and development can be finally achieved, and the theoretical knowledge cannot be understood more deeply without the experiment and the further design operation. Therefore, the practical operation of the singlechip is an indispensable link for learning the singlechip theory.
At present, for the Web front-end technology of single-chip microcomputer virtual simulation, the traditional simulation of electronic hardware is mostly in a 2D layer, and the virtual simulation in a 3D layer can only perform the simulation of functions and cannot achieve embedded code programming. The real singlechip is adopted, so that the real singlechip is high in consumption cost and has the problem of frequent damage and incapability of use, and therefore, the real singlechip is also required to be stored at ordinary times, is easily limited by a specific field during use, is inconvenient for a plurality of experiments, and is generally subjected to virtual simulation at present; however, the virtual simulation of the singlechip in the 3D scene still stays in the stage of the traditional static instruction and event triggering scheduling function, but the capability of dynamically embedding codes to realize the scheduling system function aiming at the singlechip and the like cannot be realized, so that the effect of the virtual simulation cannot meet the expected requirement.
Therefore, how to provide a simulation experiment method and system for a Web3D virtual single-chip microcomputer, which can realize the virtual simulation experiment on the single-chip microcomputer, can simulate a hardware circuit, can perform dynamic embedded code programming, enhance the simulation effect and save the cost of single-chip microcomputer simulation, has become a technical problem to be solved by those skilled in the art.
Disclosure of Invention
In order to solve the technical problems, the application provides a simulation experiment method and a simulation experiment system for a Web3D virtual single-chip microcomputer, which can realize the virtual simulation experiment of the single-chip microcomputer, can simulate a hardware circuit, can perform dynamic embedded code programming, enhance the simulation effect and save the simulation cost of the single-chip microcomputer.
The technical scheme provided by the application is as follows:
The application provides a simulation experiment method of a Web3D virtual single-chip microcomputer, which comprises the following steps:
s1, entering a virtual single-chip microcomputer 3D simulation system, initializing a simulation experiment of a virtual single-chip microcomputer development board, and then performing the simulation experiment;
S2, connecting a virtual external power supply with a power interface of the virtual single-chip microcomputer development board through a power interface, providing external power supply input for the simulation system, and starting first timing state detection of the virtual single-chip microcomputer development board;
S3, judging and detecting whether a C language control code is configured in the simulation system, and writing the C language control code into the simulation system according to a detection result and user requirements;
s4, converting the C language control code written into the simulation system into a JavaScript code, and synchronizing the JavaScript code into a CPU of the virtual single-chip development board;
And S5, then, a power switch on the virtual single-chip microcomputer development board in the simulation system is turned on to supply power to the virtual components on the virtual single-chip microcomputer development board, so that the virtual components are scheduled to start working according to the running and burnt code program or the CPU default program, and a virtual single-chip microcomputer simulation experiment is performed.
Further, in a preferred mode of the present invention, in the step S3, the specific step of determining whether to configure the C language control code in the system includes:
If the fact that the C language control code is not written in the simulation system is detected, a code input editing box is called to write the C language control code into the simulation system through a virtual computer, and then the C language control code is operated and burnt; if it is detected that the C language control code has been written in the simulation system and the running burning operation is completed, step S4 is directly entered.
Further, in a preferred mode of the present invention, in the step S4, the specific step of converting the C language control code into JavaScript code includes:
s401, firstly, carrying out cross-domain transmission on the C language control code in a character string mode;
S402, removing block annotation and line annotation in the C language control code character string, and then removing the line where the reference header file is located;
S403, removing the row of the macro definition object after global replacement, then removing sbit the row of the macro definition object, agreeing with a port fixed writing method, and converting an array writing method in a C language into an array writing method in JavaScript;
S404, removing C language keywords which cannot act in JavaScript in the C language control code, and converting variable keywords defined in the C language into var or let keywords;
S405, removing using and interrupt and defined contents thereof, increasing added value of functions where the using and interrupt are located, and then increasing judgment on whether the virtual single chip development board supplies power or not;
S406, removing function statement of the C language, and then adding function keywords in front of the function names of the C language;
S407, replacing the delay function in the C language control code character string, and adding head processing and tail processing which are convenient for function call;
and S408, finally, converting the converted C language code character string into JavaScript codes through a Function object of JavaScript, and completing code conversion processing.
Further, in a preferred mode of the present invention, the C language keywords that cannot be acted on include: void keywords, unsigned keywords, signed keywords, and const keywords.
Further, in a preferred mode of the present invention, the defining variable key includes: bit key, char key, int key, and long key.
Further, in a preferred mode of the present invention, the simulation experiment initialization includes: loading a 3D virtual simulation model, adjusting the positions of the virtual components and determining the pin connection relation of the virtual components.
Further, in a preferred mode of the present invention, in step S2, the first timing state detection is used to detect an analog power supply condition of the virtual external power supply to the virtual single chip development board.
Further, in a preferred mode of the present invention, in the step S6, it includes: s601, after the virtual components start to work, performing second timing state detection on the virtual single-chip microcomputer development board, detecting the CPU port state of the virtual single-chip microcomputer development board at fixed time, and continuously scheduling the virtual components to work.
Further, in a preferred mode of the present invention, the present invention provides a simulation experiment system for a Web3D virtual single-chip microcomputer, including: a virtual single-chip microcomputer development board; a virtual external power supply connected with the virtual single chip microcomputer development board; the virtual external power supply is connected with a power interface of the virtual single-chip microcomputer development board through a power supply plug, and analog power supply input is provided for the virtual single-chip microcomputer development board; the virtual computer is connected with the virtual single-chip microcomputer development board; the code input editing box is connected with the display of the virtual computer in an embedded mode and is used for writing a C language control code; the burning tool is arranged between the virtual single chip microcomputer development board and the virtual computer; a transcoder connected to the burning tool; the code converter is used for converting the C language control code into JavaScript code after running and burning and synchronizing the JavaScript code into the CPU of the virtual single-chip microcomputer development board; the virtual component is arranged on the virtual single-chip microcomputer development board and connected with the virtual single-chip microcomputer development board through pins; and the virtual external electronic component is connected with the function expansion interface of the virtual single chip microcomputer development board.
Further, in a preferred mode of the present invention, the virtual component includes: the virtual power switch is used for switching on the power input of the virtual external power supply for the virtual single-chip microcomputer development board; the first timing state detector is connected with the virtual single chip microcomputer development board; the first timing state detector is used for detecting an analog power supply condition of the virtual external power supply; the second timing state detector is arranged on the CPU port of the virtual single-chip development board; the second timing state detector is used for detecting the state of the CPU port and continuously scheduling the work of each virtual component.
Compared with the prior art, the simulation experiment method for the Web3D virtual single-chip microcomputer provided by the invention comprises the following steps: s1, entering a virtual single-chip microcomputer 3D simulation system, initializing a simulation experiment of a virtual single-chip microcomputer development board, and then performing the simulation experiment; s2, connecting a virtual external power supply with a power interface of the virtual single-chip microcomputer development board through a power interface, providing external power supply input for the simulation system, and starting first timing state detection of the virtual single-chip microcomputer development board; s3, judging and detecting whether a C language control code is configured in the simulation system, and writing the C language control code into the simulation system according to a detection result and user requirements; s4, converting the C language control code written into the simulation system into a JavaScript code, and synchronizing the JavaScript code into a CPU of the virtual single-chip development board; and S5, then, a power switch on the virtual single-chip microcomputer development board in the simulation system is turned on to supply power to the virtual components on the virtual single-chip microcomputer development board, so that the virtual components are scheduled to start working according to the running and burnt code program or the CPU default program, and a virtual single-chip microcomputer simulation experiment is performed. According to the invention, on the basis of carrying out 3D virtual simulation on the virtual single-chip microcomputer development board, the capability of converting the C language control code into the executable logic code in the virtual single-chip microcomputer development board is added, so that the effect of the same function as that of an actual single-chip microcomputer circuit is presented, the written C language control code can normally run after being burnt into the single-chip microcomputer development board through running a burning tool, the virtual simulation experiment of the single-chip microcomputer can be realized, a hardware circuit can be simulated, dynamic embedded code programming can be carried out, the cost of real hardware is greatly saved, the efficiency of a user for learning the single-chip microcomputer is improved through a better 3D effect, and a user is not limited by regions and hardware equipment.
Drawings
In order to more clearly illustrate the embodiments of the application or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of steps of a simulation experiment method of a Web3D virtual single-chip microcomputer provided by an embodiment of the invention;
FIG. 2 is a flowchart illustrating steps for converting a C language control code into a JavaScript code according to an embodiment of the present invention;
FIG. 3 is a frame flow chart of a simulation experiment method of a Web3D virtual single-chip microcomputer provided by the embodiment of the invention;
FIG. 4 is a schematic block diagram of a Web3D virtual single-chip microcomputer simulation experiment system provided by an embodiment of the invention;
fig. 5 is a schematic block diagram of a transcoder according to an embodiment of the present invention.
Reference numerals illustrate:
A virtual single-chip microcomputer development board 1; a virtual external power supply 2; a power interface 3; a virtual computer 4; a code input edit box 5; a burning tool 6; a transcoder 7; a function expansion interface 8; a virtual external electronic component 9; a virtual component 10; a virtual power switch 11; a first timing state detector 12; a second timing state detector 13; a cross-domain transmission unit 14; a character string processing unit 15; a code synchronization unit 16.
Detailed Description
In order that those skilled in the art will better understand the technical solutions of the present application, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
It will be understood that when an element is referred to as being "fixed" or "disposed" on another element, it can be directly on the other element or be indirectly on the other element; when an element is referred to as being "connected to" another element, it can be directly connected to the other element or be indirectly connected to the other element.
It is to be understood that the terms "length," "width," "upper," "lower," "front," "rear," "first," "second," "vertical," "horizontal," "top," "bottom," "inner," "outer," and the like are merely for convenience in describing and simplifying the description based on the orientation or positional relationship shown in the drawings, and do not indicate or imply that the devices or elements referred to must have a particular orientation, be constructed and operated in a particular orientation, and thus are not to be construed as limiting the application.
Furthermore, the terms "first," "second," and the like, are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more such feature. In the description of the present application, the meaning of "a plurality" or "a number" means two or more, unless specifically defined otherwise.
It should be understood that the structures, proportions, sizes, etc. shown in the drawings are for the purpose of understanding and reading the disclosure, and are not intended to limit the scope of the application, which is defined by the claims, but rather by the claims, unless otherwise indicated, and that any structural modifications, proportional changes, or dimensional adjustments, which would otherwise be apparent to those skilled in the art, would be made without departing from the spirit and scope of the application.
Compared with the prior art, the simulation experiment method for the Web3D virtual single-chip microcomputer provided by the invention comprises the following steps: s1, entering a virtual single-chip microcomputer 3D simulation system, initializing a simulation experiment of a virtual single-chip microcomputer development board, and then performing the simulation experiment; s2, connecting a virtual external power supply with a power interface of the virtual single-chip microcomputer development board through a power interface, providing external power supply input for the simulation system, and starting first timing state detection of the virtual single-chip microcomputer development board; s3, judging and detecting whether a C language control code is configured in the simulation system, and writing the C language control code into the simulation system according to a detection result and user requirements; s4, converting the C language control code written into the simulation system into a JavaScript code, and synchronizing the JavaScript code into a CPU of the virtual single-chip development board; and S5, then, a power switch on the virtual single-chip microcomputer development board in the simulation system is turned on to supply power to the virtual components on the virtual single-chip microcomputer development board, so that the virtual components are scheduled to start working according to the running and burnt code program or the CPU default program, and a virtual single-chip microcomputer simulation experiment is performed. According to the invention, on the basis of carrying out 3D virtual simulation on the virtual single-chip microcomputer development board, the capability of converting the C language control code into the executable logic code in the virtual single-chip microcomputer development board is added, so that the effect of the same function as that of an actual single-chip microcomputer circuit is presented, the written C language control code can normally run after being burnt into the single-chip microcomputer development board through running a burning tool, the virtual simulation experiment of the single-chip microcomputer can be realized, a hardware circuit can be simulated, dynamic embedded code programming can be carried out, the cost of real hardware is greatly saved, the efficiency of a user for learning the single-chip microcomputer is improved through a better 3D effect, and a user is not limited by regions and hardware equipment.
Referring to fig. 1 to 5, the simulation experiment method for the Web3D virtual single-chip microcomputer provided by the embodiment of the application includes the following steps:
S1, entering a virtual single-chip microcomputer 3D simulation system, initializing a simulation experiment of a virtual single-chip microcomputer development board, and then performing the simulation experiment.
Specifically, in an embodiment of the present invention, the simulation experiment initialization includes: loading a 3D virtual simulation model, adjusting the positions of the virtual components and determining the pin connection relation of the virtual components.
After the 3D simulation system is loaded, initializing the virtual single-chip microcomputer development board before a simulation experiment is carried out; the user can perform detection adjustment from three aspects of loading a 3D virtual simulation model, adjusting the positions of the virtual components and determining the pin connection relation of the virtual components, and initialization is completed.
And S2, connecting the virtual external power supply with a power interface of the virtual single-chip microcomputer development board through a power interface, providing external power supply input for the simulation system, and starting the first timing state detection of the virtual single-chip microcomputer development board.
After a 3D scene of the virtual single chip microcomputer, whether a power supply interface on the single chip microcomputer is connected with a power supply or not needs to be judged, if the power supply interface is not connected with the power supply, all virtual components on a virtual single chip microcomputer development board cannot work, therefore the virtual single chip microcomputer development board needs to be connected with a virtual external power supply through the power supply interface, the virtual external power supply provides power supply input for normal operation of a simulation experiment, and then the first timing state detection is carried out.
Specifically, in the embodiment of the present invention, the first timing state detection is configured to detect an analog power supply condition of the virtual external power supply to the virtual single chip microcomputer development board.
And S3, judging and detecting whether a C language control code is configured in the simulation system, and writing the C language control code into the simulation system according to a detection result and user requirements.
Specifically, in the embodiment of the present invention, the specific steps for determining whether to configure the C language control code in the system include:
If the fact that the C language control code is not written in the simulation system is detected, a code input editing box is called to write the C language control code into the simulation system through a virtual computer, and then the C language control code is operated and burnt;
if it is detected that the C language control code has been written in the simulation system and the running burning operation is completed, step S4 is directly entered.
The detection and configuration of the C language control code are a vital link in the simulation system; the user writes the corresponding C language control code by using the code input edit box by detecting the writing condition of the C language control code, if the C language control code is not written; if the code is already written, the next link can be directly entered.
S4, converting the C language control code written into the simulation system into a JavaScript code, and synchronizing the JavaScript code into a CPU of the virtual single chip development board.
Specifically, in the embodiment of the present invention, in the step S4, the specific step of converting the C language control code into JavaScript code includes:
s401, firstly, carrying out cross-domain transmission on the C language control code in a character string mode;
S402, removing block annotation and line annotation in the C language control code character string, and then removing the line where the reference header file is located;
S403, removing the row of the macro definition object after global replacement, then removing sbit the row of the macro definition object, agreeing with a port fixed writing method, and converting an array writing method in a C language into an array writing method in JavaScript;
S404, removing C language keywords which cannot act in JavaScript in the C language control code, and converting variable keywords defined in the C language into var or let keywords;
Specifically, in the embodiment of the present invention, the C language keywords that cannot be acted on include: void keywords, unsigned keywords, signed keywords, and const keywords.
Specifically, in an embodiment of the present invention, the defining variable key includes: bit key, char key, int key, and long key.
S405, removing using and interrupt and defined contents thereof, increasing added value of functions where the using and interrupt are located, and then increasing judgment on whether the virtual single chip development board supplies power or not;
S406, removing function statement of the C language, and then adding function keywords in front of the function names of the C language;
S407, replacing the delay function in the C language control code character string, and adding head processing and tail processing which are convenient for function call;
and S408, finally, converting the converted C language code character string into JavaScript codes through a Function object of JavaScript, and completing code conversion processing.
In the embodiment of the invention, the C language control code needs to be synchronized into the CPU of the virtual single-chip microcomputer development board after escape, so that each virtual component can work according to the program programmed by the code, and the system also has the capability of escaping the C language control code into the logic code executable in the virtual single-chip microcomputer development board, thereby presenting the same function effect as an actual single-chip microcomputer.
In the process of converting the C language control code, the process of converting the C language control code into the JavaScript code is performed in a character string processing mode, in the process, the C language code input by the code input edit box is required to be transmitted in a cross-domain mode in the form of a character string, and then a series of processing is performed on the C language control code character string according to the processing steps; finally, the converted character string of the C language code is converted into the JavaScript code through the Function object of the JavaScript, the main logic of the C language control code is reserved after conversion, meanwhile, the code execution environment of the JavaScript is adapted, and then the character string can be synchronized into the CPU of the virtual single chip development board.
And S5, then, a power switch on the virtual single-chip microcomputer development board in the simulation system is turned on to supply power to the virtual components on the virtual single-chip microcomputer development board, so that the virtual components are scheduled to start working according to the running and burnt code program or the CPU default program, and a virtual single-chip microcomputer simulation experiment is performed.
After the initialization of the simulation experiment is completed, the virtual simulation experiment can be performed; at this time, if the virtual power switch on the virtual single-chip microcomputer development board is not turned on, all the virtual components cannot work, and all the components on the single-chip microcomputer work according to the burnt code logic only by clicking a mouse to turn on the virtual power switch, so that a simulation experiment is performed.
Specifically, in the embodiment of the present invention, in the step S6, it includes: s601, after the virtual components start to work, performing second timing state detection on the virtual single-chip microcomputer development board, detecting the CPU port state of the virtual single-chip microcomputer development board at fixed time, and continuously scheduling the virtual components to work.
And the virtual power switch is turned on to perform simulation experiments and simultaneously perform first timing state detection, mainly detecting the simulated power supply condition of the virtual single chip microcomputer development board; in the simulation experiment process, port state detection is carried out on the virtual single-chip microcomputer development board; by means of the first timing state detection and the second timing state detection, normal operation of the virtual single-chip microcomputer development board is guaranteed, normal operation of the whole 3D virtual simulation experiment system is guaranteed, operation of other parts of the whole simulation experiment system is not blocked by operation of the virtual single-chip microcomputer development board, and operation of the virtual single-chip microcomputer can be influenced by parts, except for the virtual single-chip microcomputer, of the simulation experiment system.
In addition, the invention also provides a Web3D virtual single-chip microcomputer simulation experiment system, which comprises: a virtual single-chip microcomputer development board 1; a virtual external power supply 2 connected with the virtual single chip microcomputer development board 1; the virtual external power supply 2 is connected with the power interface 3 of the virtual single-chip microcomputer development board 1 through a power supply plug, and provides analog power supply input for the virtual single-chip microcomputer development board 1; a virtual computer 4 connected with the virtual single-chip development board 1; a code input edit box 5 connected with the display of the virtual computer 4 in an embedded manner, wherein the code input edit box 5 is used for writing a C language control code; the burning tool 6 is arranged between the virtual single chip microcomputer development board 1 and the virtual computer 4; a transcoder 7 connected to the burning tool 6; the code converter 7 is used for converting the C language control code into JavaScript code after running and burning and synchronizing the JavaScript code into the CPU of the virtual single-chip microcomputer development board 1; the virtual component 10 is arranged on the virtual single-chip microcomputer development board 1 and is connected with the virtual single-chip microcomputer development board 1 through pins; and a virtual external electronic component 9 connected with the function expansion interface 8 of the virtual single chip microcomputer development board 1.
Specifically, in the embodiment of the present invention, the virtual component 10 includes: the virtual power switch 11 is used for switching on the power input of the virtual external power supply 2 for the virtual single-chip microcomputer development board 1; a first timing state detector 12 connected to the virtual single chip development board 1; the first timing state detector 12 is configured to detect an analog power supply condition of the virtual external power supply 2; the second timing state detector 13 is arranged on the CPU port of the virtual single-chip microcomputer development board 1; the second timing state detector 13 is configured to detect a CPU port state, and continuously schedule each of the virtual components 10 to operate.
Specifically, in the embodiment of the present invention, the transcoder 7 includes:
a cross-domain transmission unit 14, wherein the cross-domain transmission unit 14 is used for performing cross-domain transmission of the C language control code written from the code input editing box 5 in the form of a character string;
a character string processing unit 15, where the character string processing unit 15 is configured to perform a series of escape processing on the C language control code character string, and convert the C language control code into JavaScript code;
the code synchronization unit 16, the code synchronization unit 16 is configured to synchronize the JavaScript code with the virtual single-chip development board 1.
From the above, the method and system for simulating the Web3D virtual single-chip microcomputer according to the embodiment of the invention specifically comprise the following steps: s1, entering a virtual single-chip microcomputer 3D simulation system, and performing a simulation experiment on a virtual single-chip microcomputer development board of the virtual single-chip microcomputer 3D simulation system; s2, connecting a virtual external power supply with a power interface of the virtual single-chip microcomputer development board through a power interface, and providing external power supply input for the simulation system; s3, judging and detecting whether a C language control code is configured in the simulation system; s4, converting the C language control code written into the simulation system into a JavaScript code, and synchronizing the JavaScript code into a CPU of the virtual single-chip development board; s5, carrying out simulation experiment initialization on the virtual single-chip microcomputer development board; and S6, after initialization is completed, a virtual power switch in the simulation system is turned on, and power input is conducted for the virtual single-chip microcomputer development board, so that each virtual component on the virtual single-chip microcomputer development board is scheduled to start working according to the running and burning code program, and a virtual single-chip microcomputer simulation experiment is conducted. According to the invention, on the basis of carrying out 3D virtual simulation on the virtual single-chip microcomputer development board, the capability of converting the C language control code into the executable logic code in the virtual single-chip microcomputer development board is added, so that the effect of the same function as that of an actual single-chip microcomputer circuit is presented, the written C language control code can normally run after being burnt into the single-chip microcomputer development board through running a burning tool, the virtual simulation experiment of the single-chip microcomputer can be realized, a hardware circuit can be simulated, dynamic embedded code programming can be carried out, the cost of real hardware is greatly saved, the efficiency of a user for learning the single-chip microcomputer is improved through a better 3D effect, and a user is not limited by regions and hardware equipment.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. The simulation experiment method of the Web3D virtual single-chip microcomputer is characterized by comprising the following steps of:
s1, entering a virtual single-chip microcomputer 3D simulation system, initializing a simulation experiment of a virtual single-chip microcomputer development board, and then performing the simulation experiment;
S2, connecting a virtual external power supply with a power interface of the virtual single-chip microcomputer development board through a power interface, providing external power supply input for the simulation system, and starting first timing state detection of the virtual single-chip microcomputer development board;
S3, judging and detecting whether a C language control code is configured in the simulation system, and writing the C language control code into the simulation system according to a detection result and user requirements;
s4, converting the C language control code written into the simulation system into a JavaScript code, and synchronizing the JavaScript code into a CPU of the virtual single-chip development board;
And S5, then, a power switch on the virtual single-chip microcomputer development board in the simulation system is turned on to supply power to the virtual components on the virtual single-chip microcomputer development board, so that the virtual components are scheduled to start working according to the running and burnt code program or the CPU default program, and a virtual single-chip microcomputer simulation experiment is performed.
2. The simulation experiment method of a Web3D virtual single-chip microcomputer according to claim 1, wherein in the step S3, the specific step of determining whether to configure the C language control code in the system includes:
If the fact that the C language control code is not written in the simulation system is detected, a code input editing box is called to write the C language control code into the simulation system through a virtual computer, and then the C language control code is operated and burnt;
if it is detected that the C language control code has been written in the simulation system and the running burning operation is completed, step S4 is directly entered.
3. The simulation experiment method of the Web3D virtual single-chip microcomputer according to claim 1, wherein in the step S4, the specific step of converting the C language control code into JavaScript code includes:
s401, firstly, carrying out cross-domain transmission on the C language control code in a character string mode;
S402, removing block annotation and line annotation in the C language control code character string, and then removing the line where the reference header file is located;
S403, removing the row of the macro definition object after global replacement, then removing sbit the row of the macro definition object, agreeing with a port fixed writing method, and converting an array writing method in a C language into an array writing method in JavaScript;
S404, removing C language keywords which cannot act in JavaScript in the C language control code, and converting variable keywords defined in the C language into var or let keywords;
S405, removing using and interrupt and defined contents thereof, increasing added value of functions where the using and interrupt are located, and then increasing judgment on whether the virtual single chip development board supplies power or not;
S406, removing function statement of the C language, and then adding function keywords in front of the function names of the C language;
S407, replacing the delay function in the C language control code character string, and adding head processing and tail processing which are convenient for function call;
and S408, finally, converting the converted C language code character string into JavaScript codes through a Function object of JavaScript, and completing code conversion processing.
4. The simulation experiment method of a Web3D virtual single-chip microcomputer according to claim 3, wherein the C language keywords incapable of being acted comprise: void keywords, unsigned keywords, signed keywords, and const keywords.
5. The method for simulating the Web3D virtual single-chip microcomputer according to claim 4, wherein the defining variable keywords comprises: bit key, char key, int key, and long key.
6. The Web3D virtual single-chip microcomputer simulation experiment method according to claim 1, wherein the simulation experiment initialization comprises:
loading a 3D virtual simulation model, adjusting the positions of the virtual components and determining the pin connection relation of the virtual components.
7. The method according to claim 6, wherein in step S2, the first timing state detection is used for detecting a simulated power supply condition of the virtual external power supply to the virtual single chip development board.
8. The simulation experiment method of the Web3D virtual single-chip microcomputer according to claim 7, further comprising:
and S6, after the virtual components start to work, carrying out second timing state detection on the virtual single-chip microcomputer development board, and timing detecting the CPU port state of the virtual single-chip microcomputer development board, and continuously scheduling the virtual components to work.
9. A Web3D virtual single-chip microcomputer simulation experiment system, which is characterized by being used for executing the Web3D virtual single-chip microcomputer simulation experiment method of any one of claims 1-8, comprising:
A virtual single-chip microcomputer development board; a virtual external power supply connected with the virtual single chip microcomputer development board;
The virtual external power supply is connected with a power interface of the virtual single-chip microcomputer development board through a power supply plug, and analog power supply input is provided for the virtual single-chip microcomputer development board;
the virtual computer is connected with the virtual single-chip microcomputer development board; the code input editing box is connected with the display of the virtual computer in an embedded mode and is used for writing a C language control code;
the burning tool is arranged between the virtual single chip microcomputer development board and the virtual computer;
a transcoder connected to the burning tool;
the code converter is used for converting the C language control code into JavaScript code after running and burning and synchronizing the JavaScript code into the CPU of the virtual single-chip microcomputer development board;
the virtual component is arranged on the virtual single-chip microcomputer development board and connected with the virtual single-chip microcomputer development board through pins; and the virtual external electronic component is connected with the function expansion interface of the virtual single chip microcomputer development board.
10. The Web3D virtual single chip simulation experiment system according to claim 9, wherein the virtual component comprises:
the virtual power switch is used for switching on the power input of the virtual external power supply for the virtual single-chip microcomputer development board;
the first timing state detector is connected with the virtual single chip microcomputer development board; the first timing state detector is used for detecting an analog power supply condition of the virtual external power supply;
The second timing state detector is arranged on the CPU port of the virtual single-chip development board; the second timing state detector is used for detecting the state of the CPU port and continuously scheduling the work of each virtual component.
CN202111129301.0A 2021-09-26 2021-09-26 Simulation experiment method and system for Web3D virtual single-chip microcomputer Active CN113962063B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111129301.0A CN113962063B (en) 2021-09-26 2021-09-26 Simulation experiment method and system for Web3D virtual single-chip microcomputer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111129301.0A CN113962063B (en) 2021-09-26 2021-09-26 Simulation experiment method and system for Web3D virtual single-chip microcomputer

Publications (2)

Publication Number Publication Date
CN113962063A CN113962063A (en) 2022-01-21
CN113962063B true CN113962063B (en) 2024-07-12

Family

ID=79462654

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111129301.0A Active CN113962063B (en) 2021-09-26 2021-09-26 Simulation experiment method and system for Web3D virtual single-chip microcomputer

Country Status (1)

Country Link
CN (1) CN113962063B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102508752A (en) * 2011-11-21 2012-06-20 广州市风标电子技术有限公司 Single chip microcomputer hardware simulator and simulation method for same
CN112486863A (en) * 2020-11-25 2021-03-12 珠海格力电器股份有限公司 Software virtual simulation method and device and electronic equipment

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2001095161A2 (en) * 2000-06-02 2001-12-13 Virtio Corporation Method and system for virtual prototyping
JP6550269B2 (en) * 2015-05-27 2019-07-24 株式会社キーエンス PROGRAM CREATION SUPPORT DEVICE, CONTROL METHOD, AND PROGRAM

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102508752A (en) * 2011-11-21 2012-06-20 广州市风标电子技术有限公司 Single chip microcomputer hardware simulator and simulation method for same
CN112486863A (en) * 2020-11-25 2021-03-12 珠海格力电器股份有限公司 Software virtual simulation method and device and electronic equipment

Also Published As

Publication number Publication date
CN113962063A (en) 2022-01-21

Similar Documents

Publication Publication Date Title
US5838948A (en) System and method for simulation of computer systems combining hardware and software interaction
CN100442293C (en) Method for combination of original files of hardware design language and checking data files
CN100565472C (en) A kind of adjustment method that is applicable to multiprocessor karyonide system chip
CN100422953C (en) On-line debugging method for SoC system using HDL to expand serial port
CN107907814B (en) Method for improving mass production test efficiency of chips
US8239708B2 (en) System on chip (SoC) device verification system using memory interface
CN109801665B (en) SRAM self-test system, SRAM self-test architecture, SRAM self-test method and storage medium
CN102521444A (en) Cooperative simulation/verification method and device for software and hardware
US10409936B2 (en) Method and apparatus for modelling power consumption of integrated circuit
CN112949233A (en) Automatic development method and device of FPGA chip and electronic equipment
CN105654993B (en) Function verification method and platform for DDR3 sdram controllers
CN107505851B (en) Simulation control system and simulation method based on Rinsim platform
US8121826B1 (en) Graphical user interface for system design
CN114325333A (en) High-efficiency normalized SOC (system on chip) system level verification method and device
CN106599516A (en) Method and device for automatically generating test vectors based on circuit board
CN113807041A (en) Circuit system simulation method and device, electronic equipment and storage medium
CN103793263A (en) DMA transaction-level modeling method based on Power PC processor
CN114880975A (en) Hardware trojan generation method, system, equipment and medium
CN113962063B (en) Simulation experiment method and system for Web3D virtual single-chip microcomputer
CN118052196A (en) Chip verification test method and device based on UVM and electronic equipment
CN109426671B (en) Method and device for generating boundary scan chain and computer readable storage medium
CN109885850B (en) Local register generation method and generation system
CN111259581A (en) Failure connection detection method and device for pressure contact type conductive contact piece and medium
US20130152034A1 (en) System and method for reducing integrated circuit timing derating
CN105068908A (en) Establishment method for KVM ASIC functional verification platform

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant