TEST CIRCUIT, INTEGRATED CIRCUIT, ELECTRONIC DEVICE AND METHOD FOR GENERATING THE TEST CIRCUIT

DE602021035393T2Active Publication Date: 2025-07-30HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
DE602021035393
Authority / Receiving Office
DE · DE
Patent Type
Patents
Current Assignee / Owner
Filing Date
2021-09-23
Publication Date
2025-07-30
Estimated Expiration
2041-09-23

AI Technical Summary

Technical Problem

In large-scale system on chip (SoC) integration, the inconsistency in timing and reduced transmission rate of test bus data due to long transmission distances and shared test bus configurations lead to data transmission errors, particularly in testing multiple cores within an SoC chip.

Method used

Implementing a test circuit with dynamic routing units (DRUs) and registers to ensure consistent timing and increased transmission rate by equalizing delays across input and output buses, allowing for time-sharing of test excitation and response transmission without generating incorrect responses.

Benefits of technology

The solution achieves consistent data transmission timing and improved bus transmission rates, ensuring accurate testing of multiple cores within an SoC chip by synchronizing data input and output across the test bus.

✦ Generated by Eureka AI based on patent content.
Patent Text Reader
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] This application relates to the field of integrated circuit testing, and in particular, to a test circuit, an integrated circuit, an electronic device, and a method for generating a test circuit.BACKGROUND

[0002] An integration scale of a system on chip (system on chip, SoC) is increasingly large, and one SoC chip may include hundreds or even thousands of cores (Cores), for example, a circuit module or an intellectual property (intellectual property, IP) module. Each core needs to be tested to ensure normal functions. Specifically, each core includes a test circuit and a tested circuit. The tested circuit generally includes a plurality of input channels (input channels) and a plurality of output channels (output channels). Test circuits of a plurality of cores are coupled through a shared test bus, and the test circuit outputs test excitation from the test bus to the input channel of the tested circuit and outputs a test response from the output channel of the tested circuit to the test bus. Finally, a test objective of the tested circuit is achieved by observing whether the test response meets an expectation.

[0003] The test excitation and test response of each core are transmitted through the shared test bus. A test circuit in a current core transparently transmits a test response from another core, or test excitation to be output to a tested circuit in another core. This takes a very short time. The test circuit spends a long time processing test excitation to be input to a tested circuit in the current core, or a test response generated by the tested circuit in the current core. When a transmission distance of the test bus is long, inconsistency in time causes inconsistency of timing of data transmission on each test bus. A transmission rate of the test bus has to be reduced to avoid a data transmission error. Document CN107345997 discloses converting scan output (SO) testing data after scan input (SI) testing data is obtained by an internal logic circuit of an IP core. Primary output (PO) testing data is obtained after primary input (PI) test data is passed through the circuit. The SO testing data is compared with an IP core testing pattern. Primary output (PO) testing data is compared with the IP core testing pattern. The SO testing data is output to an output port by scan chains. The PO testing data is obtained by a WBR unit for transmitting from the output port of the IP core to the output port of a testing shell.SUMMARY

[0004] Embodiments of this application provide a test circuit, an integrated circuit, an electronic device, and a method for generating a test circuit, to implement consistency of timing of data transmission on a test bus and improve a transmission rate of the test bus.

[0005] To achieve the foregoing objectives, the following technical solutions are used in embodiments of this application.

[0006] According to a first aspect, a test circuit is provided, including: a first input bus, a second input bus, a first output bus, a second output bus, a first dynamic routing unit DRU, and a first register. The first input bus is configured to be coupled to an input channel of a tested circuit through the first DRU, and the first output bus is configured to be coupled to an output channel of the tested circuit through the first DRU. The second input bus is configured to be coupled to the second output bus through the first register. In a clock cycle: the first DRU is configured to output test excitation from the first input bus to the input channel of the tested circuit, and output a test response from the output channel of the tested circuit to the first output bus; or the first DRU is configured to output data from the first input bus to the first output bus; and the first register is configured to output data from the second input bus to the second output bus.

[0007] According to the foregoing test circuit provided in this embodiment of this application, a quantity of DRUs coupled to each first input bus is the same as a quantity of registers coupled to each second input bus, so that a delay of outputting test excitation to a tested circuit in a current core through a DRU and outputting a test response through the DRU, a delay of transparently transmitting data through the DRU, and a delay of transparently transmitting data through a register coupled to the second input bus in are the same. This implements consistency of timing of data transmission on the test bus, and improves a transmission rate of the test bus.

[0008] In a possible implementation, the test circuit further includes a second DRU, a second register, and a selection circuit. The first input bus is configured to be coupled to the input channel of the tested circuit through the first DRU, the second DRU, and the selection circuit, and the first output bus is configured to be coupled to the output channel of the tested circuit through the first DRU and the second DRU. The second input bus is configured to be coupled to the second output bus through the first register and the second register; and the selection circuit is configured to select the first DRU or the second DRU to be coupled to the input channel of the tested circuit. This application does not pose a limitation on one first input bus being coupled to one or two DRUs, and one second input bus is coupled to one or two registers. A quantity of DRUs coupled to the first input bus is the same as a quantity of registers coupled to the second input bus, so that each input bus has a same delay in transmitting data. When a transmission distance of the test bus is long, inconsistency of timing of data transmission on each input bus can be avoided. In this way, a transmission speed of the test bus is improved.

[0009] In a possible implementation, in a first clock cycle, the first DRU is configured to output the test excitation to the second DRU; and in a second clock cycle, the selection circuit selects the second DRU to be coupled to the input channel of the tested circuit, and the second DRU is configured to output the test excitation to the input channel of the tested circuit, and output the test response to the first output bus; or in a second clock cycle, the selection circuit selects the first DRU to be coupled to the input channel of the tested circuit, and the first DRU is configured to output the test excitation to the input channel of the tested circuit, and output the test response to the first output bus. In a conventional technology, because a quantity of pins (namely, bus bandwidths) of a chip for inputting test excitation and outputting test responses is limited, to make full use of the bus bandwidths, complete test excitation output to a core may be split into a plurality of parts and transmitted to the bus in a time-sharing manner. If these parts are input to an input channel of a tested circuit, an incorrect test response is generated. However, for the test circuit provided in this embodiment of this application, one test cycle may include two clock cycles. No matter in which clock cycle the test excitation is input, and no matter whether the test excitation is separately input in two clock cycles, the test excitation may be output to the input channel of the tested circuit in the second clock cycle, so that all parts of the test excitation that are input in a time-sharing manner are input to the input channel of the tested circuit at the same time, and this avoids generating an incorrect test response.

[0010] In a possible implementation, the selection circuit includes a first AND gate, a second AND gate, and a second selector, where a first input of the second AND gate performs phase inversion on an input signal. An output of the first AND gate is coupled to the first DRU to output a first signal to the first DRU, an output of the second AND gate is coupled to the second DRU to output a second signal to the second DRU, a first input of the first AND gate and the first input of the second AND gate are coupled to a control end of the second selector and are configured to input a third signal, a second input of the first AND gate and a second input of the second AND gate are coupled and are configured to input a fourth signal. Two inputs of the second selector are respectively coupled to the first DRU and the second DRU, and an output of the second selector is configured to be coupled to the input channel of the tested circuit. The first signal is used to control the first DRU whether to output the test excitation to the input channel of the tested circuit, the second signal is used to control the second DRU whether to output the test excitation to the input channel of the tested circuit, the third signal is used to control the selection circuit to select the first DRU or the second DRU to be coupled to the input channel of the tested circuit, and the fourth signal is used to control the first DRU or the second DRU whether to output the test excitation to the input channel of the tested circuit. This implementation provides a possible structure of the selection circuit.

[0011] In a possible implementation, the first DRU includes a third register and a third selector. A data input of the third register is configured to be coupled to the first input bus, a data output of the third register is configured to be separately coupled to a second input of the third selector and the input channel of the tested circuit, a first input of the third selector is configured to be coupled to the output channel of the tested circuit, an output of the third selector is configured to be coupled to the first output bus, a control end of the third selector is configured to input a fifth signal, and the fifth signal is used to control the third selector to connect the first input or the second input to the output. When the third selector selects that the first input is connected to the output, the third selector may output the test excitation to the input channel of the tested circuit in one clock cycle, and output the test response from the output channel of the tested circuit.

[0012] In a possible implementation, the test circuit further includes: a reset input bus, a reset output bus, and a plurality of fourth registers. A quantity of the fourth registers is equal to a quantity of registers coupled to the second input bus; the reset input bus is coupled to the reset output bus through the plurality of fourth registers, the reset input bus is configured to input a reset signal, and the reset output bus is configured to output, to the test circuit, the reset signal delayed by the plurality of fourth registers. A difference between a time at which the reset signal is input from the reset input bus and a time at which the reset signal is output from the reset output bus is equal to a difference between a time at which data is input from the input bus and a time at which the data is output from the output bus. For each core, a difference between a time at which the test circuit is started and a time at which the data arrives is the same, which facilitates calculation of a time at which the state machine of the test circuit in each core starts to output a capture enable signal.

[0013] In a possible implementation, the test circuit further includes a plurality of fifth registers, where the first input bus and the second input bus each are coupled to A fifth registers, and A is a positive integer. In this way, data input by each input bus is input to the test circuit after a same delay. When a transmission distance of the test bus is long, inconsistency of timing of data transmission on each input bus can be avoided. In this way, a transmission speed of the test bus is improved.

[0014] In a possible implementation, the test circuit further includes a plurality of sixth registers, where the first output bus and the second output bus each are coupled to B sixth registers, and B is a positive integer. In this way, the data output by each output bus is transmitted to a next core after a same delay. When the transmission distance of the test bus is long, inconsistency of timing of data transmission on each output bus can be avoided. In this way, the transmission speed of the test bus is improved.

[0015] In a possible implementation, the test circuit further includes a first selector. An output of the first selector is configured to be coupled to one first output bus or one second output bus; two inputs of the first selector are respectively coupled to one first input bus and one second input bus; or configured to be respectively coupled to two first input buses, or configured to be respectively coupled to two second input buses. The first selector may implement that the test circuit is in a pass-through mode, that is, a sequence number of the output bus is the same as a sequence number of the coupled input bus; or may implement that the test circuit is in a shift mode, that is, a sequence number of the output bus is in a shift relationship with a sequence number of the coupled input bus.

[0016] According to a second aspect, an integrated circuit is provided, including a plurality of cores. Each core includes a tested circuit and the test circuit according to the first aspect and any implementation of the first aspect, and test circuits of the plurality of cores are coupled through a test bus.

[0017] According to a third aspect, an electronic device is provided, including a printed circuit board and the integrated circuit according to the second aspect that is disposed on the printed circuit board.

[0018] According to a fourth aspect, a method for generating a test circuit is provided. The method includes: obtaining a bandwidth of an input bus or a bandwidth of an output bus of a test bus, and a bandwidth of an input channel and a bandwidth of an output channel of a tested circuit in each core; and determining, based on the bandwidth of the input bus or the bandwidth of the output bus of the test bus, and the bandwidth of the input channel and the bandwidth of the output channel of each tested circuit, a quantity of dynamic routing units DRUs or registers coupled to each input bus in each test circuit, and generating the test circuit according to the first aspect and any implementation of the first aspect.

[0019] In a possible implementation, a quantity K of dynamic routing units or registers coupled to each input bus in a test circuit in each core is obtained in the following manner: K = Max CI CO / n , where CI represents a bandwidth of an input channel of a tested circuit in a core, CO represents a bandwidth of an output channel of the tested circuit in the core, and n represents the bandwidth of the input bus or the bandwidth of the output bus.

[0020] According to a fifth aspect, a circuit test method is provided, and is used to test a tested circuit by using the test circuit according to the first aspect and any implementation of the first aspect. The method includes: generating configuration information and test excitation, where the configuration information is used to configure a frequency division ratio of the test circuit and select an input channel for coupling a first dynamic routing unit DRU or a second DRU to the tested circuit, to input the test excitation to the tested circuit; inputting the configuration information and the test excitation into the tested circuit; receiving a test response of the tested circuit; and determining, based on the test response, whether the tested circuit is normal.

[0021] According to a sixth aspect, a computer-readable storage medium is provided. The computer-readable storage medium stores instructions, and when the instructions are executed by a processor, the method according to the second aspect is performed.

[0022] According to a seventh aspect, a computer program product including instructions is provided. When the instructions are executed by a processor, the method according to the second aspect is performed.

[0023] For technical effects of the second aspect to the seventh aspect, refer to technical effects of any one of the first aspect and the implementations of the first aspect.BRIEF DESCRIPTION OF DRAWINGS

[0024] FIG. 1 is a schematic diagram of a structure of an integrated circuit according to an embodiment of this application; FIG. 2 is a schematic diagram of a structure of a core in an integrated circuit according to an embodiment of this application; FIG. 3 is a schematic diagram of a structure of a core in another integrated circuit according to an embodiment of this application; FIG. 4 is a schematic diagram of a structure of a core in still another integrated circuit according to an embodiment of this application; FIG. 5 is a schematic diagram of a structure of a dynamic routing unit according to an embodiment of this application; FIG. 6 is a schematic diagram of a structure of a plurality of cores in an integrated circuit according to an embodiment of this application; FIG. 7 is a schematic diagram 1 of transmitting test excitation in a plurality of cores according to an embodiment of this application; FIG. 8 is a schematic diagram 2 of transmitting test excitation in a plurality of cores according to an embodiment of this application; FIG. 9 is a schematic diagram 3 of transmitting test excitation in a plurality of cores according to an embodiment of this application; FIG. 10 is a schematic diagram 4 of transmitting test excitation in a plurality of cores according to an embodiment of this application; FIG. 11 is a schematic diagram 5 of transmitting test excitation in a plurality of cores according to an embodiment of this application; FIG. 12 is a schematic diagram 6 of transmitting test excitation in a plurality of cores according to an embodiment of this application; FIG. 13 is a schematic diagram of timing of signals according to an embodiment of this application; FIG. 14 is a schematic flowchart of a test circuit generation method according to an embodiment of this application; and FIG. 15 is a schematic flowchart of a circuit test method according to an embodiment of this application. DESCRIPTION OF EMBODIMENTS

[0025] The terms "first", "second" and the like in embodiments of this application are merely intended for description, and shall not be understood as an indication or implication of relative importance or an implicit indication of a quantity of indicated technical features. Therefore, features defined with "first", "second", and the like may explicitly or implicitly include one or more such features.

[0026] It should be noted that, in this application, terms such as "an example" or "for example" are used to represent giving an example, an illustration, or a description. Any embodiment or design scheme described as an "example" or "for example" in this application should not be explained as being more preferred or having more advantages than another embodiment or design scheme. Exactly, use of the term "example", "for example", or the like is intended to present a related concept in a specific manner.

[0027] In this application, unless otherwise specified and limited, the terms "coupling" and "connection" should be understood in a broad sense. For example, the terms "coupling" and "connection" may refer to a physical direct connection, or may refer to an electrical connection implemented through an intermediate medium, for example, a connection implemented through a resistor, an inductor, a capacitor, or another electronic component.

[0028] An embodiment of this application provides an electronic device. The electronic device includes a printed circuit board and an integrated circuit disposed on the printed circuit board. The electronic device may be electronic products such as a mobile phone (mobile phone), a tablet computer (pad), a computer, an intelligent wearable product (for example, a smartwatch or a smart band), a virtual reality (virtual reality, VR) terminal device, and an augmented reality (augmented reality, AR) terminal device. A specific form of the electronic device is not limited in embodiments of this application.

[0029] As shown in FIG. 1, the integrated circuit in the electronic device includes a plurality of cores, each core includes a tested circuit 10 and a test circuit 30 corresponding to the tested circuit 10, and the tested circuit 10 and the corresponding test circuit 30 may be disposed separately or integrated together. Different tested circuits 10 in each integrated circuit may implement a same function or different functions. Test circuits 30 of the plurality of cores are coupled through a test bus 20 of the test circuit 30, test excitation input by the test bus 20 is input to the corresponding tested circuit 10 through the test circuit 30, and a test response of the tested circuit 10 is output through the test bus 20 of the test circuit 30, to test functions of a plurality of tested circuits 10.

[0030] As shown in FIG. 2, in a core, the foregoing tested circuit 10 may include a scan structure 100. The foregoing test bus 20 may include a plurality of input buses (for example, in[0] to in[7]), a plurality of output buses (for example, out[0] to out[7]), an internal joint test action group (internal joint test action group, IJTAG) (IEEE 1687 standard) bus ijtag, a reset input bus rst_in, a reset output bus rst_out, and a clock bus clk. In addition to the test bus 20, the foregoing test circuit 30 further includes a plurality of first dynamic routing units (dynamic routing units, DRUs) 301, a plurality of first registers 303, a plurality of first selectors 305, a debugging interface 307, a frequency divider (divider, DIV) 308, a state machine (also referred to as a finite state machine (finite state machine, FSM)) 309, and a plurality of fourth registers 310.

[0031] Optionally, as shown in FIG. 3 or FIG. 4, the foregoing test circuit 30 further includes a plurality of second DRUs 302 coupled to a plurality of first DRUs 301, a plurality of selection circuits 306, and a plurality of second registers 304 coupled to a plurality of first registers 303. Optionally, as shown in FIG. 4, the test circuit 30 further includes a plurality of fifth registers 311, a plurality of sixth registers 312, and a plurality of seventh registers 313.

[0032] As shown in FIG. 2 to FIG. 4, a tested circuit (the scan structure 100) includes a plurality of input channels channel_in and a plurality of output channels channel_out. Each input channel channel_in is used to input one bit of test excitation. After the test excitation is run in the tested circuit (the scan structure 100), a test response is output through the output channel channel_out, and each output channel channel_out is used to output one bit of the test response. Bandwidths of the input channel channel_in and the output channel channel_out may be the same or different. An example in which a bandwidth of the input channel channel_in and a bandwidth of the output channel channel_out each are 4 is used in this application, but is not intended to limit this application.

[0033] As shown in FIG. 2 to FIG. 4, a plurality of inputs of the frequency divider 308 are separately coupled to an IJTAG bus ijtag, a clock bus clk, and a reset output bus rst_out, and an output of the frequency divider 308 is coupled to a tested circuit (the scan structure 100). A debugging signal from the IJTAG bus ijtag is used to control a frequency division ratio of the frequency divider 308, and a reset signal from the reset output bus rst_out is used to control start and stop of the frequency divider 308. The frequency divider 308 obtains a frequency division clock signal by performing frequency division on a clock signal from the clock bus clk, and outputs the frequency division clock signal to the tested circuit (the scan structure 100) through a scanning clock bus scan_clk, to drive the tested circuit (the scan structure 100) to run. A formula for calculating the frequency division ratio K of the frequency divider 308 is: K = Max CI CO / n . CI represents a bandwidth of an input channel channel_in of a tested circuit (the scan structure 100) in a core, CO represents a bandwidth of an output channel channel_out of a tested circuit (the scan structure 100) in a core, and n represents a bandwidth of an input bus in or a bandwidth of an output bus out. It should be noted that K values of cores calculated according to the formula may be different. When a plurality of cores are coupled through a test bus, a greatest value among K values of all cores is selected as a final K value of each core, to ensure that transmission delays of the cores are the same, and reduce complexity of test excitation. An example in which K is 2 is mainly used to describe this application, but is not intended to limit this application.

[0034] As shown in FIG. 2 to FIG. 4, an input of a debugging interface 307 is coupled to the IJTAG bus ijtag, and an output of the debugging interface 307 is coupled to a control end of the plurality of first selectors 305 through a bus twist bus bus_twist. The debugging interface 307 outputs a twist control signal to the control end of the first selector 305 based on the debugging signal from the IJTAG bus ijtag through the bus twist bus bus_twist. As shown in FIG. 3 and FIG. 4, a plurality of other outputs of the debugging interface 307 are separately coupled to a control end of a second selector 3063, a first input of a first AND gate 3061, and a first input of a second AND gate 3062 of each selection circuit 306 through selection lines sel (for example, sel 0 to sel 3). The debugging interface 307 outputs a selection signal to the first input of the first AND gate 3061, the first input of the second AND gate 3062, and the control end of the second selector 3063 through selection lines sel (for example, sel 0 to sel 3) based on the debugging signal from the IJTAG bus ijtag.

[0035] As shown in FIG. 2 to FIG. 4, a plurality of inputs of an FSM 309 are separately coupled to the IJTAG bus ijtag and the reset output bus rst_out, the FSM 309 is coupled to a tested circuit (the scan structure 100) through a control line ctrl and a scanning enable line en, and the FSM 309 is coupled to the first DRU 301 through a capture enable line cap_en. As shown in FIG. 3 and FIG. 4, the FSM 309 is coupled to a second input of the first AND gate 3061 and a second input of the second AND gate 3062 of the selection circuit 306 through the capture enable line cap_en, and is further coupled to the first DRU 301 and the second DRU 302.

[0036] The debugging signal from the IJTAG bus ijtag is used to control state transition of the FSM 309, and the reset signal from the reset output bus rst_out is used to control start and stop of the FSM 309. The FSM 309 outputs a control signal to the tested circuit (the scan structure 100) through the control line ctrl, to control a scanning test state of the tested circuit (the scan structure 100). The FSM 309 outputs a scanning enable signal to the tested circuit (the scan structure 100) through the scanning enable line en, to enable or disable a scanning test mode of the tested circuit (the scan structure 100).

[0037] The FSM 309 outputs a capture enable signal through the capture enable line cap_en. For the structure shown in FIG. 2, the capture enable signal controls the first DRU 301 to transparently transmit data from the input bus in, or inputs stored test excitation to an input channel channel_in of the tested circuit (the scan structure 100) and outputs a test response from an output channel channel_out of the tested circuit (the scan structure 100). For FIG. 3 or FIG. 4, the capture enable signal is used to output capture enable signals to the second input of the first AND gate 3061 and the second input of the second AND gate 3062 of each selection circuit 306, to control, by using the selection circuit 306, the first DRU 301 or the second DRU 302 to transparently transmit data from the input bus in, or input the stored test excitation to the input channel channel_in of the tested circuit (the scan structure 100) and output the test response from the output channel channel_out of the tested circuit (the scan structure 100). Therefore, there are two states of the capture enable signal output by the FSM 309. For example, when the capture enable signal is at a low level ("0"), the first DRU 301 or the second DRU 302 is controlled to transparently transmit the data from the input bus in. When the capture enable signal is at a high level ("1"), the first DRU 301 or the second DRU 302 is controlled to output the stored test excitation to the input channel channel_in of the tested circuit (the scan structure 100), and outputs the test response from the output channel channel_out of the tested circuit (the scan structure 100) to the output bus out. The capture enable signal output by the FSM 309 changes periodically, so that a DRU and the tested circuit (the scan structure 100) may periodically exchange data at a toggle edge of the frequency division clock signal. This cycle is called a test cycle, and a length of the test cycle is equal to K*CLK, where K is the foregoing frequency division ratio, and CLK is a cycle of the clock signal of the clock bus clk. Timing of inputting the test excitation into the input channel channel_in of the tested circuit (the scan structure 100) from the first DRU 301 or the second DRU 302 matches the toggle edge of the frequency division clock signal. For details, refer to the following descriptions about the first DRU 301 and the second DRU 302.

[0038] Each selection circuit 306 includes the first AND gate 3061, the second AND gate 3062, and the second selector 3063, where the first input of the second AND gate 3062 performs phase inversion on the input signal. The first input of the first AND gate 3061 and the first input of the second AND gate 3062 are coupled to the control end of the second selector 3063, and are configured to input a selection signal (a third signal) from the debugging interface 307. The second input of the first AND gate 3061 and the second input of the second AND gate 3062 are coupled, and are configured to input a capture enable signal (a fourth signal) from the FSM 309. An output of the first AND gate 3061 is coupled to the first DRU 301, to output the first signal to the first DRU 301. An output of the second AND gate 3062 is coupled to the second DRU 302, to output a second signal to the second DRU 302. Two inputs of the second selector 3063 are respectively coupled to the first DRU 301 and the second DRU 302, and an output of the second selector 3063 is configured to be coupled to an input channel channel_in of the tested circuit (the scan structure 100), to select the first DRU 301 or the second DRU 302 to be coupled to an input channel channel_in of the tested circuit (the scan structure 100).

[0039] The selection circuit 306 is configured to select, based on the selection signal from the debugging interface 307, the first DRU 301 or the second DRU 302 to be coupled to the input channel channel_in of the tested circuit (the scan structure 100). FIG. 3 or FIG. 4 is used as an example. When a capture enable signal output by the FSM 309 through the capture enable line cap_en is at a high level ("1"), if the selection signal output by the debugging interface 307 through the selection line sel is at a high level ("1"), the first AND gate 3061 outputs a high level ("1"), and the second AND gate 3062 outputs a low level ("0") because the first input performs phase inversion, the second selector 3063 selects the first input to be connected to the output, so that a data output of a third register 401 (shown in FIG. 5) in the first DRU 302 is coupled to an input channel channel_in of the tested circuit. When a capture enable signal output by the FSM 309 through the capture enable line cap_en is at a high level ("1"), if the selection signal output by the debugging interface 307 through the selection line sel is at a low level ("0"), the first AND gate 3061 outputs a low level ("0"), the second AND gate 3062 outputs a high level ("1") because the first input performs phase inversion, and the second selector 3063 selects the second input to be connected to the output, so that a data output of a third register 401 (shown in FIG. 5) in the second DRU 303 is coupled to an input channel channel_in of the tested circuit.

[0040] Bandwidths of the input bus in and the output bus out are the same. For example, an example in which the bandwidth is 8 bits is used in this application, but is not intended to limit this application. The input bus in is configured to input test excitation or input a test response from a tested circuit in another core, and the output bus out is configured to output a test response of a tested circuit in the current core or transparently transmitted test excitation or test response. In this application, an input bus in coupled to a DRU (for example, the first DRU 301 and the second DRU 302) may be referred to as a first input bus in, for example, input buses in[0] to in[3] in FIG. 2 to FIG. 4. An output bus out coupled to a DRU (for example, the first DRU 301 and the second DRU 302) may be referred to as a first output bus out, for example, output buses out[0] to out[3] in FIG. 2 to FIG. 4 when the first selector 305 connects the first input to the output. An input bus in that is not coupled to the DRU is referred to as a second input bus in, for example, input buses in[4] to in[7] in FIG. 2 to FIG. 4. An output bus out that is not coupled to the DRU is referred to as a second output bus out, for example, output buses out[4] to out[7] in FIG. 2 to FIG. 4 when the first selector 305 connects the first input to the output. A ratio of the first input bus in to the second input bus in is not limited in this application. There may be a plurality of first input buses in and a plurality of second input buses in. A ratio of the first output bus out to the second output bus out is not limited. There may be a plurality of first input buses in and a plurality of second input buses in.

[0041] The first selector 305 includes a first input, a second input, and an output, where the output of the first selector 305 is coupled to one first output bus out or one second output bus out. Two inputs of the first selector 305 are respectively coupled to one first input bus in and one second input bus in; or are respectively coupled to two first input buses in; or are respectively coupled to two second input buses in. The first selector 305 is configured to connect the first input or the second input to the output.

[0042] The first input bus in is coupled to an input channel channel_in of the tested circuit (the scan structure 100) through the first DRU 301 (and the second DRU 302 and the selection circuit 306). An output channel channel_out of the tested circuit (the scan structure 100) is coupled to the first input of the first selector 305 through the first DRU 301 (and the second DRU 302), and then coupled to the first output bus out. From another perspective, the first input bus in is coupled to the first output bus out through the first DRU 301 (and the second DRU 302) and the first selector 305. The second input bus in is coupled to the second input of the first selector 305 through the first register 303 (and the second register 304), and then coupled to the second output bus out.

[0043] In one clock cycle: a bit of test excitation from the first input bus in is output to one input channel channel_in of the tested circuit (the scan structure 100) through the first DRU 301 (and one second DRU 302), and a bit of a test response from one output channel channel_out of the tested circuit (the scan structure 100) is output to the first output bus through the first DRU 301 (and one second DRU 302); or a bit of data (test excitation or a test response) from the first input bus in is output (that is, transparently transmitted) to the first output bus out through the first DRU 301 (and one second DRU 302), and a bit of data (test excitation or a test response) from the second input bus in is output (that is, transparently transmitted) to the second output bus out through the first register 303 (and one second register 304).

[0044] As shown in FIG. 2 to FIG. 4, when a twist control signal output by the debugging interface 307 to the control end of the first selector 305 through the bus twist line bus_twist is at low level ("0"), the first selector 305 in a first group (for example, as shown in the "first group") selects the first input to be connected to the output, so that the first DRUs 301 (and the second DRUs 302) coupled to the first input buses in (for example, input buses in[0] to in[3]) are coupled to the output buses out[0] to out[3] (namely, the first output buses out). The first selector 305 in a second group (for example, as shown in the "second group") selects the second input to be connected to the output, so that the first registers 303 and the second registers 304 coupled to the second input buses (for example, the input buses in[4] to in[7] in FIG. 3 or FIG. 4) are coupled to the output buses out[4] to out[7] (namely, the second output buses out). In this case, the mode is a pass-through mode, that is, a sequence number of the output bus out is the same as a sequence number of the coupled input bus in.

[0045] Further, FIG. 3 or FIG. 4 is used as an example. When a twist control signal output by the debugging interface 307 to the control end of the first selector 305 through the bus twist line bus_twist is at a high level ("1"), the first selector 305 in a first group (for example, as shown by the "first group" in FIG. 3 or FIG. 4) selects the second input to be connected to the output, so that the first registers 303 and the second registers 304 coupled to the second input buses (for example, the input buses in[4] to in[7] in FIG. 3 or FIG. 4) are coupled to the output buses out[0] to out[3] (namely, the second output buses out). The first selector 305 in a second group (for example, the "second group" in FIG. 3 or FIG. 4) selects the second input to be connected to the output, so that the first DRUs 301 and the second DRUs 302 coupled to the first input buses in (for example, the input buses in[0] to in[3] in FIG. 3 or FIG. 4) are coupled to the output buses out[4] to out[7] (namely, the first output buses out). In this case, the mode is a shift mode, that is, a shift relationship exists between a sequence number of the output bus out and a sequence number of the coupled input bus in.

[0046] As shown in FIG. 5, the first DRU 301 or the second DRU 302 described above includes a third register 401 and a third selector 402. A data input of the third register 401 is configured to be coupled to a first input bus in, a data output of the third register 401 is configured to be separately coupled to a second input of the third selector 402 and an input channel channel_in of a tested circuit (a scan structure 100). The third register 401 is configured to store data input from the first input bus in, and a first input of the third selector 402 is configured to be coupled to an output channel channel_out of the tested circuit (the scan structure 100). A control end of the third selector 402 is configured to be coupled to a capture enable line cap_en of an FSM 309. When applied to the first DRU 301 in FIG. 2, the control end of the third selector 402 may be directly coupled to the capture enable line cap_en of the FSM 309. When applied to the first DRU 301 in FIG. 3 and FIG. 4, the control end of the third selector 402 is indirectly coupled to the capture enable line cap_en of the FSM 309 by coupling to the output of the first AND gate 3061 described above, and inputs a first signal from the first AND gate 3061. When applied to the second DRU 302 in FIG. 3 and FIG. 4, the control end of the third selector 402 is indirectly coupled to the capture enable line cap_en of the FSM 309 by coupling to the output of the second AND gate 3062 described above, and inputs a second signal from the second AND gate 3062. The first signal or the second signal is used to control the third selector 402 to connect the first input or the second input to the output. The output of the third selector 402 is configured to be coupled to an output bus out. When a low level ("0") is input to the control end of the third selector 402, the third selector 402 connects the second input to the output, so that the data stored in the third register 401 is output to an output bus out. When a high level (for example, "1") is input to the control end of the third selector 402, the third selector 402 connects the first input to the output, so that a bit of a test response from an output channel channel_out of the tested circuit (the scan structure 100) is output to the first output bus out.

[0047] Specifically, when the DRU is used as the first DRU 301 in FIG. 2, the data input of the third register 401 is coupled to a first input bus in, and the data output of the third register 401 is coupled to both the second input of the third selector 402, and the first input of a second selector 3063, to be coupled to an input channel channel_in of the tested circuit (the scan structure 100) through the second selector 3063. The third register 401 is configured to store the data input from the first input bus in. The first input of the third selector 402 is coupled to an output channel channel_out of the tested circuit (the scan structure 100), the control end of the third selector 402 is coupled to the capture enable line cap_en of the FSM 309, and the output of the third selector 402 is coupled to the data input of the third register 401 in the second DRU 302, to be coupled to a first output bus out.

[0048] When the DRU is used as the first DRU 301 in FIG. 3 and FIG. 4, the data input of the third register 401 is coupled to a first input bus in, and the data output of the third register 401 is coupled to both the second input of the third selector 402 and the first input of the second selector 3063, to be coupled to an input channel channel_in of the tested circuit (the scan structure 100) through the second selector 3063. The third register 401 is configured to store the data input from the first input bus in. The first input of the third selector 402 is coupled to an output channel channel_out of the tested circuit (the scan structure 100), the control end of the third selector 402 is coupled to an output of the first AND gate 3061, and an output of the third selector 402 is coupled to the data input of the third register 401 in the second DRU 302, to be coupled to an output bus out through the second DRU 302.

[0049] When the DRU is used as the second DRU 302 in FIG. 3 and FIG. 4, the data input of the third register 401 is coupled to an output of a third selector in the first DRU 301, to be coupled to a first input bus in through the first DRU 301. The data output of the third register 401 is coupled to both a second input of the third selector 402 and a second input of the second selector 3063, to be coupled to an input channel channel_in of the tested circuit (the scan structure 100) through the second selector 3063. The third register 401 is configured to store data input from the first DRU 301. A first input of the third selector 402 is coupled to an output channel channel_out of the tested circuit (the scan structure 100), a control end of the third selector 402 is coupled to an output of the second AND gate 3062, and an output of the third selector 402 is coupled to the first selector 305, to be coupled to an output bus out through the first selector 305.

[0050] The following describes a working principle of a first DRU 301 coupled to a first input bus in in FIG. 2.

