A brain-like processor based on brain-like instruction set and its application method
By designing a processor based on a brain-like instruction set, the problems of programmability and compatibility of brain-like processors are solved, support for different levels and scales is achieved, and programming efficiency and application scope are improved.
Patent Information
- Application Number
- CN202210617698.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-01
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2042-06-01
AI Technical Summary
Existing brain-inspired processors lack a unified instruction set architecture, resulting in poor programmability, portability, and incompatibility, which limits the cross-platform compatibility and development efficiency of spiking neural network models and brain-inspired computing applications.
A brain-like processor based on the brain-like instruction set is designed, including fetching, decoding, execution and writeback segments. It adopts a pipeline stack architecture and introduces specific registers and data paths to support a general brain-like instruction set. Provide support for brain-inspired applications of different magnitudes, SNNs of different sizes, and different neuron models.
It improves the programming efficiency and compatibility of brain-like processors, supports more complex neuron models and applications, reduces programming difficulty, optimizes sparse and parallel computing, and expands the scope of applications.
Smart Images

Figure CN114911526B
Abstract
Description
Technical Field
[0001] The present invention relates to a brain-like processor, and in particular to a brain-like processor based on a brain-like instruction set and an application method thereof. Background Art
[0002] Brain-like computing is a general term for a group of technologies that refer to the basic laws of information processing in biological brains, and make changes to existing computing architectures at multiple levels such as hardware architecture and software algorithms, thereby achieving significant improvements in computing energy efficiency and other aspects. A brain-like processor is a processor that imitates the neural structure of the human brain in terms of architecture. It can simulate the high energy efficiency, low power consumption, and real-time characteristics of biological brain neural networks, and has the function of simulating ultra-large-scale pulse real-time communication and computing. In recent years, brain-like processors represented by IBM's TrueNorth and Intel's Loihi have continued to emerge, showing impressive energy efficiency advantages compared to computing architectures such as CPUs, GPUs, and traditional deep neural network accelerators, and are widely used in applications such as robot control, aerial image processing and recognition, unmanned autonomous system decision-making, and brain-computer signal processing.
[0003] The algorithms executed on brain-like processors are mainly based on spiking neural networks. Compared with traditional deep neural networks, spiking neural networks are more biomimetic, with the characteristics of using pulses as the way of signal transmission between neurons instead of continuous values and working in an event-driven manner.
[0004] However, existing brain-like processors all use different architectures and provide different interfaces to software. These brain-like processors generally only provide simple control commands, so programmers can only use neural network division and mapping tools to map pulse neural networks to brain-like processors, and then use control commands to operate brain-like processors to complete calculations. This working method is inefficient, has poor support for high-level language programming, and brings heavy manual work.
[0005] The root cause of these problems is that there is currently no unified instruction set architecture (ISA) to abstract and control brain-like processors. From the perspective of program development and operation, it is impossible to provide support for the implementation of spiking neural networks and brain-like computing applications through compilers and software tool chains with unified specifications, making it impossible for many spiking neural network models and brain-like computing application software programs to run compatibly on different brain-like computing hardware acceleration platforms. With the development of brain-like computing technology, brain-like algorithms are also constantly developing. However, the poor programmability, poor portability and incompatibility of brain-like processors will hinder the development of the brain-like computing ecosystem. Summary of the invention
[0006] Technical problem to be solved by the present invention: In view of the above-mentioned problems of the prior art, a brain-like processor based on a brain-like instruction set and an application method thereof are provided. The present invention can achieve architectural support for a general brain-like instruction set, solve the problems of poor programmability, poor portability and incompatibility of brain-like hardware, and can provide memory access and computing support for brain-like applications of different magnitudes and SNNs of different scales, as well as support for different neuron models.
[0007] In order to solve the above technical problems, the technical solution adopted by the present invention is:
[0008] A brain-like processor based on a brain-like instruction set, the brain-like processor comprising one or more brain-like processor cores, the brain-like processor core comprising four pipeline segments, namely, an instruction fetch segment, a decoding segment, an execution segment and a write-back segment, and a pipeline stack IF / ID is provided between the instruction fetch segment and the decoding segment, a pipeline stack ID / EXE is provided between the decoding segment and the execution segment, and a pipeline stack EXE / WB is provided between the execution segment and the write-back segment;
[0009] The instruction fetching section includes an instruction prefetching buffer and a controller. The instruction prefetching buffer is used to fetch the instructions of the brain-like instruction set from the external instruction buffer and cache them in the pipeline stack IF / ID. The controller is used to determine the address of the instruction prefetching according to the specified result of the execution of the execution section to control the instruction prefetching buffer. If the specified result is sequential execution, the instruction is fetched according to the sequential address. If the specified result is a jump, the instruction is transferred to the target address for fetching.
[0010] The decoding section includes a decoder, a general register GPR, an extension register, and one or more multiplexers. The decoder is used to translate the register index values stored in different fields of the instruction flowing out of the pipeline stack IF / ID and send them to the register group storing the operands, specifically the general register GPR or the extension register. The one or more multiplexers are used to select the operands of the specified source to be cached in the pipeline stack ID / EXE according to the results of different instruction decoding to participate in the next pipeline section to perform calculations;
[0011] The execution segment includes a request queue, a memory access unit, an arithmetic logic unit ALU, a multiplier / divider, a control status register, a vector calculation unit, a neuron array, and a multiplexer. The request queue is used to perform data interaction with the memory, and the memory access unit is used to process the request queue for reading and writing memory proposed by the instruction, and perform memory access read and write operations on the memory through the data buffer cache; the arithmetic logic unit ALU is responsible for performing general calculations, including addition, subtraction, logical AND and logical OR; the multiplier / divider is used to perform multiplication and division operations, and the control status register is used to store control-related signals, including interrupts and exceptions; the vector calculation unit is used to perform neuron synaptic reaction operations of the pulse neural network SNN; the neuron array is used to complete the operation function of the neuron model equation; the multiplexer is used to select the calculation results or memory access results of the specified source according to different instructions and cache them in the pipeline stack EXE / WB to enter the next pipeline segment;
[0012] The write-back segment includes a data buffer and a data path. The data buffer is used to receive data transmitted by a write memory request from a memory access unit or to respond to a read request issued by the memory access unit and return the requested number; the data path is used to write the result calculated by the execution segment or the read-back number back to the register specified by the decoding segment.
[0013] Optionally, the instruction fetch segment further includes a debugger, which is connected to an external adjustment interface and a controller of the instruction fetch segment and is used to debug and control the controller via the external debugging interface in a debugging mode.
[0014] Optionally, the extended register of the decoding segment includes part or all of the following registers:
[0015] The weight vector register WVR is used to store the fan-in weight of the neuron;
[0016] The pulse vector register SVR is used to store the pulse input sequence;
[0017] The current status register NCR is used to store the current status information of the neuron;
[0018] The voltage status register NVR is used to store the voltage status information of the neuron;
[0019] The pulse output register SOR is used to store the pulse output of the neuron;
[0020] The liquid state register NSR is used to store the liquid state information of the neuron, and the stored liquid state information of the neuron is the cumulative value of the number of pulse outputs generated by each neuron.
[0021] In addition, the present invention also provides a computer device, including a microprocessor and a memory connected to each other, wherein the microprocessor is also connected to a brain-like processor for realizing brain-like computing acceleration, and the brain-like processor is the brain-like processor based on the brain-like instruction set as described above.
[0022] Optionally, the instruction prefetch buffer is used to fetch fields in the instructions of the brain-like instruction set from the external instruction buffer, respectively including:
[0023] Operation code opcode is used to distinguish different types of instructions.
[0024] The index rd operand of the destination register is used to indicate the index of the destination register to which the instruction execution result needs to be written;
[0025] The index of the first source operand rs1 is used to indicate the index of the first source operand required for instruction execution;
[0026] The index of the second source operand rs2 is used to indicate the index of the second source operand required for instruction execution;
[0027] Function field, used to distinguish instructions of different functions in the same type of instructions.
[0028] Optionally, the instruction prefetch buffer is used to fetch instructions of a brain-like instruction set from an external instruction buffer, and the instruction length is 32 bits, wherein the opcode opcode occupies bits 0 to 6, the index rd operand of the destination register occupies bits 7 to 11, the function field includes bits 12 to 14 and bits 25 to 31, the index rs1 of the first source operand occupies bits 15 to 19, and the index rs2 of the second source operand occupies bits 20 to 24.
[0029] Optionally, the instruction pre-fetch buffer is used to fetch the instructions of the brain-like instruction set from the external instruction buffer, and the instructions are current calculation instructions;
[0030] When the instruction is a longitudinal vector multiplication and accumulation calculation instruction convh in the current calculation class instruction, the execution process of the four pipeline stages includes: in the instruction fetch stage, the longitudinal vector multiplication and accumulation calculation instruction convh is taken out; in the decoding stage, the indexes rs1 operand and rs2 operand of the two source operands are read from the general register GPR according to the result field generated by the instruction decoding, and 32 4-bit weights w and 32 1-bit input pulses spike are read from the weight vector register WVR and the pulse vector register SVR as indexes and sent to the next pipeline stage, and the result field generated by the instruction decoding is read from the general register The index rd operand of the destination register is read from the GPR, and sent to the current state register NCR to read the value of a current state current and send it to the next pipeline stage; in the execution stage, the 32 weights w and the input pulse spike are placed in the vector calculation unit, the longitudinal vector multiplication and accumulation calculation of the current sum is performed, and the result is accumulated to the read current state current, and then the result is sent to the next pipeline stage; in the write-back stage, the calculation result is written back to the corresponding current state register NCR according to the index rd operand of the destination register to update the value of the current state current of a neuron;
[0031] When the instruction is a longitudinal vector multiplication and accumulation calculation instruction conva in the current calculation class instruction, the execution process of the four pipeline stages includes: in the instruction fetch stage, the longitudinal vector multiplication and accumulation calculation instruction conva is taken out; in the decoding stage, the indexes rs1 operand and rs2 operand of the two source operands are read from the general register GPR according to the result field generated by the instruction decoding, and 128 4-bit weights w and 128 1-bit input pulses spike are read from the weight vector register WVR and the pulse vector register SVR as indexes respectively and sent to the next pipeline stage, and the result field generated by the instruction decoding is read from the pass vector register SVR according to the result field generated by the instruction decoding. Use the index rd operand of the destination register in the register GPR, send it to the current state register NCR to read the value of a current state current and send it to the next pipeline stage; in the execution stage, put the 128 weights w and the input pulse spike into the vector calculation unit, perform the longitudinal vector multiplication and accumulation calculation of the current sum, and add the result to the read current state current, and then send the result to the next pipeline stage; in the write-back stage, write the calculation result back to the corresponding current state register NCR according to the index rd operand of the destination register to update the current state current of a neuron;
[0032] When the instruction is a horizontal vector dot multiplication and accumulation calculation instruction doth in the current calculation class, the execution process of the four pipeline stages includes: in the instruction fetch stage, the horizontal vector dot multiplication and accumulation calculation instruction doth is taken out; in the decoding stage, the index rs1 operand and rs2 operand of the two source operands are read from the general register GPR according to the result field generated by the instruction decoding, and 32 weights w and 32 input pulses spike are read from the weight vector register WVR and the pulse vector register SVR as indexes and sent to the next pipeline stage, and the index rd operand of the destination register is read from the general register GPR according to the result field generated by the instruction decoding, and sent to the current state register NCR to read the values of 32 current states current and send to the next pipeline stage; in the execution stage, the 32 weights and input pulses are placed in the vector calculation unit, the vector dot multiplication and accumulation calculation of the current sum is performed, and then the result is sent to the next stage; the calculation result is written back to the corresponding current state register NCR according to the index rd operand of the destination register to update the current state current of 32 neurons;
[0033] When the instruction is a horizontal vector dot multiplication and accumulation calculation instruction dota in the current calculation class, the execution process of the four pipeline stages includes: in the instruction fetch stage, the horizontal vector dot multiplication and accumulation calculation instruction doth is taken out; in the decoding stage, the indexes rs1 operand and rs2 operand of the two source operands are read from the general register GPR according to the result field generated by the instruction decoding, and 128 weights w and 128 input pulses spike are read from the weight vector register WVR and the pulse vector register SVR as indexes respectively and sent to the next pipeline stage, and according to the instruction The result field generated by decoding reads the index rd operand of the destination register from the general register GPR, sends it to the current state register NCR to read the values of 128 current states current and sends it to the next pipeline stage; in the execution stage, the 128 weights w and the input pulse spike are placed in the vector calculation unit, and the vector dot multiplication and accumulation calculation of the current sum is performed, and then the result is sent to the next stage; the calculation result is written back to the corresponding current state register NCR according to the index rd operand of the destination register to update the current state current of the 128 neurons.
[0034] Optionally, the instruction pre-fetch buffer is used to fetch the instructions of the brain-like instruction set from the external instruction buffer as state update instructions;
[0035] When the instruction is a state update instruction upds in the state update type instruction, the execution process of the four pipeline stages includes: in the instruction fetch stage, the state update instruction upds is taken out; in the decoding stage, the index rd operand of the destination register is read from the general register GPR according to the result field generated by the instruction decoding, and the current, voltage, and liquid state value of one neuron are read from the current state register NCR, the voltage state register NVR, and the liquid state register NSR respectively and sent to the next pipeline stage; in the execution stage, according to the preset neuron calculation method, the current, voltage, liquid state update value and pulse output of one neuron are calculated and sent to the next pipeline stage; in the write-back stage, according to the result field generated by the instruction decoding, the index rd operand of the destination register is read from the general register GPR, and written back to the current state register NCR, the voltage state register NVR, the liquid state register NSR, and the pulse output register SOR respectively, so as to update the current, voltage, liquid state value and pulse output of one neuron;
[0036] When the instruction is a state update instruction updg in the state update type instruction, the execution process of the four pipeline stages includes: in the instruction fetch stage, the state update instruction updg is taken out; in the decoding stage, the index rd operand of the destination register is read from the general register GPR according to the result field generated by the instruction decoding, and the current, voltage, and liquid state values of 32 neurons are read from the current state register NCR, the voltage state register NVR, and the liquid state register NSR respectively and sent to the next pipeline stage; in the execution stage, according to the preset neuron calculation method, the current, voltage, liquid state update values of 32 neurons and their pulse output are calculated and sent to the next pipeline stage; in the write-back stage, according to the result field generated by the instruction decoding, the index rd operand of the destination register is read from the general register GPR, and written back to the current state register NCR, the voltage state register NVR, the liquid state register NSR, and the pulse output register SOR respectively to update the current, voltage, liquid state values and pulse output of the 32 neurons.
[0037] Optionally, the calculation steps of the preset neuron calculation method include:
[0038] S1) respectively read out the single neuron current I from the current state register NCR, the single neuron voltage V from the voltage state register NVR, and the single neuron liquid state S from the liquid state register NSR; initialize and set the activation neuron threshold voltage Vthreshold_excited, the inhibition neuron threshold voltage Vthreshold_inhibit, the activation neuron refractory period threshold and the inhibition neuron refractory period threshold;
[0039] S2) Initialize the refractory period variable period. If the current neuron type is an activation neuron, jump to step S3); if the current neuron type is an inhibition neuron, jump to step S7);
[0040] S3) calculating the current leakage variable rnd_I according to rnd_I=I>>2, where I is the current of a single neuron, ">>" is a right shift operation, and calculating the neuron current update value I' according to I'=I-(rnd_I>>3);
[0041] S4) determining whether the refractory period variable period is greater than or equal to the refractory period threshold value of the activated neuron; if not, determining that the neuron is within the refractory period, adding 1 to the refractory period variable period, and ending and exiting; otherwise, jumping to the next step;
[0042] S5) calculating the voltage leakage variable rnd_V according to rnd_V=V>>4, where I is the current of a single neuron, and calculating the updated voltage value V′ of the neuron according to V′=V-(rnd_V>>3)+(I>>3);
[0043] S6) Determine whether the updated neuron voltage value V' is greater than the threshold voltage Vthreshold_excited for activating the neuron. If so, generate a pulse output O, assign the updated neuron liquid state value S' to the neuron liquid state S plus 1, reset the updated neuron current value I' to 0, reset the updated neuron voltage value V' to 0, reset the current leakage variable rnd_I to 0, reset the voltage leakage variable rnd_V to 0, and set the refractory period variable period to 0; if not, end and exit;
[0044] S7) calculating the current leakage variable rnd_I according to rnd_I=I>>2, where I is the current of a single neuron, ">>" is a right shift operation, and calculating the neuron current update value I' according to I'=I-(rnd_I>>3);
[0045] S8) determining whether the refractory period variable period is greater than or equal to the refractory period threshold value of the inhibitory neuron; if not, determining that the neuron is within the refractory period, adding 1 to the refractory period variable period, and ending and exiting; otherwise, jumping to the next step;
[0046] S9) calculating the voltage leakage variable rnd_V according to rnd_V=V>>4, where I is the current of a single neuron, and calculating the updated voltage value V′ of the neuron according to V′=V-(rnd_V>>3)+(I>>3);
[0047] S10) Determine whether the updated voltage value V′ of the neuron is greater than the threshold voltage Vthreshold_inhibit of the inhibitory neuron. If so, generate a pulse output O, assign the updated value S′ of the neuron liquid state to the neuron liquid state S plus 1, reset the updated current value I′ of the neuron to 0, reset the updated voltage value V′ of the neuron to 0, reset the current leakage variable rnd_I to 0, reset the voltage leakage variable rnd_V to 0, and set the refractory period variable period to 0. If not, end and exit.
[0048] Optionally, the instruction pre-fetch buffer is used to fetch the instructions of the brain-like instruction set from the external instruction buffer, and the instructions are pulse transmission type instructions;
[0049] When the instruction is a pulse transmission instruction movg in the pulse transmission class, the execution process of the four pipeline stages includes: in the instruction fetch stage, the pulse transmission instruction movg is fetched; in the decoding stage, the index rd operand of the destination register is read from the general register GPR according to the result field generated by the instruction decoding, and 32 pulses are read from the pulse output register SOR to output the next pipeline stage; in the execution stage, the pulse is directly transferred and sent to the next pipeline stage; in the write-back stage, the index rd operand of the destination register is read from the general register GPR according to the result field generated by the instruction decoding, and written back to the pulse vector register SVR for use as the pulse input of the next time step;
[0050] When the instruction is the pulse transmission instruction mova in the pulse transmission type instruction, the execution process of the four pipeline stages includes: in the instruction fetch stage, the pulse transmission instruction mova is taken out; in the decoding stage, the index rd operand of the destination register is read from the general register GPR according to the result field generated by the instruction decoding, and 1024 pulses are read from the pulse output register SOR to output the next pipeline stage; in the execution stage, the pulse is directly transferred and sent to the next pipeline stage; in the write back stage, the index rd operand of the destination register is read from the general register GPR according to the result field generated by the instruction decoding, and written back to the pulse vector register SVR for use as the pulse input of the next time step.
[0051] Compared with the prior art, the present invention mainly has the following advantages:
[0052] 1. The present invention proposes a general brain-like processor based on a brain-like instruction set. By proposing an instruction set architecture, the present invention can effectively compress the length of the code and reduce the difficulty of programming from the perspective of software. From the perspective of hardware, the micro-architecture design can support the corresponding new instructions, add necessary registers, and provide necessary data paths, thereby improving the execution efficiency of instructions. Extending new instructions is a good way to improve the efficiency of processors in executing specific applications such as SNN. From the history of the x86 instruction set, since the MMX instruction extension was proposed in 1996, new extensions have been continuously introduced to improve the execution efficiency of applications. The present invention can achieve the decoupling and independent development of brain-like software and brain-like hardware, providing opportunities for the good development of the brain-like ecology. From the history of computer development, the successful cases of the proposal, development, and extension of the x86 and ARM instruction set architectures show that this is very important.
[0053] 2. The present invention can provide memory access and computing support for brain-like applications of different magnitudes and SNNs of different scales. The amount of computation of SNN is related to the specific application, and the amount of data has a large span from sparse to dense. The structure of SNN is complex and irregular, and the pulse sequence is sparse and irregular. The use of memory access instructions of different granularities and computing instructions of different granularities and directions provides a broad space for compilation tools to discover the use of sparsity for acceleration, so that sparse networks and sparsity in input data can be fully developed and utilized at the compiler level and the application level to achieve acceleration. At the same time, hardware neurons are used on demand in small-scale networks to achieve energy saving, and the high throughput requirements and high parallel computing requirements for dense networks and data inputs can also be met. In this way, both sparse development and parallel computing are taken into account, and the range of applications that can be supported is also wider.
[0054] 3. The present invention can provide support for different neuron models. With the deepening of computational neuroscience research, the academic community's understanding and abstraction of neuron behavior and brain operation rules will be further improved, and the neuron computing model will evolve in a more sophisticated and complex direction to continuously approach the real biological brain. The present invention can realize a more complex model to support this evolution trend by using a combination of different functional computing instructions. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 Schematic diagram of the structure of the brain-like processor core in an embodiment of the present invention.
[0056] Figure 2 Schematic diagram of the instruction structure in an embodiment of the present invention.
[0057] Figure 3 This is a detailed design diagram of the brain-inspired functional components in the brain-inspired processor core in an embodiment of the present invention.
[0058] Figure 4 4 is a diagram of the execution process of the longitudinal vector multiplication and accumulation calculation instruction convh in an embodiment of the present invention.
[0059] Figure 5 1 is a diagram of the execution process of the longitudinal vector multiplication and accumulation calculation instruction conva in an embodiment of the present invention.
[0060] Figure 6 1 is a diagram of the execution process of the horizontal vector dot multiplication and accumulation calculation instruction doth in an embodiment of the present invention.
[0061] Figure 7 1 is a diagram of the execution process of the horizontal vector dot multiplication and accumulation calculation instruction dota in an embodiment of the present invention.
[0062] Figure 8 4 is a diagram of the execution process of the status update instruction upds in an embodiment of the present invention.
[0063] Fig. 9 4 is a diagram of the execution process of the state update instruction updg in an embodiment of the present invention.
[0064] Fig.10 1 is a diagram of the execution process of the pulse transfer instruction movg in an embodiment of the present invention.
[0065] Fig.11 1 is a diagram of the execution process of the pulse transmission instruction mova in an embodiment of the present invention. DETAILED DESCRIPTION
[0066] Extending brain-like instructions based on RISC-V is a promising solution. There are three reasons: 1. RISC-V is an open source ISA with a mature software ecosystem and compiler. 2. The brain-like instruction set extension based on RISC-V provides an abstraction of brain-like processor hardware, improves the programmability of brain-like processors, and enables brain-like algorithms to be compatible on different brain-like processors. 3. In RISC-V, the brain-like instruction set architecture customized for SNN is more adaptable to the characteristics of SNN than the RISC-V standard vector extension, and better utilizes its sparsity. The following will take the RISC-V architecture as an example to further describe in detail the brain-like processor based on the brain-like instruction set and its application method of the present invention. It should be noted that the implementation of the brain-like processor based on the brain-like instruction set and its application method of the present invention does not depend on a specific instruction set architecture. This embodiment first provides a brain-like processor based on a brain-like instruction set, and the brain-like processor includes one or more brain-like processor cores, and a single-core or multi-core architecture can be selected as needed.
[0067] like Figure 1As shown, the brain-like processor core in this embodiment includes four pipeline segments, namely, instruction fetch (IF), decode (ID), execute (EXE) and write back (WB), and a pipeline stack IF / ID is provided between the instruction fetch and decode segments, a pipeline stack ID / EXE is provided between the decode and execute segments, and a pipeline stack EXE / WB is provided between the execute and write back segments; the pipeline segments and pipeline stacks of the brain-like processor core mainly function to complete the function set defined by the instruction and manipulate the data. The function of the pipeline segment is to complete a specific operation, while the function of the pipeline stack is to cache data between pipeline segments. Its workflow is as follows: the first step is to fetch the instruction from the instruction cache in the instruction fetch (IF) stage; the second step is to read out the content of the specific register indexed by the instruction in the decode (ID) stage according to the definition of different fields in the instruction; the third step is to perform the specified function operation on the data read out in the previous stage or write the data to the memory through the memory access unit or send the reading request to the memory according to the definition of the instruction opcode and function field in the instruction in the execution (EXE) stage; the fourth step is to write the calculation result of the previous step back to the specific register in the writeback (WB) stage, or write the number read back from the memory back to the specific register to load the data from the memory to the register. It should be noted that in Figure 1 The architecture shown is the core architecture and functional components required for the execution of the brain-like processor core. Figure 1 Based on the architecture shown, more pipeline stages, pipeline stacks and other functional components can be expanded as needed.
[0068] See also Figure 1 The instruction fetching section includes an instruction prefetching buffer and a controller. The instruction prefetching buffer is used to fetch the instructions of the brain-like instruction set from the external instruction buffer and cache them in the pipeline stack IF / ID. The controller is used to determine the address of the instruction prefetching according to the specified result of the execution of the execution section to control the instruction prefetching buffer. If the specified result is sequential execution, the instruction is fetched according to the sequential address. If the specified result is a jump, the instruction is transferred to the target address for fetching.
[0069] See also Figure 1The decoding section includes a decoder, a general register GPR, an extension register, and one or more multiplexers (which can be selected as needed, for example, two multiplexers in this embodiment), the decoder is used to translate the register index values stored in different fields of the instruction flowing out of the pipeline stack IF / ID, and send them to the register group storing the operand, specifically the general register GPR or the extension register, and the one or more multiplexers are used to select the operands of the specified source according to the results of different instruction decoding and cache them in the pipeline stack ID / EXE to participate in the next pipeline stage to perform calculation;
[0070] See also Figure 1 The execution segment includes a request queue, a memory access unit, an arithmetic logic unit ALU, a multiplier / divider, a control status register, a vector calculation unit, a neuron array, and a multiplexer. The request queue is used to execute data interaction with the memory. The memory access unit is used to process the request queue for reading and writing memory proposed by the instruction, and performs memory access and read and write operations on the memory through the data buffer cache; the arithmetic logic unit ALU is responsible for performing general calculations, including addition, subtraction, logical AND and logical OR; the multiplier / divider is used to perform multiplication and division operations, and the control status register is used to store control-related signals, including interrupts and exceptions; the vector calculation unit (also referred to as the vector component) is used to perform the neuron synaptic reaction operation of the spiking neural network SNN (spiking neural network, SNN); the neuron array is used to complete the operation function of the neuron model equation; the multiplexer is used to select the calculation results of the specified source or the memory access results according to different instructions and cache them in the pipeline stack EXE / WB to enter the next pipeline segment;
[0071] See also Figure 1 The write-back segment includes a data buffer and a data path. The data buffer is used to receive data transmitted by a write memory request from the memory access unit or to respond to a read request issued by the memory access unit and return the requested number; the data path is used to write the result calculated by the execution segment or the read-back number back to the register specified by the decoding segment.
[0072] See also Figure 1 The instruction fetch segment in this embodiment also includes a debugger, which is connected to the external adjustment interface and the controller of the instruction fetch segment and is used to debug and control the controller via the external debugging interface in the debugging mode.
[0073] In order to realize brain-like computing functions, brain-like computing-related operands are required. In this embodiment, the extended registers of the decoding segment include the following registers (part or all of which can be selected as needed) to store the operands required for SNN execution:
[0074] The weight vector register WVR is used to store the fan-in weights of the neuron. In this embodiment, there are a total of 16 32-bit weight vector registers WVR, numbered w0-w15, which can hold 128 4-bit weight operands when fully loaded.
[0075] The pulse vector register SVR is used to store the pulse input sequence. In this embodiment, there are 32 32-bit pulse vector registers SVR in total, numbered i0-i31, which can store 1024 1-bit pulse operands when fully loaded.
[0076] The current status register NCR is used to store the current status information of the neuron. In this embodiment, there are a total of 1024 16-bit NCRs, numbered c0-c1023, which can store the 16-bit current status of 1024 neurons when fully loaded.
[0077] The voltage status register NVR is used to store the voltage status information of the neuron. In this embodiment, there are a total of 1024 16-bit NVRs, numbered v0-v1023, which can store the 16-bit voltage status of 1024 neurons when fully loaded.
[0078] The pulse output register SOR is used to store the pulse output of the neuron. In this embodiment, there are 32 32-bit SORs, numbered o0-o31, which can store the 1-bit pulse output of 1024 neurons when fully loaded.
[0079] The liquid state register NSR is used to store the liquid state information of the neuron, and the stored liquid state information of the neuron is the cumulative value of the number of pulse outputs generated by each neuron. In this embodiment, there are a total of 256 32-bit NSRs, numbered s0-s255, which can store 8-bit liquid state information of 1024 neurons when fully loaded.
[0080] It should be noted that the above six types of extended registers are only examples in this embodiment, and may actually include more status registers of different types and different bit widths depending on the different SNN neuron models.
[0081] In addition, this embodiment also provides a computer device, including a microprocessor and a memory connected to each other, wherein the microprocessor is also connected to a brain-like processor for realizing brain-like computing acceleration, and the brain-like processor is the brain-like processor based on the brain-like instruction set mentioned above.
[0082] In addition, this embodiment also provides an application method of a brain-like processor based on a brain-like instruction set, wherein the instruction prefetch buffer is used to fetch the fields in the instructions of the brain-like instruction set from an external instruction buffer, respectively including:
[0083] Operation code opcode is used to distinguish different types of instructions.
[0084] The index rd operand (op) of the destination register is used to indicate the index of the destination register to which the instruction execution result needs to be written;
[0085] The index of the first source operand rs1 is used to indicate the index of the first source operand required for instruction execution;
[0086] The index of the second source operand rs2 is used to indicate the index of the second source operand required for instruction execution;
[0087] Function field, used to distinguish instructions of different functions in the same type of instructions.
[0088] like Figure 2 As shown, in this embodiment, the instruction prefetch buffer is used to fetch the instruction length of the brain-like instruction set from the external instruction buffer, wherein the operation code opcode occupies the 0th to the 6th bit, the index rd operand (op) of the destination register occupies the 7th to the 11th bit, the function field includes occupying the 12th to the 14th bit and the 25th to the 31st bit, the index rs1 of the first source operand occupies the 15th to the 19th bit, and the index rs2 of the second source operand occupies the 20th to the 24th bit.
[0089] Based on the field structure of the above instruction, the detailed design of the extended register and functional components of the decoding segment in this embodiment is as follows: Figure 3 The main additions are six types of extended registers for storing operands and states of neuron calculations, two vector components for parallel synaptic response calculations of neurons, and an array of 1024 neuron units (NU) for completing the calculation of neuron equations. Figure 3 In the example, rs1, rs2, and rd represent specific fields in the currently executed instruction (divided into Figure 2 ), used to index a register (group); op represents the operand read from a field; w represents the weight; spike represents the input pulse; current represents the current state value of the neuron; voltage represents the voltage state value of the neuron; output s represents the pulse output; liquid s represents the liquid state of the neuron. The backslash number after each signal name represents the bit width of the signal (such as 4*32 means that each operand is 4b, the signal includes 32 operands, and the total bit width is 128b), and the content in brackets after the number represents the situation where this quantity is included.
[0090] The instruction prefetch buffer is used to fetch the instructions of the brain-like instruction set from the external instruction buffer, which may be of various types. For example, the instruction prefetch buffer is used to fetch the instructions of the brain-like instruction set from the external instruction buffer, which are current calculation instructions; the function of the current calculation instruction is to read out the content of the specified weight vector register WVR, the pulse vector register SVR, and the value of the specified current state register NCR, perform the multiplication and accumulation operation of the calculated current, and then write back to update the specified current state register NCR. This type of instruction has the following 4 instructions of different granularity and 2 directions, including:
[0091] The vertical vector multiplication and accumulation calculation instruction convh is described as: convhrd,rs1,rs2
[0092] correspond Figure 2 The instruction format in is as follows:
[0093] 111 0000 SVR WVR 111 rd 111 0111
[0094] The vertical vector multiplication and accumulation calculation instruction convh is used to read out the 32 4-bit weights in a group (4 / group) of weight vector registers WVR indexed by the index rs1 operand value 0-3 stored in the general register indexed by the rs1 field in the instruction, the 32 1-bit pulse sequences in a pulse vector register SVR indexed by the index rs2 operand value 0-31 stored in the general register indexed by the rs2 field, and the current state value in a neuron current state register NCR indexed by the index rd operand (op) stored in the general register indexed by the rd field, perform the vertical vector multiplication and accumulation calculation, and then write it into a neuron current state register NCR indexed by the rd erase even value 0-1023. The parallelism of this instruction is 32 at a time, that is, the input is two groups of operands, each group of 32. Its function expression is:
[0095] NCR[R[rd]][15:0]=NCR[R[rd]][15:0]+((∑(WVR[R[rs1]*4][(i+1)*4-1:i*4]*SVR[R[rs2]][i])+∑(WVR[R[rs 1]*4+1][(i+1)*4-1:i*4]*SVR[R[rs2]][i+8])+∑(WVR[R[rs1]*4+2][(i+1)*4-1:i*4]*SVR[R[rs2]][i+16])+
[0096] ∑(WVR[R[rs1]*4+3][(i+1)*4-1:i*4]*SVR[R[rs2]][i+24]))<<8)
[0097] ∑i=0~7
[0098] In the above formula, NCR represents the current state register, SVR represents the pulse vector register, WVR represents the weight vector register, R represents the corresponding index position to be read, "<<" represents the left shift operator, and [15:0] represents the 0th to 15th bits.
[0099] like Figure 4 As shown in the figure, when the instruction is a longitudinal vector multiplication and accumulation calculation instruction convh in the current calculation class instruction, the execution process of the four pipeline stages includes: in the instruction fetch stage, the longitudinal vector multiplication and accumulation calculation instruction convh is taken out; in the decoding stage, the indexes rs1 operand (op) and rs2 operand (op) of the two source operands are read from the general register GPR according to the result field generated by the instruction decoding, and 32 4-bit weights w and 32 1-bit input pulses spike are read from the weight vector register WVR and the pulse vector register SVR as indexes and sent to the next pipeline stage, and the result field generated by the instruction decoding is read from the general register SVR according to the result field generated by the instruction decoding. The index rd operand (op) of the destination register is read from the GPR of the device, and sent to the current state register NCR to read the value of a current state current and send it to the next pipeline stage; in the execution stage, the 32 weights w and the input pulse spike are placed in the vector calculation unit, the longitudinal vector multiplication and accumulation calculation of the current sum is performed, and the result is accumulated to the read current state current, and then the result is sent to the next pipeline stage; in the write-back stage, the calculation result is written back to the corresponding current state register NCR according to the index rd operand (op) of the destination register to update the value of the current state current of a neuron;
[0100] The vertical vector multiplication and accumulation calculation instruction conva can be described as: convard,rs2
[0101] correspond Figure 2 The instruction format in is as follows:
[0102] 111 0001 SVR 00000 111 rd 111 0111
[0103] The vertical vector multiplication and accumulation calculation instruction convh is used to read out the 128 4-bit weights in all WVRs (a total of 16), the 128 1-bit pulse sequences in a group (4) of SVRs represented by the index rs2 operand value 0-7 stored in the general register indexed by the rs2 field, and the current state value in a neuron current state register NCR indexed by the index rd operand (op) operand value 0-1023 stored in the general register indexed by the rd field, and perform vertical multiplication and accumulation calculations. Finally, write back to a neuron current state register NCR indexed by the rd operand value 0-1023. The parallelism of this instruction is 128 at a time, that is, the input is two groups of operands, each with 128. Its function expression is:
[0104] NCR[R[rd]][15:0]=NCR[R[rd]][15:0]+((∑(WVR[0][(i+1)*4-1:i*4]*SVR[R[rs2]*4][i])+∑(WVR [1][(i+1)*4-1:i*4]*SVR[R[rs2]*4][i+8])+∑(WVR[2][(i+1)*4-1:i*4]*SVR[R[rs2]*4][i+16])+
[0105] ∑(WVR[3][(i+1)*4-1:i*4]*SVR[R[rs2]*4][i+24])
[0106] …
[0107] ∑(WVR
[12] [(i+1)*4-1:i*4]*SVR[rs2*4+3][i])+∑(WVR
[13] [(i+1)*4-1:i*4]*S VR[R[rs2]*4+3][i+8])+∑(WVR
[14] [(i+1)*4-1:i*4]*SVR[R[rs2]*4+3][i+16])+
[0108] ∑(WVR
[15] [(i+1)*4-1:i*4]*SVR[R[rs2]*4+3][i+24]))<<8)
[0109] ∑i=0~7.
[0110] like Figure 5As shown in FIG. 1 , when the instruction is a longitudinal vector multiplication-accumulation calculation instruction conva in the current calculation class instruction, the execution process of the four pipeline stages includes: in the instruction fetch stage, the longitudinal vector multiplication-accumulation calculation instruction conva is fetched; in the decoding stage, the indexes rs1 operand (op) and rs2 operand (op) of the two source operands are read from the general register GPR according to the result field generated by the instruction decoding, and 128 4-bit weights w and 128 1-bit input pulses spike are read from the weight vector register WVR and the pulse vector register SVR as indexes respectively and sent to the next pipeline stage, and the result field generated by the instruction decoding is read from the The index rd operand (op) of the destination register is read from the general register GPR, sent to the current state register NCR to read the value of a current state current and sent to the next pipeline stage; in the execution stage, the 128 weights w and the input pulse spike are placed in the vector calculation unit, the longitudinal vector multiplication and accumulation calculation of the current sum is performed, and the result is accumulated to the read current state current, and then the result is sent to the next pipeline stage; in the write-back stage, the calculation result is written back to the corresponding current state register NCR according to the index rd operand (op) of the destination register to update the current state current of a neuron;
[0111] The horizontal vector dot multiplication and accumulation calculation instruction doth can be described as: doth rd,rs1,rs2
[0112] correspond Figure 2 The instruction format in is as follows:
[0113] 111 0010 SVR[0] WVR 111 rd 111 0111
[0114] The horizontal vector dot multiplication and accumulation calculation instruction doth is used to read out 32 4-bit weights in a group (4 / group) WVR represented by the index rs1 operand value 0-3 stored in the general register indexed by the rs1 field, a 1-bit pulse in the 32-bit pulse stored in the SVR register No. 0 indexed by the index rs2 operand value 0-31 stored in the general register indexed by the rs2 field, and the current state value in a group (32 / group) of neuron current state registers NCR indexed by the index rd operand (op) operand value 0-31 stored in the general register indexed by the rd field, and perform a 1-dimensional horizontal vector dot multiplication and accumulation calculation. And write the result back to a group (32 / group) of neuron current state registers NCR indexed by the rd operand value 0-31 to update the current state of 32 neurons. The parallelism of this instruction is 32.
[0115] Its function expression is:
[0116] NCR[R[rd]*32][15:0]=NCR[rd*32][15:0]+((SVR[0][R[rs2]]*WVR[R[rs1]*4][3:0])<<8)
[0117] NCR[R[rd]*32+1][15:0]=NCR[rd*32+1][15:0]+((SVR[0][R[rs2]]*WVR[R[rs1]*4][7:4])<<8)
[0118] …
[0119] NCR[R[rd]*32+30][15:0]=NCR[rd*32+30][15:0]+((SVR[0][R[rs2]]*WVR[R[rs1]*4+3][27:24])<<8)
[0120] NCR[R[rd]*32+31][15:0]=NCR[rd*32+31][15:0]+((SVR[0][R[rs2]]*WVR[R[rs1]*4+3][31:28])<<8).
[0121] like Figure 6 As shown in the figure, when the instruction is a horizontal vector dot multiplication and accumulation calculation instruction doth in the current calculation class instruction, the execution process of the four pipeline stages includes: in the instruction fetch stage, the horizontal vector dot multiplication and accumulation calculation instruction doth is taken out; in the decoding stage, the indexes rs1 operand (op) and rs2 operand (op) of the two source operands are read from the general register GPR according to the result field generated by the instruction decoding, and 32 weights w and 32 input pulses spike are read from the weight vector register WVR and the pulse vector register SVR as indexes respectively and sent to the next pipeline stage, And according to the result field generated by instruction decoding, the index rd operand (op) of the destination register is read from the general register GPR, sent to the current state register NCR to read the values of 32 current states current and sent to the next pipeline stage; in the execution stage, the 32 weights and input pulses are placed in the vector calculation unit, and the vector dot multiplication and accumulation calculation of the current sum is performed, and then the result is sent to the next stage; the calculation result is written back to the corresponding current state register NCR according to the index rd operand (op) of the destination register to update the current state current of 32 neurons;
[0122] The horizontal vector dot multiplication and accumulation calculation instruction dota can be described as: dotard,rs2
[0123] correspond Figure 2 The instruction format in is as follows:
[0124] 111 0011 SVR[0] 00000 111 rd 111 0111
[0125] The horizontal vector dot multiplication and accumulation calculation instruction dota is used to read out the 128 4-bit weights in all WVRs (a total of 16), the 1-bit pulse in the 32-bit pulse stored in the SVR register No. 0 indexed by the index rs2 operand value 0-31 stored in the general register indexed by the rs2 field, and the current state value in a group (128 / group) of neuron current state registers NCR indexed by the index rd operand (op) operand value 0-7 stored in the general register indexed by the rd field, and perform 1-dimensional horizontal vector dot multiplication and accumulation calculation. And write the result back to a group (128 / group) of neuron current state registers NCR indexed by the rd operand value 0-7 to update the current state of 128 neurons. The parallelism of this instruction is 128 at a time. Its function expression is:
[0126] NCR[R[rd]*128][15:0]=NCR[rd*128][15:0]+((SVR[0][R[rs2]]*WVR[0][3:0])<<8)
[0127] NCR[R[rd]*128+1][15:0]=NCR[rd*128+1][15:0]+((SVR[0][R[rs2]]*WVR[0][7:4])<<8)
[0128] …
[0129] NCR[R[rd]*128+126][15:0]=NCR[rd*128+126][15:0]+((SVR[0][R[rs2]]*WVR
[15] [27:24])<<8)
[0130] NCR[R[rd]*128+127][15:0]=NCR[rd*128+127][15:0]+((SVR[0][R[rs2]]*WVR
[15] [31:28])<<8).
[0131] like Figure 7As shown in the figure, when the instruction is a horizontal vector dot multiplication and accumulation calculation instruction dota in the current calculation class instruction, the execution process of the four pipeline stages includes: in the instruction fetch stage, the horizontal vector dot multiplication and accumulation calculation instruction doth is taken out; in the decoding stage, the indexes rs1 operand (op) and rs2 operand (op) of the two source operands are read from the general register GPR according to the result field generated by the instruction decoding, and 128 weights w and 128 input pulses spike are read from the weight vector register WVR and the pulse vector register SVR respectively as indexes and sent to the next pipeline stage, and according to the instruction The result field generated by the decoding is read from the general register GPR, the index rd operand (op) of the destination register, and sent to the current state register NCR to read the values of 128 current states current and send to the next pipeline stage; in the execution stage, the 128 weights w and the input pulse spike are placed in the vector calculation unit, and the vector dot multiplication and accumulation calculation of the current sum is performed, and then the result is sent to the next stage; the calculation result is written back to the corresponding current state register NCR according to the index rd operand (op) of the destination register to update the current state current of the 128 neurons.
[0132] In addition, the instruction prefetch buffer is used to fetch the instructions of the brain-like instruction set from the external instruction buffer. It can also be a state update instruction. The function of the state update instruction is to read out the current, voltage and liquid state in the specified current state register NCR, voltage state register NVR, and liquid state register NSR, and perform current leakage, voltage leakage, voltage update, threshold comparison, pulse generation, state reset, liquid state update and other operations according to the neuron formula, and then write the updated current, voltage, liquid state and pulse output back to update the specified current state register NCR, voltage state register NVR, liquid state register NSR and pulse output register SOR. State update instruction This type of instruction has the following two instructions of different granularity, including:
[0133] The status update instruction upds can be described as: updsrd
[0134] correspond Figure 2 The instruction format in is as follows:
[0135] 111 0100 00000 00000 111 rd 111 0111
[0136] The status update instruction upds is used
[0137] NVR[R[rd]][15:0].update_operation
[0138] NCR[R[rd]][15:0].update_operation
[0139]
[0140]
[0141] Among them, "update_operation" represents the update operation.
[0142] The state update instruction upds is used to execute the state update of a neuron indexed by the index rd operand (op) operand value 0-1023 stored in the general register indexed by the rd field. First, read out the values of a certain 8 bits (representing the liquid state of a neuron), 1 NCR, and NVR in the NSR indexed by the index rd operand (op) operand value 0-1023 stored in the general register indexed by the rd field. Then, perform leakage current calculation, voltage generation calculation, threshold comparison and pulse generation calculation of current and voltage, and write the pulse output result back to the 1-bit position in the SOR indexed by the rd operand value 0-1023. At the same time, update the values of a certain 8 bits, 1 NCR, NVR, and NSR in the NSR indexed by the rd operand value 0-1023.
[0143] like Figure 8 As shown, when the instruction is a state update instruction upds in the state update class instruction, the execution process of the four pipeline stages includes: in the instruction fetch stage, the state update instruction upds is taken out; in the decoding stage, the index rd operand (op) of the destination register is read from the general register GPR according to the result field generated by the instruction decoding, and the current, voltage, and liquid state value of one neuron are read from the current state register NCR, the voltage state register NVR, and the liquid state register NSR respectively and sent to the next pipeline stage; in the execution stage, according to the preset neuron calculation method, the current, voltage, liquid state update value of one neuron and its pulse output are calculated and sent to the next pipeline stage; in the write-back stage, according to the result field generated by the instruction decoding, the index rd operand (op) of the destination register is read from the general register GPR, and written back to the current state register NCR, the voltage state register NVR, the liquid state register NSR, and the pulse output register SOR respectively, so as to update the current, voltage, liquid state value and pulse output of one neuron;
[0144] The status update instruction updg can be described as: updgrd
[0145] correspond Figure 2 The instruction format in is as follows:
[0146] 111 0101 00000 base 111 rd 111 0111
[0147] The status update command updg is used
[0148] NVR[R[rd]*32][15:0]~NVR[R[rd]*32+31][15:0].update_operation
[0149] NCR[R[rd]*32][15:0]~NCR[R[rd]*32+31][15:0].update_operation
[0150] NSR[R[rd]*8][31:0]~NSR[R[rd]*8+7][31:0].update_operation
[0151] SOR[R[rd]][31:0].update_operation
[0152] The state update instruction updg is used to execute the state update of a group (32 / group) of neurons indexed by the index rd operand (op) operand value 0-31 stored in the general register indexed by the rd field (read out the values of a group of NCR (32 / group), NVR (32 / group), and NSR (8 / group) indexed by the rd operand value 0-31, perform leakage current calculation, voltage generation calculation, threshold comparison and pulse generation calculation of current and voltage, and write the pulse output result back to a SOR indexed by the rd operand value 0-31, and at the same time update the values of a group of NCR, NVR, and NSR indexed by the rd operand value 0-31.
[0153] like Fig. 9 As shown, when the instruction is a state update instruction updg in the state update class instruction, the execution process of the four pipeline stages includes: in the instruction fetch stage, the state update instruction updg is taken out; in the decoding stage, the index rd operand (op) of the destination register is read from the general register GPR according to the result field generated by the instruction decoding, and the current, voltage, and liquid state values of 32 neurons are read from the current state register NCR, the voltage state register NVR, and the liquid state register NSR respectively and sent to the next pipeline stage; in the execution stage, according to the preset neuron calculation method, the current, voltage, liquid state update values of 32 neurons and their pulse output are calculated and sent to the next pipeline stage; in the write-back stage, according to the result field generated by the instruction decoding, the index rd operand (op) of the destination register is read from the general register GPR, and written back to the current state register NCR, the voltage state register NVR, the liquid state register NSR, and the pulse output register SOR respectively, so as to update the current, voltage, liquid state values and pulse output of the 32 neurons.
[0154] The calculation of the neuron calculation method is based on the equation of "integrate-leaky-fire (LIF)". As an optional implementation, the calculation steps of the neuron calculation method preset in this embodiment include:
[0155] S1) respectively read out the single neuron current I from the current state register NCR, the single neuron voltage V from the voltage state register NVR, and the single neuron liquid state S from the liquid state register NSR; initialize and set the activation neuron threshold voltage Vthreshold_excited, the inhibition neuron threshold voltage Vthreshold_inhibit, the activation neuron refractory period threshold (Trefractory_period_excited) and the inhibition neuron refractory period threshold (Trefractory_period_inhibit);
[0156] Specifically, the above initialization setting examples in this embodiment are as follows:
[0157] Vthreshold_excited = 10240 / / Threshold voltage for activating neurons
[0158] Vthreshold_inhibit = 12288 / / Inhibit neuron threshold voltage
[0159] Trefractory_period_excited = 50 / / Activate neuron refractory period threshold
[0160] Trefractory_period_inhibit = 20 / / Inhibit neuron refractory period threshold
[0161] S2) Initialize the refractory period variable period. If the current neuron type is an activation neuron, jump to step S3); if the current neuron type is an inhibition neuron, jump to step S7);
[0162] S3) calculating the current leakage variable rnd_I according to rnd_I=I>>2, where I is the current of a single neuron, ">>" is a right shift operation, and calculating the neuron current update value I' according to I'=I-(rnd_I>>3);
[0163] S4) determining whether the refractory period variable period is greater than or equal to the refractory period threshold value of the activated neuron; if not, determining that the neuron is within the refractory period, adding 1 to the refractory period variable period, and ending and exiting; otherwise, jumping to the next step;
[0164] S5) calculating the voltage leakage variable rnd_V according to rnd_V=V>>4, where I is the current of a single neuron, and calculating the updated voltage value V′ of the neuron according to V′=V-(rnd_V>>3)+(I>>3);
[0165] S6) Determine whether the updated neuron voltage value V' is greater than the threshold voltage Vthreshold_excited for activating the neuron. If so, generate a pulse output O, assign the updated neuron liquid state value S' to the neuron liquid state S plus 1, reset the updated neuron current value I' to 0, reset the updated neuron voltage value V' to 0, reset the current leakage variable rnd_I to 0, reset the voltage leakage variable rnd_V to 0, and set the refractory period variable period to 0; if not, end and exit;
[0166] S7) calculating the current leakage variable rnd_I according to rnd_I=I>>2, where I is the current of a single neuron, ">>" is a right shift operation, and calculating the neuron current update value I' according to I'=I-(rnd_I>>3);
[0167] S8) determining whether the refractory period variable period is greater than or equal to the refractory period threshold value of the inhibitory neuron; if not, determining that the neuron is within the refractory period, adding 1 to the refractory period variable period, and ending and exiting; otherwise, jumping to the next step;
[0168] S9) calculating the voltage leakage variable rnd_V according to rnd_V=V>>4, where I is the current of a single neuron, and calculating the updated voltage value V′ of the neuron according to V′=V-(rnd_V>>3)+(I>>3);
[0169] S10) Determine whether the updated voltage value V′ of the neuron is greater than the threshold voltage Vthreshold_inhibit of the inhibitory neuron. If so, generate a pulse output O, assign the updated value S′ of the neuron liquid state to the neuron liquid state S plus 1, reset the updated current value I′ of the neuron to 0, reset the updated voltage value V′ of the neuron to 0, reset the current leakage variable rnd_I to 0, reset the voltage leakage variable rnd_V to 0, and set the refractory period variable period to 0. If not, end and exit.
[0170] In addition, the instruction prefetch buffer is used to fetch the brain-like instruction set instructions from the external instruction buffer, and can also be a pulse transmission instruction. The function of the pulse transmission instruction is to read the pulse output content in the specified SOR and write it into the specified SVR as an input pulse sequence. This type of instruction has the following two instructions of different granularity, including:
[0171] The pulse transfer instruction movg can be described as: movgrd
[0172] correspond Figure 2 The instruction format in is as follows:
[0173] 111 0111 00000 00000 111 rd 111 0111
[0174] The pulse transfer instruction movg is used to decode the instruction to generate rd, read the rd operand value 0-31 index of a pulse output register SOR (32bit), and execute and copy the content to a pulse vector register SVR indexed by the rd operand value 0-31. Its function expression is:
[0175] SVR[R[rd]][31:0]=SOR[R[rd]][31:0]
[0176] like Fig.10 As shown in the figure, when the instruction is a pulse transmission instruction movg in the pulse transmission class instruction, the execution process of the four pipeline stages includes: in the instruction fetch stage, the pulse transmission instruction movg is fetched; in the decoding stage, the index rd operand (op) of the destination register is read from the general register GPR according to the result field generated by the instruction decoding, and 32 pulses are read from the pulse output register SOR to output the next pipeline stage; in the execution stage, the pulse is directly transferred and sent to the next pipeline stage; in the write-back stage, the index rd operand (op) of the destination register is read from the general register GPR according to the result field generated by the instruction decoding, and written back to the pulse vector register SVR for use as the pulse input of the next time step;
[0177] The pulse transmission instruction mova can be described as: mova
[0178] correspond Figure 2 The instruction format in is as follows:
[0179] 111 1000 00000 00000 111 rd 111 0111
[0180] The pulse transmission instruction mova is used to copy the contents of all pulse output registers SOR to the pulse vector register SVR. Its function expression is:
[0181] SVR=SOR
[0182] like Fig.11As shown, when the instruction is the pulse transmission instruction mova in the pulse transmission class instruction, the execution process of the four pipeline stages includes: in the instruction fetch stage, the pulse transmission instruction mova is taken out; in the decoding stage, the index rd operand (op) of the destination register is read from the general register GPR according to the result field generated by the instruction decoding, and 1024 pulses are read from the pulse output register SOR to output the next pipeline stage; in the execution stage, the pulse is directly transferred and sent to the next pipeline stage; in the write-back stage, the index rd operand (op) of the destination register is read from the general register GPR according to the result field generated by the instruction decoding, and written back to the pulse vector register SVR for use as the pulse input of the next time step.
[0183] The RISC-V instruction set has a modular feature, and its instruction set includes two categories: a basic instruction set and an extended instruction set. RISC-V is defined as a combination of a basic instruction set and several optional extended instruction sets, and works in a privileged mode. The extended instruction set of RISC-V is used to provide functional operation instructions in specific aspects for ISA. An ISA can choose to join multiple extended instruction sets. In order to enable multiple instruction sets to coexist, the encoding space of each instruction set is divided according to the encoding requirements of the RISC-V International Foundation (RVI). The basic instruction set of RISC-V contains a minimum set of instructions that can provide necessary functions for compilers, assemblers, linkers, operating systems, etc. The general instruction part of the method in this embodiment is implemented using RV32IMCA. In addition to basic integer operations, there are three extensions of multiplication and division, compression instructions, and atomic operation instructions to support general computing functions.
[0184] This embodiment can well solve the problems of poor programmability, poor portability and incompatibility of brain-like hardware for the following reasons:
[0185] First, this embodiment proposes an instruction set architecture, which can effectively compress the length of the code and reduce the difficulty of programming from the perspective of software. From the perspective of hardware, the micro-architecture design can support the corresponding new instructions, add necessary registers, and provide necessary data paths, thereby improving the execution efficiency of instructions. Therefore, extending new instructions is a good way to improve the efficiency of processors in executing specific applications such as SNN. From the history of the x86 instruction set, since the MMX instruction extension was proposed in 1996, new extensions have been continuously introduced to improve the execution efficiency of applications. The proposal of this patent can realize the decoupling and independent development of brain-like software and brain-like hardware, and provide opportunities for the good development of brain-like ecology. From the history of computer development, the success of the cases of the proposal, development, and extension of the x86 and ARM instruction set architectures shows that this is very important.
[0186] Second, this embodiment has a higher degree of parallelism. Since a smaller operand data bit width is used, the extended brain-like computing instructions can obtain a higher degree of parallelism when the same number of registers is used, thereby completing the calculation faster.
[0187] Third, this embodiment can achieve memory access and computing support for brain-like applications of different magnitudes and SNNs of different scales. The amount of computation of SNN is related to the specific application, and the amount of data has a large span from sparse to dense. The structure of SNN is complex and irregular, and the pulse sequence is sparse and irregular. The use of memory access instructions of different granularities and computing instructions of different granularities and directions provides a broad space for compilation tools to discover the use of sparsity for acceleration, so that sparse networks and sparsity in input data can be fully developed and utilized at the compiler level and the application level to achieve acceleration. At the same time, hardware neurons are used on demand in small-scale networks to achieve energy saving, and the high throughput requirements and high parallel computing requirements for dense networks and data inputs can also be met. In this way, sparse development and parallel computing are taken into account, and the range of applications that can be supported is also wider.
[0188] Fourth, this embodiment can support different neuron models. With the deepening of computational neuroscience research, the academic community's understanding and abstraction of neuron behavior and brain operation rules will be further improved, and the neuron computing model will evolve in a more sophisticated and complex direction to continuously approach the real biological brain. By using a combination of different functional computing instructions, a more complex model can be implemented to support this evolution trend.
[0189] In summary, extending instructions for specific functions based on a unified ISA can realize and accelerate the functions required by emerging applications. This is also the common practice and one of the sources of strong vitality of mature ISAs such as x86 and ARM. By abstracting the underlying brain-like computing hardware by extending the brain-like instruction set, many opportunities can be provided for the compilation optimization of brain-like algorithm programs. That is, from the application layer and assembly layer, the high parallel execution of brain-like algorithm programs and the development and utilization of the sparsity of data flow and network structure provide optimization space, rather than just implementing these things at the hardware layer. This makes it possible to utilize more levels, dimensions, and granularity of development parallelism and sparsity, and provides a foundation and convenience for further improving the execution speed and hardware utilization of SNN algorithms and brain-like applications, and reducing the difficulty of programming and the threshold of hardware use. The brain-like processor implemented based on RISC-V can seamlessly write programs that tightly couple general computing, brain-like computing, and deep learning to complete specific cognitive tasks because it tightly couples brain-like computing and general computing. By providing a good software-hardware interaction interface for the brain-like instruction set, the way of using brain-like processors can be changed. Instead of dividing the computational graph into blocks and then mapping them to the brain-like processor, the computational graph can be directly compiled into instructions for the brain-like processor and executed on the brain-like processor, which leaves room for development of compilation optimization, lowers the threshold for application development of brain-like processors, and lays the foundation for the development of the future brain-like ecosystem. Brain-like processors can be applied in fields such as brain-computer interface signal processing, trajectory prediction, target tracking, high-frequency arc discharge, wind tunnel observation, etc., showing energy efficiency advantages that surpass deep learning accelerators.
[0190] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may take the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes. The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, may be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the functions in the process. Figure 1 A process or multiple processes and / or boxes Figure 1These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specified manner, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0191] The above is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should also be regarded as the protection scope of the present invention.
Claims
1. A brain-like processor based on a brain-like instruction set, the brain-like processor comprising one or more brain-like processor cores, characterized in that: The brain-like processor core includes four pipeline segments, namely, an instruction fetch segment, a decoding segment, an execution segment and a write-back segment, and a pipeline stack IF / ID is provided between the instruction fetch segment and the decoding segment, a pipeline stack ID / EXE is provided between the decoding segment and the execution segment, and a pipeline stack EXE / WB is provided between the execution segment and the write-back segment; The instruction fetching section includes an instruction prefetching buffer and a controller. The instruction prefetching buffer is used to fetch the instructions of the brain-like instruction set from the external instruction buffer and cache them in the pipeline stack IF / ID. The controller is used to determine the address of the instruction prefetching according to the specified result of the execution of the execution section to control the instruction prefetching buffer. If the specified result is sequential execution, the instruction is fetched according to the sequential address. If the specified result is a jump, the instruction is transferred to the target address for fetching. The decoding section includes a decoder, a general register GPR, an extension register, and one or more multiplexers. The decoder is used to translate the register index values stored in different fields of the instruction flowing out of the pipeline stack IF / ID and send them to the register group storing the operands, specifically the general register GPR or the extension register. The one or more multiplexers are used to select the operands of the specified source to be cached in the pipeline stack ID / EXE according to the results of different instruction decoding to participate in the next pipeline section to perform calculations; The execution segment includes a request queue, a memory access unit, an arithmetic logic unit ALU, a multiplier / divider, a control status register, a vector calculation unit, a neuron array, and a multiplexer. The request queue is used to perform data interaction with the memory, and the memory access unit is used to process the request queue for reading and writing memory proposed by the instruction, and perform memory access read and write operations on the memory through the data buffer cache; the arithmetic logic unit ALU is responsible for performing general calculations, including addition, subtraction, logical AND and logical OR; the multiplier / divider is used to perform multiplication and division operations, and the control status register is used to store control-related signals, including interrupts and exceptions; the vector calculation unit is used to perform neuron synaptic reaction operations of the pulse neural network SNN; the neuron array is used to complete the operation function of the neuron model equation; the multiplexer is used to select the calculation results or memory access results of the specified source according to different instructions and cache them in the pipeline stack EXE / WB to enter the next pipeline segment; The write-back segment includes a data buffer and a data path. The data buffer is used to receive data transmitted by a write memory request from a memory access unit or to respond to a read request issued by the memory access unit and return the requested number; the data path is used to write the result calculated by the execution segment or the read-back number back to the register specified by the decoding segment.
2. The brain-inspired processor based on the brain-inspired instruction set according to claim 1, characterized in that: The instruction fetch segment also includes a debugger, which is connected to an external adjustment interface and a controller of the instruction fetch segment and is used to debug and control the controller via the external debugging interface in a debugging mode.
3. The brain-inspired processor based on the brain-inspired instruction set according to claim 1, characterized in that: The extended registers of the decoding segment include part or all of the following registers: The weight vector register WVR is used to store the fan-in weight of the neuron; The pulse vector register SVR is used to store the pulse input sequence; The current status register NCR is used to store the current status information of the neuron; The voltage status register NVR is used to store the voltage status information of the neuron; The pulse output register SOR is used to store the pulse output of the neuron; The liquid state register NSR is used to store the liquid state information of the neuron, and the stored liquid state information of the neuron is the cumulative value of the number of pulse outputs generated by each neuron.
4. A computer device comprising a microprocessor and a memory connected to each other, characterized in that: The microprocessor is also connected to a brain-inspired processor for realizing brain-inspired computing acceleration, and the brain-inspired processor is a brain-inspired processor based on a brain-inspired instruction set as described in any one of claims 1 to 3.
5. An application method of a brain-inspired processor based on a brain-inspired instruction set as claimed in any one of claims 1 to 3, characterized in that: The instruction prefetch buffer is used to fetch the fields in the instructions of the brain-like instruction set from the external instruction buffer, respectively including: Operation code opcode is used to distinguish different types of instructions. The index rd of the destination register is used to indicate the index of the destination register to which the instruction execution result needs to be written; The index of the first source operand rs1 is used to indicate the index of the first source operand required for instruction execution; The index of the second source operand rs2 is used to indicate the index of the second source operand required for instruction execution; Function field, used to distinguish instructions of different functions in the same type of instructions.
6. The application method of the brain-inspired processor based on the brain-inspired instruction set according to claim 5, characterized in that: The instruction prefetch buffer is used to fetch instructions of the brain-like instruction set from an external instruction buffer. The instruction length is 32 bits, wherein the operation code opcode occupies the 0th to the 6th bits, the index rd of the destination register occupies the 7th to the 11th bits, the function field occupies the 12th to the 14th bits and the 25th to the 31st bits, the index rs1 of the first source operand occupies the 15th to the 19th bits, and the index rs2 of the second source operand occupies the 20th to the 24th bits.
7. The application method of the brain-inspired processor based on the brain-inspired instruction set according to claim 5, characterized in that: The instruction pre-fetch buffer is used to fetch the instructions of the brain-like instruction set from the external instruction buffer, which are current calculation instructions; When the instruction is a longitudinal vector multiplication and accumulation calculation instruction convh in the current calculation class instruction, the execution process of the four pipeline stages includes: in the instruction fetch stage, the longitudinal vector multiplication and accumulation calculation instruction convh is taken out; in the decoding stage, the indexes rs1 operand and rs2 operand of the two source operands are read from the general register GPR according to the result field generated by the instruction decoding, and 32 4-bit weights w and 32 1-bit input pulses spike are read from the weight vector register WVR and the pulse vector register SVR as indexes and sent to the next pipeline stage, and the result field generated by the instruction decoding is read from the general register The index rd operand of the destination register is read from the GPR, and sent to the current state register NCR to read the value of a current state current and send it to the next pipeline stage; in the execution stage, the 32 weights w and the input pulse spike are placed in the vector calculation unit, the longitudinal vector multiplication and accumulation calculation of the current sum is performed, and the result is accumulated to the read current state current, and then the result is sent to the next pipeline stage; in the write-back stage, the calculation result is written back to the corresponding current state register NCR according to the index rd operand of the destination register to update the value of the current state current of a neuron; When the instruction is a longitudinal vector multiplication and accumulation calculation instruction conva in the current calculation class instruction, the execution process of the four pipeline stages includes: in the instruction fetch stage, the longitudinal vector multiplication and accumulation calculation instruction conva is taken out; in the decoding stage, the indexes rs1 operand and rs2 operand of the two source operands are read from the general register GPR according to the result field generated by the instruction decoding, and 128 4-bit weights w and 128 1-bit input pulses spike are read from the weight vector register WVR and the pulse vector register SVR as indexes respectively and sent to the next pipeline stage, and the result field generated by the instruction decoding is read from the pass vector register SVR according to the result field generated by the instruction decoding. Use the index rd operand of the destination register in the register GPR, send it to the current state register NCR to read the value of a current state current and send it to the next pipeline stage; in the execution stage, put the 128 weights w and the input pulse spike into the vector calculation unit, perform the longitudinal vector multiplication and accumulation calculation of the current sum, and add the result to the read current state current, and then send the result to the next pipeline stage; in the write-back stage, write the calculation result back to the corresponding current state register NCR according to the index rd operand of the destination register to update the current state current of a neuron; When the instruction is a horizontal vector dot multiplication and accumulation calculation instruction doth in the current calculation class, the execution process of the four pipeline stages includes: in the instruction fetch stage, the horizontal vector dot multiplication and accumulation calculation instruction doth is taken out; in the decoding stage, the index rs1 operand and rs2 operand of the two source operands are read from the general register GPR according to the result field generated by the instruction decoding, and 32 weights w and 32 input pulses spike are read from the weight vector register WVR and the pulse vector register SVR as indexes and sent to the next pipeline stage, and the index rd operand of the destination register is read from the general register GPR according to the result field generated by the instruction decoding, and sent to the current state register NCR to read the values of 32 current states current and send to the next pipeline stage; in the execution stage, the 32 weights and input pulses are placed in the vector calculation unit, the vector dot multiplication and accumulation calculation of the current sum is performed, and then the result is sent to the next stage; the calculation result is written back to the corresponding current state register NCR according to the index rd operand of the destination register to update the current state current of 32 neurons; When the instruction is a horizontal vector dot multiplication and accumulation calculation instruction dota in the current calculation class, the execution process of the four pipeline stages includes: in the instruction fetch stage, the horizontal vector dot multiplication and accumulation calculation instruction doth is taken out; in the decoding stage, the indexes rs1 operand and rs2 operand of the two source operands are read from the general register GPR according to the result field generated by the instruction decoding, and 128 weights w and 128 input pulses spike are read from the weight vector register WVR and the pulse vector register SVR as indexes respectively and sent to the next pipeline stage, and according to the instruction The result field generated by decoding reads the index rd operand of the destination register from the general register GPR, sends it to the current state register NCR to read the values of 128 current states current and sends it to the next pipeline stage; in the execution stage, the 128 weights w and the input pulse spike are placed in the vector calculation unit, and the vector dot multiplication and accumulation calculation of the current sum is performed, and then the result is sent to the next stage; the calculation result is written back to the corresponding current state register NCR according to the index rd operand of the destination register to update the current state current of the 128 neurons.
8. The application method of the brain-inspired processor based on the brain-inspired instruction set according to claim 5, characterized in that: The instruction pre-fetch buffer is used to fetch the instructions of the brain-like instruction set from the external instruction buffer as state update instructions; When the instruction is a state update instruction upds in the state update type instruction, the execution process of the four pipeline stages includes: in the instruction fetch stage, the state update instruction upds is taken out; in the decoding stage, the index rd operand of the destination register is read from the general register GPR according to the result field generated by the instruction decoding, and the current, voltage, and liquid state value of one neuron are read from the current state register NCR, the voltage state register NVR, and the liquid state register NSR respectively and sent to the next pipeline stage; in the execution stage, according to the preset neuron calculation method, the current, voltage, liquid state update value and pulse output of one neuron are calculated and sent to the next pipeline stage; in the write-back stage, according to the result field generated by the instruction decoding, the index rd operand of the destination register is read from the general register GPR, and written back to the current state register NCR, the voltage state register NVR, the liquid state register NSR, and the pulse output register SOR respectively, so as to update the current, voltage, liquid state value and pulse output of one neuron; When the instruction is a state update instruction updg in the state update type instruction, the execution process of the four pipeline stages includes: in the instruction fetch stage, the state update instruction updg is taken out; in the decoding stage, the index rd operand of the destination register is read from the general register GPR according to the result field generated by the instruction decoding, and the current, voltage, and liquid state values of 32 neurons are read from the current state register NCR, the voltage state register NVR, and the liquid state register NSR respectively and sent to the next pipeline stage; in the execution stage, according to the preset neuron calculation method, the current, voltage, liquid state update values of 32 neurons and their pulse output are calculated and sent to the next pipeline stage; in the write-back stage, according to the result field generated by the instruction decoding, the index rd operand of the destination register is read from the general register GPR, and written back to the current state register NCR, the voltage state register NVR, the liquid state register NSR, and the pulse output register SOR respectively to update the current, voltage, liquid state values and pulse output of the 32 neurons.
9. The application method of the brain-inspired processor based on the brain-inspired instruction set according to claim 8, characterized in that: The calculation steps of the preset neuron calculation method include: S1) respectively read out the single neuron current I from the current state register NCR, the single neuron voltage V from the voltage state register NVR, and the single neuron liquid state S from the liquid state register NSR; initialize and set the activation neuron threshold voltage Vthreshold_excited, the inhibition neuron threshold voltage Vthreshold_inhibit, the activation neuron refractory period threshold and the inhibition neuron refractory period threshold; S2) Initialize the refractory period variable period. If the current neuron type is an activation neuron, jump to step S3); if the current neuron type is an inhibition neuron, jump to step S7); S3) calculating the current leakage variable rnd_I according to rnd_I=I>>2, where I is the current of a single neuron, ">>" is a right shift operation, and calculating the neuron current update value I' according to I'=I-(rnd_I>>3); S4) determining whether the refractory period variable period is greater than or equal to the refractory period threshold value of the activated neuron; if not, determining that the neuron is within the refractory period, adding 1 to the refractory period variable period, and ending and exiting; otherwise, jumping to the next step; S5) calculating the voltage leakage variable rnd_V according to rnd_V=V>>4, where I is the current of a single neuron, and calculating the updated voltage value V′ of the neuron according to V′=V-(rnd_V>>3)+(I>>3); S6) Determine whether the updated neuron voltage value V' is greater than the threshold voltage Vthreshold_excited for activating the neuron. If so, generate a pulse output O, assign the updated neuron liquid state value S' to the neuron liquid state S plus 1, reset the updated neuron current value I' to 0, reset the updated neuron voltage value V' to 0, reset the current leakage variable rnd_I to 0, reset the voltage leakage variable rnd_V to 0, and set the refractory period variable period to 0; if not, end and exit; S7) calculating the current leakage variable rnd_I according to rnd_I=I>>2, where I is the current of a single neuron, ">>" is a right shift operation, and calculating the neuron current update value I' according to I'=I-(rnd_I>>3); S8) determining whether the refractory period variable period is greater than or equal to the refractory period threshold value of the inhibitory neuron; if not, determining that the neuron is within the refractory period, adding 1 to the refractory period variable period, and ending and exiting; otherwise, jumping to the next step; S9) calculating the voltage leakage variable rnd_V according to rnd_V=V>>4, where I is the current of a single neuron, and calculating the updated voltage value V′ of the neuron according to V′=V-(rnd_V>>3)+(I>>3); S10) Determine whether the updated voltage value V′ of the neuron is greater than the threshold voltage Vthreshold_inhibit of the inhibitory neuron. If so, generate a pulse output O, assign the updated value S′ of the neuron liquid state to the neuron liquid state S plus 1, reset the updated current value I′ of the neuron to 0, reset the updated voltage value V′ of the neuron to 0, reset the current leakage variable rnd_I to 0, reset the voltage leakage variable rnd_V to 0, and set the refractory period variable period to 0. If not, end and exit.
10. The application method of the brain-inspired processor based on the brain-inspired instruction set according to claim 5, characterized in that: The instruction pre-fetch buffer is used to fetch the instructions of the brain-like instruction set from the external instruction buffer, which are pulse transmission type instructions; When the instruction is a pulse transmission instruction movg in the pulse transmission class, the execution process of the four pipeline stages includes: in the instruction fetch stage, the pulse transmission instruction movg is fetched; in the decoding stage, the index rd operand of the destination register is read from the general register GPR according to the result field generated by the instruction decoding, and 32 pulses are read from the pulse output register SOR to output the next pipeline stage; in the execution stage, the pulse is directly transferred and sent to the next pipeline stage; in the write-back stage, the index rd operand of the destination register is read from the general register GPR according to the result field generated by the instruction decoding, and written back to the pulse vector register SVR for use as the pulse input of the next time step; When the instruction is the pulse transmission instruction mova in the pulse transmission type instruction, the execution process of the four pipeline stages includes: in the instruction fetch stage, the pulse transmission instruction mova is taken out; in the decoding stage, the index rd operand of the destination register is read from the general register GPR according to the result field generated by the instruction decoding, and 1024 pulses are read from the pulse output register SOR to output the next pipeline stage; in the execution stage, the pulse is directly transferred and sent to the next pipeline stage; in the write back stage, the index rd operand of the destination register is read from the general register GPR according to the result field generated by the instruction decoding, and written back to the pulse vector register SVR for use as the pulse input of the next time step.
