Semiconductor device, time measurement method, and time measurement program

The semiconductor device employs a timing management circuit to manage time measurement requests, addressing increased current consumption by optimizing time measurement processes and reducing power usage.

JP2024145030AActive Publication Date: 2024-10-15RENESAS ELECTRONICS CORP
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
JP2023057253
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Filing Date
2023-03-31
Publication Date
2024-10-15
Estimated Expiration
2043-03-31

AI Technical Summary

Technical Problem

The simultaneous time measurement by multiple circuits in an MCU leads to increased current consumption, particularly due to the supply of clock signals for time measurement to numerous circuits.

Method used

A semiconductor device with a timing management circuit that manages time measurement requests from peripheral circuits, executing measurements independently and reducing unnecessary operations to minimize current consumption.

Benefits of technology

The solution significantly reduces current consumption by optimizing time measurement processes, simplifying clock signal distribution, and facilitating efficient time measurement across multiple peripheral circuits.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2024145030000001_ABST
    Figure 2024145030000001_ABST
Patent Text Reader

Abstract

To provide a semiconductor device, a time measurement method, and a time measurement program capable of reducing current consumption.SOLUTION: According to one embodiment, a semiconductor device 1 comprises a processor 10, a plurality of peripheral circuits 41 controlled by the processor 10, and a timing management circuit 50 for outputting, to the peripheral circuits 41, results of time measurement performed in response to a time measurement request from the peripheral circuits 41. The timing management circuit 50 performs time measurement in response to each time measurement request.SELECTED DRAWING: Figure 10
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to a semiconductor device, a time measurement method, and a time measurement program.

Background Art

[0002] Non-Patent Document 1 describes a hardware block diagram of a microcomputer.

Prior Art Documents

Non-Patent Documents

[0003]

Non-Patent Document 1

Summary of the Invention

Problems to be Solved by the Invention

[0004] An MCU (Micro Controller Unit) includes a clock generation circuit, a timer, and communication IP (Intellectual Property), etc. The clock generation circuit has an oscillation stabilization waiting circuit that waits until the oscillation of the oscillator stabilizes. The oscillation stabilization waiting circuit has a function of measuring the time until the oscillation of the oscillator stabilizes. A plurality of peripheral circuits such as the timer and communication IP each have a function of performing time measurement. Each circuit can perform time measurement simultaneously by its respective time measurement function.

[0005] When a plurality of circuits in the MCU perform time measurement simultaneously, the power consumption current increases. Also, when a clock signal for time measurement is supplied to many circuits, the power consumption current associated with the clock operation also increases. ​

[0006] Other objects and novel features will become apparent from the description of this specification and the accompanying drawings. [Means for solving the problem]

[0007] According to one embodiment, a semiconductor device comprises an arithmetic processing unit, a plurality of peripheral circuits controlled by the arithmetic processing unit, and a timing management circuit that outputs a result of the time measurement performed in response to a time measurement request from the peripheral circuits to the peripheral circuits, and the timing management circuit performs the time measurement in response to each of the time measurement requests.

[0008] According to one embodiment, a time measurement method is a time measurement method in a semiconductor device comprising an arithmetic processing device, a plurality of peripheral circuits controlled by the arithmetic processing device, and a timing management circuit that outputs a result of the time measurement performed in response to a time measurement request from the peripheral circuits to the peripheral circuits, and includes a step of causing the timing management circuit to perform the time measurement in response to each of the time measurement requests.

[0009] According to one embodiment, a time measurement program is a time measurement program in a semiconductor device having an arithmetic processing device, a plurality of peripheral circuits controlled by the arithmetic processing device, and a timing management circuit that outputs a result of the time measurement performed in response to a time measurement request from the peripheral circuits to the peripheral circuits, and causes a computer to execute a step of causing the timing management circuit to perform the time measurement in response to each of the time measurement requests. Effect of the Invention

[0010] According to the embodiment, it is possible to provide a semiconductor device, a time measurement method, and a time measurement program capable of reducing current consumption. [Brief description of the drawings]

[0011] [Figure 1]FIG. 1 is a block diagram illustrating a semiconductor device according to a comparative example. [Diagram 2] FIG. 1 is a block diagram illustrating a semiconductor device according to a comparative example. [Diagram 3] 1 is a block diagram illustrating a processing unit, a clock generating circuit, a timer, and a communication IP in a semiconductor device according to a comparative example. [Figure 4] 1 is a block diagram illustrating a semiconductor device according to a first embodiment. [Diagram 5] 11 is a block diagram illustrating an oscillation stabilization waiting circuit in a semiconductor device according to a comparative example. [Figure 6] 11 is a block diagram illustrating an oscillation stabilization waiting circuit in a semiconductor device according to a comparative example. [Figure 7] 2 is a block diagram illustrating an oscillation stabilization waiting circuit and a timing management circuit in the semiconductor device according to the first embodiment. FIG. [Figure 8] 11 is a block diagram illustrating a configuration of an oscillation stabilization waiting circuit in a semiconductor device according to a comparative example. [Figure 9] 2 is a block diagram illustrating the configuration of an oscillation stabilization waiting circuit and a timing management circuit in the semiconductor device of the first embodiment. FIG. [Figure 10] 1 is a block diagram illustrating an arithmetic processing unit, a memory device, a timer, and a timing management circuit in a semiconductor device according to a first embodiment. [Figure 11] 2 is a block diagram illustrating a clock generation circuit, a timer, peripheral circuits, and a timing management circuit in the semiconductor device of the first embodiment. [Figure 12] FIG. 11 is a block diagram illustrating a timer in a semiconductor device according to a comparative example. [Figure 13] 2 is a block diagram illustrating a relationship between a timer and a timing management circuit in the semiconductor device of the first embodiment. FIG. [Figure 14] 11 is a flowchart illustrating a procedure for setting a compare match timer operation in a semiconductor device according to a comparative example. [Figure 15]4 is a flow chart illustrating a procedure for setting a compare match timer operation in the semiconductor device according to the first embodiment. FIG. [Figure 16] 1 is a block diagram illustrating a semiconductor device according to a first embodiment. [Figure 17] 2 is a block diagram illustrating the relationship between a clock generation circuit and a timing management circuit, and the relationship between the timing management circuit and peripheral circuits in the semiconductor device of the first embodiment. FIG. [Figure 18] 1 is a block diagram illustrating a timing management circuit of the semiconductor device according to the first embodiment. [Figure 19] 11 is a diagram illustrating a counting operation of a timing management circuit in the semiconductor device according to the first embodiment in the case of a single request for time measurement received from one peripheral circuit. FIG. [Figure 20] 11 is a diagram illustrating a counting operation of a timing management circuit in the semiconductor device according to the first embodiment in the case of multiple requests for time measurement received from a plurality of peripheral circuits. FIG. [Figure 21] 2 is a block diagram illustrating a clock generation circuit and a timing management circuit in the semiconductor device of the first embodiment. FIG. [Figure 22] 2 is a block diagram illustrating a connection relationship between a timing generation circuit in a timing management circuit and peripheral circuits in the semiconductor device of the first embodiment. FIG. [Diagram 23] 4 is a flow chart illustrating the operation of a timing generation circuit in the semiconductor device according to the first embodiment. [Figure 24] 11 is a diagram illustrating a counting operation of a timing management circuit in the semiconductor device according to the first embodiment in the case of a single request for time measurement received from one peripheral circuit. FIG. [Diagram 25] 11 is a diagram illustrating a counting operation of a timing management circuit in the semiconductor device according to the first embodiment in the case of multiple requests for time measurement received from multiple peripheral circuits at the same time; FIG. [Figure 26]11 is a diagram illustrating a counting operation of the timing management circuit accompanied by switching of the clock signal in the case of multiple requests for time measurement received from multiple peripheral circuits in the semiconductor device according to the first embodiment. FIG. [Figure 27] 1 is a graph illustrating current consumption over time in a semiconductor device according to a comparative example, in which the horizontal axis represents a configuration in which current-consuming members are stacked, and the vertical axis represents current consumption. [Figure 28] 4 is a graph illustrating current consumption over time in the semiconductor device according to the first embodiment, in which the horizontal axis indicates a configuration in which current-consuming members are stacked, and the vertical axis indicates current consumption. [Figure 29] FIG. 11 is a block diagram illustrating a semiconductor device according to a second embodiment. [Diagram 30] 11 is a block diagram illustrating a processing unit, a clock generating circuit, a timer, peripheral circuits, and a timing management circuit in a semiconductor device according to a third embodiment. FIG. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0012] For clarity of explanation, the following description and drawings have been omitted or simplified as appropriate. In addition, in each drawing, the same elements are given the same reference numerals, and duplicate explanations are omitted as necessary.

[0013] First, in <Comparative Example>, a semiconductor device according to the comparative example is described. Then, in <Problems Newly Found by the Inventor>, a problem newly found by the inventor for the semiconductor device of the comparative example is described. Then, in <Embodiment 1>, a semiconductor device according to embodiment 1 is described. Note that in <Embodiment 1>, in order to clarify the characteristics of the semiconductor device according to embodiment 1, it is appropriately compared with the semiconductor device of the comparative example.

[0014] <Comparative Example> A semiconductor device according to a comparative example will be described. FIGS. 1 and 2 are block diagrams illustrating a semiconductor device according to a comparative example. FIG. 1 is a block diagram in which a part of the main parts of FIG. 2 is extracted as an example. As shown in FIG. 1, a semiconductor device 101 according to the comparative example includes an arithmetic processing unit 110, an internal peripheral bus 111, a clock generation circuit 120, and a plurality of timers 130. The timer 130 includes a register 131, a counter circuit 132, and a clock selection circuit 133. Note that names such as "CPU", "INTERNAL PERIPHERAL BUS", "TIMER", and "CLOCK GENERATION CIRCUIT" shown in the drawings are merely examples and are not limited to these.

[0015] The arithmetic processing device 110 is, for example, a CPU (Central Processing Unit). Note that the arithmetic processing device 110 is not limited to a CPU, and may be an MPU (Micro Processor Unit) or the like, as long as it controls other devices and circuits in the semiconductor device 101 and performs processing such as data calculations. The arithmetic processing device 110 is connected to an internal peripheral bus 111 in a state in which information can be transmitted.

[0016] The clock generation circuit 120 generates a clock signal CLK. The clock signal CLK may include, for example, a signal that periodically repeats a high voltage state and a low voltage state. The clock generation circuit 120 supplies the generated clock signal CLK to a plurality of timers 130.

[0017] The timer 130 is connected to the internal peripheral bus 111 in a state in which information can be transmitted. For example, each register 131 of the multiple timers 130 is connected to the internal peripheral bus 111 in a state in which information can be transmitted. The register 131 controls a counter circuit 132 and a clock selection circuit 133.

[0018] The counter circuit 132 performs time measurement using the clock signal CLK. For example, the counter circuit 132 performs time measurement by counting the number of high voltage states or low voltage states of the clock signal CLK. The counter circuit 132 outputs the counted number to the register 131 as a result of the time measurement.

[0019] The clock selection circuit 133 receives the clock signal CLK from the clock generation circuit 120. The clock selection circuit 133 selects a predetermined clock signal CLK from the received clock signals CLK. The clock selection circuit 133 selects the predetermined clock signal CLK under the control of the register 131. The clock selection circuit 133 supplies the selected clock signal CLK to the counter circuit 132. The clock selection circuit 133 may control the generation of the clock signal CLK in the clock generation circuit 120.

[0020] 2, the semiconductor device 101 may include a processor CPU, a processor MPU, a clock generating circuit 120, a memory ROM, a memory RAM, a trigonometric function calculator TFU, an interrupt controller ICU, a data transfer controller DTC, a DMA controller DMAC, and a bus controller BSC. The semiconductor device 101 may also include circuits such as a timer TMR, a compare match timer CMTW, a temperature sensor (TEMPERATURE SENSOR), a comparator (COMPARATOR), and a D / A converter (CONVERTER). Each circuit may be connected to a bus such as an instruction bus (INSTRUCTION BUS), an operant bus (OPERANT BUS), an internal main bus (INTERNAL MAIN BUS1 and BUS2), and an internal peripheral bus (INTERNAL OERIPHERAL BUS) in a state in which information can be transmitted.

[0021] 3 is a block diagram illustrating an arithmetic processing unit 110, a clock generating circuit 120, a timer 130, and a communication IP 140 in a semiconductor device 101 according to a comparative example. As shown in FIG. 3, the semiconductor device 101 may include a plurality of communication IPs 140 in addition to the arithmetic processing unit 110, the clock generating circuit 120, and a plurality of timers 130. The semiconductor device 101 may also include, for example, an MCU.

[0022] The clock generation circuit 120 may include an oscillator A 121a, an oscillator B 121b, and an oscillation stabilization waiting circuit 123. The oscillation stabilization waiting circuit 123 has a function of waiting until the oscillations of the oscillator A 121a and the oscillator B 121b become stable. The oscillation stabilization waiting circuit 123 has a function of measuring the time until the oscillations of the oscillator A 121a and the oscillator B 121b become stable.

[0023] <New problem discovered by the inventor> Each of the peripheral circuits, such as the timer 130 and the communication IP 140, has a function of measuring time. Therefore, each of the circuits, such as the oscillation stabilization waiting circuit 123, the timer 130, and the communication IP 140, can measure time simultaneously by using their respective time measurement functions. With this configuration, the semiconductor device 101 can improve the degree of freedom of parallel operation. However, when the time measurement of each circuit in the semiconductor device 101 is performed simultaneously, the current consumption increases. In addition, when the number of circuits to which the clock signal CLK is supplied for time measurement increases, the current consumption associated with the clock operation also increases.

[0024] In recent years, with the demand for long-term operation using a battery and the addition of functions to the MCU, there is a demand for further reduction in power consumption in the semiconductor device 101. In the following embodiment, the current consumption is reduced by optimizing a circuit that performs redundant time measurement.

[0025] <Embodiment 1> Next, a semiconductor device according to the first embodiment will be described. The semiconductor device according to the present embodiment has, for example, a circuit in an MCU that performs intensive time measurement. The semiconductor device according to the present embodiment also has an interface that receives a time measurement request from a peripheral circuit such as a timer or a communication IP, and responds with the result of the time measurement to the peripheral circuit. In the following embodiments, such a circuit is called a timing management circuit.

[0026] 4 is a block diagram illustrating the semiconductor device 1 according to the first embodiment. As shown in FIG. 4, the semiconductor device 1 includes an arithmetic processing device 10, a clock generation circuit 20, a timer 30, a communication IP 40, and a timing management circuit 50. The clock generation circuit 20 may include an oscillator A 21a, an oscillator B 21b, and an oscillation stabilization waiting circuit 23. The timing management circuit 50 has a function of performing time measurement. The semiconductor device 1 may include multiple peripheral circuits other than the timer 30 and the communication IP 40. The multiple peripheral circuits are controlled by the arithmetic processing device 10.

[0027] The clock generation circuit 20 generates a clock signal CLK that is a reference for time measurement in the timing management circuit 50. The clock signal CLK generated from the oscillator A 21a in the clock generation circuit 20 may be supplied to the arithmetic processing device 10 via an oscillation stabilization waiting circuit 23. The clock signal CLK generated from the oscillator B 21b may be supplied to the timing management circuit 50.

[0028] The timing management circuit 50 is connected to the clock generation circuit 20 in a state capable of transmitting information. Specifically, the timing management circuit 50 is connected to the oscillation stabilization waiting circuit 23 in a state capable of transmitting information. The timing management circuit 50 may be connected to peripheral circuits including a plurality of timers 30 and a plurality of communication IPs 40 in a state capable of transmitting information.

[0029] The timing management circuit 50 controls the oscillation stabilization waiting circuit 23, while the oscillation stabilization waiting circuit 23 controls the timing management circuit 50. For example, the oscillation stabilization waiting circuit 23 requests the timing management circuit 50 to measure time. On the other hand, the timing management circuit 50 outputs the result of the time measurement to the oscillation stabilization waiting circuit 23.

[0030] Furthermore, the timing management circuit 50 controls a plurality of peripheral circuits including a plurality of timers 30 and a plurality of communication IPs 40, while the plurality of peripheral circuits control the timing management circuit 50. For example, the peripheral circuits such as the timers 30 and the communication IPs 40 request time measurement from the timing management circuit 50. Meanwhile, the timing management circuit 50 outputs the result of time measurement executed in response to the time measurement request from the peripheral circuits to the peripheral circuits.

[0031] In this way, the timing management circuit 50 is connected to various circuits that require time measurement. The timing management circuit 50 has a function of measuring time using the supplied clock signal CLK. When a peripheral circuit that requires time measurement issues a request to the timing management circuit 50 to start time measurement, the timing management circuit 50 notifies the completion of the time measurement after a certain period of time has elapsed. The timing management circuit 50 may output the result of the time measurement.

[0032] When receiving requests for time measurement from a plurality of peripheral circuits, the timing management circuit 50 executes time measurement in response to each request for time measurement. Specifically, when the timing management circuit 50 receives a first request for a first time measurement from any of the plurality of peripheral circuits, the timing management circuit 50 starts the first time measurement. When the timing management circuit 50 receives a second request for a second time measurement while executing the first time measurement, the timing management circuit 50 starts the second time measurement while continuing the first time measurement. The timing management circuit 50 may receive a second request from a peripheral circuit different from the peripheral circuit that received the first request. In some cases, the timing management circuit 50 may receive a second request from the peripheral circuit that received the first request.

[0033] The time measurement method in the semiconductor device 1 of the present embodiment includes a step of causing the timing management circuit 50 to execute time measurement in response to each request for time measurement. The step of executing time measurement includes a step of starting the first time measurement when a first request for a first time measurement is received from any of the multiple peripheral circuits, and a step of starting the second time measurement while continuing the first time measurement when a second request for a second time measurement is received during the first time measurement.

[0034] During periods when time measurement is not required, the timing management circuit 50 stops the built-in time measurement function. Therefore, the timing management circuit 50 executes time measurement upon receiving a time measurement request from a peripheral circuit. Therefore, after outputting the results of all requested time measurements, the timing management circuit 50 stops time measurement until it receives the next time measurement request.

[0035] Fig. 5 and Fig. 6 are block diagrams illustrating oscillation stabilization waiting circuits 123a to 123e in a semiconductor device 101 according to a comparative example. Fig. 6 is a block diagram extracting a part of the main part of Fig. 5 as an example. Fig. 7 is a block diagram illustrating oscillation stabilization waiting circuits 23a to 23c and a timing management circuit 50 in the semiconductor device 1 according to the first embodiment.

[0036] 5 and 6, the semiconductor device 101 according to the comparative example includes an oscillator A 121a and an oscillator B 121b, as well as a plurality of oscillators 121c to 121e and oscillation stabilization waiting circuits 123a to 123e for each of the on-chip oscillators. As shown in FIG. 6, each of the oscillation stabilization waiting circuits 123a to 123c has a function of measuring time. The function of measuring time may be performed by, for example, a counter.

[0037] On the other hand, as shown in Fig. 7, in the semiconductor device 1 of this embodiment, the timing management circuit 50 functions as a counter that measures time. The semiconductor device 1 of this embodiment includes a plurality of oscillators A21a and B21b, and oscillation stabilization waiting circuits 23a to 23c for each of the plurality of on-chip oscillators. When the oscillators A21a, B21b, and 21c start oscillating, the oscillation stabilization waiting circuits 23a to 23c output a time measurement request (REQUEST) to the timing management circuit 50. The timing management circuit 50 is responsible for the function of measuring time. The timing management circuit 50 outputs a result (RESULT) of the time measurement to the oscillation stabilization waiting circuits 23a to 23c.

[0038] Fig. 8 is a block diagram illustrating the oscillation stabilization waiting circuits 123a to 123c in the semiconductor device 101 according to the comparative example. Fig. 9 is a block diagram illustrating the oscillation stabilization waiting circuits 23a to 23c and the timing management circuit 50 in the semiconductor device 1 according to the first embodiment.

[0039] 8, in the semiconductor device 101 according to the comparative example, the oscillation stabilization waiting circuits 123a to 123c may have a function of measuring time and a logic gate such as an AND gate, etc. For example, a clock signal CLK may be output when the measured time coincides with a predetermined stabilization waiting time.

[0040] On the other hand, as shown in FIG. 9, in the semiconductor device 1 of this embodiment, the oscillation stabilization waiting circuits 23a to 23c may have logic gates such as AND gates. The oscillation stabilization waiting circuits 23a to 23c request the timing management circuit 50 to measure time. The timing management circuit 50 has a function of measuring time. The timing management circuit 50 outputs the result of the time measurement to the oscillation stabilization waiting circuits 23a to 23c. The oscillation stabilization waiting circuits 23a to 23c output a clock signal CLK when the measured time output by the timing management circuit 50 matches a predetermined stabilization waiting time. In FIG. 8 and FIG. 9, the oscillation stabilization waiting circuits 123a to 123c, the oscillation stabilization waiting circuits 23a to 23c, and the timing management circuit 50 are simplified. In reality, they may have complex circuits to prevent clock hazards, etc.

[0041] 10 is a block diagram illustrating the arithmetic processing device 10, the memory device 12, the timer 30, and the timing management circuit 50 in the semiconductor device 1 according to the embodiment 1. As shown in FIG. 10, the semiconductor device 1 may further include a memory device 12 in addition to the arithmetic processing device 10, the timer 30, and the timing management circuit 50. The timer 30 includes a register 31 and an interface circuit 34. The timing management circuit 50 includes a register 51 and a counter circuit 52.

[0042] The storage device 12 stores instruction codes for controlling the arithmetic processing device 10. For example, the storage device 12 may include a ROM (Read Only Memory). Note that the storage device 12 is not limited to a ROM and may be another storage device as long as it stores instruction codes for controlling the arithmetic processing device 10. The storage device 12 outputs instruction codes to the arithmetic processing device 10.

[0043] The arithmetic processing device 10 is controlled by instruction codes stored in the storage device 12. The arithmetic processing device 10 controls the timer 30 and the timing management circuit 50. Specifically, the arithmetic processing device 10 sets the operation of the timer 30 by writing instruction codes to a register 31 of the timer 30. The arithmetic processing device 10 also sets the operation of the timing management circuit 50 by writing instruction codes to a register 51 of the timing management circuit 50.

[0044] The register 31 is connected to the internal peripheral bus 11 in a state capable of transmitting information. The register 31 controls the operation of the timer 30 in accordance with the written instruction code. The interface circuit 34 is connected to the register 31 in a state capable of transmitting information. The interface circuit 34 is also connected to the timing management circuit 50 in a state capable of transmitting information. The timer 30 makes a request for time measurement to the timing management circuit 50 via the interface circuit 34. The timer 30 also receives the result of the time measurement from the timing management circuit 50 via the interface circuit 34.

[0045] The register 51 is connected to the internal peripheral bus 11 in a state capable of transmitting information. The register 51 controls the operation of the timing management circuit 50 according to the written instruction code. The counter circuit 52 executes time measurement. The counter circuit 52 executes time measurement by counting the number of high voltage states or low voltage states of the clock signal CLK. The timing management circuit 50 executes time measurement upon receiving a time measurement request from the timer 30, and outputs the result of the executed time measurement to the timer 30. The timing management circuit 50 may receive time measurement requests from multiple timers 30.

[0046] 11 is a block diagram illustrating the clock generation circuit 20, the timer 30, the peripheral circuit 41, and the timing management circuit 50 in the semiconductor device 1 according to the embodiment 1. The peripheral circuit 41 may include, for example, the timer 30 and a communication IP 40. As shown in FIG. 11, the clock generation circuit 20 has an oscillation circuit A 25a, an oscillation circuit B 25b, a frequency division circuit 27, a frequency division circuit 28, and a selection circuit 29.

[0047] The timing management circuit 50 has a counter circuit 52, a clock control circuit 53, a timing generation circuit 54, and a counter value conversion unit 55. The counter circuit 52 has a counter unit 56. The timing generation circuit 54 has a comparison unit 57a, a comparison unit 57b, a comparison unit 57c, a memory unit 58a, a memory unit 58b, a memory unit 58c, and a calculation circuit 59.

[0048] The oscillator circuit A25a generates a clock signal CLK. The oscillator circuit A25a may include an oscillator A21a. The oscillator circuit A25a outputs the generated clock signal CLK to the selection circuit 29. The oscillator circuit A25a may generate the clock signal CLK under the control of the clock control circuit 53, and output the generated clock signal CLK to the selection circuit 29.

[0049] The oscillation circuit B25b generates a clock signal CLK. The oscillation circuit B25b may include an oscillator B21b. The oscillation circuit B25b outputs the generated clock signal CLK to the selection circuit 29. The oscillation circuit B25b may also output the generated clock signal CLK to the frequency divider circuit 27. The oscillation circuit B25b may also output the generated clock signal CLK to the frequency divider circuit 28. The oscillation circuit B25b may generate a clock signal CLK under the control of the clock control circuit 53, and output the generated clock signal CLK to the selection circuit 29, the frequency divider circuit 27, and the frequency divider circuit 28.

[0050] The frequency divider circuit 27 divides the clock signal CLK. The frequency divider circuit 27 outputs the clock signal CLK generated by frequency division to the selection circuit 29. The frequency divider circuit 28 also divides the clock signal CLK. The frequency divider circuit 28 outputs the clock signal CLK generated by frequency division to the selection circuit 29. The frequency divider circuit 27 and the frequency divider circuit 28 may divide the clock signal CLK to have different frequencies. Specifically, the frequency divider circuit 27 and the frequency divider circuit 28 may use the same clock signal CLK generated from the oscillation circuit B 25b to generate clock signals CLK with different frequencies.

[0051] The selection circuit 29 receives clock signals CLK from the oscillation circuit A 25a, the oscillation circuit B 25b, the frequency divider circuit 27, and the frequency divider circuit 28. The selection circuit 29 selects a clock signal CLK from the received multiple clock signals CLK and outputs it to the counter circuit 52. For example, under the control of the clock control circuit 53, the selection circuit 29 selects a specific clock signal CLK from the multiple clock signals CLK and outputs it to the counter circuit 52. The selection circuit 29 outputs the selected clock signal CLK to the counter unit 56 in the counter circuit 52.

[0052] In this manner, the oscillator circuit A 25a generates the first clock signal CLK. The oscillator circuit B 25b may generate the second clock signal CLK having the same frequency as the first clock signal CLK, or may generate the second clock signal CLK having a frequency different from that of the first clock signal CLK. The frequency divider circuit 27 divides the second clock signal CLK to generate the third clock signal CLK. The frequency divider circuit 28 divides the second clock signal CLK to generate the fourth clock signal CLK. The frequency divider circuit 28 may generate the fourth clock signal CLK having the same frequency as the third clock signal CLK, or may generate the fourth clock signal CLK having a frequency different from that of the third clock signal CLK. The selection circuit 29 selects the clock signal CLK to be used for time measurement from the first clock signal CLK, the second clock signal CLK, the third clock signal CLK, and the fourth clock signal CLK in response to a request for time measurement.

[0053] For example, when executing the first time measurement and the second time measurement, the timing management circuit 50 may execute the first time measurement and the second time measurement based on the same clock signal CLK generated by the clock generation circuit 20. Furthermore, when executing the first time measurement and the second time measurement, the timing management circuit 50 may execute the first time measurement and the second time measurement based on mutually different clock signals CLK.

[0054] The counter circuit 52 holds the number of times the clock signal CLK is in a high voltage state or a low voltage state as a counter value. Specifically, the counter unit 56 receives the clock signal CLK from the selection circuit 29. The counter unit 56 executes time measurement using the clock signal CLK. The counter unit 56 generates a counter value. The counter unit 56 outputs the generated counter value to the counter value conversion unit 55, the comparison unit 57a, the comparison unit 57b, and the comparison unit 57c.

[0055] The clock control circuit 53 controls the generation and stopping of the clock signal CLK in the oscillation circuit A 25a and the generation and stopping of the clock signal CLK in the oscillation circuit B 25b. The clock control circuit 53 also controls the selection of the clock signal CLK in the selection circuit 29. The clock control circuit 53 controls the operations of the oscillation circuit A 25a, the oscillation circuit B 25b, and the selection circuit 29 under the control of the calculation circuit 59.

[0056] The clock control circuit 53 selects the clock signal CLK to be used in the counter unit 56 based on the peripheral circuit 41 that has requested time measurement. For example, when the peripheral circuit 41 that has requested time measurement requires high-resolution time measurement, the clock control circuit 53 selects a high-frequency clock signal CLK.

[0057] The timing generation circuit 54 receives a time measurement request from the peripheral circuit 41 and outputs a result of the time measurement to the peripheral circuit 41. The calculation circuit 59 calculates a target count number for the measurement time from the measurement time in the requested time measurement and the clock signal CLK as a target value. In this way, the calculation circuit 59 calculates the target value from the clock setting and the measurement time. The calculation circuit 59 stores the calculated target value in the storage units 58a to 58c.

[0058] The comparators 57a to 57c compare the counter value with a target value. The counter value is a count number obtained by counting the number of high voltage states or low voltage states of the clock signal CLK. The memory units 58a to 58c store the target values.

[0059] The counter value conversion unit 55 converts the counter value received from the counter circuit 52 and outputs it to the timer 30. When the peripheral circuit 41 is the timer 30 and the timing management circuit 50 receives a time measurement request from the timer 30, the counter value conversion unit 55 outputs the converted counter value to the timer 30. In this way, the timing management circuit 50 may have a function of converting and outputting the counter value of the counter circuit 52 in response to a request from the peripheral circuit 41.

[0060] For example, when the timer 30 requests the timing management circuit 50 to measure time, the counter value of the timer 30 is 100 and the counter value of the counter circuit 52 is 0. Also, assume that the timer 30 and the timing management circuit 50 use a clock signal CLK with the same frequency. In this case, if the counter value of the counter circuit 52 is, for example, 15, the counter value conversion unit 55 outputs 115 to the timer 30.

[0061] For example, when the timer 30 requests the timing management circuit 50 to measure time, the counter value of the timer 30 is 100 and the counter value of the counter circuit 52 is 0. The frequency of the clock signal CLK used in the timer 30 is twice the frequency of the clock signal CLK used in the timing management circuit 50. In this case, when the counter value of the counter circuit 52 is, for example, 15, the counter value conversion unit 55 outputs 130 to the timer 30.

[0062] 12 is a block diagram illustrating timers 130a and 130b in a semiconductor device 101 according to a comparative example. As shown in FIG. 12, the timer 130a of the semiconductor device 101 according to the comparative example includes a comparator A0, a comparator B0, and a counter circuit TCNT. The timer 130b includes a comparator A1, a comparator B1, and a counter circuit TCNT. Note that some symbols and the like are omitted to avoid complicating the drawing. The semiconductor device 101 of the comparative example measures time using the counter circuit TCNT, the comparator A0, and the like.

[0063] In the semiconductor device 101 of the comparative example, when multiple peripheral circuits 41 that require time measurement, such as multiple timers 130a and 130b, are connected and each peripheral circuit 41 performs time measurement, current consumption increases.

[0064] FIG. 13 is a block diagram illustrating the relationship between the timers 30a and 30b and the timing management circuit 50 in the semiconductor device 1 according to the first embodiment. As shown in FIG. 13, the semiconductor device 1 according to the present embodiment does not use the counters TCNT built in the timers 30a and 30b. The timing management circuit 50 has a function of measuring a plurality of times. The timing management circuit 50 receives a time measurement request from the timers 30a and 30b, and outputs a counter value converted by a counter value conversion unit 55 to the timers 30a and 30b as a result of measuring the time. The comparators A0 and the like may be configured to use the comparators 57a and the like in the timing management circuit 50, or to use the comparators A0 and the like built in the timers 30a and 30b.

[0065] Next, an example of application to a compare match timer will be described. The semiconductor device 1 of this embodiment can be adapted to a compare match timer function. Below, the function of this embodiment will be described in comparison with a comparative example.

[0066] Fig. 14 is a flow chart illustrating a procedure for setting a compare match timer operation in the semiconductor device 101 according to the comparative example. As shown in Fig. 14, in order to operate the compare match function in the semiconductor device 101 according to the comparative example, first, the compare match operation is permitted as shown in step S11. Specifically, the compare match operation is permitted by the CMWIOR register. The CMWIOR register is, for example, a timer I / O control register.

[0067] Next, as shown in step S12, the compare match timing is set. Specifically, the timing for generating a compare match is set in the CMWCOR register. The CMWCOR register is, for example, a compare match constant register.

[0068] Next, as shown in step S13, the count operation is started. Specifically, the CMWCR register is set, and the CMWSTR.STR bit is set to "1" to start the count operation. The CMWCR register is, for example, a timer control register, and the CMWSTR.STR bit is a bit of a timer start register. Then, the count operation is performed until it matches the timing set in the compare match constant register. In this way, the semiconductor device 101 of the comparative example performs the compare match operation.

[0069] Next, an example in which a compare match timer function is applied to the semiconductor device 1 according to this embodiment will be described. The semiconductor device 1 according to this embodiment does not need to be provided with a counter circuit in the timer 30. Fig. 15 is a flow chart illustrating a procedure for setting the compare match timer operation in the semiconductor device 1 according to the first embodiment. Steps S21 to S22 in Fig. 15 are similar to steps S11 to S12 in Fig. 14.

[0070] Next, as shown in step S23, the timer 30 requests the timing management circuit 50 to measure time. As a result, the timing management circuit 50 executes the time measurement. Then, the timing management circuit 50 outputs a counter value to the timer 30 as a result of the time measurement. Therefore, as shown in step S24, the timer 30 receives the result of the time measurement from the timing management circuit 50. In this way, in the semiconductor device 1 of this embodiment, the timer 30 can perform a compare match operation. In this way, the semiconductor device 1 of this embodiment can operate a function similar to that of the semiconductor device 101 of the comparative example, such as a compare match timer function, by making the timing management circuit 50 execute the time measurement.

[0071] FIG. 16 is a block diagram illustrating a semiconductor device 1 according to the first embodiment. The semiconductor device 1 includes, for example, an MCU. As shown in FIG. 16, the semiconductor device 1 includes an arithmetic processing device 10, a memory device 12, a clock generating circuit 20, a timer 30, a communication IP 40, and a timing management circuit 50. The multiple peripheral circuits 41 including the timer 30 and the communication IP 40 may include a circuit that requires time measurement. The timing management circuit 50 includes a circuit that performs time measurement, such as a counter circuit 52. The multiple peripheral circuits 41 including the timer 30 and the communication IP 40 in the semiconductor device 1 may be connected to other semiconductor devices MCU1 and MCU2 in a state in which information can be transmitted.

[0072] The clock generation circuit 20 has a clock generation function and a clock selection function. In the clock generation circuit 20, the clock generation function includes, for example, the above-mentioned oscillation circuit A 25a, oscillation circuit B 25b, frequency division circuit 27, and frequency division circuit 28. The clock selection function includes the above-mentioned selection circuit 29. The arithmetic processing device 10 executes a program (instruction code) written in the storage device 12, and sets the timing management circuit 50 and the peripheral circuit 41.

[0073] 17 is a block diagram illustrating the relationship between the clock generation circuit 20 and the timing management circuit 50, and the relationship between the timing management circuit 50 and the peripheral circuit 41 in the semiconductor device 1 according to the first embodiment. As shown in FIG. 17, the timing management circuit 50 includes a counter unit 56 for measuring time. In addition, the timing management circuit 50 controls the clock generation circuit 20.

[0074] As described above, the clock generation circuit 20 includes the oscillation circuit A 25a, the oscillation circuit B 25b, the frequency divider circuit 27, the frequency divider circuit 28, and the selection circuit 29. The timing management circuit 50 controls the oscillation and stop of the oscillation circuit A 25a, the oscillation and stop of the oscillation circuit B 25b, the frequency divider circuits 27 and 28, and the selection circuit 29. The timing management circuit 50 operates the counter unit 56 with the supplied clock signal CLK. The timing management circuit 50 also adjusts the frequency of the clock signal CLK by selection. Furthermore, the timing management circuit 50 reduces current consumption by stopping the unnecessary oscillation circuits A 25a and B 25b.

[0075] The peripheral circuit 41, which includes the oscillation stabilization waiting circuit 23, peripheral IPs 41a and 41b, etc., outputs a request to start time measurement to the timing management circuit 50 when timing generation is required during operation. If the measurement time has not been determined in advance, the timing management circuit 50 also notifies the measurement time. Upon receiving the request, the timing management circuit 50 starts time measurement, and after the determined time has elapsed, outputs a notification that the measurement is complete.

[0076] 18 is a block diagram illustrating a timing management circuit 50 of the semiconductor device 1 according to the first embodiment. As shown in FIG. 18, the timing management circuit 50 includes a counter circuit 52, a clock control circuit 53, and a timing generation circuit 54. The timing generation circuit 54 receives requests from a plurality of peripheral circuits 41 and selects an optimal clock signal CLK required for the counting operation of the counter circuit 52 for time measurement. Then, the timing generation circuit 54 requests the clock control circuit 53 to supply the selected clock signal CLK. The counter circuit 52 executes a counting operation for performing a required time measurement using the supplied clock signal CLK in response to the control of the timing generation circuit 54.

[0077] 19 is a diagram illustrating a counting operation of the timing management circuit 50 in the semiconductor device 1 according to the first embodiment in the case of a single request for time measurement from one peripheral circuit 41. As shown in FIG. 19, the timing generation circuit 54 receives a request REQUEST1 from one peripheral circuit 41 and selects an optimal clock signal CLK required for the counting operation of the counter circuit 52 for time measurement. The timing generation circuit 54 requests the clock control circuit 53 to supply the selected clock signal CLK. The counter circuit 52 executes a counting operation for time measurement using the supplied clock signal CLK under the control of the timing generation circuit 54. After the completion END1 of the time measurement, the timing generation circuit 54 outputs the measurement result to the peripheral circuit 41.

[0078] 20 is a diagram illustrating a counting operation of the timing management circuit 50 in the case of multiple requests for time measurement received from multiple peripheral circuits 41 in the semiconductor device 1 according to the first embodiment. As shown in FIG. 20, the timing generation circuit 54 first receives a request REQUEST1 from the first peripheral circuit 41 and selects an optimal clock signal CLK required for the counting operation of the counter circuit 52 for time measurement. Then, the timing generation circuit 54 requests the clock control circuit 53 to supply the selected first clock signal CLK. The counter circuit 52 executes a counting operation for time measurement using the supplied first clock signal CLK in response to the control of the timing generation circuit 54.

[0079] Next, upon receiving a request REQUEST2 from the second peripheral circuit 41, the timing generation circuit 54 selects an optimum clock signal CLK required for the counting operation of the counter circuit 52 for time measurement. Then, the timing generation circuit 54 requests the clock control circuit 53 to supply the selected second clock signal CLK. The counter circuit 52 executes a counting operation for measuring time using the supplied second clock signal CLK in response to the control of the timing generation circuit 54.

[0080] Next, after completion END2 of the time measurement based on the request REQUEST2 from the second peripheral circuit 41, the timing generation circuit 54 outputs the measurement result to the second peripheral circuit 41. Next, after completion END1 of the time measurement based on the request REQUEST1 from the first peripheral circuit 41, the timing generation circuit 54 outputs the measurement result to the first peripheral circuit 41. In this example, the frequency of the first clock signal CLK is lower than the frequency of the second clock signal CLK. Also, the measurement time measured based on the request REQUEST1 from the first peripheral circuit 41 is longer than the measurement time measured based on the request REQUEST2 from the second peripheral circuit 41.

[0081] 21 is a block diagram illustrating the clock generation circuit 20 and the timing management circuit 50 in the semiconductor device 1 according to the embodiment 1. As shown in Fig. 21, in the timing management circuit 50, a clock control circuit 53 controls the clock generation circuit 20 upon receiving a request from a timing generation circuit 54. For example, when high-resolution time measurement is required, an oscillator that generates a high-frequency clock signal CLK is operated.

[0082] The clock control circuit 53 controls the selection circuit 29 to select the clock signal CLK to be supplied to the counter circuit 52. The clock control circuit 53 also controls the selection circuit 29 to select the division ratios of the frequency divider circuit 27 and the frequency divider circuit 28. In this way, the clock control circuit 53 supplies the clock signal CLK of the minimum necessary frequency to the counter circuit 52.

[0083] Fig. 22 is a block diagram illustrating the connection relationship between a timing generation circuit 54 and a peripheral circuit 41 in a timing management circuit 50 in the semiconductor device 1 according to the first embodiment. As shown in Fig. 22, the timing generation circuit 54 includes a calculation circuit 59 that calculates a target value, comparison units 57a to 57c that compare counter values ​​with the target value, and storage units 58a to 58c that store the target values. Note that the timing management circuit 50 does not necessarily need to include the counter value conversion unit 55 described above.

[0084] 23 is a flow chart illustrating the operation of the timing generation circuit 54 in the semiconductor device 1 according to the first embodiment. As shown in step S31 of FIG. 23, the timing generation circuit 54 receives a request to start time measurement from the peripheral circuit 41. Next, as shown in step S32, the timing generation circuit 54 takes in the current clock setting from the clock control circuit 53. Next, as shown in step S33, the timing generation circuit 54 takes in the current counter value from the counter circuit 52.

[0085] Next, as shown in step S34, the timing generation circuit 54 calculates a target value from the clock setting and the counter value. Specifically, the calculation circuit 59 calculates a target value that is a target count number for time measurement from the frequency of the clock signal CKL and the current counter value. The calculation circuit 59 stores the calculated target value in the storage units 58a to 58c.

[0086] Next, as shown in step S35, the timing generation circuit 54 may cause the clock control circuit 53 to change the counting clock signal CLK if necessary. Also, the timing generation circuit 54 may change the target value in accordance with the changed clock signal CLK if necessary. For example, when the clock settings in other time measurement requests are different, the timing generation circuit 54 changes the counting clock signal CLK and the target value.

[0087] Next, as shown in step S36, the timing generation circuit 54 waits until the counter value matches the target value. Then, as shown in step S37, when the counter value matches the target value, the timing generation circuit 54 notifies the peripheral circuit 41 of the completion of the time measurement and outputs the result of the time measurement.

[0088] Next, as shown in step S38, the timing generation circuit 54, if necessary, causes the clock control circuit 53 to stop the clock signal CLK and causes the counter circuit 52 to stop counting the clock signal CLK. Also, if necessary, the timing generation circuit 54 may cause the clock control circuit 53 to change the counting clock signal CLK. Also, the timing generation circuit 54 may change the target value if necessary.

[0089] Next, a description will be given of the counting operation of the timing management circuit 50 in the case of a single request for time measurement received from one peripheral circuit 41. In the case of a single request, the operation of the timing generation circuit 54 in FIG. 23 described above can be applied as is.

[0090] 24 is a diagram illustrating a counting operation of the timing management circuit 50 in the semiconductor device 1 according to the first embodiment in the case of a single request for time measurement received from one peripheral circuit 41. As shown in FIG. 24, the timing generation circuit 54 receives a request (REQUEST1) to start time measurement (COUNT TIME1) from one peripheral circuit 41. Next, the timing generation circuit 54 takes in the current clock setting (CLK SET A) from the clock control circuit 53. Next, the timing generation circuit 54 takes in the current counter value (AAA) from the counter circuit 52.

[0091] Next, the timing generation circuit 54 calculates a target value from the clock setting and the counter value. Specifically, the calculation circuit 59 calculates a target value (AAA+α) that is a target count number for time measurement from the frequency of the clock signal CKL and the current counter value (AAA). Next, the timing generation circuit 54 waits until the counter value matches the target value (AAA+α). Then, when the counter value matches the target value, the timing generation circuit 54 notifies the peripheral circuit 41 of the completion (END1) of the time measurement.

[0092] Next, when there is no other request for time measurement, the timing generation circuit 54 may cause the clock control circuit 53 to stop the clock signal CLK and the counter circuit 52 to stop counting the clock signal CLK. Also, the timing generation circuit 54 may cause the clock control circuit 53 to change the counting clock signal CLK.

[0093] Next, when a request (REQUEST2) to start time measurement (COUNT TIME2) is received from the peripheral circuit 41, the timing generation circuit 54 performs the same process as the request (REQUEST1). That is, the timing generation circuit 54 takes in the current clock setting (CLK SET B) from the clock control circuit 53 and the current counter value (BBB) ​​from the counter circuit 52. Then, the timing generation circuit 54 calculates a target value (BBB+β) from the clock setting and the counter value. When the counter value and the target value match, the timing generation circuit 54 notifies the peripheral circuit 41 of the completion (END2) of the time measurement.

[0094] Next, a description will be given of the counting operation of the timing management circuit 50 in the case of multiple requests for time measurement received from multiple peripheral circuits 41. In the case of multiple requests, the operation of the timing generation circuit 54 in FIG. 23 described above can be applied in a redundant manner.

[0095] 25 is a diagram illustrating the counting operation of the timing management circuit 50 in the semiconductor device 1 according to the first embodiment in the case of multiple requests for time measurement received from multiple peripheral circuits 41 in a duplicated manner. First, a case where the clock signal CLK is not switched will be described. As shown in FIG. 25, the timing generation circuit 54 receives a request (REQUEST1) to start time measurement (COUNT TIME1) from the peripheral circuit 41. Next, the timing generation circuit 54 takes in the current clock setting (CLK SET A) from the clock control circuit 53. Next, the timing generation circuit 54 takes in the current counter value (A) from the counter circuit 52.

[0096] Next, the timing generation circuit 54 calculates a target value from the clock setting and the counter value. Specifically, the calculation circuit 59 calculates a target value (TARGET VALUE 1) that is a target count number for time measurement from the frequency of the clock signal CKL and the current counter value (A). Next, the timing generation circuit 54 waits until the counter value matches the target value (TARGET VALUE 1).

[0097] In the case of multiple requests, while waiting until the counter value matches the target value (TARGET VALUE 1), the timing generation circuit 54 receives a request (REQUEST2) to start time measurement (COUNT TIME 2) from the peripheral circuit 41. In this case, the timing generation circuit 54 takes in a clock setting (CLK SET A) from the clock control circuit 53. Next, the timing generation circuit 54 takes in a current counter value (A+α) from the counter circuit 52. Next, the timing generation circuit 54 calculates a target value from the clock setting and the counter value. Specifically, the calculation circuit 59 calculates a target value (TARGET VALUE 2), which is a target count number for time measurement, from the frequency of the clock signal CKL and the current counter value (A+α). Next, the timing generation circuit 54 waits until the counter value matches the target value (TARGET VALUE2).

[0098] When the counter value matches any of the target values, the timing generation circuit 54 notifies the peripheral circuit 41 of the completion of time measurement (END1 or END2). For example, when the counter value matches the target value (TARGET VALUE 2), the timing generation circuit 54 notifies the peripheral circuit 41 of the completion of time measurement (END2). Next, when the counter value matches the target value (TARGET VALUE 1), the timing generation circuit 54 notifies the peripheral circuit 41 of the completion of time measurement (END1).

[0099] Next, a counting operation of the timing management circuit 50 in the case where a multiple request involves switching of the clock signal CLK will be described. FIG. 26 is a diagram illustrating a counting operation of the timing management circuit 50 in the case where a multiple request for time measurement is received from a plurality of peripheral circuits 41 in the semiconductor device 1 according to the first embodiment, involving switching of the clock signal CLK. As shown in FIG. 26, the timing generation circuit 54 receives a request (REQUEST1) to start a time measurement (COUNT TIME 1) from the peripheral circuit 41. Next, the timing generation circuit 54 takes in the current clock setting (CLK SET A) from the clock control circuit 53. Next, the timing generation circuit 54 takes in the current counter value (A) from the counter circuit 52.

[0100] Next, the timing generation circuit 54 calculates a target value from the clock setting and the counter value. Specifically, the calculation circuit 59 calculates a target value (TARGET VALUE 1) that is a target count number for time measurement from the frequency of the clock signal CKL and the current counter value (A). Next, the timing generation circuit 54 waits until the counter value matches the target value (TARGET VALUE 1).

[0101] In the case of multiple requests, while waiting until the counter value matches the target value (TARGET VALUE 1), the timing generation circuit 54 receives a request (REQUEST2) to start time measurement (COUNT TIME 2) from the peripheral circuit 41. In this example, the request (REQUEST2) involves switching the clock signal CLK. In this case, the timing generation circuit 54 causes the clock control circuit 53 to switch the clock setting. Specifically, the timing generation circuit 54 retrieves a clock setting (CLK SET B) according to the request (REQUEST2) from the peripheral circuit 41. Next, the timing generation circuit 54 retrieves the current counter value (A+α) from the counter circuit 52.

[0102] Next, the timing generation circuit 54 calculates a target value from the clock setting and the counter value. Specifically, the calculation circuit 59 calculates a target value (TARGET VALUE 2) of the request (REQUEST2) from the clock setting (CLK SET B) corresponding to the request (REQUEST2) and the counter value (A+α). In addition, with the switching of the clock signal CLK, the calculation circuit 59 recalculates the target value corresponding to the request (REQUEST1). Specifically, the calculation circuit 59 recalculates a target value (TARGET VALUE 11) from the reset clock setting (CLK SET B) and counter value (A+α). Next, the timing generation circuit 54 waits until the counter value matches the target value (TARGET VALUE 2) or the target value (TARGET VALUE 11).

[0103] When the counter value matches any of the target values, the timing generation circuit 54 notifies the peripheral circuit 41 of the completion of time measurement (END1 or END2). For example, when the counter value matches the target value (TARGET VALUE 2), the timing generation circuit 54 notifies the peripheral circuit 41 of the completion of time measurement (END2). Next, when the counter value matches the target value (TARGET VALUE 11), the timing generation circuit 54 notifies the peripheral circuit 41 of the completion of time measurement (END1).

[0104] Next, the effect of this embodiment will be described. Fig. 27 is a graph illustrating the current consumption over time in the semiconductor device 101 according to the comparative example, where the horizontal axis indicates the configuration in which current consuming members are stacked, and the vertical axis indicates the current consumption. Fig. 28 is a graph illustrating the current consumption over time in the semiconductor device 1 according to the first embodiment, where the horizontal axis indicates the configuration in which current consuming members are stacked, and the vertical axis indicates the current consumption.

[0105] 27, in the semiconductor device 101 of the comparative example, the time measurement functions provided in each of the multiple timers 30 including timers TMR0, TMR1, and TMR2 perform time measurement. Then, the current consumption in the semiconductor device 101 is the current amount including the CTS buffer current in addition to 0.129 mA, which is the current consumption consumed by the timers TMR0, TMR1, and TMR2.

[0106] 28, in the semiconductor device 1 of the present embodiment, the timing management circuit 50 performs time measurement in a plurality of timers 30 including timers TMR0, TMR1, and TMR2. Therefore, the peripheral circuits 41 do not need to perform time measurement, and the current consumption consumed in the time measurement can be reduced. For example, the current consumption in the semiconductor device 1 is the current consumption amount including the CTS buffer current in the 0.043 mA that is the current consumption consumed by the timing management circuit 50.

[0107] In addition, since the number of destinations to which the clock signal is supplied can be reduced, the current consumed in the transmission path of the clock signal CLK can be reduced. Furthermore, the amount of distribution of the clock signal CLK for time measurement can be reduced. Therefore, the transmission system of the clock signal CLK can be simplified. This makes it possible to facilitate timing design and reduce the number of CTS buffers, that is, reduce the operating current of the clock generation circuit 20.

[0108] For example, the semiconductor device 101 of the comparative example has seven PWM circuits and three UART circuits as peripheral circuits. The PWM circuits and the UART circuits have a function of measuring time. The current consumption of one PWM circuit is, for example, 0.18 mA, and the current consumption of one UART circuit is, for example, 0.15 mA. Then, in the semiconductor device 101 of the comparative example, the current consumption for operating the PWM circuits and the UART circuits is 0.18×7+0.15×3=1.71 mA.

[0109] On the other hand, the semiconductor device 1 of this embodiment has, as peripheral circuits, seven PWM circuits, three UART circuits, and further a timing management circuit 50 that performs time measurement. The timing management circuit 50 is responsible for time measurement of the PWM circuit and the UART circuit. If the current consumption of the PWM circuit and the UART circuit for time measurement is estimated to be about 70%, it is 1.71 x 0.7 = 1.20 mA. Therefore, the current consumption of the PWM circuit and the UART circuit other than time measurement is 1.71 - 1.20 = 0.51 mA. If the current consumption of the timing management circuit 50 for time measurement is 0.1 mA, the current consumption for operating the PWM circuit and the UART circuit in the semiconductor device 1 of this embodiment is 0.51 + 0.1 = 0.61 mA. In this way, the semiconductor device 1 of this embodiment can significantly reduce the current consumption.

[0110] <Embodiment 2> Next, a semiconductor device according to a second embodiment will be described. The semiconductor device according to this embodiment has an independent counter unit for each oscillator circuit in order to handle multiple requests. In the semiconductor device 1 described above, when switching the clock source supplied to the counter unit 56 between the oscillator circuit A 25a and the oscillator circuit B 25b, it may take time to switch. If multiple requests occur frequently, there is a risk that the switching of the clock signal CLK and the counter operation cannot keep up. Therefore, in this embodiment, as a measure against such frequent multiple requests, multiple counter units are provided so that the switching time of the clock signal CLK does not occur.

[0111] FIG. 29 is a block diagram illustrating a semiconductor device 2 according to a second embodiment. As shown in FIG. 29, a timing management circuit 50 in the semiconductor device 2 of this embodiment has a plurality of counter units A56a and counter units B56b. The counter units A56a and B56b each perform time measurement using a clock signal CLK. The timing generation circuit 54 selects which of the counter units A56a and B56b to use for each time measurement request from the peripheral circuit 41. The clock control circuit 53 selects the clock signal CLK to be used in the counter units A56a and B56b based on the peripheral circuit 41 that has requested the time measurement. The clock control circuit 53 may select different clock signals CLK for each counter unit A56a and counter unit B56b.

[0112] With this configuration, the switching time required to switch the clock signal CLK can be reduced. Therefore, even if multiple requests occur frequently, the switching of the clock signal CLK and the counter operation can be tracked. In addition, the timing management circuit 50 of this embodiment can also eliminate errors in measurement time caused by switching the asynchronous clock signal CLK.

[0113] <Embodiment 3> Next, a semiconductor device according to embodiment 3 will be described. In the semiconductor device according to this embodiment, a function of measuring time is provided in, for example, the peripheral circuit 41 other than the timing management circuit 50. Fig. 30 is a block diagram illustrating the arithmetic processing device 10, the clock generation circuit 20, the timer 30, the peripheral circuit 41, and the timing management circuit 50 in the semiconductor device 3 according to embodiment 3.

[0114] 30, in the semiconductor device 3 of this embodiment, the timing management circuit 50 has a counter circuit 52 that has a limited number of requests that can be measured, and a counter function that measures time such as a counter circuit is also arranged in the peripheral circuit 41 such as the communication IP 40. The timing management circuit 50 has a determination unit 60 that determines whether or not a time measurement request from the peripheral circuit 41 is acceptable. If the determination unit 60 determines that the timing management circuit 50 can operate using only the counter circuit 52, it accepts the time measurement request from the peripheral circuit 41. Therefore, the counter circuit arranged in the peripheral circuit 41 does not operate.

[0115] On the other hand, the determination unit 60 rejects the request for time measurement from the peripheral circuit 41 when at least one of the following cases is true: the ongoing time measurement cannot be continued, and the number of requests for time measurement that can be simultaneously measured exceeds the upper limit. When rejecting the request, the determination unit 60 makes the peripheral circuit 41 execute time measurement using a counter function of the peripheral circuit 41. For example, when multiple requests for time measurement occur simultaneously and the timing management circuit 50 cannot perform time measurement, the determination unit 60 operates a counter circuit or the like arranged in the peripheral circuit 41. Although the effect of reducing current consumption becomes smaller, the time measurement operation in the semiconductor device 3 can be continued.

[0116] The case where the timing management circuit 50 cannot perform time measurement is not limited to the case where multiple requests for time measurement occur simultaneously and exceed the tolerance of the timing management circuit 50. For example, the case where time measurement is not possible may include the case where switching the clock signal CLK makes it impossible to accurately continue time measurement during operation. In addition, the case where time measurement is not possible may include the case where a condition is reached where simultaneous requests for time measurement cannot be accepted due to the type of the interface I / F between the timing management circuit 50 and the peripheral circuit 41.

[0117] The disclosure made by the present inventor has been specifically described above based on the embodiments, but the present disclosure is not limited to the above-mentioned embodiments, and it goes without saying that various modifications can be made without departing from the gist of the disclosure. For example, as shown below, a time measurement program for causing a computer to execute a time measurement method is also within the scope of the technical ideas of the present embodiments 1 to 3. The storage device 12 may store the processes performed by each component of the semiconductor device 1 as a program. The arithmetic processing device 10 may load the program from the storage device 12 into a memory and execute the program. In this way, the arithmetic processing device 10 realizes the functions of each component in the timing management circuit 50.

[0118] The time measurement program may be stored on a non-transitory computer-readable medium or tangible storage medium. By way of example and not limitation, computer-readable medium or tangible storage medium includes random-access memory (RAM), read-only memory (ROM), flash memory, solid-state drive (SSD) or other memory technology, CD-ROM, digital versatile disc (DVD), Blu-ray® disk or other optical disk storage, magnetic cassette, magnetic tape, magnetic disk storage or other magnetic storage device. The time measurement program may be transmitted on a transitory computer-readable medium or communication medium. By way of example and not limitation, transitory computer-readable medium or communication medium includes electrical, optical, acoustic or other form of propagated signal.

[0119] (Appendix A1) A processing unit; A plurality of peripheral circuits controlled by the processor; a timing management circuit that outputs a result of the time measurement executed in response to a time measurement request from the peripheral circuit to the peripheral circuit; A time measurement method for a semiconductor device comprising: causing the timing management circuit to execute the time measurement in response to each of the time measurement requests. Time measurement method. (Appendix A2) The step of executing the time measurement includes: when a first request for a first time measurement is received from any one of the plurality of the peripheral circuits, starting the first time measurement; when a second request for a second time measurement is received during the execution of the first time measurement, starting a second time measurement while continuing the first time measurement; having The time measurement method described in Appendix A1. (Appendix A3) the semiconductor device further includes a clock generation circuit that generates a clock signal that is a reference for the time measurement in the timing management circuit; In the step of executing the time measurement, when the first time measurement and the second time measurement are performed, the first time measurement and the second time measurement are performed based on the same clock signal generated by the clock generation circuit. The time measurement method described in Appendix A2. (Appendix A4) In the step of executing the time measurement, receiving the request for the time measurement from the peripheral circuit, thereby executing the time measurement; after outputting the results of all the time measurements requested, the time measurement is stopped until the next request is received; The time measurement method described in Appendix A1. (Appendix A5) the semiconductor device further includes a clock generation circuit that generates a clock signal that is a reference for the time measurement in the timing management circuit; The clock generation circuit includes: a first oscillator circuit that generates a first clock signal; a second oscillator circuit that generates a second clock signal different from the first clock signal; a frequency divider circuit that divides the second clock signal to generate a third clock signal; a selection circuit that selects the clock signal to be used for the time measurement in response to the request from a plurality of clock signals including the first clock signal, the second clock signal, and the third clock signal; having In the step of executing the time measurement, Controlling the selection of the clock signal in the selection circuit; when the first time measurement and the second time measurement are executed, the first time measurement and the second time measurement are executed based on the clock signals different from each other; The time measurement method described in Appendix A2. (Appendix A6) In the step of executing the time measurement, controlling the oscillation and stopping of the first clock signal in the first oscillation circuit, and the oscillation and stopping of the second clock signal in the second oscillation circuit; Time measurement method described in Appendix A5. (Appendix A7) the clock signal includes a signal that cycles between high and low voltage states; The step of executing the time measurement includes: receiving the request for the time measurement from the peripheral circuit; calculating a target count number for the measurement time as a target value from the measurement time in the requested time measurement and the clock signal; storing the target value; a step of counting the number of times the clock signal is in the high voltage state or the low voltage state and storing the count number as a counter value; comparing the counter value with the target value; outputting the result of the time measurement to the peripheral circuit when the counter value and the target value match; having The time measurement method described in Appendix A1. (Appendix A8) The step of executing the time measurement includes: selecting a clock signal based on the peripheral circuit that has requested the time measurement; performing a plurality of said time measurements using said clock signal; having In the step of selecting a clock signal, selecting a different said clock signal for each time measurement; The time measurement method described in Appendix A1. (Appendix A9) The step of executing the time measurement includes: determining whether or not the request for time measurement from the peripheral circuit is acceptable; rejecting the request when the ongoing time measurement cannot be continued and / or when the number of simultaneous time measurement requests exceeds an upper limit; having The time measurement method described in Appendix A1. (Appendix A10) the peripheral circuit has a counter function for measuring the time, If the request is rejected, the peripheral circuit is caused to execute the time measurement using the counter function of the peripheral circuit. The time measurement method described in Appendix A9. (Appendix A11) the peripheral circuit is a timer, The step of executing the time measurement includes: converting the counter value when the request for time measurement is received from the timer; outputting the converted counter value to the timer; having The time measurement method described in Appendix A7. (Appendix B1) A processing unit; A plurality of peripheral circuits controlled by the processor; a timing management circuit that outputs a result of the time measurement executed in response to a time measurement request from the peripheral circuit to the peripheral circuit; A time measurement program for a semiconductor device comprising: a time measurement program that causes a computer to execute a step of causing the timing management circuit to execute the time measurement in response to each of the time measurement requests; (Appendix B2) The step of executing the time measurement includes: when a first request for a first time measurement is received from any one of the plurality of the peripheral circuits, starting the first time measurement; when a second request for a second time measurement is received during the execution of the first time measurement, starting a second time measurement while continuing the first time measurement; having A timing program as described in Appendix B1. (Appendix B3) the semiconductor device further includes a clock generation circuit that generates a clock signal that is a reference for the time measurement in the timing management circuit; In the step of executing the time measurement, when the first time measurement and the second time measurement are performed, the first time measurement and the second time measurement are performed based on the same clock signal generated by the clock generation circuit. A timing program as described in Appendix B2. (Appendix B4) In the step of executing the time measurement, receiving the request for the time measurement from the peripheral circuit, thereby executing the time measurement; after outputting the results of all the time measurements requested, the time measurement is stopped until the next request is received; A timing program as described in Appendix B1. (Appendix B5) the semiconductor device further includes a clock generation circuit that generates a clock signal that is a reference for the time measurement in the timing management circuit; The clock generation circuit includes: a first oscillator circuit that generates a first clock signal; a second oscillator circuit that generates a second clock signal different from the first clock signal; a frequency divider circuit that divides the second clock signal to generate a third clock signal; a selection circuit that selects the clock signal to be used for the time measurement in response to the request from a plurality of clock signals including the first clock signal, the second clock signal, and the third clock signal; having In the step of executing the time measurement, Controlling the selection of the clock signal in the selection circuit; when the first time measurement and the second time measurement are executed, the first time measurement and the second time measurement are executed based on the clock signals different from each other; A timing program as described in Appendix B2. (Appendix B6) In the step of executing the time measurement, controlling the oscillation and stopping of the first clock signal in the first oscillation circuit, and the oscillation and stopping of the second clock signal in the second oscillation circuit; A time measurement program as described in Appendix B5. (Appendix B7) the clock signal includes a signal that cycles between high and low voltage states; The step of executing the time measurement includes: receiving the request for the time measurement from the peripheral circuit; calculating a target count number for the measurement time as a target value from the measurement time in the requested time measurement and the clock signal; storing the target value; a step of counting the number of times the clock signal is in the high voltage state or the low voltage state and storing the count number as a counter value; comparing the counter value with the target value; outputting the result of the time measurement to the peripheral circuit when the counter value and the target value match; having A timing program as described in Appendix B1. (Appendix B8) The step of executing the time measurement includes: selecting a clock signal based on the peripheral circuit that has requested the time measurement; performing a plurality of said time measurements using said clock signal; having In the step of selecting a clock signal, selecting a different said clock signal for each time measurement; A timing program as described in Appendix B1. (Appendix B9) The step of executing the time measurement includes: determining whether or not the request for time measurement from the peripheral circuit is acceptable; rejecting the request when the ongoing time measurement cannot be continued and / or when the number of simultaneous time measurement requests exceeds an upper limit; having A timing program as described in Appendix B1. (Appendix B10) the peripheral circuit has a counter function for measuring the time, If the request is rejected, the peripheral circuit is caused to execute the time measurement using the counter function of the peripheral circuit. A timing program as described in Appendix B9. (Appendix B11) the peripheral circuit is a timer, The step of executing the time measurement includes: converting the counter value when the request for time measurement is received from the timer; outputting the converted counter value to the timer; having A timing program as described in Appendix B7. [Explanation of symbols]

[0120] 1, 2, 3 Semiconductor Device 10 Processing unit 11 Internal peripheral bus 12 Storage device 20 Clock Generation Circuit 21a Oscillator A 21b Oscillator B 23, 23a, 23b, 23c Oscillation stabilization waiting circuit 25a Oscillator Circuit A 25b Oscillator circuit B 27, 28 frequency divider circuit 29 Selection circuit 30, 30a, 30b Timers 31 Registers 34 Interface circuit 40 Communication IP 41 Peripheral circuits 50 Timing management circuit 51 Register 52 Counter Circuit 53 Clock control circuit 54 Timing generation circuit 55 Counter value converter 56 Counter section 56a Counter Section A 56b Counter section B 57a, 57b, 57c comparison section 58a, 58b, 58c storage section 59 Calculation Circuit 60 Judgment section 101 Semiconductor device 110 Processing unit 111 Internal peripheral bus 120 Clock Generation Circuit 121a Oscillator A 121b Oscillator B 121c, 121d, 121e oscillators 123, 123a, 123b, 123c, 123d, 123e Oscillation stabilization waiting circuit 130, 130a, 130b Timer 131 Registers 132 Counter Circuit 133 Clock Selection Circuit 140 Communication IP A0, A1 comparator B0, B1 comparator BSC Bus Controller CLK Clock signal CMTW Compare Match Timer CPU, MPU Processing Unit DMAC DMA Controller DTC Data Transfer Controller ICU Interrupt Controller RAM, ROM storage device TCNT Counter circuit TFU Trigonometric Function Calculator TMR Timer

Claims

1. A processing unit; A plurality of peripheral circuits controlled by the processor; a timing management circuit that outputs a result of the time measurement executed in response to a time measurement request from the peripheral circuit to the peripheral circuit; Equipped with the timing management circuit performs the time measurement in response to each of the time measurement requests. Semiconductor device.

2. The timing management circuit includes: when a first request for a first time measurement is received from any one of the plurality of the peripheral circuits, the first time measurement is started; when a second request for a second time measurement is received during the execution of the first time measurement, starting the second time measurement while continuing the first time measurement; The semiconductor device according to claim 1 .

3. a clock generation circuit that generates a clock signal that is a reference for the time measurement in the timing management circuit; the timing management circuit, when executing the first time measurement and the second time measurement, executes the first time measurement and the second time measurement based on the same clock signal generated by the clock generation circuit. The semiconductor device according to claim 2 .

4. The timing management circuit includes: performing the time measurement by receiving the request for the time measurement from the peripheral circuit; after outputting the results of all the time measurements for which the request has been received, stopping the time measurements until the next request is received; The semiconductor device according to claim 1 .

5. a clock generation circuit that generates a clock signal that is a reference for the time measurement in the timing management circuit; The clock generation circuit includes: a first oscillator circuit that generates a first clock signal; a second oscillator circuit that generates a second clock signal different from the first clock signal; a frequency divider circuit that divides the second clock signal to generate a third clock signal; a selection circuit that selects the clock signal to be used for the time measurement in response to the request from a plurality of clock signals including the first clock signal, the second clock signal, and the third clock signal; having The timing management circuit includes: a clock control circuit for controlling selection of the clock signal in the selection circuit; when the first time measurement and the second time measurement are performed, the first time measurement and the second time measurement are performed based on the clock signals different from each other. The semiconductor device according to claim 2 .

6. the clock control circuit controls generation and stopping of the first clock signal in the first oscillation circuit, and controls generation and stopping of the second clock signal in the second oscillation circuit. The semiconductor device according to claim 5 .

7. the clock signal includes a signal that cycles between high and low voltage states; The timing management circuit includes: a timing generation circuit that receives the request for the time measurement from the peripheral circuit and outputs the result of the time measurement to the peripheral circuit; a counter circuit that counts the number of times the clock signal is in the high voltage state or the low voltage state and holds the count number as a counter value; having The timing generation circuit includes: a calculation circuit that calculates a target count number of the measurement time from the requested measurement time and the clock signal as a target value; A storage unit that stores the target value; a comparison unit that compares the counter value with the target value; having The semiconductor device according to claim 1 .

8. The timing management circuit includes: A plurality of counter units that perform the time measurement using a clock signal; a clock control circuit that selects the clock signal used in the counter unit based on the peripheral circuit that has requested the time measurement; having the clock control circuit selects different clock signals for each counter unit; The semiconductor device according to claim 1 .

9. the timing management circuit has a determination unit that determines whether or not the request for time measurement from the peripheral circuit is acceptable; the determination unit rejects the request when at least one of the following is true: the ongoing time measurement cannot be continued, and the number of requests for time measurement that can be simultaneously measured exceeds an upper limit. The semiconductor device according to claim 1 .

10. the peripheral circuit has a counter function for measuring the time, when the determination unit rejects the request, the determination unit causes the peripheral circuit to execute the time measurement using the counter function of the peripheral circuit; The semiconductor device according to claim 9.

11. the peripheral circuit is a timer, the timing management circuit has a counter value conversion unit that converts the counter value; the counter value converter outputs the converted counter value to the timer when receiving the request to measure the time from the timer. The semiconductor device according to claim 7.

12. A processing unit; A plurality of peripheral circuits controlled by the processor; a timing management circuit that outputs a result of the time measurement executed in response to a time measurement request from the peripheral circuit to the peripheral circuit; A time measurement method for a semiconductor device comprising: causing the timing management circuit to execute the time measurement in response to each of the time measurement requests. Time measurement method.

13. The step of executing the time measurement includes: when a first request for a first time measurement is received from any one of the plurality of the peripheral circuits, starting the first time measurement; when a second request for a second time measurement is received during the execution of the first time measurement, starting a second time measurement while continuing the first time measurement; having The time measurement method according to claim 12.

14. the semiconductor device further includes a clock generation circuit that generates a clock signal that is a reference for the time measurement in the timing management circuit; In the step of executing the time measurement, when the first time measurement and the second time measurement are executed, the first time measurement and the second time measurement are executed based on the same clock signal generated by the clock generation circuit. The time measurement method according to claim 13.

15. In the step of executing the time measurement, receiving the request for the time measurement from the peripheral circuit, thereby executing the time measurement; after outputting the results of all the time measurements requested, the time measurement is stopped until the next request is received; The time measurement method according to claim 12.

16. the semiconductor device further includes a clock generation circuit that generates a clock signal that is a reference for the time measurement in the timing management circuit; The clock generation circuit includes: a first oscillator circuit that generates a first clock signal; a second oscillator circuit that generates a second clock signal different from the first clock signal; a frequency divider circuit that divides the second clock signal to generate a third clock signal; a selection circuit that selects the clock signal to be used for the time measurement in response to the request from a plurality of clock signals including the first clock signal, the second clock signal, and the third clock signal; having In the step of executing the time measurement, Controlling the selection of the clock signal in the selection circuit; when the first time measurement and the second time measurement are performed, the first time measurement and the second time measurement are performed based on the clock signals different from each other. The time measurement method according to claim 13.

17. In the step of executing the time measurement, controlling the oscillation and stopping of the first clock signal in the first oscillation circuit, and the oscillation and stopping of the second clock signal in the second oscillation circuit; The time measurement method according to claim 16.

18. the clock signal includes a signal that cycles between high and low voltage states; The step of executing the time measurement includes: receiving the request for the time measurement from the peripheral circuit; calculating a target count number for the measurement time as a target value from the measurement time in the requested time measurement and the clock signal; storing the target value; a step of counting the number of times the clock signal is in the high voltage state or the low voltage state and storing the count number as a counter value; comparing the counter value with the target value; outputting the result of the time measurement to the peripheral circuit when the counter value and the target value match; having The time measurement method according to claim 12.

19. The step of executing the time measurement includes: selecting a clock signal based on the peripheral circuit that has requested the time measurement; performing a plurality of said time measurements using said clock signal; having In the step of selecting a clock signal, selecting a different said clock signal for each time measurement; The time measurement method according to claim 12.

20. A processing unit; A plurality of peripheral circuits controlled by the processor; a timing management circuit that outputs a result of the time measurement executed in response to a time measurement request from the peripheral circuit to the peripheral circuit; A time measurement program for a semiconductor device comprising: a time measurement program that causes a computer to execute a step of causing the timing management circuit to execute the time measurement in response to each of the time measurement requests;

Citation Information

Patent Citations

  • Integrated circuit timer with multiple channel and dedicated service processor

    JP1990252008A

  • Data-processing system, peripheral subsystem and their operating method

    JP1994195311A

  • Multichannel timer

    JP1997197067A

  • Timer unit programmable by software

    JP2001282384A

  • Data processor

    JP2004070854A