Collection
zero Useful+1
zero

simulator

Announce Upload video
Equipment mainly focused on program simulation
The simulator replicates the functions of another system with one system. The difference between the simulator and the computer simulation system is that the simulator is committed to simulating the external performance and behavior of the system, rather than simulating the abstract model of the system. See Simulation and Simulation entries.
Chinese name
simulator
Classification
Instrument and equipment

summary

Announce
edit
The simulator can replace the MCU in your target system and simulate its operation. The simulator runs like the actual target processor, but it adds other functions to enable you to observe the programs and data in MCU and control the operation of MCU through the desktop computer or other debugging interfaces. With the rapid development of IC and software integration platform, the simulator is also constantly giving new content and new challenges, because its development must be synchronized with the CPU. It is impossible to achieve TRACE under the bus speed of 150Mhz 64bit.

Basic implementation mode of simulator

Announce
edit
because [1] Simulator is a high-tech development tool, and its implementation mode is relatively complex.
1) Commercial CPU This is the simplest implementation method, and the simulator is designed directly using the most common commercial CPU. Generally speaking, the CPU has some resources, such as unmasked interrupts, NMI, TRAP instructions, Ready signals, and so on. When using commercial CPUs to design simulators, these command type signals are basically used to achieve the functions of single step, full speed running Go, and breakpoint breakpoint. Use commercial CPUs to design emulators. Generally speaking, the CPU speed cannot be very fast,
For example, 8051196 can be used in this way. If the CPU speed is very fast, it cannot be realized. Because the simulator needs to intercept or insert some information on the CPU address and data bus. The CPU is too fast to intercept or insert information in time sequence. When using commercial CPUs as simulation CPUs, it is generally difficult to reorganize I/O pins. For example, the simplest 8051 or 83C196, whose A/D bus can be reused as I/O. The simulator is to provide all information about CPU to users. Therefore, the CPU is actually running in the form of address/data bus. If the user's design uses I/O mode, the simulator must integrate a set of I/O lines again. This is the most troublesome point. Some simple simulators can't do this.
. 2) Special simulation mode. Some commercial CPUs will provide some special simulation modes, but their CPUs are still commercial CPUs. But when the CPU is powered on or reset, if some special levels or sequences are poured on some pins of the CPU, the CPU will enter a special simulation mode, such as Philips' 8051 CPU, which has a mode called "Hooks". After entering this mode, the CPU will provide some information for I/O reconstruction on the address data bus in a time-sharing manner. With this special simulation mode, I/O reconstruction of the simulator is relatively simple, but there are often some timing problems. After all, the CPU timing after entering the simulation mode is different from that of ordinary CPUs. If the user's design is very strict, sometimes the target board cannot be connected, and the CPU will have difficulty running at a high clock speed.
3.) Use a dedicated emulation CPU – BondoutSilicon Generally speaking, when the CPU speed is very fast, a dedicated emulation CPU is often required. At this time, the simulator is relatively simple to design in terms of control. But at this time, the performance of the simulator has largely depended on the simulation CPU. If the simulation CPU is well designed, the function and stability of the simulator will be relatively good. However, because the simulation CPU is a special CPU, the number of CPU produced by chip manufacturers is very small, and the degree of testing is often not very high. The special simulation CPU will have some problems more or less, just like the W78958 simulation CPU commonly used by domestic simulators at present. This is a kind of simulation CPU made by Winbond for 8051. There are problems in interrupt, I/O drive ability, etc.
4) With BDM and JTAG, when the CPU becomes more and more complex and the speed becomes faster and faster, the above methods can no longer meet the requirements. Like PowerPC or Pentium, it has MMUs and caches inside and can be executed out of order. The traditional bus mode is not feasible in the past. JTAG was originally put forward for testing. Its main purpose is to test whether the device is well soldered and whether there is short circuit or open circuit. Later, some CPU manufacturers introduced this concept into the CPU. Connect all the JTAG shift registers to the control status registers inside the CPU, and add some special registers for the simulator, such as the control of memory reading and writing. At this time, the simulator has become very simple in hardware. When designing the target board, users can achieve online real-time control as long as the level of several control pins is designed correctly. At present, 32 bit or more CPUs are generally supported
Use this debugging method. 5. Most CPU manufacturers of ROM Monitor will launch their reference design prototypes when they launch their new generation CPUs. This is known as the ADS development board. With the third-party integrated development environment, they can develop software for the corresponding CPUs. This is the implementation of the ROM Monitor simulator.

Function of MCU Emulator

Announce
edit
monolithic [2] Computer emulator is a kind of development tool that can replace MCU chip to debug software and hardware in the development stage of electronic products. With the help of the integrated development environment, the simulator can track and debug the MCU program in a single step, and can also use breakpoints, full speed and other debugging methods, and can observe the real-time data of various variables, RAM and registers, and track the execution of the program. At the same time, it can debug the hardware circuit in real time. The use of MCU simulator can quickly find and eliminate the logic errors in the program, greatly shortening the cycle of MCU development. In the field, only the burner is used to repeatedly burn and write the single chip microcomputer, and the method of developing by observing the results with naked eyes greatly increases the difficulty of debugging, prolongs the entire development cycle, and it is not easy to find many hidden errors in the program, especially for beginners with little experience in the development of single chip microcomputer, MCU simulator plays an important role in the development of MCU system.

Function concept of simulator

Announce
edit
1). Enforcement [1] Line breakpoint: This is the most common breakpoint. All emulators must have two implementation methods. One is hardware breakpoint, which is generally made by hardware comparator; The other is software breakpoints, such as TRAP instructions. Standard point for evaluating the execution breakpoint: when the user is debugging the program in the EPROM of the user board, can he set a breakpoint? Often some low-end emulators cannot do this.
2) The bus breakpoint is not enough to meet the actual needs. The bus breakpoint is an address breakpoint. If the user's system needs to adjust the data bus, or interrupt, timer/counter, and real-time debugging, the bus breakpoint is required. Bus breakpoints can be set to address bus, data bus, and some states of CPU. When matching is set at this time, let the CPU stop. Therefore, the functions of such an emulator are relatively powerful, and it is easy to find problems. But when implementing these functions, the hardware design used is much more complex.
3) The CPU is often required to support this function for such breakpoints as RegisterBreakpoint. There should be a comparator inside the CPU. When the set CPU value matches it, the emulator will stop. PowerPC can do this.
4) Event The bus breakpoint mentioned above can be regarded as an element of an event. Events can be combinations of information from some CPUs or external trigger inputs, and can have logical combinations, sequential order, counting function, etc. This event function is the most basic function in some high-end simulators.
5) The ultimate purpose of the Trigger event is to generate a trigger. This trigger does not necessarily stop the CPU immediately. When debugging, users may want to see the CPU situation when the set conditions meet the requirements of several CPUCycles. Therefore, triggering should meet this requirement, and it is better to use triggering together with tracking memory.
6) TraceMemory is like a camera. When the CPU is running at full speed, it can capture some information of the CPU, such as address/data bus, CPU status, and I/O pin status. Therefore, the tracking memory must have a certain width and depth, and the tracking memory that will soon be full does not have any significance. At present, most people are writing programs in the form of C and C++. For tracking the data captured in memory, it is meaningful to be able to translate or link to the corresponding C code.
7) . If there is only trace memory and no trace filter, such trace memory is useless! Why? Tracking memory is like a camera. When it is impossible for users to take pictures, they will start to take pictures without any selection as soon as they leave home. Usually, people only take photos of the scenic spots they are interested in. Therefore, when using the tracking memory, it is necessary to have a hardware filter, and only select useful information to save, so that the tracking memory will not be full. Of course, for the tracked and recorded data, it is better to have a software filtering action, just like re editing a movie. Some simulators claim to provide tracking or "logic analyzer" function, but there is no hardware filtering. After the user program stops, there is often a lot of useless information in the tracking memory, and the really useful data may be overwritten instead.
8) Software Performance Analysis (SPA) When starting a project, people often pursue the function at the beginning of the project, but at a certain time, they will begin to pursue the performance. At this time, they often need to optimize the program code. However, it is impossible to optimize the entire user program from beginning to end, which is very inefficient. With software performance analysis, it can be found that those codes account for a relatively high percentage of time in the running process of the whole system. When optimizing, you only need to optimize this part, so that the efficiency can be the highest.
9) Code coverage analysis can help users analyze that the user's code is scrap code. Now, the user system is getting larger and larger. Often a project is not developed by one person, or it takes a lot of time to complete the development. There will be a lot of waste code. In the running process of the system, it has never been called at all, but sometimes it is not easy to delete it. With the function of code coverage analysis, it is easy to analyze the obsolete code and delete it safely.
10) The TimeStamp has MMUs, Caches, etc. in some high-end CPUs, such as 486 and Pentium. Users can no longer calculate the execution time of each instruction according to the CPU clock and cycle. Sometimes the error may vary several times. At this time, with the time beat function, users can clearly know the execution time of each instruction. The time metronome records in the tracking memory. If you want to ensure that the record is long enough and accurate enough, you need a lot of memory.
11) Emulation Memory Emulation memory is also a basic function of the simulator. For a CPU with a narrow address space, it depends on whether it can provide full space simulation memory. For a CPU with a wide address space, it depends on how deep it can provide, and whether it can be moved freely with the linker/locator of the compiler. To evaluate the simulation memory of an emulator, we also need to see whether it does not occupy the user space at all, whether it can read the program in the EPROM of the user board, whether it can help the user disassemble and save it into a file, and whether it can be connected to the EPROM of the user board for debugging.
12) Simulation memory block expansion (BankSwitch) Some CPUs with narrow address space, such as 8051, have only 64K of program space, and some users often feel that they are not enough. If they want to store some voice and image data into EPROM, they need block expansion function. Some compilers can support block extension functions, such as Keil's C51 compiler. At this time, it is better to support the emulator together, so that users do not need to consider whether they can smoothly switch blocks, global variables and local variables.
13) Memory mapping (MAP) Generally speaking, the emulator will provide internal and external memory mapping. But in fact, a good emulator can also do more complex properties, such as Guard, Read Only, and so on. Attributes like this are very useful. Like Guard, it means that for non-existent spaces, users can set it as Guard. In this way, once the program flies into this space, the CPU will stop immediately. With the tracking function, the user can quickly locate where the program is flying and what the reason is. It may be that push/pop is missing one or interference factors.
14) Memory on the fly and Trace on the fly In some cases, such as PWM debugging motor, the motor uses the PWM duty ratio to control the motor speed. It is possible that the CPU cannot stop. Once the CPU stops, PWM remains at a high level. In this way, the motor will fly. Therefore, the CPU cannot be stopped. At this time, users may want to see the data in the simulation memory and tracking memory, so they need the simulator to support this function. At this time, it is very important not to stop the simulation CPU secretly, read it and then let the CPU run. This is false and does not make any sense. You can use dual port RAM or shadow memory (similar to Cache).
15) . Supported ToolChains A good emulator should be able to support many compilers, such as 51. There are many compiler manufacturers, such as Keil, 2500AD, BSOTasking, PLM, etc. Users cannot be required to use only one compiler after buying this simulator, so that they can familiarize themselves with a compiler environment.
16) Support of protocol software (SupportProtocol S/W) At present, user systems are becoming more and more complex, such as USB, PCMCIA1394, LCD, Ethernet, etc., which require corresponding protocols, such as TCP/IP protocol. There are many companies specialized in writing protocol software in this area, such as Interniche. A good development system should support protocol software written by a third party directly.
17) There are many supporting real-time operating systems (SupportRTOS), especially in embedded systems, such as VxWorks, ThreadX, Linux, etc. If a development system cannot support the operating systems purchased by users, those operating systems will become a pile of waste code and cannot be debugged at all.
The development system should help users display which tasks are running and which tasks are suspended because of Semaphore, Eventflag, etc. It should also help users display system defined structures such as Mailbox, messagequeue, and memorypool. The best development system should support multi project and multi CPU environments.

