Variable address occupation detection method and device, storage medium and electronic equipment

CN117194235BActive Publication Date: 2026-08-18KYLAND TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311110479.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-30
Publication Date
2026-08-18
Estimated Expiration
2043-08-30

AI Technical Summary

Technical Problem

[0003]本申请提供了一种变量地址的占用检测方法、装置、存储介质以及电子设备,以解决变量地址的常规占用检测方法响应时间长的技术问题

Benefits of technology

[0014]In this embodiment, a method is employed to obtain a variable dataset and a target variable. The variable dataset includes at least one variable, each corresponding to an address descriptor. The target variable is the variable that the user will input into the variable dataset. The storage address of the variable dataset is calculated based on the byte address bits and type length of each address descriptor in the variable dataset. A target address set for the target variable is calculated, and based on the target address set and the storage address, an occupancy detection result is calculated for each address in the target address set, including whether the address is occupied or not. If the occupancy detection result for any address in the target address set is that the address is occupied, the method determines that the target address descriptor of the target variable is occupied. This method uses a search algorithm based on the byte address bits and type length of the variable's address descriptor. This algorithm obtains the storage address of the variable dataset by traversing and calculating the byte address bits and type length of the address descriptor of each variable in the variable dataset. After the user inputs the target address descriptor of the target variable on the interface, the target address set of the target variable is calculated, and it is determined whether there is a conflict between the target address set and each storage address in the target address set. If a conflict exists with any memory address, the target address descriptor is determined to be occupied. This algorithm fully utilizes the space efficiency of the byte address bits and type length of each address descriptor, resulting in high accuracy, strong performance, fast query speed, and low space consumption. This improves the query efficiency of variable address occupancy detection with less resource consumption, thereby accelerating response time, enhancing the user interface experience, and solving the technical problem of long response time in conventional variable address occupancy detection methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117194235B_ABST
    Figure CN117194235B_ABST
Patent Text Reader

Abstract

The application relates to a variable address occupation detection method and device, a storage medium and electronic equipment. The method comprises the following steps: acquiring a variable data set and a target variable, wherein the variable data set comprises at least one variable, one variable corresponds to one address descriptor, and the target variable is a variable to be input by a user into the variable data set; calculating a storage address of the variable data set according to a byte address bit and a type length of each address descriptor in the variable data set; calculating a target address set of the target variable, and calculating an occupation detection result of each address in the target address set based on the target address set and the storage address; and determining that a target address descriptor of the target variable is occupied when the occupation detection result of any one address in the target address set is that the address is occupied. The application solves the technical problem of long response time of a conventional occupation detection method of a variable address.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of controller programming in the automatic control industry and browser web pages, and in particular to a method, device, storage medium, and electronic device for detecting the occupancy of variable addresses. Background Technology

[0002] Methods for detecting duplicate variable addresses mainly fall into two categories: traversal and set-based methods. The traversal method iterates through the entire dataset, comparing variable addresses sequentially for conflicts. This method has low space complexity but high time complexity. The set-based method first traverses the test set data to create a cached address set. During verification, only one query is needed to obtain the verification result. This method has very low time complexity but very high space complexity. Summary of the Invention

[0003] This application provides a method, apparatus, storage medium, and electronic device for detecting the occupancy of variable addresses, in order to solve the technical problem of long response time in conventional methods for detecting the occupancy of variable addresses.

[0004] In a first aspect, this application provides a method for detecting the occupancy of variable addresses, comprising: acquiring a variable dataset and a target variable, wherein the variable dataset includes at least one variable, each variable corresponding to an address descriptor, and the target variable is a variable that a user will input into the variable dataset; calculating the storage address of the variable dataset based on the byte address bits and type length of each address descriptor in the variable dataset; calculating a target address set for the target variable, and based on the target address set and the storage address, calculating an occupancy detection result for each address in the target address set, wherein the occupancy detection result includes whether the address is occupied or not; and determining that the target address descriptor of the target variable is occupied if the occupancy detection result for any address in the target address set is that the address is occupied.

[0005] Secondly, this application provides a variable address occupancy detection device, comprising: an acquisition module for acquiring a variable dataset and a target variable, wherein the variable dataset includes at least one variable, each variable corresponds to an address descriptor, and the target variable is a variable that a user will input into the variable dataset; a first calculation module for calculating the storage address of the variable dataset based on the byte address bits and type length of each address descriptor in the variable dataset; a second calculation module for calculating a target address set of the target variable, and calculating an occupancy detection result for each address in the target address set based on the target address set and the storage address, wherein the occupancy detection result includes an address being occupied and an address not being occupied; and a first determination module for determining that the target address descriptor of the target variable is occupied if the occupancy detection result of any address in the target address set is that the address is occupied.

[0006] As an optional example, the first calculation module includes: a first calculation unit, used to sequentially calculate the storage unit of each address descriptor in the above variable dataset; and a determination unit, used to determine the storage unit of the address descriptor of the last variable in the above variable dataset as the above storage address.

[0007] As an optional example, the first calculation unit includes a processing subunit, configured to sequentially use each address descriptor in the variable dataset as the current address descriptor, and perform the following operations on the current address descriptor: if the current address descriptor is the address descriptor of the first variable in the variable dataset, calculate the current storage unit of the current address descriptor based on the initial storage unit, the byte address bits of the current address descriptor, and the type length; if the current address descriptor is not the address descriptor of the first variable in the variable dataset, calculate the current storage unit of the current address descriptor based on the storage unit of the previous address descriptor, the byte address bits of the current address descriptor, and the type length.

[0008] As an optional example, the above processing subunit is used to: calculate the current address set of the current address descriptor based on the current byte address bit and the current type length of the current address descriptor; traverse each address in the current address set and calculate the storage subunit of each address; and perform an OR operation on the storage subunit of each address and the initial storage unit to obtain the current storage unit.

[0009] As an optional example, the second calculation module includes: a second calculation unit, used to perform a multiplication operation on the target type length and the target byte address bits of the target address descriptor to obtain the target starting address of the target address descriptor; and a third calculation unit, used to perform an increment operation on the target starting address according to the target type length to obtain the target address set.

[0010] As an optional example, the second calculation module includes a processing unit, configured to take each address in the target address set as the current address and perform the following operations on the current address: calculate the current storage sub-unit of the current address; perform a bitwise AND operation on the current storage sub-unit and the storage address to obtain a current result; if the current result is equal to the storage address, determine that the current occupancy detection result of the current address is that the address is occupied; if the current result is not equal to the storage address, determine that the current occupancy detection result is that the address is not occupied.

[0011] As an optional example, the above apparatus further includes: a second determining module, configured to determine that the target variable address of the target variable is not occupied when the occupancy detection result of each address in the target address set is obtained after calculating the occupancy detection result of each address in the target address set is that the address is not occupied.

[0012] Thirdly, this application provides a storage medium storing a computer program, wherein the computer program is executed by a processor to perform the aforementioned variable address occupancy detection method.

[0013] Fourthly, this application also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the above-described variable address occupancy detection method through the computer program.

[0014] In this embodiment, a method is employed to obtain a variable dataset and a target variable. The variable dataset includes at least one variable, each corresponding to an address descriptor. The target variable is the variable that the user will input into the variable dataset. The storage address of the variable dataset is calculated based on the byte address bits and type length of each address descriptor in the variable dataset. A target address set for the target variable is calculated, and based on the target address set and the storage address, an occupancy detection result is calculated for each address in the target address set, including whether the address is occupied or not. If the occupancy detection result for any address in the target address set is that the address is occupied, the method determines that the target address descriptor of the target variable is occupied. This method uses a search algorithm based on the byte address bits and type length of the variable's address descriptor. This algorithm obtains the storage address of the variable dataset by traversing and calculating the byte address bits and type length of the address descriptor of each variable in the variable dataset. After the user inputs the target address descriptor of the target variable on the interface, the target address set of the target variable is calculated, and it is determined whether there is a conflict between the target address set and each storage address in the target address set. If a conflict exists with any memory address, the target address descriptor is determined to be occupied. This algorithm fully utilizes the space efficiency of the byte address bits and type length of each address descriptor, resulting in high accuracy, strong performance, fast query speed, and low space consumption. This improves the query efficiency of variable address occupancy detection with less resource consumption, thereby accelerating response time, enhancing the user interface experience, and solving the technical problem of long response time in conventional variable address occupancy detection methods. Attached Figure Description

[0015] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0016] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0017] One or more embodiments are illustrated by way of example with reference numerals in the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.

[0018] Figure 1This is a flowchart of an optional variable address occupancy detection method according to an embodiment of this application;

[0019] Figure 2 This is a bitmap caching flowchart of an optional variable address occupancy detection method according to an embodiment of this application;

[0020] Figure 3 This is a data cache loading diagram of an optional variable address occupancy detection method according to an embodiment of this application;

[0021] Figure 4 This is a bitmap cache computation graph of an optional variable address occupancy detection method according to an embodiment of this application;

[0022] Figure 5 This is a schematic diagram of an optional variable address occupancy detection device according to an embodiment of this application;

[0023] Figure 6 This is a schematic diagram of an optional electronic device according to an embodiment of this application. Detailed Implementation

[0024] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0025] The following disclosure provides numerous different embodiments or examples for implementing various structures of this application. To simplify the disclosure, specific examples of components and arrangements are described below. These are merely examples and are not intended to limit the scope of this application. Furthermore, reference numerals and / or letters may be repeated in different examples. Such repetition is for simplification and clarity and does not in itself indicate a relationship between the various embodiments and / or arrangements discussed.