[0051] When the capture enable signal output by the FSM 309 through the capture enable line cap_en is at a low level ("0"), the first DRU 301 is in a pass-through mode, and in each clock cycle, the first DRU 301 outputs data (for example, a bit of test excitation or a bit of a test response) from one first input bus in. When the capture enable signal output by the FSM 309 through the capture enable line cap_en is at a high level ("1"), in each clock cycle, the first DRU 301 outputs a bit of test excitation from one first input bus in to one input channel channel_in of the tested circuit (the scan structure 100), and outputs one bit of a test response from one output channel channel_out of the tested circuit (the scan structure 100).

[0052] In addition, for the first register 303 coupled to the second input bus in, in each clock cycle, the first register 303 outputs data (for example, a bit of test excitation or a bit of a test response) from one second input bus in. Therefore, data transmitted by the first input bus is consistent with data transmitted by the second input bus in terms of timing. This implements consistency of timing of data transmission on the test bus, and improves a transmission rate of the test bus.

[0053] The following describes working principles of the first DRU 301, the second DRU 302, and the selection circuit 306 that are coupled to one first input bus in in FIG. 3 and FIG. 4.

[0054] In a first clock cycle, when the capture enable signal output by the FSM 309 through the capture enable line cap_en is at a low level ("0"), the first DRU 301 and the second DRU 302 are in a pass-through mode, and the selection circuit 306 does not output, to an input channel of the tested circuit (the scan structure 100), a bit of test excitation stored in the first DRU 301 or the second DRU 302. The second DRU 302 outputs stored data (for example, a bit of test excitation or a bit of a test response) to the output bus out, and the first DRU 301 outputs data (for example, a bit of test excitation or a bit of a test response) from one first input bus in to the second DRU 302 for storage.

[0055] In a second clock cycle, when the capture enable signal output by the FSM 309 through the capture enable line cap_en is at a high level ("1"), if a selection signal output by the debugging interface 307 through the selection line sel is at a low level ("0"), a first signal output by the output of the first AND gate 3061 is at a low level ("0"), that is, a low level ("0") is input to the control end of the third selector 402 of the first DRU 301. One bit of test excitation that is from the first input bus in and that is stored in the third register 401 of the first DRU 301 is output, through the third selector 402 of the first DRU 301, to the third register 401 of the second DRU 302 for storage. A second signal output by the second AND gate 3062 is at a high level ("1") because the first input performs phase inversion, that is, the high level ("1") is input to the control end of the third selector 402 of the second DRU 302. The third selector 402 of the second DRU 302 outputs a bit of a test response from an output channel channel_out of the tested circuit (the scan structure 100) to the first selector 305, so that the bit is output to an output bus out through the first selector 305. A bit that is of test excitation from the first input bus in and that is stored in the third register 401 of the second DRU 302 is output to the second input of the second selector 3063. A low level ("0") is input to the control end of the second selector 3063, and the second selector 3063 outputs a bit of test excitation stored in the second DRU 302 to an input channel channel_in of the tested circuit (the scan structure 100).

[0056] In other words, in the second clock cycle, the selection circuit 306 selects the second DRU 302 to be coupled to an input channel channel_in of the tested circuit (the scan structure 100), the second DRU 302 outputs one bit of the stored test excitation to one input channel channel_in of the tested circuit (the scan structure 100), receives a bit of the test response from an output channel channel_out of the tested circuit (the scan structure 100), and outputs the bit to an output bus out.

[0057] Alternatively, in the second clock cycle, when the capture enable signal output by the FSM 309 through the capture enable line cap_en is at a high level ("1"), if a selection signal output by the debugging interface 307 through the selection line sel is at a high level ("1"), a first signal output by the output of the first AND gate 3061 is at a high level ("1"), that is, a high level ("1") is input to the control end of the third selector 402 of the first DRU 301. The third selector 402 of the first DRU 301 outputs one bit of the test response from the output channel channel_out of the tested circuit (the scan structure 100) to the data input of the third register 401 in the second DRU 302. A bit that is of test excitation from the first input bus in and that is stored in the third register 401 of the first DRU 301 is output to the first input of the second selector 3063. A high level ("1") is input to the control end of the second selector 3063, and the second selector 3063 outputs a bit of test excitation stored in the first DRU 301 to an input channel channel_in of the tested circuit (the scan structure 100). The second AND gate 3062 outputs a low level ("0") of a second signal because the first input performs phase inversion, that is, the low level ("0") is input to the control end of the third selector 402 of the second DRU 302, and the third selector 402 of the second DRU 302 connects the second input to the output, and outputs, to an output bus out, a bit of the test response that is from the first DRU 301 and that is stored in the third register 401 of the second DRU 302.

[0058] In other words, in the second clock cycle, the selection circuit 306 selects the first DRU 301 to be coupled to an input channel channel_in of the tested circuit (the scan structure 100), the first DRU 301 outputs one bit of the test excitation from one first input bus in to one input channel channel_in of the tested circuit (the scan structure 100), receives one bit of the test response from an output channel channel_out of the tested circuit (the scan structure 100), and outputs the bit to the second DRU 302 for storage.

[0059] The following describes working principles of the first DRU 301, the second DRU 302, and the selection circuit 306 that are coupled to N first input buses in, and describes how to input N-bit test excitation to N input channels channel_in of the tested circuit (the scan structure 100) through the first DRU 301, the second DRU 302, and the selection circuit 306 that are coupled to the N first input buses in.

[0060] When the N bits of test excitation are input from the N first input buses in in the first clock cycle, in the first clock cycle, the capture enable signal output by the FSM 309 through the capture enable line cap_en is at a low level ("0"), and the first DRU 301 coupled to the N first input buses in may respectively output the N bits of test excitation to the second DRU 302 coupled to the N first input buses in for storage. In the second clock cycle, the capture enable signal output by the FSM 309 through the capture enable line cap_en is at a high level ("1"), N selection signals output by the debugging interface 307 through N selection lines sel are at low levels ("0"), and second DRUs 302 coupled to the N input buses are coupled to N input channels channel_in of the tested circuit (the scan structure 100), and N bits of stored test excitation are output to the N input channels channel_in of the tested circuit (the scan structure 100), receive N bits of a test response from N output channels channel_out of the tested circuit (the scan structure 100), and output the N bits to the N output buses out.

[0061] When the N bits of the test excitation are input from the N first input buses in in the second clock cycle, in the second clock cycle, the capture enable signal output by the FSM 309 through the capture enable line cap_en is at a high level ("1"), and N selection signals output by the debugging interface 307 through the N selection lines sel are at a high level ("1"). The first DRU 301 coupled to the N first input buses in outputs the N bits of the test excitation to the N input channels channel_in of the tested circuit (the scan structure 100), receives the N bits of the test response from the N output channels channel_out of the tested circuit (the scan structure 100), and outputs the N bits to the second DRU 302 coupled to the N first input buses in for storage.

[0062] When the first n bits of the test excitation are input from the first n first input buses in in the first clock cycle, and the last N-n bits of the test excitation are input from the last N-n first input buses in in the second clock cycle, in the first clock cycle, the capture enable signal output by the FSM 309 through the capture enable line cap_en is at a low level ("0"). The first DRUs 301 coupled to the first n first input buses in may respectively output the first n bits of test excitation to the second DRUs 302 coupled to the n first input buses in for storage. In the second clock cycle, the capture enable signal output by the FSM 309 through the capture enable line cap_en is at a high level ("1"), N selection signals output by the debugging interface 307 through the first n selection lines sel are at low levels ("0"), and the second DRU 302 coupled to the n input buses outputs n bits of stored test excitation to n input channels channel_in of the tested circuit (the scan structure 100), receives n bits of a test response from n output channels channel_out of the tested circuit (the scan structure 100), and outputs the n bits to n output buses out. N-n selection signals output by the debugging interface 307 through the last N-n selection lines sel are at high levels ("1"), and the first DRU 301 coupled to the N-n first input buses in outputs the last N-n bits of test excitation to a remaining N-n input channel channel_in of the tested circuit (the scan structure 100). The last N-n bits of the test response are received from the remaining N-n output channels channel_out of the tested circuit (the scan structure 100), and are output to the second DRU 302 coupled to the N-n first input buses in for storage.

[0063] In a conventional technology, because a quantity of pins (namely, bus bandwidths) of a chip for inputting test excitation and outputting test responses is limited, to make full use of the bus bandwidths, complete test excitation output to a core may be split into a plurality of parts and transmitted to the bus in a time-sharing manner. If these parts are input to an input channel of a tested circuit, an incorrect test response is generated. For the test circuit shown in FIG. 3 and FIG. 4, one test cycle may include two clock cycles. No matter in which clock cycle the test excitation is input, and no matter whether the test excitation is separately input in two clock cycles, the test excitation may be output to the input channel channel_in of the tested circuit (the scan structure 100) in the second clock cycle, so that all parts of the test excitation that are input in a time-sharing manner are input to the input channel of the tested circuit at the same time, and this avoids generating an incorrect test response.

