SCAMP-5c Vision System  1.0.0
An image sensor with a parallel processor on focal plane
PE Instructions and Programming Outline

Introduction

PE operations are issued by the IPU to all of the 256x256 PEs simultaneously while each of the PE executes the operation with its own registers.

PE Registers

Each of the PEs has 7 analogue registers, 13 digital registers and 3 special registers.

Analogue Registers

A, B, C, D, E, F, NEWS.

Among these registers:

Digital Registers

R0, R1, R2, ... R11, R12.

Among these registers:

Special Registers

PIX, IN, FLAG

PE Operations

Native PE Register Arthematic Operations

Native PE arthematic statement is written as "<list of destination registers> = <list of source registers>", which means divide the sum of the source registers equally into the destination registers. Such a statements can thus achieve addition and division of analogue registers, as well as performing logical OR of digital registers. For the analogue case, the result in the left side of the "=" is the negative copy of the supposed result. For instance, "A = B C" mathematically achieves "A = -(B + C)", while "A = B" is "A = -B". Note, statment written like these cannot be executed as simulation. Furthermore, they do not handle the error occured in native operations.

More examples:

Add B and C into A:

A = B C // A = -(B + C)

Add B, C and D into A:

A = B C D // A = -(B + C + D)

Divide C in to A and B :

A B = C // A = -0.5*C, B = -0.5*C

Digital OR:

R1 = R2 R3 // R1 = R2 OR R3
R1 = R2 R3 R4 // R1 = R2 OR R3 OR R4

Constant value can be written directly into digital registers:

R5 = 1 // set R5
R6 = 0 // clear R6
R1 R2 R3 R4 = 1 // set all of the four digital registers

Native PE Instructions

Some of the speical operations need to be done using the native PE instructions listed in the following table:

Instruction Example Functionaility
respix "respix" reset PIX to lowest level (-127)
res "res(A)" reset an AREG to 0
load* "A = load(B,C)" native arthematic operation "A = B C"
where "where(A)" set FLAG at where A > 0
where "where(R1)" set FLAG according to R1
all "all" set FLAG
not "R1 = not(R2)" logical NOT for digital registers

(*) Simulation support for "load" has not been finished yet, but it is planned to be used when a native arthematic operation need to be used.

Analogue Saturation

Each of the analogue registers stores a signed value using current. When the value of an analogue register need to be read by any digital device (such as the PC host), it is digitized an 8-bit integer with range [-128,127] while maximum and minimum represent the min max value inherited from the sources of all values (IN and PIX). However, after arthmatic operations are applied, the value store in a analogue register can go beyond that range.

For example, the following addition will result a value around 150 to be stored in A:

B = in(70)
C = in(80)
A = add(B,C)

However, when A is read out, the value will still be 127 as it is the maximum value the ADC can provide.

The exact value stored internally can be checked by dividing the result of an addition:

B = in(80)
C = in(70)
A = add(B,C)
div(A,D,E)

After the above code, 'D' and E will be roughly 75 which implies A holds a value around 150.

Nevertheless, the internal value will start diminishing when it is too big. However, there is not a hard threshould.

(TODO: soft saturation plot)