Techniques used in the simulator

Announce
edit
Imitation [3] The production of the prototype has a history of more than ten years in China. The technologies used in it can be divided into the following categories according to the time and performance:
(1) Simulation development system
This technology is mainly used in the initial stage of the simulator. Because there was no good simulation technology or simulation chip at that time, the simulator was designed as a dual platform system and switched between the monitoring system and the user system according to the user's requirements. The performance of this simulation system completely depends on the level of the designer. The actual final performance varies greatly among manufacturers. However, generally speaking, it needs to occupy certain user resources and has complex design. Now it has been basically eliminated and is only used in some development learning systems.
(2) Bondout technology
Generally speaking, the special simulation chip that people often say is actually Bondout. This kind of simulation chip is also a single chip computer. However, there is a special timing for simulation. After entering the simulation state, the internal timing operation can be frozen, and the resources inside the MCU at rest can be viewed/modified. Emulators made with Bondout generally have accurate timing operation (there are exceptions). Advantages such as low design and production cost: Bondout chips are generally provided by single-chip manufacturers. Therefore, it can only simulate the MCU specified by the manufacturer, and there are few kinds of simulation.
(3) HOOKS technology
HOOKS is a simulation technology owned by PHILIPS. It mainly solves the simulation problem of different kinds of single chip computers. With this patented technology, all single chip computers with HOOKS characteristics can be simulated. Even if the single chip microcomputer is manufactured by different manufacturers, the emulator manufactured by HOOKS technology can be compatible with a variety of single chips from different manufacturers, and the electrical performance of the simulation is very close to the real single chip microcomputer. However, HOOKS technology has high technical requirements for the simulator manufacturer. Different simulator manufacturers are authorized by HOOKS technology at the same time. However, the performance of the designed simulators varies greatly. Even today, not every emulator manufacturer can produce HOOKS emulators. Even though the production performance varies greatly, users should carefully distinguish between them.
(4) Chip with embedded simulation function
With the development of chip technology, many SCM manufacturers have added simulation functions inside the chip, which are generally controlled through the JTAG interface. In order to reduce costs and increase reliability, the general functions of the embedded simulation part are relatively simple. According to the current development trend, if only the standard MCS-51 series MCU is simulated, the simulator of Bondout technology can be selected. If the user wants more and more flexible functions of the emulator, such as the enhanced 80C51 series MCU, he must choose the HOOKS technology emulator. Comparatively speaking, the price performance ratio of the simulator using HOOKS technology is higher than that of Bondout technology.

Types of simulators

Announce
edit
Software emulator: This method mainly uses computer software to simulate the operation. The actual operation of MCU has certain advantages in simulating hardware independent systems. Users can verify programs without building hardware circuits, which is especially suitable for programs that focus on algorithms. The disadvantage of software simulation is that it is unable to completely simulate the hardware related parts, so the final design must be completed through hardware simulation.
Hardware simulator: use additional hardware to replace the single chip microcomputer of the user system and complete all or most of the functions of the single chip microcomputer. After using additional hardware, the user can control the operation of the program, such as single step, full speed,
View resource breakpoints, etc. Hardware simulation is necessary in the development process.