Added barriers
This commit is contained in:
@@ -435,5 +435,48 @@ void _vx_e_mat_mult(unsigned tid, unsigned wid)
|
||||
|
||||
}
|
||||
|
||||
void sleep(int num)
|
||||
{
|
||||
for (int i = 0; i < num; i++);
|
||||
}
|
||||
|
||||
|
||||
bool barrier_bool = false;
|
||||
bool barriers[32];
|
||||
|
||||
void barrier(unsigned wid, int num)
|
||||
{
|
||||
barriers[wid] = true;
|
||||
|
||||
if (wid == 0)
|
||||
{
|
||||
bool cont = false;
|
||||
int count = 0;
|
||||
while(cont)
|
||||
{
|
||||
count = 0;
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
if (barriers[i]) count++;
|
||||
}
|
||||
|
||||
if (count == num)
|
||||
{
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
barriers[i] = false;
|
||||
barrier_bool = true;
|
||||
sleep(70);
|
||||
barrier_bool = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while(!barrier_bool);
|
||||
sleep(100);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
40
kernel/vx_include/vx_mem.c
Normal file
40
kernel/vx_include/vx_mem.c
Normal file
@@ -0,0 +1,40 @@
|
||||
|
||||
#include "vx_mem.h"
|
||||
|
||||
|
||||
void * vx_malloc_shared(unsigned size)
|
||||
{
|
||||
void * to_return;
|
||||
|
||||
bool done = false;
|
||||
unsigned curr_size;
|
||||
|
||||
unsigned curr_index = 0;
|
||||
while ((curr_index < free_index) && !done)
|
||||
{
|
||||
curr_size = (unsigned) *(free_array[curr_index].ptr - 4);
|
||||
if (curr_size <= size)
|
||||
{
|
||||
to_return = free_array[curr_index].ptr;
|
||||
done = true;
|
||||
}
|
||||
|
||||
curr_index++;
|
||||
}
|
||||
|
||||
unsigned * u_heap_ptr = (unsigned *) heap_ptr;
|
||||
|
||||
if (!done)
|
||||
{
|
||||
u_heap_ptr[0] = size;
|
||||
to_return = heap_ptr + 4;
|
||||
heap_ptr = to_return + size;
|
||||
}
|
||||
|
||||
return to_return;
|
||||
}
|
||||
|
||||
void vx_free(void * to_free)
|
||||
{
|
||||
|
||||
}
|
||||
15
kernel/vx_include/vx_mem.h
Normal file
15
kernel/vx_include/vx_mem.h
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
void * vx_malloc_shared(unsigned);
|
||||
void vx_free(void *);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void * ptr;
|
||||
|
||||
} free_t;
|
||||
|
||||
void * heap_ptr = (void *) 0xFF000000;
|
||||
|
||||
free_t free_array[100];
|
||||
unsigned free_index = 0;
|
||||
|
||||
Binary file not shown.
@@ -1,31 +1,31 @@
|
||||
# DESCRIPTION: Verilator output: Timestamp data for --skip-identical. Delete at will.
|
||||
C "-Wall -cc Vortex.v --exe test_bench.cpp"
|
||||
S 4608404 12889046060 1553037052 0 1548678579 0 "/usr/local/Cellar/verilator/4.010/bin/verilator_bin"
|
||||
S 2785 12889457986 1554064009 0 1554064009 0 "VX_alu.v"
|
||||
S 3486 12890338917 1557473618 0 1557473618 0 "VX_context.v"
|
||||
S 4928 12890355578 1557474515 0 1557474515 0 "VX_context_slave.v"
|
||||
S 2785 12890803842 1558067516 0 1558067516 0 "VX_alu.v"
|
||||
S 3486 12890803843 1558067516 0 1558067516 0 "VX_context.v"
|
||||
S 4928 12890803844 1558067516 0 1558067516 0 "VX_context_slave.v"
|
||||
S 1495 12889457987 1554023089 0 1554023089 0 "VX_csr_handler.v"
|
||||
S 5512 12889457988 1557345046 0 1557345046 0 "VX_d_e_reg.v"
|
||||
S 14563 12890307904 1557474495 0 1557474495 0 "VX_decode.v"
|
||||
S 1574 12890307906 1557343909 0 1557343909 0 "VX_define.v"
|
||||
S 4267 12889457992 1557345117 0 1557345117 0 "VX_e_m_reg.v"
|
||||
S 3692 12889457993 1557447660 0 1557447660 0 "VX_execute.v"
|
||||
S 1751 12889457994 1557344924 0 1557344924 0 "VX_f_d_reg.v"
|
||||
S 4619 12890309989 1557474372 0 1557474372 0 "VX_fetch.v"
|
||||
S 6293 12889457996 1557348346 0 1557348346 0 "VX_forwarding.v"
|
||||
S 1866 12889457997 1557348551 0 1557348551 0 "VX_m_w_reg.v"
|
||||
S 4352 12890309990 1557474440 0 1557474440 0 "VX_memory.v"
|
||||
S 1249 12889457999 1557474005 0 1557474005 0 "VX_register_file.v"
|
||||
S 1655 12890356143 1557474338 0 1557474338 0 "VX_register_file_master_slave.v"
|
||||
S 1599 12889458000 1557474345 0 1557474345 0 "VX_register_file_slave.v"
|
||||
S 1686 12890308905 1557474462 0 1557474462 0 "VX_warp.v"
|
||||
S 1568 12890307909 1557348531 0 1557348531 0 "VX_writeback.v"
|
||||
S 18714 12890307910 1557368874 0 1557368874 0 "Vortex.v"
|
||||
T 451065 12890356589 1557474518 0 1557474518 0 "obj_dir/VVortex.cpp"
|
||||
T 20559 12890356588 1557474518 0 1557474518 0 "obj_dir/VVortex.h"
|
||||
T 1800 12890356591 1557474518 0 1557474518 0 "obj_dir/VVortex.mk"
|
||||
T 530 12890356587 1557474518 0 1557474518 0 "obj_dir/VVortex__Syms.cpp"
|
||||
T 711 12890356586 1557474518 0 1557474518 0 "obj_dir/VVortex__Syms.h"
|
||||
T 563 12890356592 1557474518 0 1557474518 0 "obj_dir/VVortex__ver.d"
|
||||
T 0 0 1557474518 0 1557474518 0 "obj_dir/VVortex__verFiles.dat"
|
||||
T 1159 12890356590 1557474518 0 1557474518 0 "obj_dir/VVortex_classes.mk"
|
||||
S 5512 12890803845 1558067516 0 1558067516 0 "VX_d_e_reg.v"
|
||||
S 14563 12890803846 1558067516 0 1558067516 0 "VX_decode.v"
|
||||
S 1574 12890803847 1558067516 0 1558067516 0 "VX_define.v"
|
||||
S 4267 12890803848 1558067516 0 1558067516 0 "VX_e_m_reg.v"
|
||||
S 3692 12890803849 1558067516 0 1558067516 0 "VX_execute.v"
|
||||
S 1751 12890803850 1558067516 0 1558067516 0 "VX_f_d_reg.v"
|
||||
S 4619 12890803851 1558067516 0 1558067516 0 "VX_fetch.v"
|
||||
S 6293 12890803852 1558067516 0 1558067516 0 "VX_forwarding.v"
|
||||
S 1866 12890803853 1558067516 0 1558067516 0 "VX_m_w_reg.v"
|
||||
S 4352 12890803854 1558067516 0 1558067516 0 "VX_memory.v"
|
||||
S 1249 12890803855 1558067516 0 1558067516 0 "VX_register_file.v"
|
||||
S 1655 12890803856 1558067516 0 1558067516 0 "VX_register_file_master_slave.v"
|
||||
S 1599 12890803857 1558067516 0 1558067516 0 "VX_register_file_slave.v"
|
||||
S 1686 12890803859 1558067516 0 1558067516 0 "VX_warp.v"
|
||||
S 1568 12890803860 1558067516 0 1558067516 0 "VX_writeback.v"
|
||||
S 18714 12890803861 1558067516 0 1558067516 0 "Vortex.v"
|
||||
T 451065 12890803863 1558067556 0 1558067556 0 "obj_dir/VVortex.cpp"
|
||||
T 20559 12890803864 1558067556 0 1558067556 0 "obj_dir/VVortex.h"
|
||||
T 1800 12890416977 1558067556 0 1558067556 0 "obj_dir/VVortex.mk"
|
||||
T 530 12890416973 1558067556 0 1558067556 0 "obj_dir/VVortex__Syms.cpp"
|
||||
T 711 12890416972 1558067556 0 1558067556 0 "obj_dir/VVortex__Syms.h"
|
||||
T 563 12890416978 1558067556 0 1558067556 0 "obj_dir/VVortex__ver.d"
|
||||
T 0 0 1558067556 0 1558067556 0 "obj_dir/VVortex__verFiles.dat"
|
||||
T 1159 12890416976 1558067556 0 1558067556 0 "obj_dir/VVortex_classes.mk"
|
||||
|
||||
Reference in New Issue
Block a user