[0064] An example in which each first input bus in is coupled to two DRUs and each second input bus is coupled to two registers is used in this application, but is not intended to limit this application. A frequency division ratio K = Max CI CO / n of the frequency divider 308 may be used as a quantity of DRUs coupled to each first input bus in and a quantity of registers coupled to each second input bus.

[0065] A plurality of fourth registers 310 are coupled between a reset input bus rst_in and a reset output bus rst_out. The reset input bus rst_in is configured to input a reset signal, and the reset output bus rst_out is configured to output, to the test circuit, a reset signal delayed by the plurality of fourth registers 310. A quantity of the fourth registers 310 is the same as a quantity of registers coupled to the second input bus in (or a quantity of DRUs and registers coupled to the first input bus in). For example, in FIG. 2 and FIG. 3, the quantity of fourth registers 310 is 2. The frequency division ratio of the frequency divider 308 is adjusted, so that a difference between a time at which the reset signal is input from the reset input bus rst_in and a time at which the reset signal is output from the reset output bus rst_out is equal to a difference between a time at which data is input from the input bus in and a time at which the data is output from the output bus out. For each core, a difference between a time at which the test circuit is started and a time at which the data arrives is the same, which facilitates calculation of time at which the FSM 309 of the test circuit in each core starts to output a capture enable signal. The frequency divider 308 and the FSM 309 are in a reset state when the reset signal is effective. When the reset signal is ineffective, the frequency divider 308 and the FSM 309 start to work at the same time. Correspondingly, the driven first DRU 301, second DRU 302, and selection circuit 306 also start to work.

[0066] As shown in FIG. 4, the input buses in (the first input bus in and the second input bus in) each may be coupled to A fifth registers 311, where A is a positive integer. As a result, data input by each input bus in is input to the test circuit after a same delay. When a transmission distance of the test bus is long, inconsistency of timing of data transmission on each input bus can be avoided. In this way, a transmission speed of the test bus is improved. The fifth register 311 may be located inside a core or outside a core. It should be noted that, a quantity of fourth registers 310 coupled between the reset input bus rst_in and the reset output bus rst_out also needs to be increased by A accordingly, so that the difference between the time at which the reset signal is input from the reset input bus rst_in and the time at which the reset signal is output from the reset output bus rst_out is equal to the difference between the time at which the data is input from the input bus in and the time at which the data is output from the output bus out.

[0067] As shown in FIG. 4, the output buses out (the first output bus out and the second output bus out) each may be coupled to B sixth registers 312, and the reset output bus rst_out may further be coupled to B seventh registers 313, where B is a positive integer. As a result, data output by each output bus and a reset signal are transmitted to a next core after a same delay. When the transmission distance of the test bus is long, inconsistency of timing of data transmission on each output bus and the reset output bus can be avoided. In this way, the transmission speed of the test bus is improved. The sixth register 312 and the seventh register 313 may be located inside or outside the core.

[0068] According to the foregoing test circuit provided in this embodiment of this application, a quantity of DRUs coupled to each first input bus in is the same as a quantity of registers coupled to each second input bus, so that a delay of outputting test excitation to a tested circuit in a current core through a DRU and outputting a test response through the DRU, a delay of transparently transmitting data through the DRU, and a delay of transparently transmitting data through a register coupled to the second input bus in are the same. This implements consistency of timing of data transmission on the test bus, and improves a transmission rate of the test bus.

[0069] With reference to FIG. 6 to FIG. 13, an example in which an output bus of a test circuit in a previous core is serially coupled to an input bus of a test circuit in a next core is used below to describe a working principle of the integrated circuit shown in FIG. 3. For a timing diagram of FIG. 7 to FIG. 12, refer to FIG. 13.

[0070] As shown in FIG. 6, it is assumed that a core A includes a scan structure A, a core B includes a scan structure B, and a core C includes a scan structure C. Bandwidths of an input channel channel_in and an output channel channel_out of the scan structure A each are 4, bandwidths of an input channel channel_in and an output channel channel_out of the scan structure B each are 5, and bandwidths of an input channel channel_in and an output channel channel_out of the scan structure C each are 4. Input buses of the core A are in1[0] to in1[7], output buses of the core A are out1[0] to out1[7], the input buses in1[0] to in1[3] of the core A are coupled to a first DRU 301A and a second DRU 302A, and the input buses in1[4] to in1[7] of the core A are coupled to a first register 303A and a second register 304A. Input buses of the core B are in2[0] to in2[7], output buses of the core B are out2[0] to out2[7], the input buses in2[0] to in2[4] of the core B are coupled to a first DRU 301B and a second DRU 302B, and the input buses in2[5] to in2[7] of the core B are coupled to a first register 303B and a second register 304B. Input buses of the core C are in3[0] to in3[7], output buses of the core C are out3[0] to out3[7], the input buses in3[0] to in3[3] of the core C are coupled to a first DRU 301C and a second DRU 302C, and the input buses in3[4] to in3[7] of the core C are coupled to a first register 303C and a second register 304C.

[0071] For example, as shown in Table 1, it is assumed that scan structure A to scan structure C are tested, AI1 represents test excitation input by the scan structure A in the 1 st< test cycle, BI1 represents test excitation input by the scan structure B in the 1 st< test cycle, and CI1 represents test excitation input by the scan structure C in the 1 st< test cycle. AI2 represents test excitation input by the scan structure A in the 2 nd< test cycle, BI2 represents test excitation input by scan structure B in the 2 nd< test cycle, and CI2 represents test excitation input by the scan structure C in the 2 nd< test cycle. AI3 represents test excitation input by the scan structure A in the 3 rd< test cycle, BI3 represents test excitation input by the scan structure B in the 3 rd< test cycle, and CI3 represents test excitation input by the scan structure C in the 3 rd< test cycle.

[0072] It should be noted that, when tested circuits in some cores do not participate in a scanning test, the tested circuits may be configured to be in a pass-through mode, so that transparently transmitted test excitation or test responses are continuously transmitted. In addition, no transmission resource is reserved for the test excitation of the tested circuit on the test bus, to make full use of the transmission bandwidth of the test bus. Table 1...654321in1[0]...BI3AI3BI2AI2BI1AI1inl[1]...CI3AI3CI2AI2CI1AI1in1[2]...CI3AI3CI2AI2CI1AI1in1[3]...CI3AI3CI2AI2CI1AI1in1[4]...CI3BI3CI2BI2CI1BI1in1[5]...BI3BI2BI1in1[6]...BI3BI2BI1in1[7]...BI3BI2BI1

[0073] The following uses the first group of test excitation AI1, BI1, and CI1 as an example to describe how to check test excitation. The methods for checking other test excitation are similar.

[0074] As shown in FIG. 7, in a first clock cycle of a 1 st< test cycle, test excitation AI1 is input to input buses in1[0] to in1[3] of a core A. In order to fully occupy buses as much as possible, the first four bits of test excitation BI1 are input to input buses in1[4] to in1[7] of the core A. In the core A, a first DRU 301A coupled to the input buses in1[0] to in1[3] outputs the test excitation AI1 to a second DRU 302A coupled to the input buses in1[0] to in1[3] for storage. A first register 303A coupled to the input buses in1[4] to in1[7] outputs the first four bits of the test excitation BI1 to a second register 304A coupled to the input buses in1[0] to in1[3] for storage.

[0075] As shown in FIG. 8, in a second clock cycle of a 1 st< test cycle, a fifth bit of test excitation BI1 is input to an input bus in1[0] of a core A, and test excitation CI1 is input to input buses in1[1] to in1[4] of the core A. In the core A, a first selector 305A couples input buses in1[4] to in1[7] and output buses out1[0] to out1[3] respectively, and couples input buses in1[0] to in1[3] and output buses out1[4] to out1[7] respectively. A second DRU 302A coupled to the input buses in1[0] to in1[3] outputs the previously stored test excitation AI1 to an input channel channel_in of a scan structure A, and transmits the previous test response AO1 of the core A to a first DRU 301B of a core B coupled to input buses in2[4] to in2[7] and a first register 303B through the output buses out1[4] to out1[7] (that is, the input buses in2[4] to in2[7] of the core B) for storage. A second register 304A coupled to the input buses in1[4] to in1[7] transmits, through the output buses out1[0] to out1[3] (that is, input buses in2[0] to in2[3] of the core B), the first four bits of the previously stored test excitation BI1 to the first DRU 301B that is of the core B and that is coupled to the input buses in2[4] to in2[7] for storage. A first DRU 301 coupled to the input bus in1[0] transmits a fifth bit of the test excitation BI1 to a second DRU 302A coupled to the input bus in1[0] for storage. A first register 303A coupled to the input buses in1[1] to in1[4] transmits the test excitation CI1 to the second register 304A coupled to the input buses inl[1] to in1[4] for storage.

