The document describes memory mapping functions for 1D and 2D arrays. It explains that the location of an element in a 2D array can be calculated using either row-major or column-major order mapping. Row-major order stores arrays by rows, while column-major order stores by columns. Formulas are provided to calculate an element's location based on its indices and whether indexing starts from 0 or 1. Memory mapping for a 1D array simply uses the index multiplied by the word size.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
95 views1 page
Memory Mapping Function For 2D Array
The document describes memory mapping functions for 1D and 2D arrays. It explains that the location of an element in a 2D array can be calculated using either row-major or column-major order mapping. Row-major order stores arrays by rows, while column-major order stores by columns. Formulas are provided to calculate an element's location based on its indices and whether indexing starts from 0 or 1. Memory mapping for a 1D array simply uses the index multiplied by the word size.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1
Memory Mapping Function for 2D array
Location of A [i, j] with Size = Row Size x ColSize can be calculated
using following mapping function A. Row Major Order Mapping: Assume that the matrix is collection of rows. In this mapping scheme 1st row is stored from the base address then 2nd row is stored then 3rd row is stored and so on. So, in this scheme row is assumed as unit to be stored Case 1: Index started from 0, 0 Location = Base Address (A) + {(i*ColSize) + j}*Word Size) Case 2: Index started from 1, 1 Location = Base Address (A) + [{(i-1)*ColSize} + (j-1)]*Word Size) B. Column Major Order Mapping: Assume that the matrix is collection of columns. In this mapping scheme 1st column is stored from the base address then 2nd column is stored then 3rd column is stored and so on. So, in this scheme column is assumed as unit to be stored. Case 1: Index started from 0, 0 Location = Base Address(A) + {i + (j*RowSize)}*Word Size) Case 2: Index started from 1, 1 Location = Base Address(A) + [(i-1) + {(j-1)*RowSize}]*Word Size)
Memory Mapping Function for 1D array
Location of A[i] can be calculated using following mapping function Case 1: Index started from 0 Location = Base Address (A) + (i*Word Size) Case 2: Index started from 1 Location = Base Address (A) + ((i-1)*Word Size)