[0026] According to a first aspect of the embodiments of this application, a method for detecting the occupancy of a variable address is provided, optionally, as follows: Figure 1 As shown, the above method includes:

[0027] S102, obtain the variable dataset and the target variable, wherein the variable dataset includes at least one variable, one variable corresponds to one address descriptor, and the target variable is the variable that the user will input into the variable dataset;

[0028] S104, Calculate the storage address of the variable dataset based on the byte address bits and type length of each address descriptor in the variable dataset;

[0029] S106, calculate the target address set of the target variable, and based on the target address set and the storage address, calculate the occupancy detection result of each address in the target address set, wherein the occupancy detection result includes whether the address is occupied or not.

[0030] S108, if the occupancy detection result of any address in the target address set is that the address is occupied, determine that the target address descriptor of the target variable is occupied.

[0031] Optionally, in this embodiment, considering the characteristics of variable addresses, the variable address information storage structure consists of a three-layer structure. The first layer is a set of region information mappings, the second layer is an array of all byte address information for the corresponding region, and the third layer is a set of bit address data mappings corresponding to a certain byte address. Each number in the second layer can store a maximum of 32 byte addresses, and each number in the third layer can store a maximum of 32 bit addresses. Variable addresses are divided into three regions: I, Q, and M, containing five types: X, B, W, D, and L, corresponding to BOOL, BYTE, WORD, DOUBLE_WORD, and LONG_WORD data, respectively. Specifically, the type length of the address descriptor for type X is 1, the type length of the address descriptor for type B is 1, the type length of the address descriptor for type W is 2, the type length of the address descriptor for type D is 4, and the type length of the address descriptor for type L is 8.

[0032] Optionally, in this embodiment, the storage address of the address descriptor of each variable in the variable dataset is first traversed and calculated, and the storage address of the variable dataset is finally obtained. Then, the user is waited for to input the target address descriptor of the target variable on the interface. After input, the target address set of the target variable is calculated, and it is determined whether there is a conflict between the target address set and each address in the storage address of the variable dataset. If any address has a conflict, the conflict item is highlighted in a warning color on the interface to warn the user that the target address descriptor of the target variable has been occupied.

[0033] As an optional example, calculating the storage address of the variable dataset based on the byte address bits and type length of each address descriptor in the variable dataset includes:

[0034] Calculate the storage unit for each address descriptor in the variable dataset in turn;

[0035] The storage address is determined by the address descriptor of the last variable in the variable dataset.

[0036] Optionally, in this embodiment, the storage unit of each address descriptor in the variable dataset is calculated sequentially, and finally the storage unit of the address descriptor of the last variable in the variable dataset is determined as the storage address.

[0037] As an optional example, calculating the storage unit for each address descriptor in the variable dataset sequentially includes:

[0038] For each address descriptor in the variable dataset, treat it as the current address descriptor and perform the following operations on the current address descriptor:

[0039] If the current address descriptor is the address descriptor of the first variable in the variable dataset, calculate the current storage unit of the current address descriptor based on the initial storage unit, the byte address bits of the current address descriptor, and the type length;

[0040] If the current address descriptor is not the address descriptor of the first variable in the variable dataset, calculate the current address descriptor's current storage unit based on the storage unit of the previous address descriptor, the byte address bits of the current address descriptor, and the type length.

[0041] Optionally, in this embodiment, taking the first variable in the variable dataset as an example, the initial storage unit is 0, the first address descriptor of the first variable is %IX4.6, the byte address bits are 4, the type length is 1, and the calculated first storage unit of the address descriptor is 0x10. Taking the second variable in the variable dataset as an example, the previous variable of the second variable is the first variable, the first storage unit of the first address descriptor of the first variable is 0x10, the second address descriptor of the second variable is %IB3, the byte address bits are 3, the type length is 1, and the calculated second storage unit of the second address descriptor is 0x18.

[0042] As an optional example, calculating the current storage unit of the current address descriptor based on the initial storage unit, the byte address bits of the current address descriptor, and the type length includes:

[0043] The current address set of the current address descriptor is calculated based on the current byte address bit and the current type length of the current address descriptor;

[0044] Iterate through each address in the current address set and calculate the storage sub-unit for each address;

[0045] Perform an OR operation on the storage sub-unit of each address and the initial storage unit to obtain the current storage unit.

[0046] Optionally, in this embodiment, taking the first variable in the variable dataset as an example, the initial storage unit is 0, the first address descriptor of the first variable is %IX4.6, the byte address bits are 4, and the type length is 1. First, the first address set of the first address descriptor is calculated as 4*1+{0}={4}. The storage subunit of address {4} is calculated as 0x10. Since the first address descriptor has only one address, the first storage unit is 0x10. If there are multiple addresses, the storage subunits of each address are ORed to obtain the final storage unit.

[0047] As an optional example, the set of target addresses for calculating the target variable includes:

[0048] Multiply the target type length and the target byte address bits of the target address descriptor to obtain the target start address of the target address descriptor;

[0049] Based on the length of the target type, the starting address of the target is incremented to obtain the set of target addresses.

[0050] Optionally, in this embodiment, taking the target address descriptor of the target variable as %ID2 as an example, the target type length is 4, the target byte address bits are 2, and the target starting address is {0,1,2,3}. Based on the target type length, the target starting address is incremented to obtain the target address set as 2*4+{0,1,2,3}={8,9,10,11}.

[0051] As an optional example, based on the target address set and the storage address, the occupancy detection result for each address in the target address set is calculated as follows:

[0052] For each address in the target address set, treat it as the current address and perform the following operation on the current address:

[0053] Calculate the current memory sub-cell at the current address;

[0054] Perform a bitwise AND operation between the current memory sub-unit and the memory address to obtain the current result;

[0055] If the current result is equal to the storage address, the current occupancy detection result of the current address is determined to be that the address is occupied;

[0056] If the current result is not equal to the storage address, the current occupancy detection result is determined to be that the address is not occupied.

[0057] Optionally, in this embodiment, taking the storage address of the variable dataset as 0x00FFFC18 as an example, the target address descriptor of the target variable is the target address set {8,9,10,11} of %ID2. The storage sub-unit of the calculated address {10} is 0x00400. A bitwise AND operation is performed on the storage sub-unit 0x00400 and the storage address 0x00FFFC18, and the result is 0x00FFFC18. Therefore, the current occupancy detection result of address {10} is determined to be that the address is occupied. The storage sub-unit of the calculated address {8} is 0x005F5E100. A bitwise AND operation is performed on the storage sub-unit 0x005F5E100 and the storage address 0x00FFFC18, and the result is 0x00FFFD18. Therefore, the current occupancy detection result of address {8} is determined to be that the address is not occupied.

[0058] As an optional example, after calculating the occupancy detection result for each address in the target address set, the above method further includes:

[0059] If the occupancy detection result of each address in the target address set is that the address is not occupied, it is determined that the target variable address is not occupied.

[0060] Optionally, in this embodiment, the system uses the target address set and the storage address to determine whether each address in the target address set conflicts with the storage address. If no address conflicts with any of the addresses, the user input is valid, and the target variable input by the user is saved.

[0061] To illustrate with an example, this application relates to a method for detecting the occupancy of variable addresses. It proposes a bitmap-based variable address information storage structure and caching method, as well as a search algorithm using this structure, to solve the technical problem of long response time in conventional variable address occupancy detection methods. By making full use of the spatial validity of bit information, it ensures query speed while saving space, thereby speeding up response and improving the user interface experience.

[0062] Variable addresses are divided into three regions: I, Q, and M, containing five types: X, B, W, D, and L, corresponding to BOOL, BYTE, WORD, DOUBLE_WORD, and LONG_WORD data, respectively. The allocation rules for variable address descriptors are as follows: %{I|Q|M}, {B|W|D|L}, {addr}, %{I|Q|M}, X{addr}.{addrbit}, where addr is the byte address and addrbit is the bit address. Table 1 shows the memory mapping for each address type.

[0063] (Table 1)

[0064]

[0065] Optionally, an address data storage structure is proposed. Considering the characteristics of variable addresses, this storage structure consists of three layers: the first layer is a set of region information mappings; the second layer is an array of all byte address information for the corresponding region; and the third layer is a set of bit address data mappings corresponding to a specific byte address. Each number in the second layer can store a maximum of 32 bytes of address, and each number in the third layer can store a maximum of 32 bits of address.

[0066] It can be done Figure 2 , Figure 3 as well as Figure 4 The process is described in detail below to implement variable address information caching and detection:

[0067] First, initialize the bitmap set BitMap = {I:number[],Q:number[],M:number[]}, BitMapX = {}.

[0068] Then, load the existing data sequentially and establish the corresponding bitmap cache. Check for address conflicts; if a conflict occurs, log it; if necessary, store the information in a BitMap. Specifically, check if the type is X; if so, store the information in BitMapX.

[0069] Then, the system waits for the user to input a variable address on the interface. After input, the system checks for conflicts using a bitmap cache set. If a conflict exists, the conflicting item is highlighted in a warning color on the interface; if no conflict exists, the user input is considered valid, the input value is saved, and the process ends.

[0070] Here, BitMap is a bitmap cache array with data type number[], and each bitmap cache can store a maximum of 32 bytes of address. For the address of a variable of type X, a BitMapX cache address is introduced, with data type {key: number}, and each bit stores information from Xn.0 to Xn+3.7.

[0071] Figure 3 See the flowchart for bitmap caching in [the context]. Figure 4 The algorithm is shown in formulas (1.1) and (1.2):

[0072] BitMap = {BitMap[Addr i / 32]|=1< <Addr i %32,i=1,2,L} ​​(1.1)

[0073] BitMapX = {BitMapX[Addr i / 4]|=1<<((Addr i %4)*8+Addr bit),i=1,2,L} ​​(1.2)

[0074] The calculation method for formula (1.1) is as follows: traverse and calculate the address set Addr i For each address in the address Addr ij First, via address Addr ij Divide by 32 to obtain its corresponding storage sub-unit BitMap[Addr] ij / 32]; Further calculate the storage address offset in this storage unit, using address Addr ij Take the remainder of 32, left-shift 1 by the remainder bits to obtain the storage address; perform a bitwise OR operation between the obtained storage address and the existing value in the storage unit, and assign the result to the storage unit to complete Addr. ij Address storage.

[0075] Formula (1.2) is calculated by traversing and calculating the address set Addr. i For each address in the address Addr ij First, via address Addr ij Divide by 4 to obtain its corresponding storage unit BitMapX[Addr] ij / 4]; Further calculate the storage address in this memory unit, first calculate the bit offset, using the address Addr ij Multiply by 8 and add the remainder of 4. bit The address is obtained by left-shifting 1 by the address offset; the obtained address is then bitwise ORed with the existing value in the memory location, and the result is assigned to the memory location, thus completing Addr. ij Address storage.

[0076] The deduplication check algorithm is given in formula (1.3).

[0077] BitMap[Addr i / 32]&(1< <Addr i %32)==1< <Addr i 32% (1.3)

[0078] Formula (1.3) is calculated by traversing and calculating the address set Addr. i For each address in the address Addr ij First, via address Addr ij Divide by 32 to obtain its corresponding storage unit BitMapX[Addr] ij / 32]; Further calculate the byte address offset, using address Addr ijTake the remainder of 32, then left-shift 1 by the remainder bits; further determine if there is a conflict by performing a bitwise AND operation between the previously calculated value and the existing value in the storage unit, and determine if it is equal to the original value. If they are equal, there is a conflict; otherwise, there is no conflict.

[0079] The algorithm for calculating the variable address is shown in formula (1.4).

[0080] Addr i ={Addr i |addr*len+j,j=0,1,L,len-1} (1.4)

[0081] Formula (1.4) is calculated as follows: For the address set Addr i First, calculate the starting address Addr. i0 The value is the byte address `addr` multiplied by the data type length `len`; furthermore, based on the byte type length `len`, an increment operation is performed sequentially, i.e., `Addr`... ij =Addr i0 +j, ultimately yielding the address set Addr i .

[0082] Optionally, the algorithm calculation process can be demonstrated using the dataset (Table 2) as an example.

[0083] (Table 2)

[0084] IN1 BOOL %IX4.0 IN2 BYTE %IB4 IN3 WORD %IW2 IN4 DWORD %ID1 IN5 LWROD %IL0

[0085] Initially, BitMap I =0, iterate through each variable, calculate its address, and store it in the bitmap buffer. The process can be roughly described as follows:

[0086] First, read the address descriptor %IX4.6 of variable IN1. The address bits addr = 4, the bit address bits addrbit = 6, and the type length len = 1. Calculate the address set Addr0 = 4 * 1 + {0} = {4} according to formula (1.4). Determine the type as X. Calculate BitMapX according to formula (1.2). Traverse the address set Addr0, then BitMapX[4 / 4 = 1] = 0 | (1 << (4%4) * 8 + 6) = 0x40. Then, according to formula (1.1), itMap[4 / 32 = 0] = 0 | (1 << 4%32) = 0x10.

[0087] Then, read the address descriptor %IB3 of variable IN2, where the byte address bit addr = 3 and the type length len = 1, and calculate Addr1 = 3 * 1 + {0} = {3}. Determine the type as B, and directly calculate BitMap[3 / 32 = 0] = 0x10 | (1 << 3 % 32) = 0x18. The results are shown in Table 3.

[0088] (Table 3)

[0089]

[0090] Then, the variable addresses are read sequentially and the bitmap cache is calculated. Finally, the calculated results are: BitMap = {'I':[0x00FFFC18]}, BitMapX = {1:0x40}.

[0091] Assuming the target address descriptor of the target variable input by the user is %ID2, the four addresses of %ID2, Addr = 2*4 + {0, 1, 2, 3} = {8, 9, 10, 11}, are calculated sequentially and verified against BitMap. The result of 0x00FFFC18 & (1<<10) == (1<<10) is true, indicating that the address is occupied.

[0092] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0093] According to another aspect of the embodiments of this application, a variable address occupancy detection device is also provided, such as... Figure 5 As shown, it includes:

[0094] The acquisition module 502 is used to acquire a variable dataset and a target variable. The variable dataset includes at least one variable, and each variable corresponds to an address descriptor. The target variable is the variable that the user will input into the variable dataset.

[0095] The first calculation module 504 is used to calculate the storage address of the variable dataset based on the byte address bits and type length of each address descriptor in the variable dataset;

[0096] The second calculation module 506 is used to calculate the target address set of the target variable, and based on the target address set and the storage address, calculate the occupancy detection result of each address in the target address set, wherein the occupancy detection result includes whether the address is occupied or not.

[0097] The first determining module 508 is used to determine that the target address descriptor of the target variable is occupied when the occupancy detection result of any address in the target address set is that the address is occupied.

[0098] Optionally, in this embodiment, considering the characteristics of variable addresses, the variable address information storage structure consists of a three-layer structure. The first layer is a set of region information mappings, the second layer is an array of all byte address information for the corresponding region, and the third layer is a set of bit address data mappings corresponding to a certain byte address. Each number in the second layer can store a maximum of 32 byte addresses, and each number in the third layer can store a maximum of 32 bit addresses. Variable addresses are divided into three regions: I, Q, and M, containing five types: X, B, W, D, and L, corresponding to BOOL, BYTE, WORD, DOUBLE_WORD, and LONG_WORD data, respectively. Specifically, the type length of the address descriptor for type X is 1, the type length of the address descriptor for type B is 1, the type length of the address descriptor for type W is 2, the type length of the address descriptor for type D is 4, and the type length of the address descriptor for type L is 8.

[0099] Optionally, in this embodiment, the storage address of the address descriptor of each variable in the variable dataset is first traversed and calculated, and the storage address of the variable dataset is finally obtained. Then, the user is waited for to input the target address descriptor of the target variable on the interface. After input, the target address set of the target variable is calculated, and it is determined whether there is a conflict between the target address set and each address in the storage address of the variable dataset. If any address has a conflict, the conflict item is highlighted in a warning color on the interface to warn the user that the target address descriptor of the target variable has been occupied.

[0100] As an optional example, the first computation module includes:

[0101] The first computing unit is a storage unit used to sequentially compute each address descriptor in the variable dataset;

[0102] The determination unit is used to determine the storage address of the address descriptor of the last variable in the variable dataset.

[0103] Optionally, in this embodiment, the storage unit of each address descriptor in the variable dataset is calculated sequentially, and finally the storage unit of the address descriptor of the last variable in the variable dataset is determined as the storage address.

[0104] As an optional example, the first computational unit includes:

[0105] The processing subunit is used to sequentially treat each address descriptor in the variable dataset as the current address descriptor and perform the following operations on the current address descriptor:

[0106] If the current address descriptor is the address descriptor of the first variable in the variable dataset, calculate the current storage unit of the current address descriptor based on the initial storage unit, the byte address bits of the current address descriptor, and the type length;

[0107] If the current address descriptor is not the address descriptor of the first variable in the variable dataset, calculate the current address descriptor's current storage unit based on the storage unit of the previous address descriptor, the byte address bits of the current address descriptor, and the type length.

[0108] Optionally, in this embodiment, taking the first variable in the variable dataset as an example, the initial storage unit is 0, the first address descriptor of the first variable is %IX4.6, the byte address bits are 4, the type length is 1, and the calculated first storage unit of the address descriptor is 0x10. Taking the second variable in the variable dataset as an example, the previous variable of the second variable is the first variable, the first storage unit of the first address descriptor of the first variable is 0x10, the second address descriptor of the second variable is %IB3, the byte address bits are 3, the type length is 1, and the calculated second storage unit of the second address descriptor is 0x18.

[0109] As an optional example, the processing sub-unit is used for:

[0110] The current address set of the current address descriptor is calculated based on the current byte address bit and the current type length of the current address descriptor;

[0111] Iterate through each address in the current address set and calculate the storage sub-unit for each address;

[0112] Perform an OR operation on the storage sub-unit of each address and the initial storage unit to obtain the current storage unit.

[0113] Optionally, in this embodiment, taking the first variable in the variable dataset as an example, the initial storage unit is 0, the first address descriptor of the first variable is %IX4.6, the byte address bits are 4, and the type length is 1. First, the first address set of the first address descriptor is calculated as 4*1+{0}={4}. The storage subunit of address {4} is calculated as 0x10. Since the first address descriptor has only one address, the first storage unit is 0x10. If there are multiple addresses, the storage subunits of each address are ORed to obtain the final storage unit.

[0114] As an optional example, the second computation module includes:

[0115] The second calculation unit is used to perform a multiplication operation on the target type length and the target byte address bits of the target address descriptor to obtain the target start address of the target address descriptor;

[0116] The third calculation unit is used to increment the target starting address according to the target type length to obtain the target address set.

[0117] Optionally, in this embodiment, taking the target address descriptor of the target variable as %ID2 as an example, the target type length is 4, the target byte address bits are 2, and the target starting address is {0,1,2,3}. Based on the target type length, the target starting address is incremented to obtain the target address set as 2*4+{0,1,2,3}={8,9,10,11}.

[0118] As an optional example, the second computation module includes:

[0119] The processing unit is used to take each address in the target address set as the current address and perform the following operations on the current address:

[0120] Calculate the current memory sub-cell at the current address;

[0121] Perform a bitwise AND operation between the current memory sub-unit and the memory address to obtain the current result;

[0122] If the current result is equal to the storage address, the current occupancy detection result of the current address is determined to be that the address is occupied;

[0123] If the current result is not equal to the storage address, the current occupancy detection result is determined to be that the address is not occupied.

[0124] Optionally, in this embodiment, taking the storage address of the variable dataset as 0x00FFFC18 as an example, the target address descriptor of the target variable is the target address set {8,9,10,11} of %ID2. The storage sub-unit of the calculated address {10} is 0x00400. A bitwise AND operation is performed on the storage sub-unit 0x00400 and the storage address 0x00FFFC18, and the result is 0x00FFFC18. Therefore, the current occupancy detection result of address {10} is determined to be that the address is occupied. The storage sub-unit of the calculated address {8} is 0x005F5E100. A bitwise AND operation is performed on the storage sub-unit 0x005F5E100 and the storage address 0x00FFFC18, and the result is 0x00FFFD18. Therefore, the current occupancy detection result of address {8} is determined to be that the address is not occupied.

[0125] As an optional example, the above-described apparatus further includes:

[0126] The second determining module is used to determine that the target variable address is not occupied after calculating the occupancy detection result of each address in the target address set, provided that the occupancy detection result of each address in the target address set is that the address is not occupied.

[0127] Optionally, in this embodiment, the system uses the target address set and the storage address to determine whether each address in the target address set conflicts with the storage address. If no address conflicts with any of the addresses, the user input is valid, and the target variable input by the user is saved.

[0128] For other examples of this embodiment, please refer to the examples above, which will not be repeated here.

[0129] Figure 6 This is a schematic diagram of an optional electronic device according to an embodiment of this application, such as... Figure 6 As shown, it includes a processor 602, a communication interface 604, a memory 606, and a communication bus 606. The processor 602, communication interface 604, and memory 606 communicate with each other via the communication bus 606.

[0130] Memory 606 is used to store computer programs;

[0131] When processor 602 executes a computer program stored in memory 606, it performs the following steps:

[0132] Obtain the variable dataset and the target variable. The variable dataset includes at least one variable, and each variable corresponds to an address descriptor. The target variable is the variable that the user will input into the variable dataset.

[0133] Calculate the storage address of the variable dataset based on the byte address bits and type length of each address descriptor in the variable dataset;

[0134] Calculate the target address set of the target variable, and based on the target address set and the storage address, calculate the occupancy detection result of each address in the target address set;

[0135] If the occupancy detection result of any address in the target address set is that the address is occupied, it is determined that the target address descriptor of the target variable is occupied.

[0136] Optionally, in this embodiment, the communication bus can be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 The symbol is represented by a single thick line, but this does not indicate that there is only one bus or one type of bus. The communication interface is used for communication between the aforementioned electronic devices and other devices.

[0137] The memory may include RAM, or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.

[0138] As an example, the memory 606 described above may include, but is not limited to, the acquisition module 502, the first calculation module 504, the second calculation module 506, and the first determination module 506 in the variable address occupancy detection device. Furthermore, it may include, but is not limited to, other module units in the variable address occupancy detection device, which will not be elaborated upon in this example.

[0139] The processors mentioned above can be general-purpose processors, including but not limited to: CPU (Central Processing Unit), NP (Network Processor), etc.; they can also be DSP (Digital Signal Processor), ASIC (Application Specific Integrated Circuit), FPGA (Field-Programmable Gate Array), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0140] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments, and will not be repeated here.

[0141] Those skilled in the art will understand that Figure 6 The structure shown is for illustrative purposes only. The device implementing the above variable address occupancy detection method can be a terminal device, such as a smartphone (e.g., Android phone, iOS phone), tablet computer, PDA, mobile Internet Devices (MID), PAD, etc. Figure 6 This does not limit the structure of the aforementioned electronic devices. For example, the electronic device may also include components that are more... Figure 6 The more or fewer components shown (such as network interfaces, display devices, etc.), or having the same Figure 6 The different configurations shown.

[0142] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, ROM, RAM, disk or optical disk, etc.

[0143] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer program, which, when executed by a processor, performs the steps in the variable address occupancy detection method described above.

[0144] Optionally, in this embodiment, those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0145] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0146] If the integrated units in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in the aforementioned computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application.

[0147] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0148] In the several embodiments provided in this application, it should be understood that the disclosed client can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection between units or modules, and may be electrical or other forms.

[0149] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0150] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0151] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A method of variable address occupancy detection, characterized by, include: Obtain a variable dataset and a target variable, wherein the variable dataset includes at least one variable, each variable corresponds to an address descriptor, and the target variable is the variable that the user will input into the variable dataset; The storage address of the variable dataset is calculated based on the byte address bits and type length of each address descriptor in the variable dataset. Calculate the target address set of the target variable, and based on the target address set and the storage address, calculate the occupancy detection result for each address in the target address set, wherein the occupancy detection result includes whether the address is occupied or not. If the occupancy detection result of any address in the target address set is that the address is occupied, it is determined that the target address descriptor of the target variable is occupied; The calculation of the target address set of the target variable includes: performing a multiplication operation on the target type length and the target byte address bits of the target address descriptor to obtain the target starting address of the target address descriptor; and performing an increment operation on the target starting address according to the target type length to obtain the target address set.

2. The method of claim 1, wherein, The step of calculating the storage address of the variable dataset based on the byte address bits and type length of each address descriptor in the variable dataset includes: The storage unit of each address descriptor in the variable dataset is calculated sequentially; The storage address is determined by the storage unit of the address descriptor of the last variable in the variable dataset.

3. The method of claim 2, wherein, The storage unit for sequentially calculating each address descriptor in the variable dataset includes: Each address descriptor in the variable dataset is taken as the current address descriptor, and the following operations are performed on the current address descriptor: If the current address descriptor is the address descriptor of the first variable in the variable dataset, the current storage unit of the current address descriptor is calculated based on the initial storage unit, the byte address bits of the current address descriptor, and the type length. If the current address descriptor is not the address descriptor of the first variable in the variable dataset, the current storage unit of the current address descriptor is calculated based on the storage unit of the previous address descriptor, the byte address bits of the current address descriptor, and the type length.

4. The method of claim 3, wherein, The step of calculating the current storage unit of the current address descriptor based on the initial storage unit, the byte address bits of the current address descriptor, and the type length includes: The current address set of the current address descriptor is calculated based on the current byte address bit and the current type length of the current address descriptor; Iterate through each address in the current address set and calculate the storage sub-unit for each address; The current storage unit is obtained by performing an OR operation on the storage sub-unit of each address and the initial storage unit.

5. The method of claim 1, wherein, The step of calculating the occupancy detection result for each address in the target address set based on the target address set and the storage address includes: For each address in the target address set, take it as the current address and perform the following operation on the current address: Calculate the current storage sub-unit at the current address; Perform a bitwise AND operation between the current storage sub-unit and the storage address to obtain the current result; If the current result is equal to the storage address, the current occupancy detection result of the current address is determined to be that the address is occupied; If the current result is not equal to the storage address, the current occupancy detection result is determined to be that the address is not occupied.

6. The method of claim 1, wherein, After calculating the occupancy detection result for each address in the target address set, the method further includes: If the occupancy detection result of each address in the target address set is that the address is not occupied, it is determined that the target variable address of the target variable is not occupied.

7. A variable address occupancy detection apparatus, characterized by, include: The acquisition module is used to acquire a variable dataset and a target variable, wherein the variable dataset includes at least one variable, each variable corresponds to an address descriptor, and the target variable is the variable that the user will input into the variable dataset; The first calculation module is used to calculate the storage address of the variable dataset based on the byte address bits and type length of each address descriptor in the variable dataset; The second calculation module is used to calculate the target address set of the target variable, and based on the target address set and the storage address, calculate the occupancy detection result of each address in the target address set, wherein the occupancy detection result includes whether the address is occupied or not. The first determining module is used to determine that the target address descriptor of the target variable is occupied when the occupancy detection result of any address in the target address set is that the address is occupied; The second calculation module is further configured to: perform a multiplication operation on the target type length and the target byte address bits of the target address descriptor to obtain the target starting address of the target address descriptor; and perform an increment operation on the target starting address according to the target type length to obtain the target address set.

8. A computer-readable storage medium storing a computer program, the computer-readable storage medium being characterized by, The computer program is executed by the processor to perform the method described in any one of claims 1 to 6.

9. An electronic device comprising a memory and a processor, characterized in that The memory stores a computer program, and the processor is configured to execute the method described in any one of claims 1 to 6 through the computer program.

Citation Information

Patent Citations

  • Data block processing method, device and equipment, and storage medium

    CN112463077A

  • Logic address allocation method and device, electronic equipment and storage medium

    CN116633900A