[0076] As shown in FIG. 9, in a first clock cycle of a 2 nd< test cycle, in a core B, a first DRU 301B coupled to input buses in2[0] to in2[3] outputs the first four bits of the previously stored test excitation BI1 to a second DRU 302B for storage, and a first register 303B coupled to input buses in2[4] to in2[7] outputs the previously stored test response AO1 to a second register 304B coupled to the input buses in2[4] to in2[7] for storage. In a core A, a second DRU 302A coupled to an input bus in1[0] transmits, through an output bus out1[4] (that is, an input bus in2[4] of the core B), the fifth bit of the previously stored test excitation BI1 to the first DRU 301B that is of the core B and that is coupled to the input bus in2[4] for storage. A second DRU 302A coupled to input buses inl[1] to in1[3] transmits, through output buses out1[5] to out11[7] (that is, input buses in2[5] to in2[7] of the core B), the first three bits of the previously stored test excitation CI1 to the first register 301B that is of the core B and that is coupled to the input buses in2[5] to in2[7] for storage. A second register 304A coupled to an input bus in1[4] transmits, through an output bus out1[0] (that is, an input bus in2[0] of the core B), the fourth bit of the previously stored test excitation CI1 to the first DRU 301B that is of the core B and that is coupled to the input bus in2[0] for storage.

[0077] As shown in FIG. 10, in a second clock cycle of a 2 nd< test cycle, in a core B, a first selector 305B couples input buses in2[0] to in2[7] and output buses out2[0] to out2[7] respectively. A second DRU 302B coupled to input buses in2[0] to in2[3] outputs the first four bits of the previously stored test excitation BI1 to an input channel channel_in of a scan structure B, and transmits the first four bits of the previous test response BO1 of the core B to a first DRU 301C that is of a core C and that is coupled to input buses in3[0] to in3[3] through output buses out2[0] to out2[3] (that is, the input buses in3[0] to in3[3] of the core C) for storage. A first DRU 302B coupled to an input bus in2[4] outputs the fifth bit of the previously stored test excitation BI1 to the input channel channel_in of the scan structure B, and transmits the fifth bit of the previous test response BO1 of the core B to the second DRU 302B for storage. The second DRU 302B coupled to input buses in2[4] to in2[7] transmits the previously stored test response AO1 to a first register 303C that is of the core C and that is coupled to input buses in3[4] to in3[7] through output buses out2[4] to out2[7] (that is, the input buses in3[4] to in3[7] of the core C) for storage. A first register 303B coupled to input buses in2[5] to in2[7] transmits the first three bits of the previously stored test excitation CI1 to a second register 304B coupled to the input buses in2[5] to in2[7] for storage. A first DRU 301B coupled to an input bus in2[0] transmits the fourth bit of the previously stored test excitation CI1 to the second register 304B coupled to the input bus in2[0] for storage.

[0078] As shown in FIG. 11, in a first clock cycle of a 3 rd< test cycle, in a core C, a first DRU 301B coupled to input buses in3[0] to in3[3] outputs the first four bits of the previously stored test response BO1 to a second DRU 302C for storage. A first register 303C coupled to input buses in3[4] to in3 [7] outputs the previously stored test response AO1 to a second register 304C coupled to the input buses in3[4] to in3[7] for storage. In a core B, a first selector 305B couples input buses in2[5] to in2[7] with output buses out2[0] to out2[2], and couples input buses in2[0] to in2[4] with output buses out2[3] to out2[7]. A second register 304B coupled to the input buses in2[5] to in2[7] transmits, through the output buses out2[0] to out2[2] (that is, input buses in3[0] to in3[2] of the core C), the first three bits of the previously stored test excitation CI1 to a first DRU 301C that is of the core C and is coupled to the input buses in3[0] to in3[2] for storage. A second DRU 302B coupled to an input bus in2[0] transmits, through an output bus out2[3] (that is, an input bus in3[3] of the core C), the fourth bit of the previously stored test excitation CI1 to the first DRU 301C that is of the core C and that is coupled to the input bus in3[3] for storage. The second DRU 302B coupled to an input bus in2[4] transmits, through an output bus out2[7] (that is, an input bus in3[7] of the core C), a fifth bit of the previously stored test response BO1 to the first register 303C that is of the core C and that is coupled to the input bus in3[7] for storage.

[0079] As shown in FIG. 12, in a second clock cycle of a 3 rd< test cycle, in a core C, a first selector 305C couples input buses in3[0] to in3[7] and output buses out3[0] to out3[7] respectively. A second DRU 302C coupled to input buses in3[0] to in3[3] outputs the first four bits of the previously stored test response BO1 through output buses out3[0] to out3[3]. A second register 304C coupled to input buses in3[4] to in3[7] outputs the previously stored test response AO1 through output buses out3[4] to out3[7]. A first register 303C coupled to an input bus in3[7] outputs the fifth bit of the previously stored test excitation BI1 to the second register 304C coupled to the input bus in3[7] for storage. A first DRU 301C coupled to the input buses in3[0] to in3[3] outputs the previously stored test excitation CI1 to an input channel channel_in of a scan structure C, and outputs the previous test response CO1 of the core C to the second DRU 302C coupled to the input buses in3[0] to in3[3] for storage.

[0080] In addition, in a next clock cycle, the second register 304C coupled to the input bus in3[7] outputs the previously stored fifth bit of the test excitation BI1 through the output bus out3[7]. The second DRU 302C coupled to the input buses in3[0] to in3[3] outputs the previously stored test response CO1 through the output buses out3[0] to out3[3].

[0081] Compared with other star structure solutions such as the SRF and the DBM, the test circuit provided in this embodiment of this application is more conducive to place and route, and does not have a problem of difficulty in winding. In addition, control logic is simple, an added circuit scale is small, and a test configuration is simpler. On the premise of reducing an area increase and physical design difficulty, bus resources are properly allocated to maximize utilization. A bottom-up design process is supported, and bus resource allocation is flexible and adjustable. A same hardware connection structure can implement a plurality of test solutions, making test plan flexible. Because only two clock cycles are required to complete data interaction with the tested circuit, transmission efficiency is improved. Data transmitted in each test bus can still be consistent in timing after passing through a plurality of cores. This improves the transmission rate of the bus.

[0082] An embodiment of this application further provides a generation method for the foregoing test circuit, and the method may be executed by a processor in a computer. As shown in FIG. 14, the method includes the following steps.

[0083] S1401: Obtain a bandwidth of an input bus in or a bandwidth of an output bus out of a test bus, and a bandwidth of an input channel channel_in and a bandwidth of an output channel channel _out of a tested circuit in each core.

[0084] Data can be entered by a user or imported from a configuration. The bandwidth of the input bus in is generally equal to the bandwidth of the output bus out. A bandwidth of an input channel channel _in and a bandwidth of an output channel channel_out of a same tested circuit may be the same or different.

[0085] S1402: Determine, based on the bandwidth of the input bus or the bandwidth of the output bus of the test bus, and the bandwidth of the input channel and the bandwidth of the output channel of each tested circuit, a quantity of DRUs or registers coupled to each input bus in each test circuit, and generate the test circuit.

[0086] For example, a frequency division ratio K is calculated as follows: K = Max CI CO / n . CI represents a bandwidth of an input channel channel_in of a tested circuit in a core, CO represents a bandwidth of an output channel channel_out of a tested circuit in a core, and B represents the bandwidth of the input bus in or the bandwidth of the output bus out. The K value may be used as a quantity of DRUs or registers coupled to each input bus in each core, to generate a test circuit of a plurality of cores.

[0087] An embodiment of this application further provides a circuit test method, which may be executed by a processor in a computer, and is used to test a tested circuit by using the foregoing test circuit. As shown in FIG. 15, the method includes the following steps.

[0088] S1501: Generate configuration information and test excitation.

[0089] The configuration information is used to configure a frequency division ratio of a frequency divider 308, and the configuration information is further used to configure a selection signal of a debugging interface 307 in the foregoing test circuit, to select a first DRU 301 or a second DRU 302 to be coupled to an input channel channel_in of the tested circuit, to input the test excitation into the tested circuit through the first DRU 301 or the second DRU 302.

[0090] S1502: Input the configuration information and the test excitation into a tested circuit of each core.

[0091] The configuration information is used to be input to the tested circuit of each core through an ijtag bus of a test bus, and the test excitation is used to be input to the tested circuit of each core through an input bus in of the test bus.

[0092] S1503: Receive a test response of each tested circuit.

[0093] Specifically, the test response of each tested circuit is received through an output bus out in the test bus.

[0094] S1504: Determine, based on the test response, whether the tested circuit is normal.

[0095] If a test response output by a tested circuit does not meet an expected result, it may be determined that the tested circuit functions abnormally; otherwise, it is determined that the tested circuit functions normally.

[0096] An embodiment of this application further provides a computer-readable storage medium. The computer-readable storage medium includes instructions. When the instructions are executed by a processor, functions or steps in the foregoing method embodiments are performed. For example, the computer-readable storage medium may be a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a compact disc read-only memory (Compact Disc Read-Only Memory, CD-ROM), a tape, a floppy disk, an optical data storage device, or the like.

[0097] An embodiment of this application further provides a computer program product including instructions. When the instructions are executed by a processor, functions or steps in the foregoing method embodiments are performed.

[0098] It should be understood that sequence numbers of the foregoing processes do not mean execution sequences in various embodiments of this application. The execution sequences of the processes should be determined according to functions and internal logic of the processes, and should not be construed as any limitation on the implementation processes of embodiments of this application.

[0099] A person of ordinary skill in the art may be aware that, in combination with the examples described in embodiments disclosed in this specification, modules and algorithm steps may be implemented by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are performed by hardware or software depends on particular applications and design constraint conditions of the technical solutions. A person skilled in the art may use different methods to implement the described functions for each particular application, but it should not be considered that the implementation goes beyond the scope of this application.

[0100] It may be clearly understood by a person skilled in the art that, for the purpose of convenient and brief description, for a detailed working process of the foregoing system, apparatus, and module, refer to a corresponding process in the foregoing method embodiments, and details are not described herein again.

[0101] In the several embodiments provided in this application, it should be understood that the disclosed system, device and method may be implemented in other manners. For example, the described device embodiment is merely an example. For example, division into the modules is merely logical function division and may be other division in an actual implementation. For example, a plurality of modules or components may be combined or integrated into another device, or some features may be ignored or not performed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections may be implemented through some interfaces. The indirect couplings or communication connections between the devices or modules may be implemented in electronic, mechanical, or other forms.

[0102] The modules described as separate components may or may not be physically separate, and components displayed as modules may or may not be physical modules, may be located in one device, or may be distributed on a plurality of devices. Some or all the modules may be selected according to actual needs to achieve the objectives of the solutions of embodiments.

[0103] In addition, functional modules in embodiments of this application may be integrated into one device, or each of the modules may exist alone physically, or two or more modules are integrated into one module.

[0104] All or some of the foregoing embodiments may be implemented by using software, hardware, firmware, or any combination thereof. When a software program is used to implement embodiments, embodiments may be implemented completely or partially in a form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, the procedure or functions according to embodiments of this application are all or partially generated. The computer may be a general-purpose computer, a dedicated computer, a computer network, or other programmable apparatuses. The computer instructions may be stored in a computer-readable storage medium or may be transmitted from a computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website, computer, server, or data center to another website, computer, server, or data center in a wired (for example, a coaxial cable, an optical fiber, or a digital subscriber line (Digital Subscriber Line, DSL)) or wireless (for example, infrared, radio, or microwave) manner. The computer-readable storage medium may be any usable medium accessible by a computer, or a data storage device, such as a server or a data center, integrating one or more usable media. The usable medium may be a magnetic medium (for example, a floppy disk, a hard disk, or a magnetic tape), an optical medium (for example, a DVD), a semiconductor medium (for example, a solid-state drive (solid state disk, SSD)), or the like.

[0105] The foregoing descriptions are merely specific implementations of this application, but are not intended to limit the protection scope of this application. Therefore, the protection scope of this application shall be subject to the protection scope of the claims.

Claims

1. A test circuit, comprising: a first input bus, a second input bus, a first output bus, a second output bus, a first dynamic routing unit DRU, and a first register, wherein the first input bus is configured to be coupled to an input channel of a tested circuit through the first DRU, and the first output bus is configured to be coupled to an output channel of the tested circuit through the first DRU; the second input bus is configured to be coupled to the second output bus through the first register; and in a clock cycle: the first DRU is configured to output test excitation from the first input bus to the input channel, and output a test response from the output channel to the first output bus; or the first DRU is configured to output data from the first input bus to the first output bus; and the first register is configured to output data from the second input bus to the second output bus.

2. The test circuit according to claim 1, further comprising: a second DRU coupled to the first DRU, a selection circuit, and a second register coupled to the first register, wherein the first input bus is configured to be coupled to the input channel through the first DRU, the second DRU, and the selection circuit, and the first output bus is configured to be coupled to the output channel through the first DRU and the second DRU; the second input bus is configured to be coupled to the second output bus through the first register and the second register; and the selection circuit is configured to select the first DRU or the second DRU to be coupled to the input channel.

3. The test circuit according to claim 2, wherein in a first clock cycle, the first DRU is configured to output the test excitation to the second DRU; and in a second clock cycle, the selection circuit selects the second DRU to be coupled to the input channel, and the second DRU is configured to output the test excitation to the input channel, and output the test response to the first output bus; or in a second clock cycle, the selection circuit selects the first DRU to be coupled to the input channel, and the first DRU is configured to output the test excitation to the input channel, and output the test response to the first output bus.

4. The test circuit according to claim 2 or 3, wherein the selection circuit comprises a first AND gate, a second AND gate, and a second selector, wherein a first input of the second AND gate performs phase inversion on an input signal; an output of the first AND gate is coupled to the first DRU to output a first signal to the first DRU, an output of the second AND gate is coupled to the second DRU to output a second signal to the second DRU, a first input of the first AND gate and the first input of the second AND gate are coupled to a control end of the second selector and are configured to input a third signal, a second input of the first AND gate and a second input of the second AND gate are coupled and are configured to input a fourth signal, two inputs of the second selector are respectively coupled to the first DRU and the second DRU, and an output of the second selector is configured to be coupled to the input channel; and the first signal is used to control the first DRU whether to output the test excitation to the input channel, the second signal is used to control the second DRU whether to output the test excitation to the input channel, the third signal is used to control the selection circuit to select the first DRU or the second DRU to be coupled to the input channel, and the fourth signal is used to control the first DRU or the second DRU whether to output the test excitation to the input channel.

5. The test circuit according to any one of claims 1 to 4, wherein the first DRU comprises a third register and a third selector; and a data input of the third register is configured to be coupled to the first input bus, a data output of the third register is configured to be separately coupled to a second input of the third selector and the input channel, a first input of the third selector is configured to be coupled to the output channel, an output of the third selector is configured to be coupled to the first output bus, a control end of the third selector is configured to input a fifth signal, and the fifth signal is used to control the third selector to connect the first input or the second input to the output.

6. The test circuit according to any one of claims 1 to 5, further comprising: a reset input bus, a reset output bus, and a plurality of fourth registers, wherein a quantity of the fourth registers is equal to a quantity of registers coupled to the second input bus; the reset input bus is coupled to the reset output bus through the plurality of fourth registers; the reset input bus is configured to input a reset signal; and the reset output bus is configured to output, to the test circuit, the reset signal delayed by the plurality of fourth registers.

7. The test circuit according to any one of claims 1 to 6, further comprising a plurality of fifth registers, wherein the first input bus and the second input bus each are coupled to A fifth registers, and A is a positive integer.

8. The test circuit according to any one of claims 1 to 7, further comprising a plurality of sixth registers, wherein the first output bus and the second output bus each are coupled to B sixth registers, and B is a positive integer.

9. An integrated circuit, comprising a plurality of cores, wherein each core comprises a tested circuit and the test circuit according to any one of claims 1 to 8, and test circuits of the plurality of cores are coupled through a test bus.

10. An electronic device, comprising a printed circuit board and the integrated circuit according to claim 9 disposed on the printed circuit board.

11. A method for generating a test circuit, comprising: obtaining a bandwidth of an input bus or a bandwidth of an output bus of a test bus, and a bandwidth of an input channel and a bandwidth of an output channel of a tested circuit in each core; and determining, based on the bandwidth of the input bus or the bandwidth of the output bus of the test bus, and the bandwidth of the input channel and the bandwidth of the output channel of the tested circuit in each core, a quantity of dynamic routing units DRUs or registers coupled to each input bus in each test circuit, and generating the test circuit according to any one of claims 1 to 8.

12. The method according to claim 11, wherein a quantity K of dynamic routing units or registers coupled to each input bus in a test circuit in each core is obtained in the following manner: K = Max CI CO / n , wherein CI represents a bandwidth of an input channel of a tested circuit in a core, CO represents a bandwidth of an output channel of the tested circuit in the core, and n represents the bandwidth of the input bus or the bandwidth of the output bus.

13. A circuit test method, used to test a tested circuit by using the test circuit according to any one of claims 1 to 8, wherein the method comprises: generating configuration information and test excitation, wherein the configuration information is used to configure a frequency division ratio of the test circuit, and the test excitation is used to be input to the tested circuit; inputting the configuration information and the test excitation into the tested circuit; receiving a test response of the tested circuit; and determining, based on the test response, whether the tested circuit is normal.