runtime static library

This commit is contained in:
Blaise Tine
2020-06-27 14:13:13 -04:00
parent b7d7e69f47
commit 8a306de02d
73 changed files with 360 additions and 94341 deletions

1
runtime/.gitignore vendored
View File

@@ -1 +0,0 @@
/config.h

View File

@@ -1,4 +1,38 @@
RISCV_TOOLCHAIN_PATH ?= ~/dev/riscv-gnu-toolchain/drops
all:
CC = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-gcc
AR = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-gcc-ar
DP = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-objdump
CP = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-objcopy
CFLAGS += -O3 -march=rv32im -mabi=ilp32
CFLAFS += -nostartfiles -ffreestanding -fno-exceptions -Wl,--gc-sections
CFLAGS += -I./include -I../hw
LDFLAGS +=
PROJECT = libvortexrt
SRCS = ./src/vx_start.S ./src/vx_intrinsics.S ./src/vx_print.S ./src/vx_print.c ./src/vx_spawn.c
OBJS := $(addsuffix .o, $(notdir $(SRCS)))
all: $(PROJECT).a $(PROJECT).dump
$(PROJECT).dump: $(PROJECT).a
$(DP) -D $(PROJECT).a > $(PROJECT).dump
%.S.o: src/%.S
$(CC) $(CFLAGS) -c $< -o $@
%.c.o: src/%.c
$(CC) $(CFLAGS) -c $< -o $@
$(PROJECT).a: $(OBJS)
$(AR) rc $(PROJECT).a $^
.depend: $(SRCS)
$(CC) $(CFLAGS) -MM $^ > .depend;
clean:
rm -rf *.a *.o *.dump .depend

View File

@@ -1,48 +0,0 @@
#include <VX_config.h>
# .section .FileIO
# .type vx_close, @function
# .global vx_close
# vx_close:
# nop
# ret
# nop
# nop
# .type vx_fstat, @function
# .global vx_fstat
# vx_fstat:
# nop
# ret
# nop
# nop
# .type vx_isatty, @function
# .global vx_isatty
# vx_isatty:
# nop
# ret
# nop
# nop
# .type vx_read, @function
# .global vx_read
# vx_read:
# nop
# ret
# nop
# nop
# .type vx_write, @function
# .global vx_write
# vx_write:
# nop
# ret
# nop
# nop

View File

@@ -1,22 +0,0 @@
#ifndef FILE_IOO
#define FILE_IOO
// #include <sys/stat.h>
// #include <errno.h>
// #include <stdio.h>
// void vx_close();
// void vx_fstat();
// void vx_isatty();
// void vx_read();
// void vx_write();
#endif

View File

@@ -7,8 +7,6 @@
extern "C" {
#endif
static char * hextoa[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"};
void vx_print_hex(unsigned);
void vx_printf(const char *, unsigned);

View File

@@ -4,8 +4,7 @@
Copying and distribution of this script, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. */
OUTPUT_FORMAT("elf32-littleriscv", "elf32-littleriscv",
"elf32-littleriscv")
OUTPUT_FORMAT("elf32-littleriscv", "elf32-littleriscv", "elf32-littleriscv")
OUTPUT_ARCH(riscv)
ENTRY(_start)
SECTIONS

View File

@@ -1,34 +0,0 @@
RISCV_TOOL_PATH ?= $(wildcard ../../../../riscv-gnu-toolchain/drops)
COMP = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-gcc
CC_FLAGS = -march=rv32im -mabi=ilp32 -O0 -Wl,-Bstatic,-T,../vortex_link.ld -ffreestanding -nostdlib
DMP = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-objdump
CPY = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-objcopy
NEWLIB = ../../newlib/newlib.c
VX_STR = ../../startup/vx_start.s
VX_INT = ../../intrinsics/vx_intrinsics.s
VX_IO = ../../io/vx_io.s ../../io/vx_io.c
VX_API = ../../vx_api/vx_api.c
VX_TEST = ../../tests/tests.c
VX_FIO = ../../fileio/fileio.s
LIBS = $(RISCV_TOOL_PATH)/riscv32-unknown-elf/lib/libc.a $(RISCV_TOOL_PATH)/riscv32-unknown-elf/lib/libstdc++.a -static-libgcc -lgcc
VX_MAIN = vx_simple_main
all: HEX DUMP ELF
DUMP: ELF
$(DMP) -D $(VX_MAIN).elf > $(VX_MAIN).dump
HEX: ELF
$(CPY) -O ihex $(VX_MAIN).elf $(VX_MAIN).hex
ELF:
$(COMP) $(CC_FLAGS) $(VX_STR) $(VX_FIO) $(NEWLIB) $(VX_INT) $(VX_IO) $(VX_API) $(VX_TEST) $(VX_MAIN).c $(LIBS) -Iinclude -o $(VX_MAIN).elf
clean:
rm -rf *.o *.elf *.dump *.hex *.qemu *.log *.debug

View File

@@ -1,335 +0,0 @@
#include "../io/vx_io.h"
#include "../fileio/fileio.h"
#include "../intrinsics/vx_intrinsics.h"
#include <sys/stat.h>
#include <errno.h>
#include <stdio.h>
#define CLOSE 1
#define ISATTY 2
#define LSEEK 3
#define READ 4
#define WRITE 5
#define FSTAT 6
#define OPEN 7
#define FILE_IO_WRITE 0x71000000
#define FILE_IO_READ 0x72000000
#ifdef __cplusplus
extern "C" {
#endif
typedef void (*funct_t)(void);
funct_t trap_to_simulator = (funct_t) 0x70000000;
void upload(char ** ptr, char * src, int size)
{
char * drain = *ptr;
// *((int *) drain) = size;
char * size_ptr = (char *) &size;
drain[0] = size_ptr[0];
drain[1] = size_ptr[1];
drain[2] = size_ptr[2];
drain[3] = size_ptr[3];
// vx_printf("size: ", (unsigned) size);
// vx_printf("drain_ptr: ", (unsigned) drain);
drain += 4;
for (int i = 0; i < size; i++)
{
(*drain) = src[i];
drain += 1;
}
unsigned drain_val = (unsigned) drain;
drain_val += (drain_val%4);
drain = (char *) drain_val;
*ptr = drain;
}
void download(char ** ptr, char * drain)
{
char * src = *ptr;
int size;
// size = *((int *) src);
char * size_ptr = (char *) &size;
size_ptr[0] = src[0];
size_ptr[1] = src[1];
size_ptr[2] = src[2];
size_ptr[3] = src[3];
src += 4;
// vx_printf("newlib.c: Size of download: ", size);
// vx_printf("newlib.c: Real size: ", sizeof(struct stat));
for (int i = 0; i < size; i++)
{
drain[i] = (*src);
src += 1;
}
unsigned src_val = (unsigned) src;
src_val += (src_val%4);
src = (char *) src_val;
*ptr = src;
}
void _close()
{
// vx_print_str("Hello from _close\n");
}
int _fstat(int file, struct stat * st)
{
// char * write_buffer = (char *) FILE_IO_WRITE;
// int cmd_id = FSTAT;
// upload((char **) &write_buffer, (char *) &cmd_id, sizeof(int));
// upload((char **) &write_buffer, (char *) &file , sizeof(int));
// trap_to_simulator();
// char * read_buffer = (char *) FILE_IO_READ;
// unsigned value;
// download((char **) &read_buffer, (char *) &value);
// st->st_mode = value;
// download((char **) &read_buffer, (char *) &value);
// st->st_dev = value;
// download((char **) &read_buffer, (char *) &value);
// st->st_uid = value;
// download((char **) &read_buffer, (char *) &value);
// st->st_gid = value;
// download((char **) &read_buffer, (char *) &value);
// st->st_size = value;
// download((char **) &read_buffer, (char *) &value);
// st->st_blksize = value;
// download((char **) &read_buffer, (char *) &value);
// st->st_blocks = value;
// vx_print_str("Hello from fstat\n");
// // st->st_mode = 33279;
// vx_printf("st_mode: ", st->st_mode);
// vx_printf("st_dev: ", st->st_dev);
// vx_printf("st_ino: ", st->st_ino);
// vx_printf("st_uid: ", st->st_uid);
// vx_printf("st_gid: ", st->st_gid);
// vx_printf("st_rdev: ", st->st_rdev);
// vx_printf("st_size: ", st->st_size);
// vx_printf("st_blksize: ", st->st_blksize);
// vx_printf("st_blocks: ", st->st_blocks);
st->st_mode = S_IFCHR;
return 0;
}
int _isatty (int file)
{
// vx_print_str("Hello from _isatty\n");
return 1;
}
int _lseek(int fd, int offset, int whence)
{
// // vx_print_str("Hello from _lseek\n");
// char * write_buffer = (char *) FILE_IO_WRITE;
// char * read_buffer = (char *) FILE_IO_READ;
// int cmd_id = LSEEK;
// upload((char **) &write_buffer, (char *) &cmd_id , sizeof(int));
// upload((char **) &write_buffer, (char *) &fd , sizeof(int));
// upload((char **) &write_buffer, (char *) &offset , sizeof(int));
// upload((char **) &write_buffer, (char *) &whence , sizeof(int));
// trap_to_simulator();
// int retval;
// download((char **) &read_buffer, (char *) &retval);
// return retval;
return 0;
}
// void _lseek()
// {
// }
int _read (int file, char *ptr, int len)
{
// char * write_buffer = (char *) FILE_IO_WRITE;
// char * read_buffer = (char *) FILE_IO_READ;
// int cmd_id = READ;
// upload((char **) &write_buffer, (char *) &cmd_id, sizeof(int));
// upload((char **) &write_buffer, (char *) &file , sizeof(int));
// upload((char **) &write_buffer, (char *) &ptr , sizeof(int));
// upload((char **) &write_buffer, (char *) &len , sizeof(int));
// trap_to_simulator();
// return len;
return 0;
}
int _write (int file, char *buf, int nbytes)
{
// char * write_buffer = (char *) FILE_IO_WRITE;
// int cmd_id = WRITE;
// upload((char **) &write_buffer, (char *) &cmd_id, sizeof(int));
// upload((char **) &write_buffer, (char *) &file , sizeof(int));
// upload((char **) &write_buffer, (char *) buf , nbytes);
// trap_to_simulator();
// vx_print_str("Hello from _write\n");
int i;
unsigned int volatile * const print_addr = (unsigned int *) 0x00010000;
for (i = 0; i < nbytes; i++)
{
(*print_addr) = buf[i];
}
return nbytes;
}
static int heap_start = (int) 0x90000000;
static int head_end = (int) 0xa0000000;
void * _sbrk (int nbytes)
{
vx_print_str("Hello from _sbrk\n");
// vx_printf("nbytes: ", nbytes);
//if (nbytes < 0) //vx_print_str("nbytes less than zero\n");
// printf("nBytes: %d\n", nbytes);
if (nbytes < 0)
{
nbytes = nbytes * -1;
}
// vx_printf("New nbytes: ", nbytes);
if (nbytes > 10240)
{
nbytes = 10240;
}
// if (((unsigned) head_end) > ((unsigned) (heap_ptr + nbytes)))
if (true)
{
int base = heap_start;
heap_start += nbytes;
// vx_print_str("_sbrk returning: ");
// vx_print_hex((unsigned) base);
// vx_print_str("\n");
return (void *) base;
}
// else
// {
// errno = ENOMEM;
// return (void *) -1;
// }
} /* _sbrk () */
int _open(const char *name, int flags, int mode)
{
// char * write_buffer = (char *) FILE_IO_WRITE;
// char * read_buffer = (char *) FILE_IO_READ;
// int cmd_id = OPEN;
// upload((char **) &write_buffer, (char *) &cmd_id, sizeof(int));
// upload((char **) &write_buffer, (char *) &name , sizeof (char *));
// upload((char **) &write_buffer, (char *) &flags , sizeof(int));
// upload((char **) &write_buffer, (char *) & mode , sizeof(int));
// trap_to_simulator();
// int fd;
// download((char **) &read_buffer, (char *) &fd);
// return fd;
return 0;
}
void _kill()
{
vx_tmc(0);
}
unsigned _getpid()
{
return vx_thread_id();
}
void _unlink()
{
vx_print_str("ERROR: _unlink not yet implemented\n");
}
static int curr_time = 0;
int _gettimeofday()
{
// vx_print_str("ERROR: _gettimeofday not yet implemented\n");
return curr_time++;
}
void _link()
{
vx_print_str("ERROR: _link not yet implemented\n");
}
#ifdef __cplusplus
}
#endif

View File

@@ -1,27 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include "../vx_api/vx_api.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef void (*pocl_workgroup_func) (
void * /* args */,
void * /* pocl_context */,
uint32_t /* group_x */,
uint32_t /* group_y */,
uint32_t /* group_z */
);
void pocl_spawn(struct pocl_context_t * ctx, pocl_workgroup_func pfn, const void * args) {
uint32_t x, y, z;
for (z = 0; z < ctx->num_groups[2]; ++z)
for (y = 0; y < ctx->num_groups[1]; ++y)
for (x = 0; x < ctx->num_groups[0]; ++x)
(pfn)(arguments, ctx, x, y, z);
}
#ifdef __cplusplus
}
#endif

View File

@@ -1,10 +1,12 @@
#include "vx_io.h"
#include <vx_print.h>
#ifdef __cplusplus
extern "C" {
#endif
static char * hextoa[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"};
void vx_print_hex(unsigned f)
{
// vx_print_str(hextoa[f]);

View File

@@ -1,6 +1,5 @@
#include <VX_config.h>
#include "../intrinsics/vx_intrinsics.h"
#include "vx_api.h"
#include <vx_spawn.h>
#include <vx_intrinsics.h>
#include <inttypes.h>
#ifdef __cplusplus

5
runtime/tests/Makefile Normal file
View File

@@ -0,0 +1,5 @@
all:
$(MAKE) -C simple
clean:
$(MAKE) -C simple clean

View File

@@ -1,12 +1,12 @@
RISCV_TOOL_PATH ?= $(wildcard ../../../../riscv-gnu-toolchain/drops)
RISCV_TOOLCHAIN_PATH ?= $(wildcard ../../../../riscv-gnu-toolchain/drops)
COMP = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-gcc
COMP = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-gcc
# CC_FLAGS = -march=rv32im -mabi=ilp32 -O0 -Wl,-Bstatic,-T,linker.ld -ffreestanding -nostdlib
CC_FLAGS = -march=rv32im -mabi=ilp32 -O0 -Wl,-Bstatic,-T,../../startup/vx_link.ld -ffreestanding -nostartfiles
DMP = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-objdump
CPY = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-objcopy
DMP = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-objdump
CPY = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-objcopy
VX_STR = ../../startup/vx_start.S

View File

@@ -1,12 +1,12 @@
RISCV_TOOL_PATH ?= $(wildcard ../../../../riscv-gnu-toolchain/drops)
RISCV_TOOLCHAIN_PATH ?= $(wildcard ../../../../riscv-gnu-toolchain/drops)
COMP = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-gcc
COMP = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-gcc
# CC_FLAGS = -march=rv32im -mabi=ilp32 -O0 -Wl,-Bstatic,-T,linker.ld -ffreestanding -nostdlib
CC_FLAGS = -march=rv32im -mabi=ilp32 -O0 -Wl,-Bstatic,-T,../../startup/vx_link.ld
DMP = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-objdump
CPY = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-objcopy
DMP = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-objdump
CPY = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-objcopy
NEWLIB = ../../newlib/newlib.c
@@ -15,7 +15,7 @@ VX_INT = ../../intrinsics/vx_intrinsics.S
VX_IO =
VX_API =
VX_FIO =
LIBS = $(RISCV_TOOL_PATH)/riscv32-unknown-elf/lib/libc.a $(RISCV_TOOL_PATH)/riscv32-unknown-elf/lib/libstdc++.a -static-libgcc -lgcc
LIBS = $(RISCV_TOOLCHAIN_PATH)/riscv32-unknown-elf/lib/libc.a $(RISCV_TOOLCHAIN_PATH)/riscv32-unknown-elf/lib/libstdc++.a -static-libgcc -lgcc
VX_MAIN = hello

View File

@@ -1,13 +1,13 @@
RISCV_TOOL_PATH ?= $(wildcard ../../../../riscv-gnu-toolchain/drops)
RISCV_TOOLCHAIN_PATH ?= $(wildcard ../../../../riscv-gnu-toolchain/drops)
COMP = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-g++
COMP = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-g++
# CC_FLAGS = -march=rv32im -mabi=ilp32 -O0 -Wl,-Bstatic,-T,linker.ld -ffreestanding -nostdlib
# CC_FLAGS = -march=rv32im -mabi=ilp32 -O0 -Wl,-Bstatic,-T,linker.ld -ffreestanding -nostartfiles
CC_FLAGS = -ffreestanding -O0 -Wl,--gc-sections -nostartfiles -nostdlib -nostartfiles -nodefaultlibs -Wl,-Bstatic,-T,../../startup/vx_link.ld -march=rv32im -mabi=ilp32
DMP = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-objdump
CPY = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-objcopy
DMP = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-objdump
CPY = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-objcopy
# VX_STR = ../../startup/vx_start.S

View File

@@ -1,12 +1,12 @@
RISCV_TOOL_PATH ?= $(wildcard ../../../../riscv-gnu-toolchain/drops)
RISCV_TOOLCHAIN_PATH ?= $(wildcard ../../../../riscv-gnu-toolchain/drops)
COMP = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-gcc
COMP = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-gcc
# CC_FLAGS = -march=rv32im -mabi=ilp32 -O0 -Wl,-Bstatic,-T,linker.ld -ffreestanding -nostdlib
CC_FLAGS = -march=rv32im -mabi=ilp32 -O0 -Wl,-Bstatic,-T,../../startup/vx_link.ld -ffreestanding -nostartfiles -nostdlib
DMP = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-objdump
CPY = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-objcopy
DMP = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-objdump
CPY = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-objcopy
NEWLIB = ../../newlib/newlib.c ../../newlib/newlib_notimp.c ../../newlib/newlib.s

View File

@@ -1,40 +1,34 @@
RISCV_TOOLCHAIN_PATH ?= ~/dev/riscv-gnu-toolchain/drops
VORTEX_RT_PATH ?= $(wildcard ../..)
COMP = ~/dev/riscv-gnu-toolchain/drops/bin/riscv32-unknown-elf-g++
CC = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-gcc
AR = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-gcc-ar
DP = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-objdump
CP = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-objcopy
CC_FLAGS = -march=rv32im -mabi=ilp32 -O3 -Wl,-Bstatic,-T,../../startup/vx_link.ld
CC_FLAGS += -nostartfiles -ffreestanding -fno-rtti -fno-exceptions -Wl,--gc-sections
CFLAGS += -march=rv32im -mabi=ilp32 -O3 -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link.ld
CFLAGS += -nostartfiles -ffreestanding -fno-exceptions -Wl,--gc-sections
CFLAGS += -I$(VORTEX_RT_PATH)/include
CC_FLAGS += -I../../../hw
LDFLAGS += $(VORTEX_RT_PATH)/libvortexrt.a
DMP = ~/dev/riscv-gnu-toolchain/drops/bin/riscv32-unknown-elf-objdump
CPY = ~/dev/riscv-gnu-toolchain/drops/bin/riscv32-unknown-elf-objcopy
PROJECT = vx_simple
SRCS = main.c tests.c
NEWLIB = ../../newlib/newlib.c
VX_STR = ../../startup/vx_start.S
VX_INT = ../../intrinsics/vx_intrinsics.S
VX_IO = ../../io/vx_io.S ../../io/vx_io.c
VX_API = ../../vx_api/vx_api.c
VX_FIO = ../../fileio/fileio.S
all: $(PROJECT).elf $(PROJECT).hex $(PROJECT).dump
VX_MAIN = vx_simple_main
$(PROJECT).dump: $(PROJECT).elf
$(DP) -D $(PROJECT).elf > $(PROJECT).dump
#LIBS += ~/dev/riscv-gnu-toolchain/drops/riscv32-unknown-elf/lib/libc.a
#LIBS += ~/dev/riscv-gnu-toolchain/drops/riscv32-unknown-elf/lib/libstdc++.a
#LIBS += -static-libgcc -lgcc
$(PROJECT).hex: $(PROJECT).elf
$(CP) -O ihex $(PROJECT).elf $(PROJECT).hex
VX_SRCS = vx_simple_main.c tests.c
$(PROJECT).elf: $(SRCS)
$(CC) $(CFLAGS) $(SRCS) $(LDFLAGS) -o $(PROJECT).elf
all: HEX DUMP ELF BIN
.depend: $(SRCS)
$(CC) $(CFLAGS) -MM $^ > .depend;
DUMP: ELF
$(DMP) -D $(VX_MAIN).elf > $(VX_MAIN).dump
HEX: ELF
$(CPY) -O ihex $(VX_MAIN).elf $(VX_MAIN).hex
BIN: ELF
$(CPY) -O binary $(VX_MAIN).elf $(VX_MAIN).bin
ELF:
$(COMP) $(CC_FLAGS) $(VX_STR) $(VX_FIO) $(NEWLIB) $(VX_INT) $(VX_IO) $(VX_API) $(VX_SRCS) $(LIBS) -Iinclude -o $(VX_MAIN).elf
clean:
rm -rf *.elf *.hex *.dump .depend

View File

@@ -1,8 +1,8 @@
#include "../../intrinsics/vx_intrinsics.h"
#include "../../io/vx_io.h"
#include "tests.h"
#include "../../vx_api/vx_api.h"
#include <vx_intrinsics.h>
#include <vx_print.h>
#include <vx_spawn.h>
typedef struct

View File

@@ -1,8 +1,6 @@
#include "tests.h"
#include "../../intrinsics/vx_intrinsics.h"
#include "../../io/vx_io.h"
#include <vx_intrinsics.h>
#include <vx_print.h>
int tmc_array[4] = {5,5,5,5};

View File

@@ -1,5 +1,3 @@
#ifndef TESTS
#define TESTS

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,42 +0,0 @@
#include "io/io.h" // Printing functions
#include "intrinsics/instrinsics.h" // vx_thread_id and vx_WarpID
struct args
{
void * data;
};
void function(void * arg)
{
struct args * real_arg = (struct args *) arg;
unsigned tid = vx_thread_id();
unsigned wid = vx_WarpID();
__if(something) // Control divergent if
{
}
__else
{
}
__endif
}
int main()
{
void * data = vx_loadfile("filename.txt"); // The raw char data will be returned by vx_loadfile
struct args arg;
arg.data = data;
vx_spawn_warps(numWarps, numThreads, function, &data);
}

View File

@@ -1,13 +1,13 @@
RISCV_TOOL_PATH ?= $(wildcard ../../../../riscv-gnu-toolchain/drops)
RISCV_TOOLCHAIN_PATH ?= $(wildcard ../../../../riscv-gnu-toolchain/drops)
COMP = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-g++
COMP = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-g++
# CC_FLAGS = -march=rv32im -mabi=ilp32 -O0 -Wl,-Bstatic,-T,linker.ld -ffreestanding -nostdlib
# CC_FLAGS = -march=rv32im -mabi=ilp32 -O0 -Wl,-Bstatic,-T,linker.ld -ffreestanding -nostartfiles
CC_FLAGS = -ffreestanding -O0 -Wl,--gc-sections -nostartfiles -nostdlib -nostartfiles -nodefaultlibs -Wl,-Bstatic,-T,../../startup/vx_link.ld -march=rv32im -mabi=ilp32
DMP = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-objdump
CPY = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-objcopy
DMP = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-objdump
CPY = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-objcopy
# VX_STR = ../../startup/vx_start.S

View File

@@ -1,12 +1,12 @@
RISCV_TOOL_PATH ?= $(wildcard ../../../../riscv-gnu-toolchain/drops)
RISCV_TOOLCHAIN_PATH ?= $(wildcard ../../../../riscv-gnu-toolchain/drops)
COMP = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-gcc
COMP = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-gcc
CC_FLAGS = -ffreestanding -O0 -Wl,--gc-sections -nostartfiles -nostdlib -nostartfiles -nodefaultlibs -Wl,-Bstatic,-T,../../startup/vx_link.ld -march=rv32imv -mabi=ilp32
DMP = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-objdump
CPY = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-objcopy
DMP = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-objdump
CPY = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-objcopy
# VX_STR = ../../startup/vx_start.S
@@ -20,7 +20,7 @@ VX_IO = ../../io/vx_io.S ../../io/vx_io.c
VX_API = ../../vx_api/vx_api.c
VX_FIO = ../../fileio/fileio.S
VX_VEC = vx_vec.s
LIBS = $(RISCV_TOOL_PATH)/riscv32-unknown-elf/lib/libc.a $(RISCV_TOOL_PATH)/riscv32-unknown-elf/lib/libstdc++.a -static-libgcc -lgcc
LIBS = $(RISCV_TOOLCHAIN_PATH)/riscv32-unknown-elf/lib/libc.a $(RISCV_TOOLCHAIN_PATH)/riscv32-unknown-elf/lib/libstdc++.a -static-libgcc -lgcc
VX_MAIN = vx_vector_main