I then tried to write the software in EDK and I'm running into big troubles. I don't think I really understand how the HW/SW interface works. My process takes in two 32bit inputs and the returns the output, 32 bits. The hardware process is called "mult." I have successfully imported the pcore and connected it. Running a hello world without and impulse functions on the hardware doesn't blow up, so at least I know it's not totally wrong. I don't know if I'll run into hardware issues yet, but I'm stuck on software.
CODE
#include "xio.h"
#include "xparameters.h"
#include "co.h"
#include "mult.h"
#include "fsl_if.h"
Xint32 a,b,c;
unsigned long err;
int main() {
co_architecture my_arch;
void *param = NULL;
my_arch = co_initialize(param);
co_execute(my_arch);
return;
}
void mult(co_stream numIn, co stream result) {
a = 24;
b = 24;
xil_printf("Hello World\r\n");
xil_printf("Multiplying %d by %d\r\n");
HW_STREAM_OPEN(mult, numIn, O_WRONLY, INT_TYPE(STREAMWIDTH));
HW_STREAM_OPEN(mult, result, O_RDONLY, INT_TYPE(STREAMWIDTH));
HW_STREAM_WRITE(mult, numIn, a);
HW_STREAM_WRITE(mult, numIn, b);
HW_STREAM_READ(mult, result, c, err);
xil_printf("Result: %d", c);
HW_STREAM_CLOSE(mult,numIn);
HW_STREAM_CLOSE(mult,result);
}
#include "xparameters.h"
#include "co.h"
#include "mult.h"
#include "fsl_if.h"
Xint32 a,b,c;
unsigned long err;
int main() {
co_architecture my_arch;
void *param = NULL;
my_arch = co_initialize(param);
co_execute(my_arch);
return;
}
void mult(co_stream numIn, co stream result) {
a = 24;
b = 24;
xil_printf("Hello World\r\n");
xil_printf("Multiplying %d by %d\r\n");
HW_STREAM_OPEN(mult, numIn, O_WRONLY, INT_TYPE(STREAMWIDTH));
HW_STREAM_OPEN(mult, result, O_RDONLY, INT_TYPE(STREAMWIDTH));
HW_STREAM_WRITE(mult, numIn, a);
HW_STREAM_WRITE(mult, numIn, b);
HW_STREAM_READ(mult, result, c, err);
xil_printf("Result: %d", c);
HW_STREAM_CLOSE(mult,numIn);
HW_STREAM_CLOSE(mult,result);
}
Here are the error messages:
CODE
/cygdrive/e/ECASP/mult_impulse/main.c: In function 'main':
/cygdrive/e/ECASP/mult_impulse/main.c:13: warning: assignment makes pointer from integer without a cast
/cygdrive/e/ECASP/mult_impulse/main.c: At top level:
/cygdrive/e/ECASP/mult_impulse/main.c:19: error: expected declaration specifiers or '...' before 'co'
/cygdrive/e/ECASP/mult_impulse/main.c:19: error: conflicting types for 'mult'
/cygdrive/e/ECASP/mult_impulse/mult.h:13: error: previous declaration of 'mult' was here
/cygdrive/e/ECASP/mult_impulse/main.c: In function 'mult':
/cygdrive/e/ECASP/mult_impulse/main.c:26: error: expected ':' or ')' before 'p_mult_numIn'
/cygdrive/e/ECASP/mult_impulse/main.c:27: error: expected ':' or ')' before 'p_mult_numIn'
/cygdrive/e/ECASP/mult_impulse/main.c:28: error: expected ':' or ')' before 'p_mult_result'
/cygdrive/e/ECASP/mult_impulse/main.c:30: error: expected ':' or ')' before 'p_mult_numIn'
/cygdrive/e/ECASP/mult_impulse/main.c:31: error: expected ':' or ')' before 'p_mult_result'
/cygdrive/e/ECASP/mult_impulse/main.c:13: warning: assignment makes pointer from integer without a cast
/cygdrive/e/ECASP/mult_impulse/main.c: At top level:
/cygdrive/e/ECASP/mult_impulse/main.c:19: error: expected declaration specifiers or '...' before 'co'
/cygdrive/e/ECASP/mult_impulse/main.c:19: error: conflicting types for 'mult'
/cygdrive/e/ECASP/mult_impulse/mult.h:13: error: previous declaration of 'mult' was here
/cygdrive/e/ECASP/mult_impulse/main.c: In function 'mult':
/cygdrive/e/ECASP/mult_impulse/main.c:26: error: expected ':' or ')' before 'p_mult_numIn'
/cygdrive/e/ECASP/mult_impulse/main.c:27: error: expected ':' or ')' before 'p_mult_numIn'
/cygdrive/e/ECASP/mult_impulse/main.c:28: error: expected ':' or ')' before 'p_mult_result'
/cygdrive/e/ECASP/mult_impulse/main.c:30: error: expected ':' or ')' before 'p_mult_numIn'
/cygdrive/e/ECASP/mult_impulse/main.c:31: error: expected ':' or ')' before 'p_mult_result'
Any insight would be very appreciated. I've been working at this for a while, but completely lost.
I have read most of "Practical FPGA Programming in C," but it doesn't seem to be helping me with my problems. I'm not quite sure of how to use the HW_STREAM_XXXX macros correctly and I can't find any documentation on them...
Thanks!












