| Electronic Components Datasheet Search |
|
ST20-C1 Datasheet(PDF) 42 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
ST20-C1 Datasheet(HTML) 42 Page - STMicroelectronics |
|
42 / 205 page ![]() 4.5 Forming addresses 42/205 ® Access to a component of an array can be split into two sections; first the address of the component must be constructed, and then the transfer of data to or from that component must be performed. Evaluating a subscript Array subscripts can be evaluated efficiently using the smul or mul instruction. If array A has been declared by int A[S1] .. . [Sn]; where Si (i = 1..n) are the dimensions, then one way of arranging this in memory is to have all elements of the array in a contiguous block. For the purposes of this section, suppose that the elements in the last dimension are stored adjacently; otherwise change the order of the dimension subscripts. For example Figure 4.1 shows the elements of a particular three dimensional array (Array) stored in this way. Figure 4.1 A possible method of storing an array of integers If an access is required to the following array element A[e1] ... [en] then the code to evaluate the subscript is e1; ldc S2; mul; e2; add; ldc S3; mul; e3; add; .. . ldc Sn; mul; en; add; For example to evaluate the subscript for element Array[x][y][z], (where Array is declared as in Figure 4.1) the code sequence is ld x; ldc 2; mul; ld y; add; ldc 3; mul; ld z; add; If x is 1, y is 0 and z is 2, then this evaluates to 8, which as can be seen from Figure 4.1, is the correct offset from the base of the array. Array[1][1][1] Array[1][1][0] Array[1][1][2] Array[1][0][1] Array[1][0][0] Array[1][0][2] Array[0][1][1] Array[0][1][0] Array[0][1][2] Array[0][0][1] Array[0][0][0] Array[0][0][2] int Array[ 2][2][3]; Increasing memory addresses Contiguous locations for words in memory space |
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |