Skip to content

Commit 929ef1b

Browse files
committedJan 14, 2025
Remove unused EXTV code, clean up code, pragma once around vpu.h
1 parent 01974e1 commit 929ef1b

File tree

8 files changed

+2399
-2420
lines changed

8 files changed

+2399
-2420
lines changed
 

‎sim/simx/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ SRCS += $(SRC_DIR)/processor.cpp $(SRC_DIR)/cluster.cpp $(SRC_DIR)/socket.cpp $(
2222

2323
# Add V extension sources
2424
ifneq ($(findstring -DEXT_V_ENABLE, $(CONFIGS)),)
25-
SRCS += $(SRC_DIR)/execute_v.cpp
25+
SRCS += $(SRC_DIR)/vpu.cpp
2626
endif
2727

2828
# Debugging

‎sim/simx/arch.h

-6
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ class Arch {
2929
uint16_t num_cores_;
3030
uint16_t num_clusters_;
3131
uint16_t socket_size_;
32-
uint16_t vsize_;
3332
uint16_t num_barriers_;
3433
uint64_t local_mem_base_;
3534

@@ -40,7 +39,6 @@ class Arch {
4039
, num_cores_(num_cores)
4140
, num_clusters_(NUM_CLUSTERS)
4241
, socket_size_(SOCKET_SIZE)
43-
, vsize_(VLEN / 8)
4442
, num_barriers_(NUM_BARRIERS)
4543
, local_mem_base_(LMEM_BASE_ADDR)
4644
{}
@@ -73,10 +71,6 @@ class Arch {
7371
return socket_size_;
7472
}
7573

76-
uint16_t vsize() const {
77-
return vsize_;
78-
}
79-
8074
};
8175

8276
}

‎sim/simx/emulator.cpp

+1-11
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ using namespace vortex;
3333
Emulator::warp_t::warp_t(const Arch& arch)
3434
: ireg_file(arch.num_threads(), std::vector<Word>(MAX_NUM_REGS))
3535
, freg_file(arch.num_threads(), std::vector<uint64_t>(MAX_NUM_REGS))
36-
, vreg_file(MAX_NUM_REGS, std::vector<Byte>(arch.vsize()))
36+
, vreg_file(MAX_NUM_REGS, std::vector<Byte>(MAX_NUM_REGS))
3737
, uuid(0)
3838
{}
3939

@@ -77,16 +77,6 @@ void Emulator::warp_t::clear(uint64_t startup_addr) {
7777
#endif
7878
}
7979
}
80-
81-
for (auto& reg_file : this->vreg_file) {
82-
for (auto& reg : reg_file) {
83-
#ifndef NDEBUG
84-
reg = 0;
85-
#else
86-
reg = std::rand();
87-
#endif
88-
}
89-
}
9080
}
9181

9282
///////////////////////////////////////////////////////////////////////////////

‎sim/simx/execute.cpp

+3-9
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,7 @@ void Emulator::execute(const Instr &instr, uint32_t wid, instr_trace_t *trace) {
932932
for (uint32_t t = thread_start; t < num_threads; ++t) {
933933
if (!warp.tmask.test(t))
934934
continue;
935-
uint32_t frm = (func3 == 0x7) ? this->get_csr(VX_CSR_FRM, t, wid) : func3;
935+
uint32_t frm = this->get_fpu_rm(func3, t, wid);
936936
uint32_t fflags = 0;
937937
switch (func7) {
938938
case 0x00: { // RV32F: FADD.S
@@ -1247,10 +1247,7 @@ void Emulator::execute(const Instr &instr, uint32_t wid, instr_trace_t *trace) {
12471247
break;
12481248
}
12491249
}
1250-
if (fflags) {
1251-
this->set_csr(VX_CSR_FCSR, this->get_csr(VX_CSR_FCSR, t, wid) | fflags, t, wid);
1252-
this->set_csr(VX_CSR_FFLAGS, this->get_csr(VX_CSR_FFLAGS, t, wid) | fflags, t, wid);
1253-
}
1250+
this->update_fcrs(fflags, t, wid);
12541251
}
12551252
rd_write = true;
12561253
break;
@@ -1304,10 +1301,7 @@ void Emulator::execute(const Instr &instr, uint32_t wid, instr_trace_t *trace) {
13041301
default:
13051302
break;
13061303
}
1307-
if (fflags) {
1308-
this->set_csr(VX_CSR_FCSR, this->get_csr(VX_CSR_FCSR, t, wid) | fflags, t, wid);
1309-
this->set_csr(VX_CSR_FFLAGS, this->get_csr(VX_CSR_FFLAGS, t, wid) | fflags, t, wid);
1310-
}
1304+
this->update_fcrs(fflags, t, wid);
13111305
}
13121306
rd_write = true;
13131307
break;

‎sim/simx/execute_v.cpp ‎sim/simx/vpu.cpp

+2-2,389
Large diffs are not rendered by default.

‎sim/simx/vpu.h

+2,391
Large diffs are not rendered by default.

‎tests/riscv/riscv-vector-tests/README

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ XLEN=64 ./run-test.sh
1111

1212
## Adding a new testcase
1313

14-
The source code for the vector extension can be found in `sim/simx/execute_vector.cpp`.
14+
The source code for the vector extension can be found in `sim/simx/vpu.cpp`.
1515
If you add support for a new vector instruction please go to `run-test.sh` and it to the default testcases.
1616
This will ensure your instruction is included in the regression test suite.
1717

‎tests/riscv/riscv-vector-tests/run-test.sh.in

-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
#!/bin/bash
2-
VLEN=${VLEN:-256}
3-
XLEN=${XLEN:-32}
4-
52
RISCV_TOOLCHAIN_PATH=${RISCV_TOOLCHAIN_PATH:-$TOOLDIR"/riscv"$XLEN"-gnu-toolchain"}
63

74
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

0 commit comments

Comments
 (0)
Please sign in to comment.