fix rtl gpr zero
This commit is contained in:
@@ -3,8 +3,8 @@ CFLAGS += -std=c++11 -g -O0 -Wall -Wextra -Wfatal-errors
|
|||||||
|
|
||||||
CFLAGS += -I../../include -I../../../hw/simulate -I../../../runtime
|
CFLAGS += -I../../include -I../../../hw/simulate -I../../../runtime
|
||||||
|
|
||||||
MULTICORE += -DNUM_CLUSTERS=2 -DNUM_CORES=2
|
#MULTICORE += -DNUM_CLUSTERS=2 -DNUM_CORES=2
|
||||||
#DEBUG = 1
|
DEBUG = 1
|
||||||
|
|
||||||
CFLAGS += -fPIC
|
CFLAGS += -fPIC
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -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_DMP = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-objdump
|
||||||
VX_CPY = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-objcopy
|
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_STR = $(VX_RT_PATH)/startup/vx_start.S
|
||||||
VX_INT = $(VX_RT_PATH)/intrinsics/vx_intrinsics.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_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
|
VX_CFLAGS = -march=rv32im -mabi=ilp32 -O3 -Wl,-Bstatic,-T,$(VX_RT_PATH)/startup/vx_link.ld -ffreestanding -nostartfiles -Wl,--gc-sections
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef _COMMON_H_
|
#ifndef _COMMON_H_
|
||||||
#define _COMMON_H_
|
#define _COMMON_H_
|
||||||
|
|
||||||
#define KERNEL_ARG_DEV_MEM_ADDR 0x7fffff00
|
#define KERNEL_ARG_DEV_MEM_ADDR 0x7ffff000
|
||||||
|
|
||||||
struct kernel_arg_t {
|
struct kernel_arg_t {
|
||||||
uint32_t num_warps;
|
uint32_t num_warps;
|
||||||
|
|||||||
@@ -225,12 +225,6 @@ int main(int argc, char *argv[]) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = run_test(device, buffer, kernel_arg, buf_size, num_points);
|
|
||||||
if (ret != 0) {
|
|
||||||
cleanup();
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
// cleanup
|
// cleanup
|
||||||
std::cout << "cleanup" << std::endl;
|
std::cout << "cleanup" << std::endl;
|
||||||
cleanup();
|
cleanup();
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -7,13 +7,18 @@ module VX_gpr (
|
|||||||
VX_gpr_read_if gpr_read_if,
|
VX_gpr_read_if gpr_read_if,
|
||||||
VX_wb_if writeback_if,
|
VX_wb_if writeback_if,
|
||||||
|
|
||||||
output reg[`NUM_THREADS-1:0][`NUM_GPRS-1:0] a_reg_data,
|
output wire[`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] 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
|
`ifndef ASIC
|
||||||
assign write_enable = valid_write_request && ((writeback_if.wb != 0)) && (writeback_if.rd != 0);
|
|
||||||
|
|
||||||
VX_gpr_ram gpr_ram (
|
VX_gpr_ram gpr_ram (
|
||||||
.we (write_enable),
|
.we (write_enable),
|
||||||
@@ -24,16 +29,17 @@ module VX_gpr (
|
|||||||
.raddr2(gpr_read_if.rs2),
|
.raddr2(gpr_read_if.rs2),
|
||||||
.be (writeback_if.valid),
|
.be (writeback_if.valid),
|
||||||
.wdata (writeback_if.data),
|
.wdata (writeback_if.data),
|
||||||
.q1 (a_reg_data),
|
.q1 (a_reg_data_uqual),
|
||||||
.q2 (b_reg_data)
|
.q2 (b_reg_data_uqual)
|
||||||
);
|
);
|
||||||
|
|
||||||
`else
|
`else
|
||||||
assign write_enable = valid_write_request && ((writeback_if.wb != 0));
|
|
||||||
wire going_to_write = write_enable & (| writeback_if.wb_valid);
|
wire going_to_write = write_enable & (| writeback_if.wb_valid);
|
||||||
wire[`NUM_THREADS-1:0][`NUM_GPRS-1:0] write_bit_mask;
|
wire[`NUM_THREADS-1:0][`NUM_GPRS-1:0] write_bit_mask;
|
||||||
|
|
||||||
genvar i;
|
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];
|
wire local_write = write_enable & writeback_if.wb_valid[i];
|
||||||
assign write_bit_mask[i] = {`NUM_GPRS{~local_write}};
|
assign write_bit_mask[i] = {`NUM_GPRS{~local_write}};
|
||||||
end
|
end
|
||||||
@@ -52,17 +58,17 @@ module VX_gpr (
|
|||||||
`ifndef SYN
|
`ifndef SYN
|
||||||
genvar j;
|
genvar j;
|
||||||
for (i = 0; i < `NUM_THREADS; i = i + 1) begin
|
for (i = 0; i < `NUM_THREADS; i = i + 1) begin
|
||||||
for (j = 0; j < `NUM_GPRS; j=j+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 a_reg_data_uqual[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];
|
assign b_reg_data_uqual[i][j] = ((temp_b[i][j] === 1'dx) || cena_2) ? 1'b0 : temp_b[i][j];
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
`else
|
`else
|
||||||
assign a_reg_data = temp_a;
|
assign a_reg_data_uqual = temp_a;
|
||||||
assign b_reg_data = temp_b;
|
assign b_reg_data_uqual = temp_b;
|
||||||
`endif
|
`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)
|
for (i = 0; i < 'NT; i=i+4)
|
||||||
begin
|
begin
|
||||||
|
|||||||
@@ -112,10 +112,11 @@ void Simulator::io_driver() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Simulator::reset() {
|
void Simulator::reset() {
|
||||||
time_stamp = 0;
|
|
||||||
vortex_->reset = 1;
|
vortex_->reset = 1;
|
||||||
this->step();
|
this->step();
|
||||||
vortex_->reset = 0;
|
vortex_->reset = 0;
|
||||||
|
|
||||||
|
dram_rsp_vec_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Simulator::step() {
|
void Simulator::step() {
|
||||||
@@ -150,6 +151,7 @@ bool Simulator::is_busy() {
|
|||||||
void Simulator::flush_caches(uint32_t mem_addr, uint32_t size) {
|
void Simulator::flush_caches(uint32_t mem_addr, uint32_t size) {
|
||||||
// send snoop requests to the caches
|
// send snoop requests to the caches
|
||||||
printf("[sim] total cycles: %ld\n", time_stamp/2);
|
printf("[sim] total cycles: %ld\n", time_stamp/2);
|
||||||
|
|
||||||
// align address to LLC block boundaries
|
// align address to LLC block boundaries
|
||||||
auto aligned_addr_start = mem_addr / GLOBAL_BLOCK_SIZE;
|
auto aligned_addr_start = mem_addr / GLOBAL_BLOCK_SIZE;
|
||||||
auto aligned_addr_end = (mem_addr + size + GLOBAL_BLOCK_SIZE - 1) / GLOBAL_BLOCK_SIZE;
|
auto aligned_addr_end = (mem_addr + size + GLOBAL_BLOCK_SIZE - 1) / GLOBAL_BLOCK_SIZE;
|
||||||
|
|||||||
@@ -274,14 +274,6 @@ void * _sbrk (int nbytes)
|
|||||||
// }
|
// }
|
||||||
} /* _sbrk () */
|
} /* _sbrk () */
|
||||||
|
|
||||||
|
|
||||||
void _exit(int val)
|
|
||||||
{
|
|
||||||
// vx_print_str("Hello from exit\n");
|
|
||||||
vx_tmc(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int _open(const char *name, int flags, int mode)
|
int _open(const char *name, int flags, int mode)
|
||||||
{
|
{
|
||||||
// char * write_buffer = (char *) FILE_IO_WRITE;
|
// char * write_buffer = (char *) FILE_IO_WRITE;
|
||||||
|
|||||||
@@ -4,27 +4,35 @@
|
|||||||
.global _start
|
.global _start
|
||||||
.type _start, @function
|
.type _start, @function
|
||||||
_start:
|
_start:
|
||||||
la a1, vx_set_sp
|
la a1, vx_set_sp
|
||||||
li a0, NUM_WARPS # activate all warps
|
li a0, NUM_WARPS # activate all warps
|
||||||
.word 0x00b5106b # wspawn a0(numWarps), a1(PC SPAWN)
|
.word 0x00b5106b # wspawn a0(numWarps), a1(PC SPAWN)
|
||||||
jal vx_set_sp
|
jal vx_set_sp
|
||||||
li a0, 1
|
li a0, 1
|
||||||
.word 0x0005006b # back to single thread
|
.word 0x0005006b # back to single thread
|
||||||
# Initialize global pointerp
|
# Initialize global pointerp
|
||||||
# call __cxx_global_var_init
|
# call __cxx_global_var_init
|
||||||
# Clear the bss segment
|
# Clear the bss segment
|
||||||
la a0, _edata
|
la a0, _edata
|
||||||
la a2, _end
|
la a2, _end
|
||||||
sub a2, a2, a0
|
sub a2, a2, a0
|
||||||
li a1, 0
|
li a1, 0
|
||||||
call memset
|
call memset
|
||||||
la a0, __libc_fini_array # Register global termination functions
|
la a0, __libc_fini_array # Register global termination functions
|
||||||
call atexit # to be called upon exit
|
call atexit # to be called upon exit
|
||||||
call __libc_init_array # Run global initialization functions
|
call __libc_init_array # Run global initialization functions
|
||||||
call main
|
call main
|
||||||
tail exit
|
tail exit
|
||||||
.size _start, .-_start
|
.size _start, .-_start
|
||||||
|
|
||||||
|
.section .text
|
||||||
|
.type _exit, @function
|
||||||
|
.global _exit
|
||||||
|
_exit:
|
||||||
|
li a0, 0
|
||||||
|
.word 0x0005006b # disable all threads
|
||||||
|
|
||||||
|
|
||||||
.section .text
|
.section .text
|
||||||
.type vx_set_sp, @function
|
.type vx_set_sp, @function
|
||||||
.global vx_set_sp
|
.global vx_set_sp
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
COMP = ~/dev/riscv-gnu-toolchain/drops/bin/riscv32-unknown-elf-g++
|
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
|
DMP = ~/dev/riscv-gnu-toolchain/drops/bin/riscv32-unknown-elf-objdump
|
||||||
CPY = ~/dev/riscv-gnu-toolchain/drops/bin/riscv32-unknown-elf-objcopy
|
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
|
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 += ~/dev/riscv-gnu-toolchain/drops/riscv32-unknown-elf/lib/libc.a
|
||||||
#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/libstdc++.a
|
||||||
|
#LIBS += -static-libgcc -lgcc
|
||||||
|
|
||||||
VX_SRCS = vx_simple_main.c tests.c
|
VX_SRCS = vx_simple_main.c tests.c
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user