CN107102921B - Digital quantity monitoring method for SoC (system on chip) with I/O (input/output) type digital quantity asynchronous port - Google Patents
Digital quantity monitoring method for SoC (system on chip) with I/O (input/output) type digital quantity asynchronous port Download PDFInfo
- Publication number
- CN107102921B CN107102921B CN201710179456.2A CN201710179456A CN107102921B CN 107102921 B CN107102921 B CN 107102921B CN 201710179456 A CN201710179456 A CN 201710179456A CN 107102921 B CN107102921 B CN 107102921B
- Authority
- CN
- China
- Prior art keywords
- digital quantity
- type digital
- port
- latest
- value
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/22—Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
- G06F11/2205—Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing using arrangements specific to the hardware being tested
- G06F11/2221—Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing using arrangements specific to the hardware being tested to test input/output devices or peripheral units
Abstract
The invention provides a digital quantity monitoring method facing an SoC (system on chip) with an I/O (input/output) type digital quantity asynchronous port, which adopts an I/O type digital quantity state port to record an I/O type digital quantity state in real time; storing the latest port value and the change times of the I/O type digital quantity state at most N times in real time by adopting an I/O type digital quantity asynchronous data port; and responding the change of the I/O type digital quantity state port by adopting an interrupt response program, and analyzing the latest nCount turnover change condition of each I/O type digital quantity recorded by the I/O type digital quantity asynchronous data port. The invention adopts an asynchronous mode of recording and reading the change of the I/O type digital quantity, reduces the performance requirement on the processor on the basis of ensuring high real-time performance and improves the sensitivity of the change of the I/O type digital quantity; the problem of asynchronous reading and writing of software and hardware of the same port is solved by adopting repeated comparison of multiple times of reading, and the reliability and the fidelity of monitoring the change state of the input I/O type digital quantity are improved.
Description
Technical Field
The invention relates to a digital quantity monitoring method for an SoC (system on chip) with an I/O (input/output) type digital quantity asynchronous data port, which is used for monitoring the I/O type digital quantity in an embedded circuit system in real time and belongs to the field of real-time monitoring control.
Background
I/O type digital quantities are a type of signal that is often monitored in embedded systems. Which is typically used as a switching signal in an embedded system to control the transition of the system from one state to another during operation of the system. Therefore, the real-time monitoring of the I/O type digital quantity can help to better understand the running state and running process of the system, is convenient for correcting the running deviation of the system in time, adjusts the running rhythm of the system and improves the running efficiency of the system.
Common I/O type digital quantity monitoring methods can be divided into two categories: cyclic sampling and variation detection. The basic idea of the cyclic sampling method is to sample the detected I/O type digital quantity at high density, record the result of each sampling, and obtain the time domain distribution of the I/O type digital quantity at high and low levels by counting the sampling results. The method has the advantages that the level state of the I/O type digital quantity at each moment can be conveniently known in real time, the minimum pulse width of the I/O type digital quantity which can be monitored by the method depends on the sampling processing efficiency, the duration of the level and the change moment of the level are careless for counting the historical change rule of the I/O type digital quantity in real time, and the better noise monitoring result can be obtained only by matching complex hardware and software; another type of change detection method responds to the upper and lower edges of the change of the I/O type digital quantity through interruption, and judges the state change time of the I/O type digital quantity by detecting the rising edge and the falling edge of the I/O type digital quantity. If a new I/O type digital quantity is generated when the change of the first I/O type digital quantity is not processed, the new change state is lost.
Disclosure of Invention
The technical problem to be solved by the invention is as follows: the digital quantity monitoring method for the SoC with the I/O type digital quantity asynchronous port overcomes the technical difficulty caused by the fact that the digital quantity information is lost or the change time information is recorded incorrectly due to the fact that the asynchronous change detection method is used for asynchronously analyzing the digital quantity change information and recording the read-write conflict of the digital quantity change information, and the change information of the I/O type digital quantity in the system is monitored reliably in real time.
The technical solution of the invention is as follows: a digital quantity monitoring method facing an SoC with an I/O type digital quantity asynchronous port comprises an I/O type digital quantity state port and an I/O type digital quantity asynchronous data port, wherein the I/O type digital quantity state port is used for recording M parallel I/O type digital quantity states in real time, M is more than or equal to 1, the I/O type digital quantity asynchronous data port is used for storing the most N times of latest I/O type digital quantity state port values and change times in real time, when the I/O type digital quantity state port changes, the I/O type digital quantity asynchronous data port is immediately updated and generates an interrupt request, and the SoC responds to the interrupt request and executes the following steps:
(1) reading the I/O type digital quantity asynchronous data port, acquiring the most N times of the latest I/O type digital quantity state port value and the change times at the same time, recording the change times as nCount, wherein the SoC performs reading operation on the I/O type digital quantity asynchronous data port to have a reading and clearing function on the change times stored in the I/O type digital quantity asynchronous data port, and the priority of the clearing operation is higher than the writing operation when the I/O type digital quantity asynchronous data port is updated;
(2) reading the I/O type digital quantity state port and obtaining the value of the I/O type digital quantity state port;
(3) analyzing the latest nCount turnover change condition of each I/O type digital quantity recorded by the I/O type digital quantity asynchronous data port according to the latest N times of latest I/O type digital quantity state port value and the current nCount value recorded by the latest I/O type digital quantity asynchronous data port;
(4) comparing whether the latest I/O type digital quantity state port value recorded by the latest I/O type digital quantity asynchronous data port is consistent with the I/O type digital quantity state port value acquired from the latest I/O type digital quantity state port or not, and if so, ending the interrupt processing process; otherwise, turning to the step (5);
(5) storing the most N times of latest I/O type digital quantity state port values and nCount recorded by the latest I/O type digital quantity asynchronous data port, reading the I/O type digital quantity asynchronous data port again according to the mode in the step (1) and obtaining the most N times of latest I/O type digital quantity state port values and the change times recorded by the I/O type digital quantity asynchronous data port;
(6) reading the I/O type digital quantity state port again to obtain the value of the I/O type digital quantity state port;
(7) and comparing the most N times of the latest I/O type digital quantity state port values obtained by reading the I/O type digital quantity asynchronous data ports for the latest two times, analyzing to obtain the real change times of the I/O type digital quantity state port values between the I/O type digital quantity asynchronous data port operations for the latest two times, recording the change times as nCount, and re-executing the steps (3) to (7).
And (3) the port value of the I/O type digital quantity state in the step (2) is a value obtained after filtering processing is carried out on the I/O type digital quantity asynchronous port to remove burrs or interference.
The method for judging the change of the port value of the I/O type digital quantity state comprises the following steps: performing exclusive-or operation on the I/O type digital quantity state port value and the latest I/O type digital quantity state port value stored in the I/O type digital quantity asynchronous data port, wherein if the exclusive-or result is not 0, the I/O type digital quantity state port is changed; otherwise, the I/O type digital quantum status port is considered unchanged.
The specific method for analyzing the latest nCount number roll-over change condition of each I/O type number recorded by the I/O type number asynchronous data port according to the latest I/O type number state port value and nCount of the most N times recorded by the latest I/O type number asynchronous data port obtained in the step (3) is as follows: in the latest nCount times of inverted I/O type digital quantity state port values recorded by the latest I/O type digital quantity asynchronous data port, according to the sequence from old to new, each I/O type digital quantity state port value is compared with the I/O type digital quantity state port value before the change of the I/O type digital quantity state port value, the inversion change condition of each I/O type digital quantity during each change is obtained, until all nCount times of latest I/O type digital quantity state port values are compared, all nCount times of I/O type digital quantity inversion change conditions are obtained, and when the step is executed for the first time, the value before the change of the default I/O type digital quantity state port value is the initial I/O type digital quantity state value.
The specific method for analyzing and obtaining the actual change times of the port value of the I/O type digital quantity state between the two latest I/O type digital quantity asynchronous data port reading operations by comparing the latest I/O type digital quantity state port value obtained by the two latest I/O type digital quantity asynchronous data port reading operations for the most N times is as follows:
(7.1) extracting the change times recorded by the I/O type digital quantity asynchronous data port which is read recently, and taking the change times as an estimation value C of the actual change times of the port value of the I/O type digital quantity state between the operations of reading the I/O type digital quantity asynchronous data port for the last two times;
(7.2) finding the latest I/O type digital quantity state port value before the I/O type digital quantity state port changes for C times from the I/O type digital quantity state port data recorded by the I/O type digital quantity asynchronous data port which is read recently, judging whether the value is the same as the latest I/O type digital quantity state port value recorded by the I/O type digital quantity asynchronous data port which is read recently, if so, considering that the current actual change frequency estimated value C is the actual change frequency of the I/O type digital quantity state port value between the two times of reading of the I/O type digital quantity asynchronous data ports, and ending; otherwise, executing step (7.3);
(7.3) adding 1 to the current actual change frequency estimated value C, updating the actual change frequency estimated value C, and taking N as the actual change frequency of the port value of the I/O type digital quantity state between the latest two times of reading I/O type digital quantity asynchronous data port operations when the updated actual change frequency estimated value C is equal to N, and ending; and (4) when the updated actual change time estimation value C is smaller than N, repeatedly executing the step (7.2) to the step (7.3).
Compared with the prior art, the invention has the beneficial effects that:
(1) the method can realize that the SoC can read the generated I/O change state at the same time and record the generated I/O state change at the same time, thereby logically and completely solving the problem that the I/O type digital quantity change information generated in the switching process between frequently responding observation and recording tasks is lost because the observation or recording task can only be executed at the same time in the traditional monitoring method, ensuring the real-time property of recording and improving the sensitivity of the I/O type digital quantity change;
(2) the traditional I/O type digital quantity monitoring method can only respond to one change in a very short time, and the method can record multiple changes simultaneously through an I/O type digital quantity asynchronous data port, so that the loss of the upper edge and the lower edge of the I/O type digital quantity coming in a short time is avoided;
(3) in the asynchronous I/O type digital quantity monitoring method, the critical resource range between asynchronous tasks is minimized, a solution strategy of critical resource competition is provided, and the problem of small-probability I/O type digital quantity change record loss caused by critical resource competition is solved.
(4) The invention carries out filtering treatment to remove burrs or interference aiming at the I/O type digital quantity asynchronous port and then carries out state change judgment, thereby preventing the influence of external interference on the judgment, increasing the judgment complexity and prolonging the judgment time.
Drawings
Fig. 1 is a flow chart of a digital quantity monitoring method for an SoC with an I/O type digital asynchronous port according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a process for analyzing I/O type digital quantity flipping changes according to an embodiment of the present invention.
Detailed Description
The invention is described in detail below with reference to the figures and specific embodiments.
The I/O type digital quantity is a common information representation mode in electronic equipment, and the embedded type electronic system can conveniently know the state change of the embedded type system in the running process by carrying out asynchronous real-time monitoring on the I/O type digital quantity.
The invention provides a digital quantity monitoring method for an SoC (system on chip) with an I/O type digital quantity asynchronous port, which is used for counting the historical change rule of the I/O type digital quantity in real time and is explained in detail by adopting a specific embodiment.
Examples
In this embodiment, the method of the present invention is utilized to monitor 64 paths of I/O type digital quantities, and the 64 paths of I/O type digital quantities are divided into 8 groups, each group includes 8 parallel I/O type digital quantities, so that each group corresponds to one I/O type digital quantity asynchronous port. The SOC monitors each I/O type digital asynchronous port independently.
One I/O type digital quantity asynchronous port corresponds to one I/O type digital quantity status port and one I/O type digital quantity asynchronous data port. The I/O type digital quantity state port is used for recording 8 parallel I/O type digital quantity states in real time; for convenience of presentation, the I/O type digital asynchronous DATA port consists of two 32-bit registers (denoted as IO _ DATA _ BUF)2iAnd IO _ DATA _ BUF2i+1) To store in real time up to 7 most recent I/O type digital volume status port values and change times. 8I/O type digital asynchronous DATA ports are realized by 16 32-bit registers IO _ DATA _ BUF 0-IO _ DATA _ BUF 15. The 8I/O type digital quantum STATUS ports may be implemented using two 32-bit registers (denoted IO _ STATUS and IO _ STATUS 1).
The register format corresponding to each I/O type digital asynchronous data port is defined as follows:
Bit31~Bit24 | Bit23~Bit16 | Bit15~Bit8 | Bit7~Bit0 | |
IO_DATA_BUF2i | Data2 | Data1 | Data0 | n_Count |
IO_DATA_BUF2i+1 | Data6 | Data5 | Data4 | Data3 |
wherein IO _ DATA _ BUF2iThe four eight bits of the port from low to high are respectively: the number of times the eight-bit I/O type number changes, the state after the eight-bit I/O type number has changed for the latest time, and the state after the eight-bit I/O type number has changed for the next time; IO _ DATA _ BUF2i+1Four eight bits of the port from low to high are sequentially and respectively at IO _ DATA _ BUF2iBefore three changes of the number of I/O types recorded: the state of the eight-bit I/O type digital quantity after the latest change, the state of the eight-bit I/O type digital quantity after the latest change and the state of the eight-bit I/O type digital quantity after the latest change are recorded; the lower eight bits n _ Count of IO _ DATA _ BUF0 are bits for recording the number of times the number of changes of the eight-bit I/O type number. And I is 1-8 and represents the ith I/O type digital asynchronous port.
The I/O type digital quantity status port register and the bit packet thereof correspond to the I/O type digital quantity asynchronous data port register as follows:
in the following, the change of the IO state of the lower 8 bits is described in further detail as an example, and the change of the IO state of other groups is handled as the change of the IO state of the lower eight bits.
In order to prevent the unstable state of the I/O type digital quantity caused by the external interference or the glitch, the SOC performs filtering processing on the externally input I/O type digital quantity to remove the glitch or the interference, so that the I/O type digital quantity state port value is a value after performing filtering processing on the I/O type digital quantity asynchronous port to remove the glitch or the interference, and reflects a current input state of the current I/O type digital quantity.
In this embodiment, the I/O type digital quantity status port value Data is exclusive-ored with the latest I/O type digital quantity status port value Data0 stored in the I/O type digital quantity asynchronous Data port IO _ Data _ BUF0, so as to sequentially determine whether the I/O type digital quantity status port value changes.
If the XOR result is not 0, the I/O type digital quantity status port is changed; otherwise, the I/O type digital quantum status port is considered unchanged.
If the exclusive or result is not 0, the filtered input data is inconsistent with the current data state, which indicates that the I/O type digital quantity state port is changed;
and if the result is 0, namely the filtered input data is consistent with the current data state, the I/O type digital quantity state port is not changed and is not processed.
When one or more bits of the I/O type digital quantity state port are changed, the I/O type digital quantity asynchronous data port is immediately updated, and the specific process is as follows: and assigning the Nth data to be the (N-1) th data, assigning the N-2 th data to be the (N-1) th data, and so on, assigning the 1 st data to be the 0 th data, wherein the 0 th data is the I/O state of the latest changed I/O type digital quantity asynchronous data port and is used for recording the change times N _ Count of the change times of the W-bit I/O type digital quantity and adding 1. I.e. shift the upper 24 bits of IO _ DATA _ BUF0 8 bits to the left and assign the latest DATA to the DATA0 field, while completing the add 1 operation on n _ Count and raising the interrupt service request signal to the SoC.
The states of IO _ DATA _ BUF0 and IO _ DATA _ BUF1 in the set state are as follows,
Bit31~Bit24 | Bit23~Bit16 | Bit15~Bit8 | Bit7~Bit0 | |
IO_DATA_BUF0 | 1111 1110b | 1101 1010b | 0101 1010b | 0 |
IO_DATA_BUF1 | 0000 1000b | 0000 1100b | 1000 1100b | 1000 1110b |
if the Data read at this time is 01011010b, the states of IO _ Data _ BUF0 and IO _ Data _ BUF1 are not changed because the value is the same as the value of Data0 in the current IO _ Data _ BUF 0.
If the Data read by the test is 01011011b, since the exclusive or result of the Data value and the Data0 in the current IO _ Data _ BUF0 is 00000001 b and not 0, the Data value is recorded in the Data0, and the n _ Count value is modified to be 1, and the modified IO _ Data _ BUF0 and IO _ Data _ BUF1 values are as follows:
Bit31~Bit24 | Bit23~Bit16 | Bit15~Bit8 | Bit7~Bit0 | |
IO_DATA_BUF0 | 1101 1010b | 0101 1010b | 0101 |
1 |
IO_DATA_BUF1 | 0000 1100b | 1000 1100b | 1000 1110b | 1111 1110b |
at this time, since the value of n _ Count is 1, the interrupt is raised to the SoC and the SoC waits for a response. The SoC responds to the interrupt request, and the interrupt service routine running in the SoC is started to execute after receiving the interrupt request, as shown in fig. 1, the interrupt service routine execution steps are as follows:
(1) sequentially reading the values of I/O type digital quantity asynchronous DATA ports IO _ DATA _ BUF0 and IO _ DATA _ BUF1 into variables Buf _ New0 and Buf _ New 1;
Bit31~Bit24 | Bit23~Bit16 | Bit15~Bit8 | Bit7~Bit0 | |
Buf_New0 | 1101 1010b | 0101 1010b | 0101 |
1 |
Buf_New1 | 0000 1100b | 1000 1100b | 1000 1110b | 1111 1110b |
the SoC has a "read clear" function for the number of changes stored in the I/O type digital quantity asynchronous DATA port when performing a read operation on the I/O type digital quantity asynchronous DATA port, that is, when reading the DATA register, the n _ Count field in the DATA register is cleared simultaneously, and the priority of the clear operation is higher than that of a write operation when the I/O type digital quantity asynchronous DATA port is updated, at this time, the values of the registers IO _ DATA _ BUF0 and IO _ DATA _ BUF1 become:
Bit31~Bit24 | Bit23~Bit16 | Bit15~Bit8 | Bit7~Bit0 | |
IO_DATA_BUF0 | 1101 1010b | 0101 1010b | 0101 1011b | 0 |
IO_DATA_BUF1 | 0000 1100b | 1000 1100b | 1000 1110b | 1111 1110b |
(2) reading an I/O type digital quantity state port IO _ STATUS, acquiring an I/O type digital quantity state port value, and assigning a value to a variable ioStatus;
if the IO STATUS state is not changed at this time, the value of ioStatus becomes 01011011b, to illustrate the operation of the algorithm, it is assumed that at this time, the IO _ STATUS filtered value is changed again, and it is assumed that it becomes 01011001 b, at this time, the process of writing the changed value into the registers IO _ DATA _ BUF0 and IO _ DATA _ BUF1 is performed simultaneously with the interrupt handler of the SoC, while updating n _ Count, the SoC interrupt service routine is reading the values of registers IO _ DATA _ BUF0 and IO _ DATA _ BUF1, at which time the SoC triggers a clear write of n _ Count, and the external hardware triggers an add-on operation of n _ Count, which occurs when the n _ Count resource contends for write collision, in order to ensure that the zero clearing process of the SoC during data reading is normal so that the program runs correctly, the write priority of the SoC interrupt service program is higher than that of the external hardware, so that the n _ Count value is 0 in the case of resource write conflict. The value read by ioStatus at this time is 01011001 b, and the values of the registers IO _ DATA _ BUF0 and IO _ DATA _ BUF1 become the following states:
(3) analyzing the latest nCount turnover change condition of each I/O type digital quantity recorded by the I/O type digital quantity asynchronous data port according to the latest N times of the latest I/O type digital quantity state port value and nCount recorded by the latest I/O type digital quantity asynchronous data port, wherein nCount is 1 at the moment, and the specific steps are as follows: and according to the sequence from old to new or from new to old, performing bit comparison on each I/O type digital quantity state port value and the I/O type digital quantity state port value before the change of the I/O type digital quantity state port value to obtain the turnover change condition of each I/O type digital quantity during each change, until all the nCount times of the latest I/O type digital quantity state port values are compared, obtaining all nCount times of I/O type digital quantity turnover change conditions, and when the step is executed for the first time, defaulting the value before the change of the I/O type digital quantity state port value as the I/O type digital quantity initial state value.
In this embodiment, the holding variable io _ old is used to record the I/O type digital quantity status port value before the I/O type digital quantity status port value changes during each comparison, and the specific steps are shown in fig. 2.
(3.1) when the step is executed for the first time, initializing a hold type variable io _ old to be an initial state value of the I/O type digital quantity, wherein the value of io _ old is 01011010b in the current state;
(3.2) reading the field of Buf _ New0 recording the number of times the eight-bit I/O type number changes into the variable nCursor, which is then 1.
(3.3), reading the oldest status of the Buf _ New0 or Buf _ New1 after the change of the I/O type digital quantity is given to io _ New;
since there is only one change, the field portion of Data0 is assigned to the io _ new variable. The copied io _ new variable is 01011011 b.
(3.4) comparing the bit change of the io _ new relative to the io _ old, and respectively recording the start time and the end time of the change of the I/O type digital quantity according to the corresponding bit change, namely the upper edge or the lower edge;
at this time, the IO state corresponding to the lowest bit is changed from 0 to 1, and therefore the corresponding IO records the previous edge information once, which can be obtained by comparing the value 01011010b of IO _ old with the value 01011011b of IO _ new.
(3.5) subtracting 1 from the nCursor value to obtain a new nCursor;
(3.6), if nCursor is not 0, repeatedly executing the steps (3.3) to (3.6); if nCursor is 0, the process is ended. Since nCount is 0 at this time, no jump to step 3 is necessary.
(4) Comparing whether the latest I/O type digital quantity state port value (Bit 15-Bit 8 in Buf _ New 0) recorded by the latest I/O type digital quantity asynchronous data port is consistent with the latest I/O type digital quantity state port value (variable ioStatus) acquired from the I/O type digital quantity state port or not:
if the request is consistent with the interrupt request, ending the processing process of the interrupt request;
if not, go to step 5.
At this time, the variable in ioStatus is 01011001 b, and the latest status in Buf _ New0 is 01011011b, which are different, so that step 5 needs to be performed.
The field of n _ Count in the I/O type digital asynchronous DATA port IO _ DATA _ BUF0 is a critical resource of an external hardware component and an SoC interrupt handler, and under the condition of parallel operation, a competitive write situation occurs, that is, the problem of asynchronous reading and writing of software and hardware of the same port. When a certain I/O type digital quantity changes, the interrupt service processing logic starts to execute, and the I/O type digital quantity asynchronous data port is read in the execution process, and if the new I/O type digital quantity changes, the new state in the I/O type digital quantity asynchronous data port is updated, at the moment, the change times of the eight-bit I/O type digital quantity change cannot be recorded, so that the possible situation that the I/O type digital quantity change is lost occurs. The step is to check whether a conflict phenomenon occurs when the I/O type digital quantity asynchronous data port is read, if the conflict occurs, the problem that the digital quantity information is lost or the recording of the change time information is incorrect is caused, and the subsequent steps are adopted for further detection.
(5) And saving the Buf _ New0 to the Buf _ Old0, saving the Buf _ New1 to the Buf _ Old1, reading the I/O type digital quantity asynchronous data port again according to the mode in the step (1), and obtaining the most N times of latest I/O type digital quantity state port values and the change times recorded by the I/O type digital quantity asynchronous data port.
Buf _ Old0 and Buf _ Old1 backed up the values in Buf _ New0 and Buf _ New 1. Namely:
reading the values of the I/O type digital quantity asynchronous DATA ports IO _ DATA _ BUF0 and IO _ DATA _ BUF1 into the variables Buf _ New0 and Buf _ New1 in sequence again;
if the filtered value of the I/O type digital quantity STATUS port IO _ STATUS changes twice before the processing of this step, the value of the I/O type digital quantity STATUS port IO _ STATUS goes through the process of changing from 01011001 b to 01111001 b, and then changing to 00111001b again. The values in the I/O type digital quantity asynchronous DATA ports IO _ DATA _ BUF0 and IO _ DATA _ BUF1 at this time become as follows:
Bit31~Bit24 | Bit23~Bit16 | Bit15~Bit8 | Bit7~Bit0 | |
IO_DATA_BUF0 | 0101 1001b | 0111 1001b | 0011 1001b | 2 |
IO_DATA_BUF1 | 1111 1110b | 1101 1010b | 0101 1010b | 0101 1011b |
in the above steps, since there is no process of reading and writing the I/O type digital asynchronous DATA ports IO _ DATA _ BUF0 and IO _ DATA _ BUF1, no read-write collision is caused, and the n _ Count field is correctly written by the external hardware processing device.
After this step, the values in Buf _ Old0, Buf _ Old1, Buf _ New0 and Buf _ New1 are as follows:
Bit31~Bit24 | Bit23~Bit16 | Bit15~Bit8 | Bit7~Bit0 | |
Buf_New0 | 0101 1001b | 0111 1001b | 0011 1001b | 2 |
Buf_Old0 | 1101 1010b | 0101 1010b | 0101 |
1 |
Buf_New1 | 0000 1100b | 1000 1100b | 1000 1110b | 1111 1110b |
Buf_Old1 | 1111 1110b | 1101 1010b | 0101 1010b | 0101 1011b |
buf _ New0 and Buf _ New1 reflect the state of the current latest IO _ DATA _ BUF0 and IO _ DATA _ BUF 1.
(6) Reading the I/O type digital quantity state port again to obtain the value of the I/O type digital quantity state port;
since IO _ STATUS is not changed at this time, ioStatus reads 00111001 b.
(7) And comparing the most N times of the latest I/O type digital quantity state port values obtained by reading the I/O type digital quantity asynchronous data ports for the latest two times, analyzing to obtain the real change times of the I/O type digital quantity state port values between the I/O type digital quantity asynchronous data port operations for the latest two times, recording the change times as nCount, and re-executing the steps (3) to (7). The method specifically comprises the following steps:
(7.1) extracting the change times recorded by the I/O type digital quantity asynchronous data port which is read recently, and taking the change times as an estimation value C of the actual change times of the port value of the I/O type digital quantity state between the operations of reading the I/O type digital quantity asynchronous data port for the last two times;
(7.2) finding the latest I/O type digital quantity state port value before the I/O type digital quantity state port changes for C times from the I/O type digital quantity state port data recorded by the I/O type digital quantity asynchronous data port which is read recently, judging whether the value is the same as the latest I/O type digital quantity state port value recorded by the I/O type digital quantity asynchronous data port which is read recently, if so, considering that the current actual change frequency estimated value C is the actual change frequency of the I/O type digital quantity state port value between the two times of reading of the I/O type digital quantity asynchronous data ports, and ending; otherwise, executing step (7.3);
(7.3) adding 1 to the current actual change frequency estimated value C, updating the actual change frequency estimated value C, and taking N as the actual change frequency of the port value of the I/O type digital quantity state between the latest two times of reading I/O type digital quantity asynchronous data port operations when the updated actual change frequency estimated value C is equal to N, and ending; and (4) when the updated actual change time estimation value C is smaller than N, repeatedly executing the step (7.2) to the step (7.3).
In this embodiment, in the above processing procedure, the STATUS of the I/O type digital quantity STATUS port IO _ STATUS changes 3 times, but the record of one change is lost due to read-write collision, so the current value of n _ Count is 2, and 2 is taken as the assumed actual number of changes.
Data from Buf _ New0 or Buf _ New1 depending on the value of n _ Count in Buf _ New0n_CountInitially, searching the Old data area for the first data which is consistent with the state after the number of eight-bit I/O type digits in the Buf _ Old0 is changed for the latest time until the target data area is found or the data area is exceeded;
since the current n _ Count has a value of 2, starting from Data2 of Buf _ New0, Data2 of Buf _ New0, Data3 of Buf _ New1, Data4, Data5, Data6 are searched in sequence, and a position equal to the Data0 value of Buf _ Old0 is searched.
If the target is found, taking the subscript of the current data of Buf _ New0 as a New nCount; if Step2 ends with no target found, then 7 is set as the new nCount.
At this time, Data3 of Buf _ New1 is equal to Data0 of Buf _ Old0, and Data3 of Buf _ New1 has a Data index of 3. nCount is therefore assigned a value of 3.
In summary, the invention can realize that the SoC reads the occurred I/O change state while recording the occurring I/O state change, thereby logically and completely solving the problem that the I/O type digital quantity change occurring in the switching process between the frequent response observation and recording tasks is lost because only the observation or recording task can be executed at the same time in the traditional monitoring method, thereby ensuring the real-time performance of the recording. In the asynchronous I/O type digital quantity monitoring method, the critical resource range between asynchronous tasks is minimized, a solution strategy of critical resource competition is provided, the problem of small-probability I/O type digital quantity change record loss caused by critical resource competition is avoided, and the change information of the I/O type digital quantity in the system is reliably monitored in high real time.
The invention can be used for solving the problem of real-time monitoring of I/O type digital quantity in embedded systems in various application fields.
The present invention has not been described in detail as is known to those skilled in the art.
Claims (4)
1. A digital quantity monitoring method facing to an SoC with an I/O type digital quantity asynchronous port is characterized in that: the I/O type digital quantity asynchronous port comprises an I/O type digital quantity state port and an I/O type digital quantity asynchronous data port, the I/O type digital quantity state port is used for recording M parallel I/O type digital quantity states in real time, M is larger than or equal to 1, the I/O type digital quantity asynchronous data port is used for storing the most N times of latest I/O type digital quantity state port values and the change times in real time, when the I/O type digital quantity state port changes, the I/O type digital quantity asynchronous data port is immediately updated and generates an interrupt request, and the SoC responds to the interrupt request to execute the following steps:
(1) reading the I/O type digital quantity asynchronous data port, acquiring the most N times of the latest I/O type digital quantity state port value and the change times at the same time, recording the change times as nCount, performing read operation on the I/O type digital quantity asynchronous data port by the SoC to perform read clearing operation on the change times stored in the I/O type digital quantity asynchronous data port, wherein the priority of the clear clearing operation is higher than the write-in operation when the I/O type digital quantity asynchronous data port is updated;
(2) reading the I/O type digital quantity state port and obtaining the value of the I/O type digital quantity state port; the port value of the I/O type digital quantity state is a value obtained after filtering processing is carried out on an I/O type digital quantity asynchronous port to remove burrs or interference;
(3) analyzing the latest nCount turnover change condition of each I/O type digital quantity recorded by the I/O type digital quantity asynchronous data port according to the latest N times of latest I/O type digital quantity state port value and the current nCount value recorded by the latest I/O type digital quantity asynchronous data port;
(4) comparing whether the latest I/O type digital quantity state port value recorded by the latest I/O type digital quantity asynchronous data port is consistent with the I/O type digital quantity state port value acquired from the latest I/O type digital quantity state port or not, and if so, ending the interrupt processing process; otherwise, turning to the step (5);
(5) storing the most N times of latest I/O type digital quantity state port values and nCount recorded by the latest I/O type digital quantity asynchronous data port, reading the I/O type digital quantity asynchronous data port again according to the mode in the step (1) and obtaining the most N times of latest I/O type digital quantity state port values and the change times recorded by the I/O type digital quantity asynchronous data port;
(6) reading the I/O type digital quantity state port again to obtain the value of the I/O type digital quantity state port;
(7) and comparing the most N times of the latest I/O type digital quantity state port values obtained by reading the I/O type digital quantity asynchronous data ports for the latest two times, analyzing to obtain the real change times of the I/O type digital quantity state port values between the I/O type digital quantity asynchronous data port operations for the latest two times, recording the change times as nCount, and re-executing the steps (3) to (7).
2. The digital quantity monitoring method facing the SoC with the I/O type digital quantity asynchronous port is characterized in that: the method for judging the change of the port value of the I/O type digital quantity state comprises the following steps: performing exclusive-or operation on the I/O type digital quantity state port value and the latest I/O type digital quantity state port value stored in the I/O type digital quantity asynchronous data port, wherein if the exclusive-or result is not 0, the I/O type digital quantity state port is changed; otherwise, the I/O type digital quantum status port is considered unchanged.
3. The digital quantity monitoring method facing the SoC with the I/O type digital quantity asynchronous port is characterized in that: the specific method for analyzing the latest nCount number roll-over change condition of each I/O type number recorded by the I/O type number asynchronous data port according to the latest I/O type number state port value and nCount of the most N times recorded by the latest I/O type number asynchronous data port obtained in the step (3) is as follows: in the latest nCount times of inverted I/O type digital quantity state port values recorded by the latest I/O type digital quantity asynchronous data port, according to the sequence from old to new, each I/O type digital quantity state port value is compared with the I/O type digital quantity state port value before the change of the I/O type digital quantity state port value, the inversion change condition of each I/O type digital quantity during each change is obtained, until all nCount times of latest I/O type digital quantity state port values are compared, all nCount times of I/O type digital quantity inversion change conditions are obtained, and when the step is executed for the first time, the value before the change of the default I/O type digital quantity state port value is the initial I/O type digital quantity state value.
4. The digital quantity monitoring method facing the SoC with the I/O type digital quantity asynchronous port is characterized in that: the specific method for analyzing and obtaining the actual change times of the port value of the I/O type digital quantity state between the two latest I/O type digital quantity asynchronous data port reading operations by comparing the latest I/O type digital quantity state port value obtained by the two latest I/O type digital quantity asynchronous data port reading operations for the most N times is as follows:
(7.1) extracting the change times recorded by the I/O type digital quantity asynchronous data port which is read recently, and taking the change times as an estimation value C of the actual change times of the port value of the I/O type digital quantity state between the operations of reading the I/O type digital quantity asynchronous data port for the last two times;
(7.2) finding the latest I/O type digital quantity state port value before the I/O type digital quantity state port changes for C times from the I/O type digital quantity state port data recorded by the I/O type digital quantity asynchronous data port which is read recently, judging whether the value is the same as the latest I/O type digital quantity state port value recorded by the I/O type digital quantity asynchronous data port which is read recently, if so, considering that the current actual change frequency estimated value C is the actual change frequency of the I/O type digital quantity state port value between the two times of reading of the I/O type digital quantity asynchronous data ports, and ending; otherwise, executing step (7.3);
(7.3) adding 1 to the current actual change frequency estimated value C, updating the actual change frequency estimated value C, and taking N as the actual change frequency of the port value of the I/O type digital quantity state between the latest two times of reading I/O type digital quantity asynchronous data port operations when the updated actual change frequency estimated value C is equal to N, and ending; and (4) when the updated actual change time estimation value C is smaller than N, repeatedly executing the step (7.2) to the step (7.3).
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710179456.2A CN107102921B (en) | 2017-03-23 | 2017-03-23 | Digital quantity monitoring method for SoC (system on chip) with I/O (input/output) type digital quantity asynchronous port |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710179456.2A CN107102921B (en) | 2017-03-23 | 2017-03-23 | Digital quantity monitoring method for SoC (system on chip) with I/O (input/output) type digital quantity asynchronous port |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107102921A CN107102921A (en) | 2017-08-29 |
CN107102921B true CN107102921B (en) | 2020-05-12 |
Family
ID=59675657
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710179456.2A Active CN107102921B (en) | 2017-03-23 | 2017-03-23 | Digital quantity monitoring method for SoC (system on chip) with I/O (input/output) type digital quantity asynchronous port |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107102921B (en) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5796720A (en) * | 1995-07-05 | 1998-08-18 | Fujitsu Limited | Control method of asynchronous data communications |
WO2004049159A2 (en) * | 2002-11-22 | 2004-06-10 | Continental Teves Ag & Co. Ohg | Device and method for analysing embedded systems |
CN1845028A (en) * | 2005-09-19 | 2006-10-11 | 上海电器科学研究所(集团)有限公司 | Long-distance IO digital value module with Profibus-DP bus interface |
CN2896347Y (en) * | 2005-09-19 | 2007-05-02 | 上海电器科学研究所(集团)有限公司 | Remote 10 number-quantity module with Profibus DP bus interface |
CN201576371U (en) * | 2009-12-23 | 2010-09-08 | 西华大学 | Remote-control teaching training system based on wide area network |
CN105183688A (en) * | 2015-08-28 | 2015-12-23 | 北京航天自动控制研究所 | Serial port network based IO digital quantity monitoring port extension method |
-
2017
- 2017-03-23 CN CN201710179456.2A patent/CN107102921B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5796720A (en) * | 1995-07-05 | 1998-08-18 | Fujitsu Limited | Control method of asynchronous data communications |
WO2004049159A2 (en) * | 2002-11-22 | 2004-06-10 | Continental Teves Ag & Co. Ohg | Device and method for analysing embedded systems |
CN1845028A (en) * | 2005-09-19 | 2006-10-11 | 上海电器科学研究所(集团)有限公司 | Long-distance IO digital value module with Profibus-DP bus interface |
CN2896347Y (en) * | 2005-09-19 | 2007-05-02 | 上海电器科学研究所(集团)有限公司 | Remote 10 number-quantity module with Profibus DP bus interface |
CN201576371U (en) * | 2009-12-23 | 2010-09-08 | 西华大学 | Remote-control teaching training system based on wide area network |
CN105183688A (en) * | 2015-08-28 | 2015-12-23 | 北京航天自动控制研究所 | Serial port network based IO digital quantity monitoring port extension method |
Non-Patent Citations (1)
Title |
---|
24765-2010 - ISO/IEC/IEEE International Standard - Systems and software engineering -- Vocabulary;无;《IEEE》;20101215 * |
Also Published As
Publication number | Publication date |
---|---|
CN107102921A (en) | 2017-08-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR102025556B1 (en) | Processing apparatus, trace unit and diagnostic apparatus | |
US8473789B2 (en) | Memory leak monitoring system and associated methods | |
CN106682193A (en) | Device and method for data persistent storage on basis of cache | |
CN114817860B (en) | Data statistical method and device, solid state disk and medium | |
CN112185453A (en) | Read interference test method and device, computer readable storage medium and electronic equipment | |
CN115421672A (en) | Chip-based data storage method, system and storage medium | |
US20090138767A1 (en) | Self-diagnostic circuit and self-diagnostic method for detecting errors | |
CN115686961A (en) | Processor testing method and device and electronic equipment | |
CN111290305B (en) | Multi-channel digital quantity acquisition and processing anti-collision method and system for multiple sets of inertial navigation systems | |
CN107102921B (en) | Digital quantity monitoring method for SoC (system on chip) with I/O (input/output) type digital quantity asynchronous port | |
US6826245B1 (en) | Optimal location of a digital sync pattern | |
CN113127314A (en) | Method and device for detecting program performance bottleneck and computer equipment | |
CN109669828B (en) | Hard disk detection method and device | |
CN107943739B (en) | FPGA-based multi-group SPI code signal detection and verification method | |
CN108469997B (en) | Automatic identification method of user-defined heap management function based on dynamic characteristics | |
CN115966237A (en) | Screening method and device for bad blocks of hard disk, storage medium and electronic device | |
WO2016122318A1 (en) | A computer implemented method for generating a variant call file | |
CN111382052A (en) | Code quality evaluation method and device and electronic equipment | |
US8321851B2 (en) | Determining compiler efficiency | |
US7216316B1 (en) | Method for evaluating nets in crosstalk noise analysis | |
KR102275635B1 (en) | Apparatus and method for detecting anomaly through function call pattern analysis | |
CN110659150B (en) | Method for detecting micro-control unit memory and related device | |
US20170052887A1 (en) | To-be-stubbed target determining apparatus, to-be-stubbed target determining method and non-transitory recording medium storing to-be-stubbed target determining program | |
CN109358815B (en) | NAND flash memory data management method and device | |
US20240007486A1 (en) | Signal detection apparatus, vehicle, and method |
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 |