fix rtl gpr zero

This commit is contained in:
Blaise Tine 2020-05-06 05:25:20 -04:00
parent 7e748e4e38
commit b1fdf0a947
16 changed files with 34529 additions and 78542 deletions

View file

@ -3,8 +3,8 @@ CFLAGS += -std=c++11 -g -O0 -Wall -Wextra -Wfatal-errors
CFLAGS += -I../../include -I../../../hw/simulate -I../../../runtime
MULTICORE += -DNUM_CLUSTERS=2 -DNUM_CORES=2
#DEBUG = 1
#MULTICORE += -DNUM_CLUSTERS=2 -DNUM_CORES=2
DEBUG = 1
CFLAGS += -fPIC

Binary file not shown.

View file

@ -6,12 +6,12 @@ VX_CXX = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-g++
VX_DMP = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-objdump
VX_CPY = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-objcopy
VX_NEWLIB = $(VX_RT_PATH)/newlib/newlib.c
#VX_NEWLIB = $(VX_RT_PATH)/newlib/newlib.c
VX_STR = $(VX_RT_PATH)/startup/vx_start.S
VX_INT = $(VX_RT_PATH)/intrinsics/vx_intrinsics.S
VX_IO = $(VX_RT_PATH)/io/vx_io.S $(VX_RT_PATH)/io/vx_io.c
#VX_IO = $(VX_RT_PATH)/io/vx_io.S $(VX_RT_PATH)/io/vx_io.c
VX_API = $(VX_RT_PATH)/vx_api/vx_api.c
VX_FIO = $(VX_RT_PATH)/fileio/fileio.S
#VX_FIO = $(VX_RT_PATH)/fileio/fileio.S
VX_CFLAGS = -march=rv32im -mabi=ilp32 -O3 -Wl,-Bstatic,-T,$(VX_RT_PATH)/startup/vx_link.ld -ffreestanding -nostartfiles -Wl,--gc-sections

View file

@ -1,7 +1,7 @@
#ifndef _COMMON_H_
#define _COMMON_H_
#define KERNEL_ARG_DEV_MEM_ADDR 0x7fffff00
#define KERNEL_ARG_DEV_MEM_ADDR 0x7ffff000
struct kernel_arg_t {
uint32_t num_warps;

View file

@ -224,12 +224,6 @@ int main(int argc, char *argv[]) {
cleanup();
return ret;
}
ret = run_test(device, buffer, kernel_arg, buf_size, num_points);
if (ret != 0) {
cleanup();
return ret;
}
// cleanup
std::cout << "cleanup" << std::endl;

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load diff

View file

@ -7,13 +7,18 @@ module VX_gpr (
VX_gpr_read_if gpr_read_if,
VX_wb_if writeback_if,
output reg[`NUM_THREADS-1:0][`NUM_GPRS-1:0] a_reg_data,
output reg[`NUM_THREADS-1:0][`NUM_GPRS-1:0] b_reg_data
output wire[`NUM_THREADS-1:0][`NUM_GPRS-1:0] a_reg_data,
output wire[`NUM_THREADS-1:0][`NUM_GPRS-1:0] b_reg_data
);
wire write_enable;
wire[`NUM_THREADS-1:0][`NUM_GPRS-1:0] a_reg_data_uqual;
wire[`NUM_THREADS-1:0][`NUM_GPRS-1:0] b_reg_data_uqual;
assign a_reg_data = (gpr_read_if.rs1 != 0) ? a_reg_data_uqual : 0;
assign b_reg_data = (gpr_read_if.rs2 != 0) ? b_reg_data_uqual : 0;
wire write_enable = valid_write_request && ((writeback_if.wb != 0));
`ifndef ASIC
assign write_enable = valid_write_request && ((writeback_if.wb != 0)) && (writeback_if.rd != 0);
VX_gpr_ram gpr_ram (
.we (write_enable),
@ -24,16 +29,17 @@ module VX_gpr (
.raddr2(gpr_read_if.rs2),
.be (writeback_if.valid),
.wdata (writeback_if.data),
.q1 (a_reg_data),
.q2 (b_reg_data)
.q1 (a_reg_data_uqual),
.q2 (b_reg_data_uqual)
);
`else
assign write_enable = valid_write_request && ((writeback_if.wb != 0));
wire going_to_write = write_enable & (| writeback_if.wb_valid);
wire[`NUM_THREADS-1:0][`NUM_GPRS-1:0] write_bit_mask;
genvar i;
for (i = 0; i < `NUM_THREADS; i=i+1) begin
for (i = 0; i < `NUM_THREADS; i = i + 1) begin
wire local_write = write_enable & writeback_if.wb_valid[i];
assign write_bit_mask[i] = {`NUM_GPRS{~local_write}};
end
@ -52,17 +58,17 @@ module VX_gpr (
`ifndef SYN
genvar j;
for (i = 0; i < `NUM_THREADS; i = i + 1) begin
for (j = 0; j < `NUM_GPRS; j=j+1) begin
assign a_reg_data[i][j] = ((temp_a[i][j] === 1'dx) || cena_1 )? 1'b0 : temp_a[i][j];
assign b_reg_data[i][j] = ((temp_b[i][j] === 1'dx) || cena_2) ? 1'b0 : temp_b[i][j];
for (j = 0; j < `NUM_GPRS; j = j + 1) begin
assign a_reg_data_uqual[i][j] = ((temp_a[i][j] === 1'dx) || cena_1 )? 1'b0 : temp_a[i][j];
assign b_reg_data_uqual[i][j] = ((temp_b[i][j] === 1'dx) || cena_2) ? 1'b0 : temp_b[i][j];
end
end
`else
assign a_reg_data = temp_a;
assign b_reg_data = temp_b;
assign a_reg_data_uqual = temp_a;
assign b_reg_data_uqual = temp_b;
`endif
wire[`NUM_THREADS-1:0][`NUM_GPRS-1:0] to_write = (writeback_if.rd != 0) ? writeback_if.write_data : 0;
wire[`NUM_THREADS-1:0][`NUM_GPRS-1:0] to_write = writeback_if.write_data;
for (i = 0; i < 'NT; i=i+4)
begin

View file

@ -111,11 +111,12 @@ void Simulator::io_driver() {
vortex_->io_req_ready = true;
}
void Simulator::reset() {
time_stamp = 0;
void Simulator::reset() {
vortex_->reset = 1;
this->step();
this->step();
vortex_->reset = 0;
dram_rsp_vec_.clear();
}
void Simulator::step() {
@ -150,6 +151,7 @@ bool Simulator::is_busy() {
void Simulator::flush_caches(uint32_t mem_addr, uint32_t size) {
// send snoop requests to the caches
printf("[sim] total cycles: %ld\n", time_stamp/2);
// align address to LLC block boundaries
auto aligned_addr_start = mem_addr / GLOBAL_BLOCK_SIZE;
auto aligned_addr_end = (mem_addr + size + GLOBAL_BLOCK_SIZE - 1) / GLOBAL_BLOCK_SIZE;

View file

@ -274,14 +274,6 @@ void * _sbrk (int nbytes)
// }
} /* _sbrk () */
void _exit(int val)
{
// vx_print_str("Hello from exit\n");
vx_tmc(0);
}
int _open(const char *name, int flags, int mode)
{
// char * write_buffer = (char *) FILE_IO_WRITE;

View file

@ -4,27 +4,35 @@
.global _start
.type _start, @function
_start:
la a1, vx_set_sp
li a0, NUM_WARPS # activate all warps
.word 0x00b5106b # wspawn a0(numWarps), a1(PC SPAWN)
jal vx_set_sp
li a0, 1
.word 0x0005006b # back to single thread
# Initialize global pointerp
# call __cxx_global_var_init
# Clear the bss segment
la a0, _edata
la a2, _end
sub a2, a2, a0
li a1, 0
call memset
la a0, __libc_fini_array # Register global termination functions
call atexit # to be called upon exit
call __libc_init_array # Run global initialization functions
call main
tail exit
la a1, vx_set_sp
li a0, NUM_WARPS # activate all warps
.word 0x00b5106b # wspawn a0(numWarps), a1(PC SPAWN)
jal vx_set_sp
li a0, 1
.word 0x0005006b # back to single thread
# Initialize global pointerp
# call __cxx_global_var_init
# Clear the bss segment
la a0, _edata
la a2, _end
sub a2, a2, a0
li a1, 0
call memset
la a0, __libc_fini_array # Register global termination functions
call atexit # to be called upon exit
call __libc_init_array # Run global initialization functions
call main
tail exit
.size _start, .-_start
.section .text
.type _exit, @function
.global _exit
_exit:
li a0, 0
.word 0x0005006b # disable all threads
.section .text
.type vx_set_sp, @function
.global vx_set_sp

View file

@ -1,8 +1,8 @@
COMP = ~/dev/riscv-gnu-toolchain/drops/bin/riscv32-unknown-elf-g++
#COMP = /opt/riscv-new/drops/bin/riscv32-unknown-elf-g++
CC_FLAGS = -march=rv32im -mabi=ilp32 -O3 -Wl,-Bstatic,-T,../../startup/vx_link.ld -ffreestanding -nostdlib
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
DMP = ~/dev/riscv-gnu-toolchain/drops/bin/riscv32-unknown-elf-objdump
CPY = ~/dev/riscv-gnu-toolchain/drops/bin/riscv32-unknown-elf-objcopy
@ -17,8 +17,9 @@ VX_FIO = ../../fileio/fileio.S
VX_MAIN = vx_simple_main
LIBS = ~/dev/riscv-gnu-toolchain/drops/riscv32-unknown-elf/lib/libc.a ~/dev/riscv-gnu-toolchain/drops/riscv32-unknown-elf/lib/libstdc++.a -static-libgcc -lgcc
#LIBS = /opt/riscv-new/drops/riscv32-unknown-elf/lib/libc.a /opt/riscv-new/drops/riscv32-unknown-elf/lib/libstdc++.a -static-libgcc -lgcc
#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
VX_SRCS = vx_simple_main.c tests.c

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff