Control method, device, equipment, chip and storage medium of DDR equipment

文档序号:923746 发布日期:2021-03-02 浏览:4次 中文

阅读说明:本技术 Ddr设备的控制方法、装置、设备、芯片及存储介质 (Control method, device, equipment, chip and storage medium of DDR equipment ) 是由 郝鑫 邓思华 薛文良 于 2020-07-10 设计创作,主要内容包括:本发明提供一种DDR设备的控制方法、装置以计算机可读存储介质,其中,DDR设备的控制方法包括步骤:获取DDR设备中DDR控制器的第一时钟频率和DDR控制器对应总线的第二时钟频率;计算DDR设备对应每一任务指令间的延时时间,比较计算所得的各个延时时间得到最大延时时间,DDR设备对应任务的数量为DDR设备所能同时处理的最大数量;将第二时钟频率除以第一时钟频率得到的频率比值乘以最大延时时间得到缓冲器的深度值,并将深度值配置给DDR设备。本发明避免了缓冲器的深度值过大导致缓冲器对应芯片面积的浪费和成本的增加,也避免了缓冲器的深度值过小导致总线的拥堵,提高了DDR设备所在计算机系统的运行效率。(The invention provides a control method and a device of DDR equipment and a computer readable storage medium, wherein the control method of the DDR equipment comprises the following steps: acquiring a first clock frequency of a DDR controller in the DDR equipment and a second clock frequency of a bus corresponding to the DDR controller; calculating the delay time between each task instruction corresponding to the DDR equipment, and comparing the calculated delay time to obtain the maximum delay time, wherein the number of the tasks corresponding to the DDR equipment is the maximum number which can be processed by the DDR equipment at the same time; and multiplying the frequency ratio obtained by dividing the second clock frequency by the first clock frequency by the maximum delay time to obtain the depth value of the buffer, and configuring the depth value to the DDR equipment. The method avoids the waste of the area of the corresponding chip of the buffer and the increase of the cost caused by the overlarge depth value of the buffer, also avoids the bus congestion caused by the overlarge depth value of the buffer, and improves the operation efficiency of a computer system in which the DDR equipment is positioned.)

1. A control method of a DDR device is characterized by comprising the following steps:

s100, acquiring a first clock frequency of a DDR controller in the DDR equipment and a second clock frequency of a bus corresponding to the DDR controller;

s200, calculating delay time between each task instruction corresponding to the DDR equipment, and comparing the calculated delay time to obtain the maximum delay time in each delay time, wherein the number of tasks corresponding to the DDR equipment is the maximum number of tasks which can be processed by the DDR equipment at the same time;

and S300, dividing the second clock frequency by the first clock frequency to obtain a frequency ratio, multiplying the frequency ratio by the maximum delay time to obtain a depth value of a buffer, and configuring the depth value to the DDR equipment.

2. The method for controlling the DDR device of claim 1, wherein the step S200 comprises:

s210, sequentially determining tasks corresponding to the DDR equipment as target tasks, calculating delay time between adjacent instructions corresponding to the target tasks, and judging whether the delay time of the instructions corresponding to the target tasks is calculated;

s220, if the delay time of the instruction corresponding to the target task is calculated, continuing to calculate the delay time between adjacent instructions corresponding to the next target task until the delay time between the adjacent instructions corresponding to all the target tasks is calculated, and obtaining the delay time corresponding to each task;

and S230, comparing the delay time corresponding to each task, and determining the maximum value in the delay time corresponding to each task as the maximum delay time.

3. The method for controlling a DDR device of claim 2, wherein in step S210, the step of calculating the delay time between adjacent instructions corresponding to the target task comprises:

s211, judging the command types existing in the adjacent commands of the target task, wherein each command at least corresponds to one command: if the adjacent instructions of the target task only have the same kind of commands, executing step S212; if the adjacent instructions of the target task only have different types of commands, executing step S213; if the adjacent instructions of the target task have the same kind of commands and different kinds of commands, executing step S214;

s212, determining target commands with long processing time in the same type of commands, and adding the processing time of each target command to obtain the delay time between adjacent instructions of the target task;

s213, adding the processing time of various commands to obtain the delay time between adjacent instructions of the target task;

s214, determining a target command with long processing time in the same type of command, and adding the processing time of the target command and the processing time of different types of commands to obtain the delay time between adjacent instructions of the target task.

4. The method for controlling a DDR device according to claim 1, wherein in step S200, the step of calculating the delay time between each task instruction corresponding to the DDR device comprises:

s201, acquiring charging preparation time, charging processing time, self-refreshing processing time and activation processing time of each task instruction corresponding to the DDR equipment;

s202, correspondingly calculating the delay time between each task instruction according to the charging preparation time, the charging processing time, the self-refreshing processing time and the activation processing time;

the calculation formula for correspondingly calculating the delay time between each task instruction according to the charging preparation time, the charging processing time, the self-refreshing processing time and the activation processing time is as follows:

tDELY=tRAS+tRP+tRFC+tRCD;

the tDELY represents a delay time, the tRAS represents a charge preparation time, the tRP represents a charge processing time, the tRFC represents a self-refresh processing time, and the tRCD represents an activation processing time.

5. The DDR device control method according to any one of claims 1 to 4, wherein the step S300 comprises:

s310, dividing the second clock frequency by the first clock frequency to obtain a frequency ratio, multiplying the frequency ratio by the maximum delay time to obtain a depth value of a buffer, and judging whether the depth value is an integer: if the depth value is not an integer, then go to step S311; if the depth value is an integer, go to step S312;

s311, rounding the depth value upwards to obtain a rounded depth value, and configuring the rounded depth value to the DDR equipment;

s312, configuring the depth value to the DDR equipment.

6. A control device of a DDR apparatus, the control device of the DDR apparatus comprising:

the DDR device comprises an acquisition module, a control module and a control module, wherein the acquisition module is used for acquiring a first clock frequency of a DDR controller in the DDR device and a second clock frequency of a bus corresponding to the DDR controller;

the calculation module is used for calculating the delay time between each task instruction corresponding to the DDR equipment, wherein the number of tasks corresponding to the DDR equipment is the maximum number which can be processed by the DDR equipment at the same time;

the comparison module is used for comparing each delay time obtained by calculation to obtain the maximum delay time in each delay time;

the calculation module is further configured to divide the second clock frequency by the first clock frequency to obtain a frequency ratio, and multiply the frequency ratio by the maximum delay time to obtain a depth value of the buffer;

and the configuration module is used for configuring the depth value to the DDR equipment.

7. The DDR device control apparatus of claim 6, wherein the calculation module comprises:

the first calculation unit is used for sequentially determining tasks corresponding to the DDR equipment as target tasks and calculating the delay time between adjacent instructions corresponding to the target tasks;

the judging unit is used for judging whether the delay time of the instruction corresponding to the target task is calculated;

the first calculating unit is further configured to continue calculating the delay time between adjacent instructions corresponding to the next target task when the judgment result of the judging unit is yes, until the delay time between adjacent instructions corresponding to all target tasks is calculated, and obtain the delay time corresponding to each task;

the comparing module is further used for comparing the delay time corresponding to each task and determining the maximum value in the delay time corresponding to each task as the maximum delay time.

8. The DDR device control device of claim 7, wherein the first computing unit comprises:

a judging subunit, configured to judge whether the adjacent instruction of the target task is: only the same kind of commands exist; only different kinds of commands exist; the commands of the same kind and the commands of different kinds exist, wherein each instruction at least corresponds to one command;

the calculating subunit is used for calculating the delay time between the adjacent instructions according to the judgment result of the judging subunit: if the adjacent instructions of the target task only have the same type of commands, determining the target commands with long processing time in the same type of commands, and adding the processing time of each target command to obtain the delay time between the adjacent instructions of the target task; if only different types of commands exist, adding the processing time of the various types of commands to obtain the delay time between the adjacent instructions of the target task; if the same type of command and different types of commands exist in the adjacent commands of the target task, determining the target command with long processing time in the same type of command, and adding the processing time of the target command and the processing time of the different types of commands to obtain the delay time between the adjacent commands of the target task.

9. The DDR device control apparatus of claim 6, wherein the calculation module further comprises:

the DDR device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring the charging preparation time, the charging processing time, the self-refreshing processing time and the activation processing time of each task instruction corresponding to the DDR device;

the second calculation unit is used for correspondingly calculating the delay time between each task instruction according to the charging preparation time, the charging processing time, the self-refreshing processing time and the activation processing time;

the calculation formula for correspondingly calculating the delay time between each task instruction according to the charging preparation time, the charging processing time, the self-refreshing processing time and the activation processing time is as follows:

tDELY=tRAS+tRP+tRFC+tRCD;

the tDELY represents a delay time, the tRAS represents a charge preparation time, the tRP represents a charge processing time, the tRFC represents a self-refresh processing time, and the tRCD represents an activation processing time.

10. The control device for the DDR device according to any one of claims 6 to 9, wherein the control device for the DDR device comprises:

the judging module is used for judging whether the depth value is an integer or not;

the rounding module is used for rounding the depth value upwards to obtain a rounded depth value if the depth value is not an integer;

the configuration module is further configured to configure the rounded depth value to the DDR device; and if the depth value is an integer, configuring the depth value to the DDR equipment.

11. A DDR device, characterized in that the DDR device comprises a DDR controller, and the DDR controller is connected with the control device of the DDR device according to any one of claims 6 to 10.

12. The DDR device of claim 11, wherein the DDR device further comprises a DDR memory, the DDR memory being coupled to the DDR controller, the DDR memory being configured to store data sent by the DDR controller;

the DDR equipment is used for being connected with the CPU unit and receiving data sent by the CPU unit.

13. A chip having an integrated circuit thereon, wherein the integrated circuit comprises a DDR device as recited in claim 11 or 12.

14. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon a computing program which, when executed by a processor, implements the steps of the control method for a DDR device according to any one of claims 1 to 5.

Technical Field

The invention relates to the technical field of computers, in particular to a control method and device of a DDR device, the DDR device, a chip and a computer readable storage medium.

Background

DDR (Double Data Rate Dynamic Random Access Memory) is commonly used as a storage for Data or instructions of a computer system. In chip design, generally, all devices to be accessed are connected to a DDR controller through an axi (advanced eXtensible interface), and at an interface of the DDR controller, a buffer is usually designed to buffer some instructions or data first, so as to prevent bus congestion caused by unbalanced DDR processing speed, which further causes the overall computer system to operate inefficiently. However, how to determine the depth value of the buffer has different considerations in different designs. Too small buffer depth value easily causes low access efficiency of access equipment and bus congestion; too large a buffer depth value results in waste of chip area and increased cost.

Two schemes are designed for the traditional buffer depth value. In synchronous circuit designs, the depth value of the buffer is typically 2, i.e., a so-called ping-pong buffer. In the design of an asynchronous circuit, a buffer at an interface of a DDR controller is used for asynchronous processing, and generally, an asynchronous FIFO (First input First output) is used as a mode of asynchronous processing, and depth values of the FIFO are generally n powers of 2, such as 4, 8, or 16. According to the traditional buffer depth value design scheme, the processing speed and the processing characteristic of the DDR controller are not considered, so that the corresponding bus is always in an access state when the DDR controller cannot read and write, and if the buffer depth value is not enough, namely the buffer is full, the DDR controller cannot receive a command any more, and can hang the bus, so that the bus is blocked; if the depth value of the buffer is large, the waste of chip area is caused.

Therefore, in the prior art, the depth value of the buffer is fixed in both the synchronous circuit and the asynchronous circuit, so that the bus is blocked when the depth value of the buffer is insufficient, and the chip area is wasted when the depth value of the buffer is too large.

Disclosure of Invention

Based on the above situation, a primary objective of the present invention is to provide a method and an apparatus for controlling a DDR device, a chip, and a computer-readable storage medium, so as to avoid waste of chip area corresponding to a buffer and increase of cost due to an excessively large depth value of the buffer, avoid bus congestion due to an excessively small depth value of the buffer, and improve operating efficiency of a computer system in which the DDR device is located.

In order to achieve the purpose, the technical scheme adopted by the invention is as follows:

a control method of a DDR device comprises the following steps:

s100, acquiring a first clock frequency of a DDR controller in the DDR equipment and a second clock frequency of a bus corresponding to the DDR controller;

s200, calculating delay time between each task instruction corresponding to the DDR equipment, and comparing the calculated delay time to obtain the maximum delay time in each delay time, wherein the number of tasks corresponding to the DDR equipment is the maximum number of tasks which can be processed by the DDR equipment at the same time;

and S300, dividing the second clock frequency by the first clock frequency to obtain a frequency ratio, multiplying the frequency ratio by the maximum delay time to obtain a depth value of a buffer, and configuring the depth value to the DDR equipment.

Preferably, step S200 includes:

s210, sequentially determining tasks corresponding to the DDR equipment as target tasks, calculating delay time between adjacent instructions corresponding to the target tasks, and judging whether the delay time of the instructions corresponding to the target tasks is calculated;

s220, if the delay time of the instruction corresponding to the target task is calculated, continuing to calculate the delay time between adjacent instructions corresponding to the next target task until the delay time between the adjacent instructions corresponding to all the target tasks is calculated, and obtaining the delay time corresponding to each task;

and S230, comparing the delay time corresponding to each task, and determining the maximum value in the delay time corresponding to each task as the maximum delay time.

Preferably, in step S210, the step of calculating the delay time between adjacent instructions corresponding to the target task includes:

s211, judging the command types existing in the adjacent commands of the target task, wherein each command at least corresponds to one command: if the adjacent instructions of the target task only have the same kind of commands, executing step S212; if the adjacent instructions of the target task only have different types of commands, executing step S213; if the adjacent instructions of the target task have the same kind of commands and different kinds of commands, executing step S214;

s212, determining target commands with long processing time in the same type of commands, and adding the processing time of each target command to obtain the delay time between adjacent instructions of the target task;

s213, adding the processing time of various commands to obtain the delay time between adjacent instructions of the target task;

s214, determining a target command with long processing time in the same type of command, and adding the processing time of the target command and the processing time of different types of commands to obtain the delay time between adjacent instructions of the target task.

Preferably, in step S200, the step of calculating the delay time between each task instruction corresponding to the DDR device includes:

s201, acquiring charging preparation time, charging processing time, self-refreshing processing time and activation processing time of each task instruction corresponding to the DDR equipment;

s202, correspondingly calculating the delay time between each task instruction according to the charging preparation time, the charging processing time, the self-refreshing processing time and the activation processing time;

the calculation formula for correspondingly calculating the delay time between each task instruction according to the charging preparation time, the charging processing time, the self-refreshing processing time and the activation processing time is as follows:

tDELY=tRAS+tRP+tRFC+tRCD;

the tDELY represents a delay time, the tRAS represents a charge preparation time, the tRP represents a charge processing time, the tRFC represents a self-refresh processing time, and the tRCD represents an activation processing time.

Preferably, step S300 includes:

s310, dividing the second clock frequency by the first clock frequency to obtain a frequency ratio, multiplying the frequency ratio by the maximum delay time to obtain a depth value of a buffer, and judging whether the depth value is an integer: if the depth value is not an integer, then go to step S311; if the depth value is an integer, go to step S312;

s311, rounding the depth value upwards to obtain a rounded depth value, and configuring the rounded depth value to the DDR equipment;

s312, configuring the depth value to the DDR equipment.

The invention also provides a control device of the DDR equipment, which comprises the following components:

the DDR device comprises an acquisition module, a control module and a control module, wherein the acquisition module is used for acquiring a first clock frequency of a DDR controller in the DDR device and a second clock frequency of a bus corresponding to the DDR controller;

the calculation module is used for calculating the delay time between each task instruction corresponding to the DDR equipment;

the comparison module is used for comparing each delay time obtained by calculation to obtain the maximum delay time in each delay time, wherein the number of tasks corresponding to the DDR equipment is the maximum number which can be processed by the DDR equipment at the same time;

the calculation module is further configured to divide the second clock frequency by the first clock frequency to obtain a frequency ratio, and multiply the frequency ratio by the maximum delay time to obtain a depth value of the buffer;

and the configuration module is used for configuring the depth value to the DDR equipment.

Preferably, the calculation module comprises:

the first calculation unit is used for sequentially determining tasks corresponding to the DDR equipment as target tasks and calculating the delay time between adjacent instructions corresponding to the target tasks;

the judging unit is used for judging whether the delay time of the instruction corresponding to the target task is calculated;

the first calculating unit is further configured to continue calculating the delay time between adjacent instructions corresponding to the next target task when the judgment result of the judging unit is yes, until the delay time between adjacent instructions corresponding to all target tasks is calculated, and obtain the delay time corresponding to each task;

the comparing module is further used for comparing the delay time corresponding to each task and determining the maximum value in the delay time corresponding to each task as the maximum delay time.

Preferably, the first calculation unit includes:

a judging subunit, configured to judge whether the adjacent instruction of the target task is: only the same kind of commands exist; only different kinds of commands exist; the commands of the same kind and the commands of different kinds exist, wherein each instruction at least corresponds to one command;

the calculating subunit is used for calculating the delay time between the adjacent instructions according to the judgment result of the judging subunit: if the adjacent instructions of the target task only have the same type of commands, determining the target commands with long processing time in the same type of commands, and adding the processing time of each target command to obtain the delay time between the adjacent instructions of the target task; if only different types of commands exist, adding the processing time of the various types of commands to obtain the delay time between the adjacent instructions of the target task; if the same type of command and different types of commands exist in the adjacent commands of the target task, determining the target command with long processing time in the same type of command, and adding the processing time of the target command and the processing time of the different types of commands to obtain the delay time between the adjacent commands of the target task.

Preferably, the calculation module further comprises:

the DDR device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring the charging preparation time, the charging processing time, the self-refreshing processing time and the activation processing time of each task instruction corresponding to the DDR device;

the second calculation unit is used for correspondingly calculating the delay time between each task instruction according to the charging preparation time, the charging processing time, the self-refreshing processing time and the activation processing time;

the calculation formula for correspondingly calculating the delay time between each task instruction according to the charging preparation time, the charging processing time, the self-refreshing processing time and the activation processing time is as follows:

tDELY=tRAS+tRP+tRFC+tRCD;

the tDELY represents a delay time, the tRAS represents a charge preparation time, the tRP represents a charge processing time, the tRFC represents a self-refresh processing time, and the tRCD represents an activation processing time.

Preferably, the control device of the DDR device includes:

the judging module is used for judging whether the depth value is an integer or not;

the rounding module is used for rounding the depth value upwards to obtain a rounded depth value if the depth value is not an integer;

the configuration module is further configured to configure the rounded depth value to the DDR device; and if the depth value is an integer, configuring the depth value to the DDR equipment.

The DDR device comprises a DDR controller, and the DDR controller is connected with the control device of the DDR device.

Preferably, the DDR device further comprises a DDR memory, the DDR memory is connected to the DDR controller, and the DDR memory is used to store data sent by the DDR controller;

and the DDR equipment is also used for being connected with the CPU unit and receiving the data sent by the CPU unit.

The invention also provides a chip. Having an integrated circuit thereon, the integrated circuit including a DDR device as described above.

The invention also provides a computer readable storage medium, wherein a control program of the DDR device is stored on the computer readable storage medium, and the control program of the DDR device realizes the steps of the control method of the DDR device when being executed by a processor.

[ PROBLEMS ] the present invention

The method comprises the steps that a first clock frequency of a DDR controller in the DDR device and a second clock frequency of a bus corresponding to the DDR controller are obtained; calculating the delay time between each task instruction corresponding to the DDR equipment, and comparing the calculated delay times to obtain the maximum delay time in each delay time, wherein the number of tasks corresponding to the DDR equipment is the maximum number of tasks which can be processed by the DDR equipment at the same time; and calculating to obtain a frequency ratio according to the first clock frequency and the second clock frequency, multiplying the frequency ratio by the maximum delay time to obtain a depth value of the buffer, and configuring the depth value to the DDR equipment. The method and the device have the advantages that the characteristic of the DDR device is considered, the delay time between each task instruction corresponding to the DDR device is calculated, the depth value of the buffer is calculated according to the maximum delay time, the depth value of the buffer determined according to the task corresponding to the DDR device is obtained, the depth value of the buffer is not limited by the fixed depth value of the buffer of a synchronous or asynchronous circuit, the waste of the area of a chip corresponding to the buffer and the increase of cost caused by the overlarge depth value of the buffer are avoided, the congestion of a bus caused by the undersize depth value of the buffer is also avoided, the operating efficiency of a computer system where the DDR device is located is improved, and the manufacturing cost of the chip of the computer system is reduced.

Other advantages of the present invention will be described in the detailed description, and those skilled in the art will understand the technical features and technical solutions presented in the description.

Drawings

Preferred embodiments according to the present invention will be described below with reference to the accompanying drawings. In the figure:

FIG. 1 is a flow chart of one embodiment of a method for controlling a DDR device of the present invention;

FIG. 2 is a schematic structural diagram of an embodiment of a control device of the DDR apparatus of the invention;

fig. 3 is a schematic structural diagram of a DDR device, a CPU unit, and a control device of the DDR device in the embodiment of the present invention.

Detailed Description

Fig. 1 is a flowchart of an embodiment of a method for controlling a DDR device according to the present invention, which includes the following steps.

Step S100, a first clock frequency of a DDR controller in the DDR device and a second clock frequency of a bus corresponding to the DDR controller are obtained.

In the present embodiment, the DDR device includes a DDR controller and a DDR memory. And when the buffer depth value needs to be calculated, acquiring the clock frequency of the DDR controller and the clock frequency of a bus corresponding to the DDR controller. In order to distinguish different clock frequencies, the present embodiment records the clock frequency of the DDR controller as a first clock frequency, and records the clock frequency of the bus as a second clock frequency. It should be noted that the first clock frequency is the maximum clock frequency of the DDR controller, the second clock frequency is also the maximum clock frequency of the bus, and the first clock frequency and the second clock frequency are fixed and are fixed during hardware design. The bus is a bus between a DDR (central processing unit) and a CPU (central processing unit), the CPU is connected with the DDR controller through the bus, the CPU sends task data to the DDR controller through the bus, the DDR controller processes data transmission of the task data and sends the received task data to a DDR memory for storage, and the DDR memory is used for storing data sent by the DDR controller. Specifically, when an acquisition instruction is detected, a preset first clock frequency and a preset second clock frequency are acquired through the acquisition instruction. The obtaining instruction may be triggered manually by a user as required, or may be triggered under a specific condition, for example, after the buffer depth value calculation device establishes a connection relationship with the DDR controller, the buffer depth value calculation device automatically triggers, or the buffer depth value calculation device receives a calculation instruction and triggers.

Step S200, calculating the delay time between each task instruction corresponding to the DDR device, and comparing the calculated delay times to obtain the maximum delay time in each delay time, wherein the number of tasks corresponding to the DDR device is the maximum number which can be processed by the DDR device at the same time.

And calculating the delay time between each task instruction corresponding to the DDR equipment. It should be noted that the DDR device corresponds to at least one task, and each task has at least one instruction. In this embodiment, the number of tasks corresponding to the DDR device is the maximum number that can be processed by the DDR device at the same time. It can be understood that, since each task has at least one delay time, after the delay time between instructions of each task corresponding to the DDR device is obtained through calculation, the obtained delay times are compared to obtain the maximum delay time among the delay times. Specifically, in the process of calculating the delay time between each task instruction corresponding to the DDR device, the delay time between every two instructions in each task may be calculated, so as to obtain the delay time corresponding to the task.

Further, step S200 includes:

step S210, sequentially determining tasks corresponding to the DDR device as target tasks, calculating the delay time between adjacent instructions corresponding to the target tasks, and judging whether the delay time of the instructions corresponding to the target tasks is calculated.

Further, the tasks corresponding to the DDR device are sequentially determined as target tasks, the delay time between adjacent instructions corresponding to the target tasks is calculated, and whether the delay time of the instructions corresponding to the target tasks is calculated is judged. Specifically, the tasks corresponding to the DDR device may be sorted, and then the tasks are determined as the target tasks in sequence from front to back according to the sorting result. Such as may be ordered from front to back according to when the DDR device receives each task. In the embodiment, the calculated delay time is the delay time between adjacent instructions of the target task, and if the a task has four instructions, i.e., a1, a2, A3 and a4, the delay time corresponding to the a task is the delay time between a1 and a2, the delay time between a2 and A3, and the delay time between A3 and a 4. It can be understood that after the delay time between adjacent instructions of a target task is calculated, the delay time of the instruction corresponding to the target task is determined to be calculated; and when the delay time between the adjacent target tasks is not calculated, determining that the delay time of the instruction corresponding to the target task is not calculated, and continuously calculating the delay time between the adjacent instructions corresponding to the target task.

Specifically, in step S201, the step of calculating the delay time between adjacent instructions corresponding to the target task includes:

s211, judging the command types existing in the adjacent commands of the target task, wherein each command at least corresponds to one command: if the adjacent instructions of the target task only have the same kind of commands, executing step S212; if the adjacent instructions of the target task only have different types of commands, executing step S213; if the adjacent instructions of the target task have the same kind of command and different kinds of commands, step S214 is executed.

Specifically, the process of calculating the delay time between adjacent instructions corresponding to the target task is as follows: and judging the command types existing in the adjacent commands of the target task, wherein each command at least corresponds to one command. There are three cases of command types in the target task adjacent instruction, the first is that the target task adjacent instruction only has the same type of command, at this time, step S212 is executed; the second is that there are only different kinds of commands in the adjacent instructions of the target task, and step S213 is executed; the third is that the adjacent instructions of the target task have the same kind of command and different kinds of commands, and step S214 is executed. For example, a charging preparation command, a charging processing command, a self-refresh command, an activation command, and the like exist in a certain instruction. When the adjacent commands contain the charging processing command, the charging processing command is the same type of command; when one instruction contains an activation command and the other instruction does not contain the activation command, the activation command is a different kind of command.

S212, determining the target commands with long processing time in the same type of commands, and adding the processing time of each target command to obtain the delay time between adjacent instructions of the target task.

And S213, adding the processing time of the various commands to obtain the delay time between the adjacent instructions of the target task.

S214, determining a target command with long processing time in the same type of command, and adding the processing time of the target command and the processing time of different types of commands to obtain the delay time between adjacent instructions of the target task.

If only the same type of command exists in the adjacent commands of the target task, the same type of command is determined, the command with long processing time is the target command, and then the processing time of each target command is added to obtain the delay time between the adjacent commands of the target task. For example, when the A2 instruction and the A3 instruction both contain the activate command, the processing time of the activate command in the A2 instruction is longer than that of the activate command in the A3 instruction, and therefore, the activate command in the A2 instruction is the target command. If it is determined that only different types of commands exist in the adjacent commands of the target task and the same type of commands do not exist, adding the processing time of each type of commands, namely adding the processing time of all the commands corresponding to the adjacent commands to obtain the delay time between the adjacent commands of the target task. If the adjacent instructions of the target task have the same type of commands and different types of commands, determining the target command with long processing time in the same type of commands, and adding the processing time of the target command and the processing time of the different types of commands to obtain the delay time between the adjacent instructions of the target task. If the a2 instruction includes an a command in addition to an active command, and the A3 instruction includes a b command in addition to an active command, the delay time between the a2 and A3 instructions is equal to the sum of the processing times of the active command, the a command, and the b command in the a2 instruction.

Step S220, if the delay time of the instruction corresponding to the target task is calculated, the delay time between the adjacent instructions corresponding to the next target task is continuously calculated until the delay time between the adjacent instructions corresponding to all the target tasks is calculated, and the delay time corresponding to each task is obtained.

Step S230, comparing the delay times corresponding to the tasks, and determining the maximum value of the delay times corresponding to the tasks as the maximum delay time.

And if the delay time of the instruction corresponding to the target task is calculated, continuing to calculate the delay time between adjacent instructions corresponding to the next target task until the delay time between the adjacent instructions corresponding to all the target tasks is calculated, and obtaining the delay time corresponding to each task. It should be noted that the delay time calculation process between adjacent instructions of each target task is the same, and the description of this embodiment is not repeated. And after the delay time corresponding to each task is obtained, comparing the delay time corresponding to each task, and determining the maximum value in the delay time corresponding to each task as the maximum delay time. It should be noted that, for the DDR device, it is a simple read operation and a write operation, so the maximum latency time of a single task is considered to be the maximum latency time of all tasks of the DDR device.

Further, in step S200, the step of calculating the delay time between each task instruction corresponding to the DDR device includes:

step S201, acquiring a charging preparation time, a charging processing time, a self-refresh processing time, and an activation processing time of each task instruction corresponding to the DDR device.

Step S202, correspondingly calculating the delay time between each task instruction according to the charging preparation time, the charging processing time, the self-refreshing processing time and the activation processing time; the calculation formula for correspondingly calculating the delay time between each task instruction according to the charging preparation time, the charging processing time, the self-refreshing processing time and the activation processing time is as follows:

tDELY=tRAS+tRP+tRFC+tRCD;

the tDELY represents a delay time, the tRAS represents a charge preparation time, the tRP represents a charge processing time, the tRFC represents a self-refresh processing time, and the tRCD represents an activation processing time.

Further, in this embodiment, a delay time between every two instructions processed by the DDR controller is fully considered, during which there is always an access at the interface of the DDR controller, and during the access process of the DDR controller, there may be some special commands, such as active (active), precharge (charge), auto-refresh (self-refresh), etc., according to the characteristics of the DDR. Then in any two instructions, the delay time that can be encountered is the relative time that the DDR inserts the charge command, the self-refresh command, the activate command, etc. corresponding to these commands. Each command has a certain processing time, and in the embodiment, the charging command includes a charging preparation command and a charging processing command.

The method comprises the steps of obtaining charging preparation time, charging processing time, self-refreshing processing time and activation processing time of each task instruction corresponding to the DDR device, and correspondingly calculating delay time among the task instructions according to the charging preparation time, the charging processing time, the self-refreshing processing time and the activation processing time. It is understood that the charge preparation time is a time required to execute the charge preparation command, the charge processing time is a time required to execute the charge processing command, the self-refresh processing time is a time required to execute the self-refresh command, and the activation processing time is a time required to execute the activation command.

Specifically, in this embodiment, the charge preparation time of the charge preparation command is denoted as tRAS, the charge processing time of the charge processing command is denoted as tRP, the self-refresh processing time of the self-refresh command is denoted as tRFC, and the activation processing time of the activation command is denoted as tRCD, at this time, the delay time of the first instruction and the second instruction of the first task is tDELY11 ═ tRAS + tRP + tRFC + tRCD, and the delay time tDELY12 between the second instruction and the third instruction of the first task, and the delay time tDELY13 … … between the K-1 th instruction and the K-th instruction of the third instruction and the delay time tDELY1K between the K-th instruction are obtained by subclass calculation. It should be noted that, calculating the processing time of the selected time length in the same type of command of the first instruction and the second instruction for tRAS, tRP, tRFC and tRCD in tDELY11, for example, for a self-refresh command, if the self-refresh processing time of the first instruction is longer than that of the second instruction, calculating tRFC in tDELY11 as the self-refresh processing time corresponding to the self-refresh command in the first instruction; for the activate command, if the activate processing time of the first instruction is less than the activate processing time of the second instruction, tRCD in tdly 11 is calculated as the activate processing time corresponding to the activate command in the second instruction. After the delay time calculation of the instruction corresponding to the first task is completed, acquiring a second task, and calculating the delay time between every two instructions in the second task to obtain tDELY21, tDELY22 and tDELY23 … … tDELY 2K; by analogy, traversing the N tasks, and calculating the delay time between every two instructions, wherein the maximum number of tasks to be processed by the DDR device is N tasks; the maximum delay time tDELY is then obtained by comparing each delay time one by one. The processing time corresponding to the tRAS, tRP, tRFC and tRCD may be obtained by referring to a standard protocol of the DDR.

It will be appreciated that in other embodiments, each instruction may or may not include a charge command, a self-refresh command, and an activate command, and may or may not include one or more of the charge command, the self-refresh command, and the activate command, such as including the charge command and the self-refresh command, but not including the activate command. The number of commands corresponding to each instruction may be the same or different, and the number of instructions corresponding to each task may be the same or different.

Step S300, dividing the second clock frequency by the first clock frequency to obtain a frequency ratio, multiplying the frequency ratio by the maximum delay time to obtain a depth value of the buffer, and configuring the depth value to the DDR device.

And after the maximum delay time, the first clock frequency and the second clock frequency are obtained, obtaining a prestored depth value calculation formula of the buffer, dividing the second clock frequency by the first clock frequency to obtain a frequency ratio, multiplying the calculated frequency ratio by the maximum delay time to obtain the depth value of the buffer, and configuring the calculated depth value to the DDR equipment, namely, in the hardware design stage, fixing the depth value of the buffer of the interface of the DDR controller to the calculated depth value. Specifically, the buffer depth value is calculated by D ═ (CLK2/CLK1) × tDELYmax; where D denotes a depth value, CLK1 denotes a first clock frequency, CLK2 denotes a second clock frequency, tDELYmax is a maximum delay time.

For the DDR device, the DDR device is a simple read operation and a write operation, so the maximum delay time of a single task is considered, the maximum delay time of all tasks of the DDR device is already considered, the second clock frequency is the clock frequency of the CPU unit for accessing the DDR device, the first clock frequency is the clock frequency in the running process of the DDR device, therefore, the second clock frequency is divided by the first clock frequency to obtain a frequency ratio, the data throughput between the DDR device and the CPU unit is the same under the condition of busy, thereby ensuring that the data transmission between the CPU unit and the DDR device is not blocked and the data transmission efficiency of the CPU unit is not delayed, and finally, the frequency ratio is multiplied by the maximum delay time to obtain a depth value, so that a buffer of an interface of the DDR controller can successfully receive the data sent by the CPU unit when the DDR device simultaneously processes the maximum number of tasks, congestion of the bus is avoided.

It should be noted that the calculated depth value is the bit width number of the bus between the CPU unit and the DDR controller. The maximum delay time indicates that within the maximum delay time, if other commands are inserted into the DDR device, the DDR device does not perform read-write operation any more, but within this time, the CPU unit may still perform read-write operation, and therefore the CPU unit may still send the read-write command to the DDR device, and at this time, the buffer is required to perform buffering, so as long as it is determined within the maximum delay time, in a limit condition (the CPU unit sends the read-write command to the DDR device within each cycle), how many commands the CPU unit sends to the DDR device, how many commands the DDR device needs to buffer corresponding to the buffer, each command represents one read-write request, and one read-write request needs a bit width during buffering. Therefore, the number of commands which can be sent by the CPU unit in unit time is obtained by dividing the second clock frequency by the first clock frequency, and then the maximum delay time is multiplied to obtain the number of commands which need to be cached by the buffer corresponding to the DDR device, so that the number of bit widths corresponding to the DDR device is obtained, and the depth value of the buffer corresponding to the DDR device is obtained. It is understood that the pulse signal is a pulse signal continuously emitted at a certain voltage amplitude and a certain time interval, the time interval between the pulse signals is referred to as a period, and the number of pulses generated in a unit time (e.g., 1 second) is referred to as a frequency. The frequency is a measure name describing how many pulses occur in a unit time in a periodic cycle signal (including a pulse signal); the standard units of measure for frequency are: hz (hertz), kHz (kilohertz), MHz (megahertz), etc., wherein 1GHz 1000MHz, 1MHz 1000kHz, 1kHz 1000Hz, the time unit for calculating the pulse signal period and the corresponding conversion relationship are: s (seconds), ms (milliseconds), μ s (microseconds), ns (nanoseconds), etc., so that if the unit between the first clock frequency and the second clock frequency is different and the unit time of the corresponding period of the clock frequency is different from the unit time of the maximum delay time in the process of calculating the depth value, unit conversion is performed to ensure the accuracy of the calculated depth value.

In the embodiment, a first clock frequency of a DDR controller in DDR equipment and a second clock frequency of a bus corresponding to the DDR controller are obtained; calculating the delay time between each task instruction corresponding to the DDR equipment, and comparing the calculated delay times to obtain the maximum delay time in each delay time, wherein the number of tasks corresponding to the DDR equipment is the maximum number of tasks which can be processed by the DDR equipment at the same time; and dividing the second clock frequency by the first clock frequency to obtain a frequency ratio, multiplying the frequency ratio by the maximum delay time to obtain a depth value of the buffer, and configuring the depth value to the DDR equipment. The method and the device have the advantages that the characteristic of the DDR device is considered, the delay time between each task instruction corresponding to the DDR device is calculated, the depth value of the buffer is calculated according to the maximum delay time, the depth value of the buffer determined according to the task corresponding to the DDR device is obtained, the depth value of the buffer is not limited by the fixed depth value of the buffer of a synchronous or asynchronous circuit, the waste of the area of a chip corresponding to the buffer and the increase of cost caused by the overlarge depth value of the buffer are avoided, the congestion of a bus caused by the undersize depth value of the buffer is also avoided, the operating efficiency of a computer system where the DDR device is located is improved, and the manufacturing cost of the chip of the computer system is reduced.

Further, another embodiment of the control method of the DDR device of the present invention is provided.

Another embodiment of the method for controlling a DDR device is different from the above-mentioned embodiment of the method for controlling a DDR device in that the step S300 includes:

step f, S310, dividing the second clock frequency by the first clock frequency to obtain a frequency ratio, multiplying the frequency ratio by the maximum delay time to obtain a depth value of the buffer, and determining whether the depth value is an integer: if the depth value is not an integer, then go to step S311; if the depth value is an integer, step S312 is executed.

And S311, rounding the depth value upwards to obtain a rounded depth value, and configuring the rounded depth value to the DDR equipment.

S312, configuring the depth value to the DDR equipment.

And when the frequency ratio between the first clock frequency and the second clock frequency is obtained through calculation, multiplying the frequency ratio by the maximum delay time to obtain the depth value of the buffer, and judging whether the calculated depth value is an integer. If the depth value is determined to be not an integer, namely the calculated r depth value contains decimal points, rounding up the depth value to obtain a rounded depth value, and configuring the rounded depth value to the DDR equipment; and if the calculated depth value is an integer, directly configuring the calculated depth value to the DDR equipment. If the calculated depth value is 10.1, the depth value obtained after rounding up is 11; when the calculated depth value is 12.9, the depth value rounded up is 13. And if the calculated depth value is determined to be an integer, directly configuring the calculated depth value to the DDR equipment.

In the embodiment, after the depth value is obtained through calculation, whether the depth value is an integer is judged, when the depth value is determined not to be the integer, the depth value is rounded upwards to obtain the rounded depth value, and the rounded depth value is configured to the DDR device, so that the situation that the depth value which is not the integer is configured to the DDR device, the process that the depth value is configured to the DDR device is failed, and the success rate of the depth value configuration of the buffer is improved.

The present invention also provides a DDR device control apparatus, and referring to fig. 2, the DDR device control apparatus includes:

the DDR device comprises an acquisition module 10, a bus interface module and a bus interface module, wherein the acquisition module is used for acquiring a first clock frequency of a DDR controller in the DDR device and a second clock frequency of a bus corresponding to the DDR controller;

a calculating module 20, configured to calculate a delay time between each task instruction corresponding to the DDR device, where a number of tasks corresponding to the DDR device is a maximum number that the DDR device can process simultaneously;

a comparing module 30, configured to compare the calculated delay times to obtain a maximum delay time of the delay times;

the calculating module 20 is further configured to divide the second clock frequency by the first clock frequency to obtain a frequency ratio, and multiply the frequency ratio by the maximum delay time to obtain a depth value of the buffer;

a configuration module 40, configured to configure the depth value to the DDR device.

Further, the calculation module 20 includes:

the first calculation unit is used for sequentially determining tasks corresponding to the DDR equipment as target tasks and calculating the delay time between adjacent instructions corresponding to the target tasks;

the judging unit is used for judging whether the delay time of the instruction corresponding to the target task is calculated;

the first calculating unit is further configured to continue calculating the delay time between adjacent instructions corresponding to the next target task when the judgment result of the judging unit is yes, until the delay time between adjacent instructions corresponding to all target tasks is calculated, and obtain the delay time corresponding to each task;

the comparing module 30 is further configured to compare the delay times corresponding to the tasks, and determine a maximum value of the delay times corresponding to the tasks as a maximum delay time.

Further, the first calculation unit includes:

a judging subunit, configured to judge whether the adjacent instruction of the target task is: only the same kind of commands exist; only different kinds of commands exist; the commands of the same kind and the commands of different kinds exist, wherein each instruction at least corresponds to one command;

the calculating subunit is used for calculating the delay time between the adjacent instructions according to the judgment result of the judging subunit: if the adjacent instructions of the target task only have the same type of commands, determining the target commands with long processing time in the same type of commands, and adding the processing time of each target command to obtain the delay time between the adjacent instructions of the target task; if only different types of commands exist, adding the processing time of the various types of commands to obtain the delay time between the adjacent instructions of the target task; if the same type of command and different types of commands exist in the adjacent commands of the target task, determining the target command with long processing time in the same type of command, and adding the processing time of the target command and the processing time of the different types of commands to obtain the delay time between the adjacent commands of the target task.

Further, the calculation module 20 further includes:

the DDR device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring the charging preparation time, the charging processing time, the self-refreshing processing time and the activation processing time of each task instruction corresponding to the DDR device;

the second calculation unit is used for correspondingly calculating the delay time between each task instruction according to the charging preparation time, the charging processing time, the self-refreshing processing time and the activation processing time;

the calculation formula for correspondingly calculating the delay time between each task instruction according to the charging preparation time, the charging processing time, the self-refreshing processing time and the activation processing time is as follows:

tDELY=tRAS+tRP+tRFC+tRCD;

the tDELY represents a delay time, the tRAS represents a charge preparation time, the tRP represents a charge processing time, the tRFC represents a self-refresh processing time, and the tRCD represents an activation processing time.

Further, the control device of the DDR device includes:

the judging module is used for judging whether the depth value is an integer or not;

the rounding module is used for rounding the depth value upwards to obtain a rounded depth value if the depth value is not an integer;

the configuration module 40 is further configured to configure the rounded depth value to the DDR device; and if the depth value is an integer, configuring the depth value to the DDR equipment.

The specific implementation of the control device of the DDR device of the present invention is basically the same as that of each embodiment of the control method of the DDR device, and will not be described again here.

The DDR device comprises a DDR controller, and the DDR controller is connected with the control device of the DDR device.

Further, the DDR device further comprises a DDR memory, the DDR memory is connected with the DDR controller, and the DDR memory is used for storing data sent by the DDR controller;

and the DDR equipment is also used for being connected with the CPU unit and receiving the data sent by the CPU unit.

Further, the DDR controller is connected with the control device of the DDR device, and specifically, a schematic structural diagram among the CPU unit, the DDR controller, the DDR memory, and the control device of the DDR device may refer to fig. 3.

It should be noted that the description of the DDR device has been described in the above embodiments, and the description is not repeated here.

The invention also provides a chip, wherein an integrated circuit is arranged on the chip, and the integrated circuit comprises the DDR equipment.

It should be noted that the description of the DDR device has been described in the above embodiments, and the description is not repeated here.

The invention also provides a computer readable storage medium, wherein a control program of the DDR device is stored on the computer readable storage medium, and when the control program of the DDR device is executed by a processor, the steps of the control method of the DDR device are realized.

The specific implementation of the computer-readable storage medium of the present invention is substantially the same as the embodiments of the control method of the DDR device, and will not be described again here.

It will be appreciated by those skilled in the art that the above-described preferred embodiments may be freely combined, superimposed, without conflict.

It will be understood that the embodiments described above are illustrative only and not restrictive, and that various obvious and equivalent modifications and substitutions for details described herein may be made by those skilled in the art without departing from the basic principles of the invention.

17页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种控制器共享同步方法和装置

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!