I am presenting here a pascal program for matrix multiplication and the corresponding PDP-11 program from the book "Computer Organization" by Carl Hamacher. I have some doubts which I would request the list to look into. I have appended these questions at the end.
for i:= 0 to n-1 do
for j:= 0 to n-1 do
for k:= 0 to n-1 do
C(i,j):= C(i,j) + A(i,k) x B(i,k)
LOOPI: CLR R2
LOOPJ: MOV R2,R1
LOOPK: MOV R4,R3
Here, R0, R2 and R4 hold the values i, j and k respectively. N is the memory location holding the value n. Array subscripts run from (0,0) to (n-1,n-1). The elements of each array are stored in consecutive word locations beginning with (0,0) and continuing in column order. All the elements are 16-bit integers.
My question is: In the book, the formula for calculating the byte address of element(i,j) of an array, relative to the address of the first element, is given as 2(nxj+i). Could anyone provide an explanation?.
Secondly, how is it that the addressable space of a PDP-11 is 2-to-the-power-of-15 words or 2-to-the-power-of-16 bytes? Since each word consists of 16 bits, it should have been 2-to-the-power-of-16 words.
thanks and regards