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

Go to the source code of this file.

Functions

dreg pro_flood_from_boundary (dreg r1)
 flooding a DREG plane with '1's from the boundary More...
 
dreg pro_flood_from_source (dreg r1, dreg r2)
 flooding a DREG plane with '1's from the '1's in another DREG plane More...
 
dreg pro_digital_news (dreg r1, string str)
 acquire a certain DREG of from adjunct PEs More...
 
dreg pro_diffuse (areg r1, int p1, int p2)
 diffuse a AREG plane More...
 
 pro_locate_event (dreg r1, reg o1, reg o2)
 locate a '1' in a DREG plane, starting from bottom right More...
 

Detailed Description

Author
Jianing Chen

Function Documentation

dreg pro_flood_from_boundary ( dreg  r1)

flooding a DREG plane with '1's from the boundary

Parameters
r1the control register
Returns
the flooded DREG plane

Flagging: Z.

Used DREG: R0, R1, R2, R3, R4, R12

Starting from the boundary pixels, each pixel that have at least one '1' neighbour will be filled with 1 if the control register of that pixel is 1. This step is repeated hundreds of times asynchronously in less than 20 clock cycles. As a result, after one call of this macro, the result register is usually flooded by '1's except those areas that are closed by '0's in the control register.

module_async_propagation.png

Note: the DREG that are used inside this macro cannot be used as the control register. For example, "R1 = pro.flood_from_boundary(R2)" is invalid.

Example Usage:

1 R1 = pro.flood_from_boundary(R5)
dreg pro_flood_from_source ( dreg  r1,
dreg  r2 
)

flooding a DREG plane with '1's from the '1's in another DREG plane

Parameters
r1the control register
r2the source of the flood
Returns
the flooded DREG plane

Used DREG: R0, R1, R2, R3, R4, R12

This process is similar to pro_flood_from_boundary. The only difference is that the source of the flood are from the '1's in another DREG plane rather than the boundary.

module_async_propagation2.png

The traveling distance of the flood will not cover the whole plane. The following image shows the result of a flood sourced by one poxel at (128,128):

module_async_point_flood.png

To increase the traveling distance, one can use this macro multiple times using the result of a previous flood as the source:

1 ipu.pixel_set(R5,100,100)
2 R5 = pro.flood_from_source(R8,R5)
3 R5 = pro.flood_from_source(R8,R5)
4 R5 = pro.flood_from_source(R8,R5)

Note: the DREG that are used inside this macro cannot be used as the control register. For example, "R1 = pro.flood_from_source(R2,R3)" is invalid.

Example Usage:

Flooding R1 from coordinates (100,50):

1 ipu.set_pixel(R6,100,50)
2 R1 = pro.flood_from_source(R5,R6)
dreg pro_digital_news ( dreg  r1,
string  str 
)

acquire a certain DREG of from adjunct PEs

Parameters
r1the DREG of the adjunct PE
strlist of directions, can be 'north' 'east' 'west' 'south'
Returns
the acquired value

Flagging: clr Z.

Used DREG: R0, R1, R2, R3, R4

This is the function to achieve the digital NEWS functionality. Unlike the analogue NEWS, this function allows the read of any DREG of a neighbour PE.

Example Usage:

Shift R5 DREG plane to the east:

1 R5 = pro.digital_news(R5,'west')

Shift R5 DREG plane to the north east:

1 R5 = pro.digital_news(R5,'west')
2 R5 = pro.digital_news(R5,'south')

Let THIS.R5 = WEST.R5 OR SOUTH.R5:

1 R5 = pro.digital_news(R5,'west south')
dreg pro_diffuse ( areg  r1,
int  p1,
int  p2 
)

diffuse a AREG plane

Parameters
r1the source AREG value
p1Boolean value, enable vertical diffusion
p2Boolean value, enable horizontal diffusion
Returns
the diffused AREG value

Used DREG: R0, R1, R2, R3

This function diffuse the AREG plane asynchronously.

Example Usage:

1 A = pro.diffuse(A,1,1)
pro_locate_event ( dreg  r1,
reg  o1,
reg  o2 
)

locate a '1' in a DREG plane, starting from bottom right

Parameters
r1the DREG plane to be searched
o1ipu register to store the x coordinate
o2ipu register to store the y coordinate
Returns
the diffused AREG value

Used DREG: R0, R1, R2, R3

This function locate a '1' in a DREG plane. The search starts from south east and proceed towards north first. This process is executed asynchronously, which means the distance between the '1' and the start location won't affect the time cost to search.

Example Usage:

Get the coordinates of the first '1' in R5 DREG plane.

1 pro.locate_event(R5,s1,s2)

A more systematic usage of events scanning can be found in Example 8: Events Scanning.