|
@@ -356,12 +356,16 @@ uintptr_t _starpu_fpga_allocate_memory(unsigned dst_node, size_t size, int flags
|
|
|
/* 0 would be seen as NULL, i.e. allocation failed... */
|
|
|
// FIXME: Maxeler FPGAs want 192-byte alignment
|
|
|
static fpga_mem current_address = 8192*192;
|
|
|
- fpga_mem addr;
|
|
|
- // TODO: vérifier si current_address + size > taille de la LMEm
|
|
|
+ fpga_mem addr, next_addr;
|
|
|
addr = current_address;
|
|
|
- current_address += size;
|
|
|
+ next_addr = current_address + size;
|
|
|
+ if (next_addr >= global_mem[0])
|
|
|
+ {
|
|
|
+ printf("Memory overflow\n");
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ current_address = next_addr;
|
|
|
printf("fpga mem returned from allocation @: %p - %p\n",addr, addr + size);
|
|
|
- //success = 0
|
|
|
return (uintptr_t) addr;
|
|
|
}
|
|
|
|