Fixed most of the cache issues, mat_add left

This commit is contained in:
felsabbagh3
2020-03-22 15:59:45 -07:00
parent 82ea79c680
commit 5372c07b01
9 changed files with 29220 additions and 28624 deletions

View File

@@ -71,7 +71,7 @@ module VX_cache_miss_resrv
output wire miss_resrv_valid_st0,
output wire[31:0] miss_resrv_addr_st0,
output wire[`WORD_SIZE_RNG] miss_resrv_data_st0,
output wire[`vx_clog2(NUMBER_REQUESTS)-1:0] miss_resrv_tid_st0,
output wire[`vx_clog2(NUMBER_REQUESTS)-1:0] miss_resrv_tid_st0,
output wire[4:0] miss_resrv_rd_st0,
output wire[1:0] miss_resrv_wb_st0,
output wire[`NW_M1:0] miss_resrv_warp_num_st0,
@@ -90,8 +90,11 @@ module VX_cache_miss_resrv
reg[`vx_clog2(MRVQ_SIZE)-1:0] head_ptr;
reg[`vx_clog2(MRVQ_SIZE)-1:0] tail_ptr;
reg[31:0] size;
assign miss_resrv_full = (MRVQ_SIZE != 2) && (tail_ptr+1) == head_ptr;
// assign miss_resrv_full = (MRVQ_SIZE != 2) && (tail_ptr+1) == head_ptr;
assign miss_resrv_full = (MRVQ_SIZE != 2) && (size == MRVQ_SIZE);
wire enqueue_possible = !miss_resrv_full;
@@ -108,7 +111,7 @@ module VX_cache_miss_resrv
wire dequeue_possible = valid_table[head_ptr] && ready_table[head_ptr];
wire[`vx_clog2(MRVQ_SIZE)-1:0] dequeue_index = head_ptr;
wire[`vx_clog2(MRVQ_SIZE)-1:0] dequeue_index = head_ptr;
assign miss_resrv_valid_st0 = (MRVQ_SIZE != 2) && dequeue_possible;
assign miss_resrv_pc_st0 = pc_table[dequeue_index];
@@ -126,6 +129,7 @@ module VX_cache_miss_resrv
pc_table <= 0;
end else begin
if (miss_add && enqueue_possible && (MRVQ_SIZE != 2)) begin
size <= size + 1;
valid_table[enqueue_index] <= 1;
ready_table[enqueue_index] <= 0;
pc_table[enqueue_index] <= miss_add_pc;
@@ -139,6 +143,7 @@ module VX_cache_miss_resrv
end
if (miss_resrv_pop && dequeue_possible) begin
size <= size - 1;
valid_table[dequeue_index] <= 0;
ready_table[dequeue_index] <= 0;
addr_table[dequeue_index] <= 0;

View File

@@ -94,7 +94,7 @@ module VX_tag_data_access
wire[`DBANK_LINE_SIZE_RNG][31:0] use_write_data;
wire real_writefill = writefill_st1e && miss_st1e;
wire real_writefill = writefill_st1e && ((valid_req_st1e && !use_read_valid_st1e) || (valid_req_st1e && use_read_valid_st1e && (writeaddr_st1e[`TAG_SELECT_ADDR_RNG] != use_read_tag_st1e)));
wire fill_sent;
@@ -238,14 +238,14 @@ module VX_tag_data_access
wire[3:0] sh_mask = (b0 ? 4'b0011 : 4'b1100);
wire should_write = (sw || sb || sh) && valid_req_st1e && use_read_valid_st1e && !miss_st1e;
wire force_write = writefill_st1e && valid_req_st1e && miss_st1e && (!use_read_valid_st1e || (use_read_valid_st1e && !miss_st1e));
wire force_write = real_writefill && valid_req_st1e && miss_st1e && (!use_read_valid_st1e || (use_read_valid_st1e && !miss_st1e));
wire[`DBANK_LINE_SIZE_RNG][3:0] we;
wire[`DBANK_LINE_SIZE_RNG][31:0] data_write;
genvar g;
generate
for (g = 0; g < `DBANK_LINE_SIZE_WORDS; g = g + 1) begin : write_enables
wire normal_write = (block_offset == g[`WORD_SELECT_SIZE_RNG]) && should_write && !writefill_st1e;
wire normal_write = (block_offset == g[`WORD_SELECT_SIZE_RNG]) && should_write && !real_writefill;
assign we[g] = (force_write) ? 4'b1111 :
(normal_write && (FUNC_ID == `LLFUNC_ID)) ? 4'b1111 :

