SCAMP-5c Vision System  1.0.0
An image sensor with a parallel processor on focal plane
Data Structures | Functions
pe_analog_macros.h File Reference

Go to the source code of this file.

Data Structures

class  areg
 operand of this type can only be an analogue register More...
 

Functions

 pe_rpix ()
 reset PIX (the photodiode) More...
 
 pe_rpix (areg a1, areg a2)
 read the image from PIX in to AREGs, and reset PIX More...
 
areg pe_mov (areg a1)
 make a copy of an AREG More...
 
areg pe_add (areg a1, areg a2)
 add two AREGs More...
 
areg pe_sub (areg a1, areg a2)
 subtract two AREGs More...
 
areg pe_neg (areg a1)
 invert the polarity of AREG and copy to another AREG More...
 
areg pe_abs (areg a1)
 take the absolute value of an AREG and copy to another AREG More...
 
 pe_div (areg a1, areg a2, areg a3)
 divide (by half) an AREG into two AREGs More...
 
areg pe_in (r_int v)
 set an analogue register for all pe with a value More...
 
areg pe_north (areg a1)
 copy the AREG of the north neighbouring PE More...
 
areg pe_east (areg a1)
 copy the AREG of the east neighbouring PE More...
 
areg pe_west (areg a1)
 copy the AREG of the west neighbouring PE More...
 
areg pe_south (areg a1)
 copy the AREG of the south neighbouring PE More...
 

Detailed Description

Author
Jianing Chen

Function Documentation

pe_rpix ( )

reset PIX (the photodiode)

As this macro clears the light accumulated on the photodiode, it also marks the beginning of a new exposure period.

pe_rpix ( areg  a1,
areg  a2 
)

read the image from PIX in to AREGs, and reset PIX

Parameters
a1stores the image using a range of [0,-127]
a2stores the image using a range of [-127,-127]

Both of the stored images have positive polarity, but they have different ranges.

For a1, the theoretical range is 0 to 127 from darkest to brightest.

For a2, the theoretical range is -127 to 127 from darkest to brightest.

Example Usage:

The first thing to do in a new frame is likely to be:

1 pe.rpix(B,C)
areg pe_mov ( areg  a1)

make a copy of an AREG

Parameters
a1the AREG to be copied
Returns
the destination AREG to place the copy

Example Usage:

1 A = pe.mov(B)
areg pe_add ( areg  a1,
areg  a2 
)

add two AREGs

Parameters
a1first AREG
a2second AREG
Returns
the result of "a1 + a2"

Example Usage:

The following line arithmetically achieves "A = B + C":

1 A = pe.add(B,C)

The following line arithmetically achieves "B = B + C":

1 pe.add(B,C)
areg pe_sub ( areg  a1,
areg  a2 
)

subtract two AREGs

Parameters
a1the AREG to subtract from
a2the subtracted AREG
Returns
the result of (a1 - a2)

Example Usage:

The following line arithmetically achieves "A = B - C":

1 A = pe.sub(B,C)

The following line arithmetically achieves "B = B - C":

1 pe.sub(B,C)
areg pe_neg ( areg  a1)

invert the polarity of AREG and copy to another AREG

Parameters
a1the source AREG
Returns
the resulted copy

The copy step in this macro is free of offset error.

Example Usage:

The following line arithmetically achieves "A = -B":

1 A = pe.neg(B)
areg pe_abs ( areg  a1)

take the absolute value of an AREG and copy to another AREG

Parameters
a1the source AREG
Returns
the resulted copy

The copy step in this macro is free of offset error.

Example Usage:

The following line arithmetically achieves "A = |B|":

1 A = pe.abs(B)
pe_div ( areg  a1,
areg  a2,
areg  a3 
)

divide (by half) an AREG into two AREGs

Parameters
a1the source AREG
a2the first half of the result
a3the second half of the result

The copy step in this macro is free of offset error. Note, the two results may not be equal, a small mismatch error may still exist despite a compensation procedure being applied within this macro.

Example Usage:

The following line arithmetically achieves "B = A/2, C = A/2":

1 pe.div(A,B,C)
areg pe_in ( r_int  v)

set an analogue register for all pe with a value

Parameters
va value with a range of [-128,127]
Returns
the analogue register to store the value

The value used is an signed 8-bit integer. Thus, value warp will occur when overflow or underflow happens. For example, "in(128)" is essentially "in(-128)" and "in(-129)" is "in(127)".

Example Usage:

Filling register A with 50:

1 A = pe.in(50)

Filling register A with a value read from a slider on the host:

1 s0 = usb.slider(my_slider_1)
2 A = pe.in(s0)
areg pe_north ( areg  a1)

copy the AREG of the north neighbouring PE

Parameters
a1the target AREG of the north neighbouring PE
Returns
the value analogue register

Example Usage:

Copy B of the north neighbour to the B in this PE:

1 B = pe.north(B)
areg pe_east ( areg  a1)

copy the AREG of the east neighbouring PE

Parameters
a1the target AREG of the east neighbouring PE
Returns
the value analogue register
areg pe_west ( areg  a1)

copy the AREG of the west neighbouring PE

Parameters
a1the target AREG of the west neighbouring PE
Returns
the value analogue register
areg pe_south ( areg  a1)

copy the AREG of the south neighbouring PE

Parameters
a1the target AREG of the south neighbouring PE
Returns
the value analogue register