Shop OBEX P1 Docs P2 Docs Learn Events
Hub test case proposal — Parallax Forums

Hub test case proposal

TubularTubular Posts: 4,705
edited 2014-05-16 14:45 in Propeller 2
I've come up with this as a possible test case for discussion / cycle profiling. It's based on acquiring live data from a camera (eg PropCam!) that is only known at runtime, and passing the data through an arbitrary transfer function (eg to do histogram equalization) that is located in the hub memory

I've deliberately limited it to 4 bit input data as I think that's sufficient to see whether claims hold true, when manipulating the input data for edge cases

There may be up to 32 cycles of timing variability depending on where things start and end relative to the cog's natural hub slot. However there are three opportunities to 'slip' in between hub reads, which could mean 45 cycles that would exceed the 32 cycle timing allowance and indicate an 'issue'. If necessary we could examine a RdBloc version

'Test case: acquiring and displaying data from Propcam.  Input: 4 bit pixels, 
'values could be anything 0..F eg all black 0,0,0,0, or a gradient 0,1,2,3 or 6,4,2,0 etc
'Runs through a nonlinear transform for equalization or other transform
'hub mem < $1ff.  Cog memory lookup value starts at hub base = $2000   ($2000..$200F)


'acquire data
mov $100, pixelvalue0           'acquire 4 bit pixel values from camera
mov $101, pixelvalue1            'could be any value 0..$F
mov $102, pixelvalue2
mov $103, pixelvalue3


'turn it into lookup pointers
add pixelvalue0, hubbase            'add 2000 to convert to hub ram pointer for lookup.  via constant eg hubbase=$2000
add pixelvalue1, hubbase
add pixelvalue2, hubbase
add pixelvalue3, hubbase            'so far this is all in cog and deterministic and file


'look up the transformed data to display
mov ticks1, CNT
rdlong displayvalue0, pixelvalue0    'determine transformed value to display for first pixel
rdlong displayvalue1, pixelvalue1
rdlong displayvalue2, pixelvalue2
rdlong displayvalue3, pixelvalue3 
mov ticks2, CNT


'display the transformed data...


Sign In or Register to comment.