[raspi-internals] Vector Instructions: Column Base Offset

  • From: Herman Hermitage <hermanhermitage@xxxxxxxxxxx>
  • To: "raspi-internals@xxxxxxxxxxxxx" <raspi-internals@xxxxxxxxxxxxx>
  • Date: Mon, 1 Jul 2013 22:59:42 +1200

Something I've witnessed in a few filters that do accumulation or blurring 
across a few frames.

Status register bits SR[5:4] act as a column base offset.

Instructions to manipulate CB:
0000 0000 0000 0110    cbclr               Clear vector column base ie SR[5:4] 
= 0
0000 0000 0000 0111    cbinc               Increment vector column base ie 
SR[5:4]++
0000 0000 0000 1000    cbchg               Toggle vector column base ie SR[5] = 
~SR[5]
0000 0000 0000 1001    cbdec               Decrement vector column base ie 
SR[5:4]--


Then in the 80 bit vector instructions, the extended vector flags f_d, f_a, f_b:

5:2      Scalar register r0-r14, if required; otherwise, all 1's (ie r15 is not 
available)
1        If set, increment argument by 1 for each instruction repetition.
         Y coordinate is incremented if argument is horizontal; X coordinate if 
vertical.
0        If set use bits 5:4 of SR as a column offset for the vector reference. 
 ie. P(y,x) becomes P(y,(x+cb*16)&61).

So setting the least significant bit, adjusts the vector coordinates according 
to the current value of CB (SR[5:4]).

eg.

cbclr
vmov H(0,0)+CB, #100
cbinc 
vmov H(0,0)+CB, #101
cbinc
vmov H(0,0)+CB, #102
cbinc
vmov H(0,0)+CB, #103

would result in H(0,0) = 100, H(0,16) = 101, H(0,32) = 102, H(0,48) = 103

The offset always seems to be horizontal, irrespective of the orientation of 
the vector.

The main purpose seems to be simplifying kernels that need to refer to a 
previous buffer.  It saves gymnastics with scalar register offsets.

HH.

                                          

Other related posts: