The present application is based on, and claims priority from, Taiwan Application Serial Number 104,142,085, filed on Dec. 15, 2015, the disclosure of which is hereby incorporated by reference herein in its entirety.
The disclosure is related to a method for system simulation and a non-transitory computer-readable recording medium thereof.
System simulation, such as the gate level simulation and the register-transfer level simulation, is broadly used in the process of the manufacturing of electronic products. With the system simulation, the designer is capable of aware of the possible problem in the interactions between devices. Hence, the use of the system simulation is capable of improving the yield rate and therefore reducing the production cost. However, the system simulation usually costs lots of time and therefore the procedures of design and manufacture is lengthened.
A method for system simulation in one embodiment of the disclosure comprises the steps of: simulating at least one operation of a first circuit during N clock periods based on a first model and at least one parameter of a simulation granularity, wherein the first model is corresponding to the first circuit and N is a positive integer; and adjusting the at least one parameter of the simulation granularity based on at least one input signal corresponding to the first model or at least one output signal corresponding to the first model to adjust N.
A method for system simulation in one embodiment of the disclosure comprises the steps of: selectively simulating a first circuit in a cycle mode, an event mode, or a window mode based on a signal rate; when simulating the first circuit in the window mode, simulating at least one operation of the first circuit during N clock periods based on a first model and at least one parameter of a simulation granularity, wherein the first model is corresponding to the first circuit and N is a positive integer; and adjusting the at least one parameter of the simulation granularity based on the signal rate to adjust N, wherein the signal rate is corresponding to at least one input signal corresponding to the first model or at least one output signal corresponding to the first model.
A non-transitory computer-readable recording medium corresponding to the aforementioned methods is also disclosed. The non-transitory computer-readable recording medium stores at least one program. The at least one program causing a processor to perform the aforementioned methods after the at least one program is loaded on a computer and is executed.
A non-transitory computer-readable recording medium corresponding to the aforementioned methods is also disclosed. The non-transitory computer-readable recording medium stores at least one program. When the at least one program is executed by a device, the device performs the aforementioned methods.
In order to make the aforementioned and other features of the present disclosure more comprehensible, several embodiments accompanied with figures are described in detail below.
The present disclosure will become more fully understood from the detailed description given herein below for illustration only, and thus are not limitative of the present disclosure, and wherein:
In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the disclosed embodiments. It will be apparent, however, that one or more embodiments may be practiced without these specific details. In other instances, well-known structures and devices are schematically shown in order to simplify the drawings.
The method for system simulation based on one embodiment of the disclosure includes cycle mode, event mode and window mode, wherein the user may arbitrarily choose the mode for simulation in one embodiment, or the mode for simulation may be switched based on the signal rate. As to the operation of the window mode, please refer to
Practically, please refer to
In one embodiment, the simulation system 1000 is a real hardware system. For example, the first simulation module 1140 is a central processing unit; the first queue 1120 and the second queue 1130 are registers or memory modules; and the first synchronization module 1110 is another processing unit for triggering other units.
In another embodiment, the simulation system 1000 is a system environment constructed by software program(s). The interactivities between the modules and the queues are realized by flags, pointers, function calls, and/or value responses. In another embodiment, the simulation system 1000 may be realized with the hardware description language (HDL), and may be realized in a register-transfer level (RTL) description, a behavioral level description, or a gate level description. The first circuit, for example, is the first circuit mentioned in description related to
In one embodiment, the first model 1100 and the second model 1200 may be simulated in different modes. For example, the first model 1100 is simulated in the window mode, and the second model 1200 is simulated in the cycle mode. In another embodiment, the first model 1100 and the second model 1200 may have different window periods. For example, the first model 1100 is simulated in the window mode wherein the window period equals to two periods of the clock signal, while the second model 1200 is simulated in the window mode wherein the window period equals to five periods of the clock signal.
Please refer to
In this condition, if the circuit is simulated in the cycle mode, whether an event occurs or not, the server simulates/checks the state of the circuit every cycle. Hence, it takes k*(TP+TS) for the server to simulate the operation of the circuit during k periods of the clock signal, wherein TP is the processing time to simulate the operation of the circuit within one period of clock signal and TS is the synchronization time to simulate the transaction between circuits.
If the circuit is simulated in the event mode, the server simulates/checks the state of the circuit when there is an event occurring, so it takes k*TP+Ne*TS for the server to simulate the operation of the circuit during k periods of the clock signal, wherein Ne is how many times the event occurs.
If the circuit is simulated in the window mode, it is needed to provide a value N, which means that the server simulates/checks the state of the signal exchanging between the circuits every N periods of the clock signal. N is a positive integer and the N periods of the clock signal can be seen as a window period. It takes k*TP+k*TS/N for the server to simulate the operation of the circuit during k periods of the clock signal. In other words, when the frequency of the event occurring (or the frequency of signal exchanging, the signal rate) is less than a certain threshold, simulating in the window mode takes less time than simulating in the cycle mode. When the frequency of the event occurring (or the frequency of signal exchanging, the signal rate) is larger than a certain threshold, simulating in the window mode takes less time than simulating in the event mode. For example, simulating in the window mode with N equal to 2 is faster than simulating in the cycle mode. When k/N is less than Ne, simulating in the window mode is faster than simulating in the event mode. The above is an example, and the time for simulation may be different between different simulation environments or between different circuits.
In one embodiment, taking the first simulation module 1140 for example, please refer to
In the determination of the step S512, if the signal rate does not increase, as shown in step S524, the dynamic sync adjusting unit 1145 determines whether the decrement (Rk-i-Rk) of the signal rate is less than the variation threshold Rth. If the decrement is less than the variation threshold Rth, as shown in step S526, the dynamic sync adjusting unit 1145 maintains the parameter(s) of simulation granularity so as to keep the value of N unchanged. If the decrement is not less than the variation threshold Rth, as shown in step S528, the dynamic sync adjusting unit 1145 determines whether the value of N is less than the upper threshold Nmax. If the value of N is less than the upper threshold Nmax, as shown in step S530, the dynamic sync adjusting unit 1145 adjusts the parameter(s) of simulation granularity (e.g., add a specific value to the value of N) so as to increase the value of N. If the value of N is not less than the upper threshold Nmax, as shown in step S532, the dynamic sync adjusting unit 1145 maintains the parameter(s) of simulation granularity so as to keep the value of N unchanged.
In some embodiments, please refer to
In one embodiment, when the first model 1100 is simulated in the cycle mode, the dynamic sync adjusting unit 1145 determines whether the signal rate is less than the upper threshold of the signal rate, and switches the simulation mode from the cycle mode to the window mode when the signal rate is less than the upper threshold of the signal rate. When the first model 1100 is simulated in the event mode, the dynamic sync adjusting unit 1145 determines whether the signal rate is larger than the lower threshold of the signal rate, and switches the simulation mode from the event mode to the window mode when the signal rate is larger than the lower threshold of the signal rate.
In another embodiment, please refer to
Hence, in one embodiment, the first simulation module 1140 further includes the timing sequence error estimation unit 1147 and the timing sequence error compensation unit 1149. The timing sequence error estimation unit 1147 calculates the accumulated error value of the timing sequence. When the response signal is outputted in the tenth period of the clock signal, the error value of the timing sequence is calculated to be 7 periods of the clock signal, which means there is delay in the current timing sequence. In this embodiment, by the calculation of the timing sequence error compensation unit 1149, it is known that if the next response signal, which is originally to be outputted in the twentieth period of the clock signal, is outputted in the tenth period of the clock signal, the accumulated error value of the timing sequence would become the summation of the error d1′(i.e., 7 periods of the clock signal) and the error d2′(i.e., −5 periods of the clock signal), which is equal to two periods of the clock signal, and is less than the summation of the error d1 (i.e., 7 periods of the clock signal) and the error d2 (i.e., 5 periods of the clock signal), which is equal to twelve periods of the clock signal.
In the thirtieth period of the clock signal, the error value of the timing sequence is increased by three periods of the clock signal (d3′) and equals to five periods of the clock signal. By calculation, the timing sequence error compensation unit 1149 would determine whether to output the response signal which is originally to be outputted in the fortieth period of the clock signal. It is calculated that if the response signal originally to be outputted in the fortieth period of the clock signal is outputted in the thirtieth period of the clock signal, the accumulated error value of the timing sequence would be reduced, so the response signal originally to be outputted in the fortieth period of the clock signal is outputted in the thirtieth period of the clock signal. Hence, after compensation, the accumulated error value of the timing sequence equals to the summation of the errors d1′ to d4′. Because the error d1′ equals to 7 periods of the clock signal, the error d2′ equals to −5 periods of the clock signal, the error d3′ equals to 3 periods of the clock signal, and the error d4′ equals to −3 periods of the clock signal, the accumulated error value of the timing sequence equals to 2 periods of the clock signal. Therefore, the accumulated error value of the timing sequence after compensation (i.e., 2 periods of the clock signal) is smaller than the accumulated error value of the timing sequence before compensation (i.e., 22 periods of the clock signal).
Hence, based on the simulation method of this embodiment, the first model 1100 checks the accumulated error value of the timing sequence every window period based on the calculation result of the timing sequence error compensation unit 1149 so as to determine whether to output the response signal. If the accumulated error value of the timing sequence can be reduced by postponing the output of the response signal for one window period, the first model 1100 would not output the response signal in the present window period but output the response signal in next window period based on the calculation result of the timing sequence error compensation unit 1149. Otherwise, the response signal is outputted in the present window period. Specifically, the error value of the timing sequence is firstly estimated or calculated when the error compensation is performed. The estimation of the error is to predict the accumulated error value of the timing sequence in the future, and the calculation of the error is to accumulate the errors in the present and in the past. In some embodiments, the timing sequence error estimation unit 1147 and the timing sequence error compensation unit 1149 perform both the estimation and the calculation, and in some embodiments, the timing sequence error estimation unit 1147 and the timing sequence error compensation unit 1149 perform only the calculation or only the estimation.
When the error value of the timing sequence is larger than zero, it means that there is delay in the timing sequence, so the first model 1100 may output part or all of the output signals in advance. When the error value of the timing sequence is less than zero, the first model 1100 may postpone outputting part or all of the output signals. Additionally, the amount of the error value of the timing sequence is capable of being used in adjust the parameter(s) of the simulation granularity so as to adjust the value of N. The method, for example, includes the steps of: decreasing the window period (i.e., the value of N) when the error value of the timing sequence is larger than a first preset threshold; and otherwise, increasing the value of N. The abovementioned first preset threshold may include more than one value. For example, the value of N can be decreased when the error value of the timing sequence is larger than the upper threshold of the error value of the timing sequence. The value of N can be increased when the error value of the timing sequence is less than the lower threshold of the error value of the timing sequence.
A non-transitory computer-readable recording medium is further provided according to one embodiment of the disclosure. In one embodiment, the non-transitory computer-readable recording medium stores at least one program. After the at least one program is loaded on a computer and is executed, the at least one program causes a processor to perform the simulation method mentioned above. In one embodiment, when the at least one program stored in non-transitory computer-readable recording medium is the executed by a device, the device performs the simulation method mentioned above. The computer-readable recording medium, for example, may be a floppy disk, a hard disk, a CD_ROM, or a flash memory.
The simulation method according to one embodiment of the disclosure is simulated and the simulation results list in Table I. It can be seen from Table I that when N increases, the efficiency of the window mode is better than the cycle mode, N=1.
As above, the simulation system based on one or more embodiments of the disclosure is capable of automatically adjust the window period N. Since the server running the simulation does not require to process the behavior of the circuits every clock cycle, the resource usage may be reduced and the efficiency of running the simulation may be increased.
Number | Date | Country | Kind |
---|---|---|---|
104142085 | Dec 2015 | TW | national |