View File

@@ -12,7 +12,7 @@ int main(int argc, char **argv)
Verilated::traceEverOn(true);
#define ALL_TESTS
// #define ALL_TESTS
#ifdef ALL_TESTS
bool passed = true;
@@ -88,9 +88,9 @@ int main(int argc, char **argv)
#else
// char testing[] = "../../runtime/mains/simple/vx_simple_main.hex";
char testing[] = "../../runtime/mains/simple/vx_simple_main.hex";
// char testing[] = "../../emulator/riscv_tests/rv32ui-p-lw.hex";
char testing[] = "../../emulator/riscv_tests/rv32ui-p-sw.hex";
// char testing[] = "../../emulator/riscv_tests/rv32ui-p-sw.hex";
Vortex v;
// const char *testing;

View File

@@ -1,5 +1,5 @@
COMP = /opt/riscv-new/drops/bin/riscv32-unknown-elf-gcc
COMP = /opt/riscv-new/drops/bin/riscv32-unknown-elf-g++
CC_FLAGS = -march=rv32im -mabi=ilp32 -O0 -Wl,-Bstatic,-T,../vortex_link.ld -ffreestanding -nostdlib
DMP = /opt/riscv-new/drops/bin/riscv32-unknown-elf-objdump

View File

@@ -52,7 +52,7 @@ int main()
// Main is called with all threads active of warp 0
vx_tmc(1);
vx_print_str("Let's start...\n");
vx_print_str("Let's start... (This might take a while)\n");
unsigned what[36];
for (int i = 0; i < 36; i++)
{
@@ -98,31 +98,31 @@ int main()
}
vx_print_str("vx_spawnWarps mat_add_kernel\n");
// vx_print_str("vx_spawnWarps mat_add_kernel\n");
mat_add_args_t arguments;
arguments.x = x;
arguments.y = y;
arguments.z = z;
arguments.numColums = 4;
arguments.numRows = 4;
// mat_add_args_t arguments;
// arguments.x = x;
// arguments.y = y;
// arguments.z = z;
// arguments.numColums = 4;
// arguments.numRows = 4;
int numWarps = 4;
int numThreads = 4;
// int numWarps = 4;
// int numThreads = 4;
vx_spawnWarps(numWarps, numThreads, mat_add_kernel, &arguments);
// vx_spawnWarps(numWarps, numThreads, mat_add_kernel, &arguments);
for (int i = 0; i < arguments.numRows; i++)
{
for (int j = 0; j < arguments.numColums; j++)
{
unsigned index = (i * arguments.numColums) + j;
vx_print_hex(z[index]);
vx_print_str(" ");
}
vx_print_str("\n");
}
// for (int i = 0; i < arguments.numRows; i++)
// {
// for (int j = 0; j < arguments.numColums; j++)
// {
// unsigned index = (i * arguments.numColums) + j;
// vx_print_hex(z[index]);
// vx_print_str(" ");
// }
// vx_print_str("\n");
// }
return 0;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -17,27 +17,34 @@
.global _start
.type _start, @function
_start:
# Initialize SP
# la sp, __stack_top
# li a0, 4
# .word 0x0005006b # tmc 4
# csrr a2, 0x20 # get tid
# slli a2, a2, 2
# la a3, 0x80000000
# add a3, a3, a2
# lw a4, 0(a3)
la a1, vx_set_sp
li a0, 4
.word 0x00b5106b # wspawn a0(numWarps), a1(PC SPAWN)
jal vx_set_sp
##########################################
# li a0, 1
# .word 0x0005006b # tmc 1
# 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
# li a0, 4
# .word 0x0005006b # tmc 4
# # 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
li a0, 4
.word 0x0005006b # tmc 4
##############################################
call main
tail exit
.size _start, .-_start