by Guest »
I'm working on a pretty simple function for HLS, to take in data as it comes in and multiply the value by a corresponding value in an array, and send the result back to the processor. For some reason, 0 is the only value retrieved from my Array, whick I checked using hexprint. I srunk the array to experiment with it, but the full size is 283x696. Is there any reason why zero would be the only thing out? Is it not being initialized properly?
- Code: Select all
//6/22/15 The previous version worked, but the output was a bit weird;
//After talking to V, a potential reason for this is the cf factor being greater than 1.
//Going to change the value to 2.0, and see if the answeres line up this time.
//Also going to take out some of the "potentially" useless code in the function,
//before the first line of main execution
#include <math.h>
#include <stdint.h>
#include "xilly_debug.h"
//#include "coeff.h"
#define IMAGE_WIDTH 696
#define TOTAL_BANDS 520
#define SKIPBYTES 896
#define SKIPCOUNT 448 // (896/2)
// When creating data cube, it is helpful to discard unneeded bands.
#define SHORTEST_BAND_TO_INCLUDE 171 // Must be between 1 and 519
#define SHORTEST_SKIPCOUNT 119016 // (171*696*2/2)
#define LONGEST_BAND_TO_INCLUDE 453 // Must be between 2 and 520, greater than SHORTEST_BAND_TO_INCLUDE
#define LONGEST_SKIPCOUNT 46632 // (67*696*2/2)
#define PROCESSCOUNT 196968 // (283*696*2/2)
// BANDS = LONGEST_BAND_TO_INCLUDE - SHORTEST_BAND_TO_INCLUDE + 1;
#define BANDS 283
#define RADIANCE_SCALING_FACTOR 100
int m = 0;
int n = 0;
int cf[4]={2,2,2,2];
uint16_t radCorr(uint16_t unCorrPixel){
uint16_t corrPixel; //Holder for the corrected pixel value
uint16_t x2;
float a2, b2;
int c2;
a2 = (float) unCorrPixel;// * cf_mn;//L0R
c2 = cf[0];
xilly_hexprint(c2, 1);
xilly_puts("\n");
b2 = a2 * c2* RADIANCE_SCALING_FACTOR;
corrPixel = *((uint16_t *) &b2); // Convert float to uint16_t
return corrPixel;
//IF this works like inner array tester, then 2.0 should be the multiplier ad infinitum.
}
void xillybus_wrapper(int *in, int *out) {
#pragma AP interface ap_fifo port=in
#pragma AP interface ap_fifo port=out
#pragma AP interface ap_ctrl_none port=return
uint32_t a1;
uint16_t x1;
uint16_t y1;
xilly_puts("Hello, world\n");
// Handle input data
a1 = *in++;
x1 = *((uint16_t *) &a1); // Convert uint32_t to uint16_t
// Run the calculations
y1 = radCorr(x1);
// Handle output data
*out++ = y1;
}
I'm working on a pretty simple function for HLS, to take in data as it comes in and multiply the value by a corresponding value in an array, and send the result back to the processor. For some reason, 0 is the only value retrieved from my Array, whick I checked using hexprint. I srunk the array to experiment with it, but the full size is 283x696. Is there any reason why zero would be the only thing out? Is it not being initialized properly?
[code]
//6/22/15 The previous version worked, but the output was a bit weird;
//After talking to V, a potential reason for this is the cf factor being greater than 1.
//Going to change the value to 2.0, and see if the answeres line up this time.
//Also going to take out some of the "potentially" useless code in the function,
//before the first line of main execution
#include <math.h>
#include <stdint.h>
#include "xilly_debug.h"
//#include "coeff.h"
#define IMAGE_WIDTH 696
#define TOTAL_BANDS 520
#define SKIPBYTES 896
#define SKIPCOUNT 448 // (896/2)
// When creating data cube, it is helpful to discard unneeded bands.
#define SHORTEST_BAND_TO_INCLUDE 171 // Must be between 1 and 519
#define SHORTEST_SKIPCOUNT 119016 // (171*696*2/2)
#define LONGEST_BAND_TO_INCLUDE 453 // Must be between 2 and 520, greater than SHORTEST_BAND_TO_INCLUDE
#define LONGEST_SKIPCOUNT 46632 // (67*696*2/2)
#define PROCESSCOUNT 196968 // (283*696*2/2)
// BANDS = LONGEST_BAND_TO_INCLUDE - SHORTEST_BAND_TO_INCLUDE + 1;
#define BANDS 283
#define RADIANCE_SCALING_FACTOR 100
int m = 0;
int n = 0;
int cf[4]={2,2,2,2];
uint16_t radCorr(uint16_t unCorrPixel){
uint16_t corrPixel; //Holder for the corrected pixel value
uint16_t x2;
float a2, b2;
int c2;
a2 = (float) unCorrPixel;// * cf_mn;//L0R
c2 = cf[0];
xilly_hexprint(c2, 1);
xilly_puts("\n");
b2 = a2 * c2* RADIANCE_SCALING_FACTOR;
corrPixel = *((uint16_t *) &b2); // Convert float to uint16_t
return corrPixel;
//IF this works like inner array tester, then 2.0 should be the multiplier ad infinitum.
}
void xillybus_wrapper(int *in, int *out) {
#pragma AP interface ap_fifo port=in
#pragma AP interface ap_fifo port=out
#pragma AP interface ap_ctrl_none port=return
uint32_t a1;
uint16_t x1;
uint16_t y1;
xilly_puts("Hello, world\n");
// Handle input data
a1 = *in++;
x1 = *((uint16_t *) &a1); // Convert uint32_t to uint16_t
// Run the calculations
y1 = radCorr(x1);
// Handle output data
*out++ = y1;
}
[/code]