diff --git a/sim/common/mem.cpp b/sim/common/mem.cpp index ff67489d..67f5b2d6 100644 --- a/sim/common/mem.cpp +++ b/sim/common/mem.cpp @@ -276,7 +276,7 @@ void RAM::loadHexImage(const char* filename) { ifs.seekg(0, ifs.beg); ifs.read(content.data(), size); - int offset = 0; + uint32_t offset = 0; char *line = content.data(); this->clear(); diff --git a/sim/common/mem.h b/sim/common/mem.h index d404602d..558a524a 100644 --- a/sim/common/mem.h +++ b/sim/common/mem.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include diff --git a/sim/common/rvfloats.cpp b/sim/common/rvfloats.cpp index a03152cb..fd21d0c6 100644 --- a/sim/common/rvfloats.cpp +++ b/sim/common/rvfloats.cpp @@ -86,7 +86,7 @@ uint64_t rv_fmadd_d(uint64_t a, uint64_t b, uint64_t c, uint32_t frm, uint32_t* uint32_t rv_fmsub_s(uint32_t a, uint32_t b, uint32_t c, uint32_t frm, uint32_t* fflags) { softfloat_roundingMode = frm; - int c_neg = c ^ F32_SIGN; + auto c_neg = c ^ F32_SIGN; auto r = f32_mulAdd(to_float32_t(a), to_float32_t(b), to_float32_t(c_neg)); if (fflags) { *fflags = get_fflags(); } return from_float32_t(r); @@ -94,7 +94,7 @@ uint32_t rv_fmsub_s(uint32_t a, uint32_t b, uint32_t c, uint32_t frm, uint32_t* uint64_t rv_fmsub_d(uint64_t a, uint64_t b, uint64_t c, uint32_t frm, uint32_t* fflags) { softfloat_roundingMode = frm; - long c_neg = c ^ F64_SIGN; + auto c_neg = c ^ F64_SIGN; auto r = f64_mulAdd(to_float64_t(a), to_float64_t(b), to_float64_t(c_neg)); if (fflags) { *fflags = get_fflags(); } return from_float64_t(r); @@ -102,8 +102,8 @@ uint64_t rv_fmsub_d(uint64_t a, uint64_t b, uint64_t c, uint32_t frm, uint32_t* uint32_t rv_fnmadd_s(uint32_t a, uint32_t b, uint32_t c, uint32_t frm, uint32_t* fflags) { softfloat_roundingMode = frm; - int a_neg = a ^ F32_SIGN; - int c_neg = c ^ F32_SIGN; + auto a_neg = a ^ F32_SIGN; + auto c_neg = c ^ F32_SIGN; auto r = f32_mulAdd(to_float32_t(a_neg), to_float32_t(b), to_float32_t(c_neg)); if (fflags) { *fflags = get_fflags(); } return from_float32_t(r); @@ -111,8 +111,8 @@ uint32_t rv_fnmadd_s(uint32_t a, uint32_t b, uint32_t c, uint32_t frm, uint32_t* uint64_t rv_fnmadd_d(uint64_t a, uint64_t b, uint64_t c, uint32_t frm, uint32_t* fflags) { softfloat_roundingMode = frm; - long a_neg = a ^ F64_SIGN; - long c_neg = c ^ F64_SIGN; + auto a_neg = a ^ F64_SIGN; + auto c_neg = c ^ F64_SIGN; auto r = f64_mulAdd(to_float64_t(a_neg), to_float64_t(b), to_float64_t(c_neg)); if (fflags) { *fflags = get_fflags(); } return from_float64_t(r); @@ -120,7 +120,7 @@ uint64_t rv_fnmadd_d(uint64_t a, uint64_t b, uint64_t c, uint32_t frm, uint32_t* uint32_t rv_fnmsub_s(uint32_t a, uint32_t b, uint32_t c, uint32_t frm, uint32_t* fflags) { softfloat_roundingMode = frm; - int a_neg = a ^ F32_SIGN; + auto a_neg = a ^ F32_SIGN; auto r = f32_mulAdd(to_float32_t(a_neg), to_float32_t(b), to_float32_t(c)); if (fflags) { *fflags = get_fflags(); } return from_float32_t(r); @@ -128,7 +128,7 @@ uint32_t rv_fnmsub_s(uint32_t a, uint32_t b, uint32_t c, uint32_t frm, uint32_t* uint64_t rv_fnmsub_d(uint64_t a, uint64_t b, uint64_t c, uint32_t frm, uint32_t* fflags) { softfloat_roundingMode = frm; - long a_neg = a ^ F64_SIGN; + auto a_neg = a ^ F64_SIGN; auto r = f64_mulAdd(to_float64_t(a_neg), to_float64_t(b), to_float64_t(c)); if (fflags) { *fflags = get_fflags(); } return from_float64_t(r); @@ -312,7 +312,7 @@ uint64_t rv_feq_d(uint64_t a, uint64_t b, uint32_t* fflags) { } uint32_t rv_fmin_s(uint32_t a, uint32_t b, uint32_t* fflags) { - long r; + uint32_t r; if (isNaNF32UI(a) && isNaNF32UI(b)) { r = defaultNaNF32UI; } else { @@ -330,7 +330,7 @@ uint32_t rv_fmin_s(uint32_t a, uint32_t b, uint32_t* fflags) { } uint64_t rv_fmin_d(uint64_t a, uint64_t b, uint32_t* fflags) { - long r; + uint64_t r; if (isNaNF64UI(a) && isNaNF64UI(b)) { r = defaultNaNF64UI; } else { @@ -348,7 +348,7 @@ uint64_t rv_fmin_d(uint64_t a, uint64_t b, uint32_t* fflags) { } uint32_t rv_fmax_s(uint32_t a, uint32_t b, uint32_t* fflags) { - long r; + uint32_t r; if (isNaNF32UI(a) && isNaNF32UI(b)) { r = defaultNaNF32UI; } else { @@ -366,7 +366,7 @@ uint32_t rv_fmax_s(uint32_t a, uint32_t b, uint32_t* fflags) { } uint64_t rv_fmax_d(uint64_t a, uint64_t b, uint32_t* fflags) { - long r; + uint64_t r; if (isNaNF64UI(a) && isNaNF64UI(b)) { r = defaultNaNF64UI; } else { @@ -391,7 +391,7 @@ uint32_t rv_fclss_s(uint32_t a) { bool isNaN = isNaNF32UI(a); bool isSNaN = softfloat_isSigNaNF32UI(a); - int r = + uint32_t r = ( sign && infOrNaN && fracZero ) << 0 | ( sign && !infOrNaN && !subnormOrZero ) << 1 | ( sign && subnormOrZero && !fracZero ) << 2 | @@ -406,7 +406,7 @@ uint32_t rv_fclss_s(uint32_t a) { return r; } -uint64_t rv_fclss_d(uint64_t a) { +uint32_t rv_fclss_d(uint64_t a) { auto infOrNaN = (0x7ff == expF64UI(a)); auto subnormOrZero = (0 == expF64UI(a)); bool sign = signF64UI(a); @@ -414,7 +414,7 @@ uint64_t rv_fclss_d(uint64_t a) { bool isNaN = isNaNF64UI(a); bool isSNaN = softfloat_isSigNaNF64UI(a); - int r = + uint32_t r = ( sign && infOrNaN && fracZero ) << 0 | ( sign && !infOrNaN && !subnormOrZero ) << 1 | ( sign && subnormOrZero && !fracZero ) << 2 | @@ -430,63 +430,49 @@ uint64_t rv_fclss_d(uint64_t a) { } uint32_t rv_fsgnj_s(uint32_t a, uint32_t b) { - - int sign = b & F32_SIGN; - int r = sign | (a & ~F32_SIGN); - + auto sign = b & F32_SIGN; + auto r = sign | (a & ~F32_SIGN); return r; } -uint64_t rv_fsgnj_d(uint64_t a, uint64_t b) { - - long sign = b & F64_SIGN; - long r = sign | (a & ~F64_SIGN); - +uint64_t rv_fsgnj_d(uint64_t a, uint64_t b) { + auto sign = b & F64_SIGN; + auto r = sign | (a & ~F64_SIGN); return r; } uint32_t rv_fsgnjn_s(uint32_t a, uint32_t b) { - - int sign = ~b & F32_SIGN; - int r = sign | (a & ~F32_SIGN); - + auto sign = ~b & F32_SIGN; + auto r = sign | (a & ~F32_SIGN); return r; } -uint64_t rv_fsgnjn_d(uint64_t a, uint64_t b) { - - long sign = ~b & F64_SIGN; - long r = sign | (a & ~F64_SIGN); - +uint64_t rv_fsgnjn_d(uint64_t a, uint64_t b) { + auto sign = ~b & F64_SIGN; + auto r = sign | (a & ~F64_SIGN); return r; } uint32_t rv_fsgnjx_s(uint32_t a, uint32_t b) { - - int sign1 = a & F32_SIGN; - int sign2 = b & F32_SIGN; - int r = (sign1 ^ sign2) | (a & ~F32_SIGN); - + auto sign1 = a & F32_SIGN; + auto sign2 = b & F32_SIGN; + auto r = (sign1 ^ sign2) | (a & ~F32_SIGN); return r; } -uint64_t rv_fsgnjx_d(uint64_t a, uint64_t b) { - - long sign1 = a & F64_SIGN; - long sign2 = b & F64_SIGN; - long r = (sign1 ^ sign2) | (a & ~F64_SIGN); - +uint64_t rv_fsgnjx_d(uint64_t a, uint64_t b) { + auto sign1 = a & F64_SIGN; + auto sign2 = b & F64_SIGN; + auto r = (sign1 ^ sign2) | (a & ~F64_SIGN); return r; } uint32_t rv_dtof(uint64_t a) { - auto r = f64_to_f32(to_float64_t(a)); return from_float32_t(r); } uint64_t rv_ftod(uint32_t a) { - auto r = f32_to_f64(to_float32_t(a)); return from_float64_t(r); } diff --git a/sim/common/rvfloats.h b/sim/common/rvfloats.h index c0b65939..f5cb0424 100644 --- a/sim/common/rvfloats.h +++ b/sim/common/rvfloats.h @@ -38,6 +38,7 @@ uint32_t rv_feq_s(uint32_t a, uint32_t b, uint32_t* fflags); uint32_t rv_fmin_s(uint32_t a, uint32_t b, uint32_t* fflags); uint32_t rv_fmax_s(uint32_t a, uint32_t b, uint32_t* fflags); +/////////////////////////////////////////////////////////////////////////////// uint64_t rv_fadd_d(uint64_t a, uint64_t b, uint32_t frm, uint32_t* fflags); uint64_t rv_fsub_d(uint64_t a, uint64_t b, uint32_t frm, uint32_t* fflags); @@ -59,7 +60,7 @@ uint64_t rv_utof_d(uint64_t a, uint32_t frm, uint32_t* fflags); uint64_t rv_ltof_d(uint64_t a, uint32_t frm, uint32_t* fflags); uint64_t rv_lutof_d(uint64_t a, uint32_t frm, uint32_t* fflags); -uint64_t rv_fclss_d(uint64_t a); +uint32_t rv_fclss_d(uint64_t a); uint64_t rv_fsgnj_d(uint64_t a, uint64_t b); uint64_t rv_fsgnjn_d(uint64_t a, uint64_t b); uint64_t rv_fsgnjx_d(uint64_t a, uint64_t b); diff --git a/sim/common/texturing.h b/sim/common/texturing.h index 5941594e..5e032ce7 100644 --- a/sim/common/texturing.h +++ b/sim/common/texturing.h @@ -56,7 +56,7 @@ inline void Unpack8888(TexFormat format, uint32_t texel, uint32_t* lo, uint32_t* hi) { - int r, g, b, a; + uint32_t r, g, b, a; switch (format) { case TexFormat::A8R8G8B8: r = (texel >> 16) & 0xff; diff --git a/sim/simx/Makefile b/sim/simx/Makefile index 1354e380..a519c6e3 100644 --- a/sim/simx/Makefile +++ b/sim/simx/Makefile @@ -36,11 +36,6 @@ ifdef XLEN CXXFLAGS += -DXLEN=$(XLEN) endif -# FLEN parameterization -ifdef FLEN - CXXFLAGS += -DFLEN=$(FLEN) -endif - PROJECT = simx all: $(DESTDIR)/$(PROJECT) diff --git a/sim/simx/archdef.h b/sim/simx/archdef.h index bd5a556a..3e8b2da6 100644 --- a/sim/simx/archdef.h +++ b/sim/simx/archdef.h @@ -21,8 +21,7 @@ private: uint16_t num_barriers_; public: - ArchDef(const std::string& /*arch*/, - uint16_t num_cores, + ArchDef(uint16_t num_cores, uint16_t num_warps, uint16_t num_threads) : num_cores_(num_cores) @@ -67,4 +66,5 @@ public: return num_cores_; } }; + } \ No newline at end of file diff --git a/sim/simx/cache.cpp b/sim/simx/cache.cpp index 525ae32b..c6d69a6b 100644 --- a/sim/simx/cache.cpp +++ b/sim/simx/cache.cpp @@ -42,7 +42,7 @@ struct params_t { assert(config.ports_per_bank <= this->words_per_block); - // uint32_t select + // Word select this->word_select_addr_start = config.W; this->word_select_addr_end = (this->word_select_addr_start+offset_bits-1); @@ -488,11 +488,11 @@ private: } else { bool hit = false; bool found_free_block = false; - int hit_block_id = 0; - int repl_block_id = 0; + uint32_t hit_block_id = 0; + uint32_t repl_block_id = 0; uint32_t max_cnt = 0; - for (int i = 0, n = set.blocks.size(); i < n; ++i) { + for (uint32_t i = 0, n = set.blocks.size(); i < n; ++i) { auto& block = set.blocks.at(i); if (block.valid) { if (block.tag == pipeline_req.tag) { diff --git a/sim/simx/core.cpp b/sim/simx/core.cpp index 088b4c7f..cec4154d 100644 --- a/sim/simx/core.cpp +++ b/sim/simx/core.cpp @@ -73,7 +73,7 @@ Core::Core(const SimContext& ctx, const ArchDef &arch, uint32_t id) , decode_latch_("decode") , pending_icache_(arch_.num_warps()) { - for (int i = 0; i < arch_.num_warps(); ++i) { + for (uint32_t i = 0; i < arch_.num_warps(); ++i) { warps_.at(i) = std::make_shared(this, i); } @@ -195,7 +195,7 @@ void Core::tick() { void Core::schedule() { bool foundSchedule = false; - int scheduled_warp = last_schedule_wid_; + uint32_t scheduled_warp = last_schedule_wid_; // round robin scheduling for (size_t wid = 0, nw = arch_.num_warps(); wid < nw; ++wid) { @@ -367,11 +367,11 @@ void Core::commit() { } } -WarpMask Core::wspawn(int num_warps, int nextPC) { +WarpMask Core::wspawn(uint32_t num_warps, uint32_t nextPC) { WarpMask ret(1); - int active_warps = std::min(num_warps, arch_.num_warps()); + uint32_t active_warps = std::min(num_warps, arch_.num_warps()); DP(3, "*** Activate " << (active_warps-1) << " warps at PC: " << std::hex << nextPC); - for (int i = 1; i < active_warps; ++i) { + for (uint32_t i = 1; i < active_warps; ++i) { auto warp = warps_.at(i); warp->setPC(nextPC); warp->setTmask(0, true); @@ -380,7 +380,7 @@ WarpMask Core::wspawn(int num_warps, int nextPC) { return std::move(ret); } -WarpMask Core::barrier(int bar_id, int count, int warp_id) { +WarpMask Core::barrier(uint32_t bar_id, uint32_t count, uint32_t warp_id) { WarpMask ret(0); auto& barrier = barriers_.at(bar_id); barrier.set(warp_id); @@ -389,7 +389,7 @@ WarpMask Core::barrier(int bar_id, int count, int warp_id) { DP(3, "*** Suspend warp #" << warp_id << " at barrier #" << bar_id); return std::move(ret); } - for (int i = 0; i < arch_.num_warps(); ++i) { + for (uint32_t i = 0; i < arch_.num_warps(); ++i) { if (barrier.test(i)) { DP(3, "*** Resume warp #" << i << " at barrier #" << bar_id); warps_.at(i)->activate(); @@ -446,7 +446,7 @@ void Core::writeToStdOut(Addr addr, uint32_t data) { } } -uint32_t Core::get_csr(Addr addr, int tid, int wid) { +uint32_t Core::get_csr(Addr addr, uint32_t tid, uint32_t wid) { switch (addr) { case CSR_SATP: case CSR_PMPCFG0: @@ -644,7 +644,7 @@ uint32_t Core::get_csr(Addr addr, int tid, int wid) { return 0; } -void Core::set_csr(Addr addr, uint32_t value, int /*tid*/, int wid) { +void Core::set_csr(Addr addr, uint32_t value, uint32_t /*tid*/, uint32_t wid) { if (addr == CSR_FFLAGS) { fcsrs_.at(wid) = (fcsrs_.at(wid) & ~0x1F) | (value & 0x1F); } else if (addr == CSR_FRM) { diff --git a/sim/simx/core.h b/sim/simx/core.h index 0125acb4..812fd9e9 100644 --- a/sim/simx/core.h +++ b/sim/simx/core.h @@ -99,13 +99,13 @@ public: return warps_.at(0)->getIRegValue(reg); } - uint32_t get_csr(Addr addr, int tid, int wid); + uint32_t get_csr(Addr addr, uint32_t tid, uint32_t wid); - void set_csr(Addr addr, uint32_t value, int tid, int wid); + void set_csr(Addr addr, uint32_t value, uint32_t tid, uint32_t wid); - WarpMask wspawn(int num_warps, int nextPC); + WarpMask wspawn(uint32_t num_warps, uint32_t nextPC); - WarpMask barrier(int bar_id, int count, int warp_id); + WarpMask barrier(uint32_t bar_id, uint32_t count, uint32_t warp_id); uint32_t icache_read(Addr, Size); diff --git a/sim/simx/decode.cpp b/sim/simx/decode.cpp index bc7ae263..2a4dd124 100644 --- a/sim/simx/decode.cpp +++ b/sim/simx/decode.cpp @@ -351,7 +351,7 @@ std::ostream &operator<<(std::ostream &os, const Instr &instr) { if (instr.getRDType() != RegType::None) { os << instr.getRDType() << std::dec << instr.getRDest() << " <- "; } - int i = 0; + uint32_t i = 0; for (; i < instr.getNRSrc(); ++i) { if (i) os << ", "; os << instr.getRSType(i) << std::dec << instr.getRSrc(i); @@ -552,7 +552,7 @@ std::shared_ptr Decoder::decode(uint32_t code) const { uint32_t bit_11 = (unordered >> 8) & 0x1; uint32_t bits_10_1 = (unordered >> 9) & 0x3ff; uint32_t bit_20 = (unordered >> 19) & 0x1; - Word imm = (Word) 0 | (bits_10_1 << 1) | (bit_11 << 11) | (bits_19_12 << 12) | (bit_20 << 20); + Word imm = (bits_10_1 << 1) | (bit_11 << 11) | (bits_19_12 << 12) | (bit_20 << 20); if (bit_20) { imm |= ~j_imm_mask_; } diff --git a/sim/simx/execute.cpp b/sim/simx/execute.cpp index 4a1c6ed2..5ccf200b 100644 --- a/sim/simx/execute.cpp +++ b/sim/simx/execute.cpp @@ -57,22 +57,22 @@ inline uint64_t nan_box(uint32_t word) { void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { assert(tmask_.any()); - Word nextPC = PC_ + core_->arch().wsize(); + auto nextPC = PC_ + core_->arch().wsize(); - uint32_t func2 = instr.getFunc2(); - uint32_t func3 = instr.getFunc3(); - uint32_t func6 = instr.getFunc6(); - uint32_t func7 = instr.getFunc7(); + auto func2 = instr.getFunc2(); + auto func3 = instr.getFunc3(); + auto func6 = instr.getFunc6(); + auto func7 = instr.getFunc7(); auto opcode = instr.getOpcode(); - int rdest = instr.getRDest(); - int rsrc0 = instr.getRSrc(0); - int rsrc1 = instr.getRSrc(1); - int rsrc2 = instr.getRSrc(2); - Word immsrc = instr.getImm(); - uint32_t vmask = instr.getVmask(); + auto rdest = instr.getRDest(); + auto rsrc0 = instr.getRSrc(0); + auto rsrc1 = instr.getRSrc(1); + auto rsrc2 = instr.getRSrc(2); + auto immsrc = instr.getImm(); + auto vmask = instr.getVmask(); - int num_threads = core_->arch().num_threads(); + auto num_threads = core_->arch().num_threads(); std::vector rsdata(num_threads); std::vector rddata(num_threads); @@ -80,16 +80,16 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { std::vector frsdata(num_threads); std::vector frddata(num_threads); - int num_rsrcs = instr.getNRSrc(); + auto num_rsrcs = instr.getNRSrc(); if (num_rsrcs) { - for (int i = 0; i < num_rsrcs; ++i) { + for (uint32_t i = 0; i < num_rsrcs; ++i) { DPH(2, "Src Reg [" << std::dec << i << "]: "); auto type = instr.getRSType(i); - int reg = instr.getRSrc(i); + auto reg = instr.getRSrc(i); switch (type) { case RegType::Integer: DPN(2, "r" << std::dec << reg << "={"); - for (int t = 0; t < num_threads; ++t) { + for (uint32_t t = 0; t < num_threads; ++t) { if (t) DPN(2, ", "); if (!tmask_.test(t)) { DPN(2, "-"); @@ -102,7 +102,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { break; case RegType::Float: DPN(2, "fr" << std::dec << reg << "={"); - for (int t = 0; t < num_threads; ++t) { + for (uint32_t t = 0; t < num_threads; ++t) { if (t) DPN(2, ", "); if (!tmask_.test(t)) { DPN(2, "-"); @@ -129,7 +129,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { case LUI_INST: { trace->exe_type = ExeType::ALU; trace->alu.type = AluType::ARITH; - for (int t = 0; t < num_threads; ++t) { + for (uint32_t t = 0; t < num_threads; ++t) { if (!tmask_.test(t)) continue; rddata[t] = immsrc << 12; @@ -141,7 +141,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { case AUIPC_INST: { trace->exe_type = ExeType::ALU; trace->alu.type = AluType::ARITH; - for (int t = 0; t < num_threads; ++t) { + for (uint32_t t = 0; t < num_threads; ++t) { if (!tmask_.test(t)) continue; rddata[t] = (immsrc << 12) + PC_; @@ -154,7 +154,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { trace->alu.type = AluType::ARITH; trace->used_iregs.set(rsrc0); trace->used_iregs.set(rsrc1); - for (int t = 0; t < num_threads; ++t) { + for (uint32_t t = 0; t < num_threads; ++t) { if (!tmask_.test(t)) continue; if (func7 & 0x1) { @@ -314,7 +314,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { trace->exe_type = ExeType::ALU; trace->alu.type = AluType::ARITH; trace->used_iregs.set(rsrc0); - for (int t = 0; t < num_threads; ++t) { + for (uint32_t t = 0; t < num_threads; ++t) { if (!tmask_.test(t)) continue; switch (func3) { @@ -375,7 +375,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { trace->alu.type = AluType::ARITH; trace->used_iregs.set(rsrc0); trace->used_iregs.set(rsrc1); - for (int t = 0; t < num_threads; ++t) { + for (uint32_t t = 0; t < num_threads; ++t) { if (!tmask_.test(t)) continue; if (func7 & 0x1){ @@ -501,7 +501,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { trace->exe_type = ExeType::ALU; trace->alu.type = AluType::ARITH; trace->used_iregs.set(rsrc0); - for (int t = 0; t < num_threads; ++t) { + for (uint32_t t = 0; t < num_threads; ++t) { if (!tmask_.test(t)) continue; switch (func3) { @@ -545,7 +545,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { trace->alu.type = AluType::BRANCH; trace->used_iregs.set(rsrc0); trace->used_iregs.set(rsrc1); - for (int t = 0; t < num_threads; ++t) { + for (uint32_t t = 0; t < num_threads; ++t) { if (!tmask_.test(t)) continue; switch (func3) { @@ -603,7 +603,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { case JAL_INST: { trace->exe_type = ExeType::ALU; trace->alu.type = AluType::BRANCH; - for (int t = 0; t < num_threads; ++t) { + for (uint32_t t = 0; t < num_threads; ++t) { if (!tmask_.test(t)) continue; rddata[t] = nextPC; @@ -619,7 +619,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { trace->exe_type = ExeType::ALU; trace->alu.type = AluType::BRANCH; trace->used_iregs.set(rsrc0); - for (int t = 0; t < num_threads; ++t) { + for (uint32_t t = 0; t < num_threads; ++t) { if (!tmask_.test(t)) continue; rddata[t] = nextPC; @@ -638,7 +638,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { if (opcode == L_INST || (opcode == FL && func3 == 2) || (opcode == FL && func3 == 3)) { - for (int t = 0; t < num_threads; ++t) { + for (uint32_t t = 0; t < num_threads; ++t) { if (!tmask_.test(t)) continue; uint32_t mem_addr = (rsdata[t][0] + immsrc) & 0xFFFFFFFC; @@ -707,12 +707,12 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { switch (instr.getVlsWidth()) { case 6: { // load word and unit strided (not checking for unit stride) - for (int i = 0; i < vl_; i++) { - uint32_t mem_addr = ((rsdata[i][0]) & 0xFFFFFFFC) + (i * vtype_.vsew / 8); + for (uint32_t i = 0; i < vl_; i++) { + Addr mem_addr = ((rsdata[i][0]) & 0xFFFFFFFC) + (i * vtype_.vsew / 8); DP(4, "LOAD MEM: ADDRESS=0x" << std::hex << mem_addr); - uint32_t data_read = core_->dcache_read(mem_addr, 4); + Word data_read = core_->dcache_read(mem_addr, 4); DP(4, "Mem addr: " << std::hex << mem_addr << " Data read " << data_read); - int *result_ptr = (int *)(vd.data() + i); + Word *result_ptr = (Word *)(vd.data() + i); *result_ptr = data_read; } break; @@ -732,7 +732,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { trace->used_iregs.set(rsrc1); if (opcode == S_INST || (opcode == FS && func3 == 2)) { - for (int t = 0; t < num_threads; ++t) { + for (uint32_t t = 0; t < num_threads; ++t) { if (!tmask_.test(t)) continue; uint32_t mem_addr = rsdata[t][0] + immsrc; @@ -776,7 +776,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { } } } else { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint32_t mem_addr = rsdata[i][0] + (i * vtype_.vsew / 8); DP(4, "STORE MEM: ADDRESS=0x" << std::hex << mem_addr); switch (instr.getVlsWidth()) { @@ -795,7 +795,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { break; } case SYS_INST: { - for (int t = 0; t < num_threads; ++t) { + for (uint32_t t = 0; t < num_threads; ++t) { if (!tmask_.test(t)) continue; uint32_t csr_addr = immsrc; @@ -884,7 +884,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { } case FCI: { trace->exe_type = ExeType::FPU; - for (int t = 0; t < num_threads; ++t) { + for (uint32_t t = 0; t < num_threads; ++t) { if (!tmask_.test(t)) continue; uint32_t frm = get_fpu_rm(func3, core_, t, id_); @@ -1250,10 +1250,10 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { trace->used_fregs.set(rsrc0); trace->used_fregs.set(rsrc1); trace->used_fregs.set(rsrc2); - for (int t = 0; t < num_threads; ++t) { + for (uint32_t t = 0; t < num_threads; ++t) { if (!tmask_.test(t)) continue; - int frm = get_fpu_rm(func3, core_, t, id_); + uint32_t frm = get_fpu_rm(func3, core_, t, id_); uint32_t fflags = 0; switch (opcode) { case FMADD: @@ -1297,8 +1297,8 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { break; } case GPGPU: { - int ts = 0; - for (int t = 0; t < num_threads; ++t) { + uint32_t ts = 0; + for (uint32_t t = 0; t < num_threads; ++t) { if (tmask_.test(t)) { ts = t; break; @@ -1314,20 +1314,20 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { if (rsrc1) { // predicate mode ThreadMask pred; - for (int i = 0; i < num_threads; ++i) { - pred[i] = tmask_.test(i) ? (ireg_file_.at(i).at(rsrc0) != 0) : 0; + for (uint32_t t = 0; t < num_threads; ++t) { + pred[t] = tmask_.test(t) ? (ireg_file_.at(t).at(rsrc0) != 0) : 0; } if (pred.any()) { tmask_ &= pred; } } else { tmask_.reset(); - for (int i = 0; i < num_threads; ++i) { - tmask_.set(i, rsdata.at(ts)[0] & (1 << i)); + for (uint32_t t = 0; t < num_threads; ++t) { + tmask_.set(t, rsdata.at(ts)[0] & (1 << t)); } } DPH(3, "*** New TMC: "); - for (int i = 0; i < num_threads; ++i) + for (uint32_t i = 0; i < num_threads; ++i) DPN(3, tmask_.test(num_threads-i-1)); DPN(3, std::endl); @@ -1352,22 +1352,22 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { trace->fetch_stall = true; if (HasDivergentThreads(tmask_, ireg_file_, rsrc0)) { ThreadMask tmask; - for (int i = 0; i < num_threads; ++i) { - tmask[i] = tmask_.test(i) && !ireg_file_.at(i).at(rsrc0); + for (uint32_t t = 0; t < num_threads; ++t) { + tmask[t] = tmask_.test(t) && !ireg_file_.at(t).at(rsrc0); } DomStackEntry e(tmask, nextPC); dom_stack_.push(tmask_); dom_stack_.push(e); - for (size_t i = 0; i < e.tmask.size(); ++i) { - tmask_.set(i, !e.tmask.test(i) && tmask_.test(i)); + for (uint32_t t = 0, n = e.tmask.size(); t < n; ++t) { + tmask_.set(t, !e.tmask.test(t) && tmask_.test(t)); } active_ = tmask_.any(); DPH(3, "*** Split: New TM="); - for (int i = 0; i < num_threads; ++i) DPN(3, tmask_.test(num_threads-i-1)); + for (uint32_t t = 0; t < num_threads; ++t) DPN(3, tmask_.test(num_threads-t-1)); DPN(3, ", Pushed TM="); - for (int i = 0; i < num_threads; ++i) DPN(3, e.tmask.test(num_threads-i-1)); + for (uint32_t t = 0; t < num_threads; ++t) DPN(3, e.tmask.test(num_threads-t-1)); DPN(3, ", PC=0x" << std::hex << e.PC << "\n"); } else { DP(3, "*** Unanimous pred"); @@ -1396,7 +1396,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { active_ = tmask_.any(); DPH(3, "*** Join: New TM="); - for (int i = 0; i < num_threads; ++i) DPN(3, tmask_.test(num_threads-i-1)); + for (uint32_t t = 0; t < num_threads; ++t) DPN(3, tmask_.test(num_threads-t-1)); DPN(3, "\n"); dom_stack_.pop(); @@ -1416,7 +1416,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { trace->exe_type = ExeType::LSU; trace->lsu.type = LsuType::PREFETCH; trace->used_iregs.set(rsrc0); - for (int t = 0; t < num_threads; ++t) { + for (uint32_t t = 0; t < num_threads; ++t) { if (!tmask_.test(t)) continue; auto mem_addr = rsdata[t][0]; @@ -1435,7 +1435,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { trace->used_iregs.set(rsrc0); trace->used_iregs.set(rsrc1); trace->used_iregs.set(rsrc2); - for (int t = 0; t < num_threads; ++t) { + for (uint32_t t = 0; t < num_threads; ++t) { if (!tmask_.test(t)) continue; auto unit = func2; @@ -1455,7 +1455,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { trace->used_iregs.set(rsrc0); trace->used_iregs.set(rsrc1); trace->used_iregs.set(rsrc2); - for (int t = 0; t < num_threads; ++t) { + for (uint32_t t = 0; t < num_threads; ++t) { if (!tmask_.test(t)) continue; rddata[t] = rsdata[t][0] ? rsdata[t][1] : rsdata[t][2]; @@ -1471,8 +1471,8 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { } } break; case VSET: { - int VLEN = core_->arch().vsize() * 8; - int VLMAX = (instr.getVlmul() * VLEN) / instr.getVsew(); + uint32_t VLEN = core_->arch().vsize() * 8; + uint32_t VLMAX = (instr.getVlmul() * VLEN) / instr.getVsew(); switch (func3) { case 0: // vector-vector switch (func6) { @@ -1482,7 +1482,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { auto& vd = vreg_file_.at(rdest); auto& mask = vreg_file_.at(0); if (vtype_.vsew == 8) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint8_t emask = *(uint8_t *)(mask.data() + i); uint8_t value = emask & 0x1; if (vmask || (!vmask && value)) { @@ -1494,7 +1494,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { } } } else if (vtype_.vsew == 16) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint16_t emask = *(uint16_t *)(mask.data() + i); uint16_t value = emask & 0x1; if (vmask || (!vmask && value)) { @@ -1506,7 +1506,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { } } } else if (vtype_.vsew == 32) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint32_t emask = *(uint32_t *)(mask.data() + i); uint32_t value = emask & 0x1; if (vmask || (!vmask && value)) { @@ -1525,7 +1525,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { auto &vr2 = vreg_file_.at(rsrc1); auto &vd = vreg_file_.at(rdest); if (vtype_.vsew == 8) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint8_t first = *(uint8_t *)(vr1.data() + i); uint8_t second = *(uint8_t *)(vr2.data() + i); uint8_t result = (first == second) ? 1 : 0; @@ -1533,7 +1533,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { *(uint8_t *)(vd.data() + i) = result; } } else if (vtype_.vsew == 16) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint16_t first = *(uint16_t *)(vr1.data() + i); uint16_t second = *(uint16_t *)(vr2.data() + i); uint16_t result = (first == second) ? 1 : 0; @@ -1541,7 +1541,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { *(uint16_t *)(vd.data() + i) = result; } } else if (vtype_.vsew == 32) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint32_t first = *(uint32_t *)(vr1.data() + i); uint32_t second = *(uint32_t *)(vr2.data() + i); uint32_t result = (first == second) ? 1 : 0; @@ -1556,7 +1556,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { auto &vr2 = vreg_file_.at(rsrc1); auto &vd = vreg_file_.at(rdest); if (vtype_.vsew == 8) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint8_t first = *(uint8_t *)(vr1.data() + i); uint8_t second = *(uint8_t *)(vr2.data() + i); uint8_t result = (first != second) ? 1 : 0; @@ -1564,7 +1564,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { *(uint8_t *)(vd.data() + i) = result; } } else if (vtype_.vsew == 16) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint16_t first = *(uint16_t *)(vr1.data() + i); uint16_t second = *(uint16_t *)(vr2.data() + i); uint16_t result = (first != second) ? 1 : 0; @@ -1572,7 +1572,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { *(uint16_t *)(vd.data() + i) = result; } } else if (vtype_.vsew == 32) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint32_t first = *(uint32_t *)(vr1.data() + i); uint32_t second = *(uint32_t *)(vr2.data() + i); uint32_t result = (first != second) ? 1 : 0; @@ -1587,7 +1587,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { auto &vr2 = vreg_file_.at(rsrc1); auto &vd = vreg_file_.at(rdest); if (vtype_.vsew == 8) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint8_t first = *(uint8_t *)(vr1.data() + i); uint8_t second = *(uint8_t *)(vr2.data() + i); uint8_t result = (first < second) ? 1 : 0; @@ -1595,7 +1595,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { *(uint8_t *)(vd.data() + i) = result; } } else if (vtype_.vsew == 16) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint16_t first = *(uint16_t *)(vr1.data() + i); uint16_t second = *(uint16_t *)(vr2.data() + i); uint16_t result = (first < second) ? 1 : 0; @@ -1603,7 +1603,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { *(uint16_t *)(vd.data() + i) = result; } } else if (vtype_.vsew == 32) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint32_t first = *(uint32_t *)(vr1.data() + i); uint32_t second = *(uint32_t *)(vr2.data() + i); uint32_t result = (first < second) ? 1 : 0; @@ -1618,7 +1618,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { auto &vr2 = vreg_file_.at(rsrc1); auto &vd = vreg_file_.at(rdest); if (vtype_.vsew == 8) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { int8_t first = *(int8_t *)(vr1.data() + i); int8_t second = *(int8_t *)(vr2.data() + i); int8_t result = (first < second) ? 1 : 0; @@ -1626,7 +1626,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { *(uint8_t *)(vd.data() + i) = result; } } else if (vtype_.vsew == 16) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { int16_t first = *(int16_t *)(vr1.data() + i); int16_t second = *(int16_t *)(vr2.data() + i); int16_t result = (first < second) ? 1 : 0; @@ -1634,7 +1634,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { *(int16_t *)(vd.data() + i) = result; } } else if (vtype_.vsew == 32) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { int32_t first = *(int32_t *)(vr1.data() + i); int32_t second = *(int32_t *)(vr2.data() + i); int32_t result = (first < second) ? 1 : 0; @@ -1649,7 +1649,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { auto &vr2 = vreg_file_.at(rsrc1); auto &vd = vreg_file_.at(rdest); if (vtype_.vsew == 8) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint8_t first = *(uint8_t *)(vr1.data() + i); uint8_t second = *(uint8_t *)(vr2.data() + i); uint8_t result = (first <= second) ? 1 : 0; @@ -1657,7 +1657,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { *(uint8_t *)(vd.data() + i) = result; } } else if (vtype_.vsew == 16) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint16_t first = *(uint16_t *)(vr1.data() + i); uint16_t second = *(uint16_t *)(vr2.data() + i); uint16_t result = (first <= second) ? 1 : 0; @@ -1665,7 +1665,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { *(uint16_t *)(vd.data() + i) = result; } } else if (vtype_.vsew == 32) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint32_t first = *(uint32_t *)(vr1.data() + i); uint32_t second = *(uint32_t *)(vr2.data() + i); uint32_t result = (first <= second) ? 1 : 0; @@ -1680,7 +1680,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { auto &vr2 = vreg_file_.at(rsrc1); auto &vd = vreg_file_.at(rdest); if (vtype_.vsew == 8) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { int8_t first = *(int8_t *)(vr1.data() + i); int8_t second = *(int8_t *)(vr2.data() + i); int8_t result = (first <= second) ? 1 : 0; @@ -1688,7 +1688,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { *(uint8_t *)(vd.data() + i) = result; } } else if (vtype_.vsew == 16) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { int16_t first = *(int16_t *)(vr1.data() + i); int16_t second = *(int16_t *)(vr2.data() + i); int16_t result = (first <= second) ? 1 : 0; @@ -1696,7 +1696,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { *(int16_t *)(vd.data() + i) = result; } } else if (vtype_.vsew == 32) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { int32_t first = *(int32_t *)(vr1.data() + i); int32_t second = *(int32_t *)(vr2.data() + i); int32_t result = (first <= second) ? 1 : 0; @@ -1711,7 +1711,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { auto &vr2 = vreg_file_.at(rsrc1); auto &vd = vreg_file_.at(rdest); if (vtype_.vsew == 8) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint8_t first = *(uint8_t *)(vr1.data() + i); uint8_t second = *(uint8_t *)(vr2.data() + i); uint8_t result = (first > second) ? 1 : 0; @@ -1719,7 +1719,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { *(uint8_t *)(vd.data() + i) = result; } } else if (vtype_.vsew == 16) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint16_t first = *(uint16_t *)(vr1.data() + i); uint16_t second = *(uint16_t *)(vr2.data() + i); uint16_t result = (first > second) ? 1 : 0; @@ -1727,7 +1727,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { *(uint16_t *)(vd.data() + i) = result; } } else if (vtype_.vsew == 32) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint32_t first = *(uint32_t *)(vr1.data() + i); uint32_t second = *(uint32_t *)(vr2.data() + i); uint32_t result = (first > second) ? 1 : 0; @@ -1742,7 +1742,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { auto &vr2 = vreg_file_.at(rsrc1); auto &vd = vreg_file_.at(rdest); if (vtype_.vsew == 8) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { int8_t first = *(int8_t *)(vr1.data() + i); int8_t second = *(int8_t *)(vr2.data() + i); int8_t result = (first > second) ? 1 : 0; @@ -1750,7 +1750,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { *(uint8_t *)(vd.data() + i) = result; } } else if (vtype_.vsew == 16) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { int16_t first = *(int16_t *)(vr1.data() + i); int16_t second = *(int16_t *)(vr2.data() + i); int16_t result = (first > second) ? 1 : 0; @@ -1758,7 +1758,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { *(int16_t *)(vd.data() + i) = result; } } else if (vtype_.vsew == 32) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { int32_t first = *(int32_t *)(vr1.data() + i); int32_t second = *(int32_t *)(vr2.data() + i); int32_t result = (first > second) ? 1 : 0; @@ -1777,7 +1777,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { auto &vr2 = vreg_file_.at(rsrc1); auto &vd = vreg_file_.at(rdest); if (vtype_.vsew == 8) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint8_t first = *(uint8_t *)(vr1.data() + i); uint8_t second = *(uint8_t *)(vr2.data() + i); uint8_t first_value = (first & 0x1); @@ -1786,11 +1786,11 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { DP(3, "Comparing " << first << " + " << second << " = " << result); *(uint8_t *)(vd.data() + i) = result; } - for (int i = vl_; i < VLMAX; i++) { + for (uint32_t i = vl_; i < VLMAX; i++) { *(uint8_t *)(vd.data() + i) = 0; } } else if (vtype_.vsew == 16) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint16_t first = *(uint16_t *)(vr1.data() + i); uint16_t second = *(uint16_t *)(vr2.data() + i); uint16_t first_value = (first & 0x1); @@ -1799,11 +1799,11 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { DP(3, "Comparing " << first << " + " << second << " = " << result); *(uint16_t *)(vd.data() + i) = result; } - for (int i = vl_; i < VLMAX; i++) { + for (uint32_t i = vl_; i < VLMAX; i++) { *(uint16_t *)(vd.data() + i) = 0; } } else if (vtype_.vsew == 32) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint32_t first = *(uint32_t *)(vr1.data() + i); uint32_t second = *(uint32_t *)(vr2.data() + i); uint32_t first_value = (first & 0x1); @@ -1812,7 +1812,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { DP(3, "Comparing " << first << " + " << second << " = " << result); *(uint32_t *)(vd.data() + i) = result; } - for (int i = vl_; i < VLMAX; i++) { + for (uint32_t i = vl_; i < VLMAX; i++) { *(uint32_t *)(vd.data() + i) = 0; } } @@ -1823,7 +1823,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { auto &vr2 = vreg_file_.at(rsrc1); auto &vd = vreg_file_.at(rdest); if (vtype_.vsew == 8) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint8_t first = *(uint8_t *)(vr1.data() + i); uint8_t second = *(uint8_t *)(vr2.data() + i); uint8_t first_value = (first & 0x1); @@ -1832,11 +1832,11 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { DP(3, "Comparing " << first << " + " << second << " = " << result); *(uint8_t *)(vd.data() + i) = result; } - for (int i = vl_; i < VLMAX; i++) { + for (uint32_t i = vl_; i < VLMAX; i++) { *(uint8_t *)(vd.data() + i) = 0; } } else if (vtype_.vsew == 16) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint16_t first = *(uint16_t *)(vr1.data() + i); uint16_t second = *(uint16_t *)(vr2.data() + i); uint16_t first_value = (first & 0x1); @@ -1845,11 +1845,11 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { DP(3, "Comparing " << first << " + " << second << " = " << result); *(uint16_t *)(vd.data() + i) = result; } - for (int i = vl_; i < VLMAX; i++) { + for (uint32_t i = vl_; i < VLMAX; i++) { *(uint16_t *)(vd.data() + i) = 0; } } else if (vtype_.vsew == 32) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint32_t first = *(uint32_t *)(vr1.data() + i); uint32_t second = *(uint32_t *)(vr2.data() + i); uint32_t first_value = (first & 0x1); @@ -1858,7 +1858,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { DP(3, "Comparing " << first << " + " << second << " = " << result); *(uint32_t *)(vd.data() + i) = result; } - for (int i = vl_; i < VLMAX; i++) { + for (uint32_t i = vl_; i < VLMAX; i++) { *(uint32_t *)(vd.data() + i) = 0; } } @@ -1869,7 +1869,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { auto &vr2 = vreg_file_.at(rsrc1); auto &vd = vreg_file_.at(rdest); if (vtype_.vsew == 8) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint8_t first = *(uint8_t *)(vr1.data() + i); uint8_t second = *(uint8_t *)(vr2.data() + i); uint8_t first_value = (first & 0x1); @@ -1878,11 +1878,11 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { DP(3, "Comparing " << first << " + " << second << " = " << result); *(uint8_t *)(vd.data() + i) = result; } - for (int i = vl_; i < VLMAX; i++) { + for (uint32_t i = vl_; i < VLMAX; i++) { *(uint8_t *)(vd.data() + i) = 0; } } else if (vtype_.vsew == 16) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint16_t first = *(uint16_t *)(vr1.data() + i); uint16_t second = *(uint16_t *)(vr2.data() + i); uint16_t first_value = (first & 0x1); @@ -1891,11 +1891,11 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { DP(3, "Comparing " << first << " + " << second << " = " << result); *(uint16_t *)(vd.data() + i) = result; } - for (int i = vl_; i < VLMAX; i++) { + for (uint32_t i = vl_; i < VLMAX; i++) { *(uint16_t *)(vd.data() + i) = 0; } } else if (vtype_.vsew == 32) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint32_t first = *(uint32_t *)(vr1.data() + i); uint32_t second = *(uint32_t *)(vr2.data() + i); uint32_t first_value = (first & 0x1); @@ -1904,7 +1904,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { DP(3, "Comparing " << first << " + " << second << " = " << result); *(uint32_t *)(vd.data() + i) = result; } - for (int i = vl_; i < VLMAX; i++) { + for (uint32_t i = vl_; i < VLMAX; i++) { *(uint32_t *)(vd.data() + i) = 0; } } @@ -1915,7 +1915,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { auto &vr2 = vreg_file_.at(rsrc1); auto &vd = vreg_file_.at(rdest); if (vtype_.vsew == 8) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint8_t first = *(uint8_t *)(vr1.data() + i); uint8_t second = *(uint8_t *)(vr2.data() + i); uint8_t first_value = (first & 0x1); @@ -1924,11 +1924,11 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { DP(3, "Comparing " << first << " + " << second << " = " << result); *(uint8_t *)(vd.data() + i) = result; } - for (int i = vl_; i < VLMAX; i++) { + for (uint32_t i = vl_; i < VLMAX; i++) { *(uint8_t *)(vd.data() + i) = 0; } } else if (vtype_.vsew == 16) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint16_t first = *(uint16_t *)(vr1.data() + i); uint16_t second = *(uint16_t *)(vr2.data() + i); uint16_t first_value = (first & 0x1); @@ -1937,11 +1937,11 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { DP(3, "Comparing " << first << " + " << second << " = " << result); *(uint16_t *)(vd.data() + i) = result; } - for (int i = vl_; i < VLMAX; i++) { + for (uint32_t i = vl_; i < VLMAX; i++) { *(uint16_t *)(vd.data() + i) = 0; } } else if (vtype_.vsew == 32) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint32_t first = *(uint32_t *)(vr1.data() + i); uint32_t second = *(uint32_t *)(vr2.data() + i); uint32_t first_value = (first & 0x1); @@ -1950,7 +1950,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { DP(3, "Comparing " << first << " + " << second << " = " << result); *(uint32_t *)(vd.data() + i) = result; } - for (int i = vl_; i < VLMAX; i++) { + for (uint32_t i = vl_; i < VLMAX; i++) { *(uint32_t *)(vd.data() + i) = 0; } } @@ -1961,7 +1961,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { auto &vr2 = vreg_file_.at(rsrc1); auto &vd = vreg_file_.at(rdest); if (vtype_.vsew == 8) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint8_t first = *(uint8_t *)(vr1.data() + i); uint8_t second = *(uint8_t *)(vr2.data() + i); uint8_t first_value = (first & 0x1); @@ -1970,11 +1970,11 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { DP(3, "Comparing " << first << " + " << second << " = " << result); *(uint8_t *)(vd.data() + i) = result; } - for (int i = vl_; i < VLMAX; i++) { + for (uint32_t i = vl_; i < VLMAX; i++) { *(uint8_t *)(vd.data() + i) = 0; } } else if (vtype_.vsew == 16) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint16_t first = *(uint16_t *)(vr1.data() + i); uint16_t second = *(uint16_t *)(vr2.data() + i); uint16_t first_value = (first & 0x1); @@ -1983,11 +1983,11 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { DP(3, "Comparing " << first << " + " << second << " = " << result); *(uint16_t *)(vd.data() + i) = result; } - for (int i = vl_; i < VLMAX; i++) { + for (uint32_t i = vl_; i < VLMAX; i++) { *(uint16_t *)(vd.data() + i) = 0; } } else if (vtype_.vsew == 32) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint32_t first = *(uint32_t *)(vr1.data() + i); uint32_t second = *(uint32_t *)(vr2.data() + i); uint32_t first_value = (first & 0x1); @@ -1996,7 +1996,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { DP(3, "Comparing " << first << " + " << second << " = " << result); *(uint32_t *)(vd.data() + i) = result; } - for (int i = vl_; i < VLMAX; i++) { + for (uint32_t i = vl_; i < VLMAX; i++) { *(uint32_t *)(vd.data() + i) = 0; } } @@ -2007,7 +2007,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { auto &vr2 = vreg_file_.at(rsrc1); auto &vd = vreg_file_.at(rdest); if (vtype_.vsew == 8) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint8_t first = *(uint8_t *)(vr1.data() + i); uint8_t second = *(uint8_t *)(vr2.data() + i); uint8_t first_value = (first & 0x1); @@ -2016,11 +2016,11 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { DP(3, "Comparing " << first << " + " << second << " = " << result); *(uint8_t *)(vd.data() + i) = result; } - for (int i = vl_; i < VLMAX; i++) { + for (uint32_t i = vl_; i < VLMAX; i++) { *(uint8_t *)(vd.data() + i) = 0; } } else if (vtype_.vsew == 16) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint16_t first = *(uint16_t *)(vr1.data() + i); uint16_t second = *(uint16_t *)(vr2.data() + i); uint16_t first_value = (first & 0x1); @@ -2029,11 +2029,11 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { DP(3, "Comparing " << first << " + " << second << " = " << result); *(uint16_t *)(vd.data() + i) = result; } - for (int i = vl_; i < VLMAX; i++) { + for (uint32_t i = vl_; i < VLMAX; i++) { *(uint16_t *)(vd.data() + i) = 0; } } else if (vtype_.vsew == 32) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint32_t first = *(uint32_t *)(vr1.data() + i); uint32_t second = *(uint32_t *)(vr2.data() + i); uint32_t first_value = (first & 0x1); @@ -2042,7 +2042,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { DP(3, "Comparing " << first << " + " << second << " = " << result); *(uint32_t *)(vd.data() + i) = result; } - for (int i = vl_; i < VLMAX; i++) { + for (uint32_t i = vl_; i < VLMAX; i++) { *(uint32_t *)(vd.data() + i) = 0; } } @@ -2053,7 +2053,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { auto &vr2 = vreg_file_.at(rsrc1); auto &vd = vreg_file_.at(rdest); if (vtype_.vsew == 8) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint8_t first = *(uint8_t *)(vr1.data() + i); uint8_t second = *(uint8_t *)(vr2.data() + i); uint8_t first_value = (first & 0x1); @@ -2062,11 +2062,11 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { DP(3, "Comparing " << first << " + " << second << " = " << result); *(uint8_t *)(vd.data() + i) = result; } - for (int i = vl_; i < VLMAX; i++) { + for (uint32_t i = vl_; i < VLMAX; i++) { *(uint8_t *)(vd.data() + i) = 0; } } else if (vtype_.vsew == 16) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint16_t first = *(uint16_t *)(vr1.data() + i); uint16_t second = *(uint16_t *)(vr2.data() + i); uint16_t first_value = (first & 0x1); @@ -2075,11 +2075,11 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { DP(3, "Comparing " << first << " + " << second << " = " << result); *(uint16_t *)(vd.data() + i) = result; } - for (int i = vl_; i < VLMAX; i++) { + for (uint32_t i = vl_; i < VLMAX; i++) { *(uint16_t *)(vd.data() + i) = 0; } } else if (vtype_.vsew == 32) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint32_t first = *(uint32_t *)(vr1.data() + i); uint32_t second = *(uint32_t *)(vr2.data() + i); uint32_t first_value = (first & 0x1); @@ -2088,7 +2088,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { DP(3, "Comparing " << first << " + " << second << " = " << result); *(uint32_t *)(vd.data() + i) = result; } - for (int i = vl_; i < VLMAX; i++) { + for (uint32_t i = vl_; i < VLMAX; i++) { *(uint32_t *)(vd.data() + i) = 0; } } @@ -2099,7 +2099,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { auto &vr2 = vreg_file_.at(rsrc1); auto &vd = vreg_file_.at(rdest); if (vtype_.vsew == 8) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint8_t first = *(uint8_t *)(vr1.data() + i); uint8_t second = *(uint8_t *)(vr2.data() + i); uint8_t first_value = (first & 0x1); @@ -2108,11 +2108,11 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { DP(3, "Comparing " << first << " + " << second << " = " << result); *(uint8_t *)(vd.data() + i) = result; } - for (int i = vl_; i < VLMAX; i++) { + for (uint32_t i = vl_; i < VLMAX; i++) { *(uint8_t *)(vd.data() + i) = 0; } } else if (vtype_.vsew == 16) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint16_t first = *(uint16_t *)(vr1.data() + i); uint16_t second = *(uint16_t *)(vr2.data() + i); uint16_t first_value = (first & 0x1); @@ -2121,11 +2121,11 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { DP(3, "Comparing " << first << " + " << second << " = " << result); *(uint16_t *)(vd.data() + i) = result; } - for (int i = vl_; i < VLMAX; i++) { + for (uint32_t i = vl_; i < VLMAX; i++) { *(uint16_t *)(vd.data() + i) = 0; } } else if (vtype_.vsew == 32) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint32_t first = *(uint32_t *)(vr1.data() + i); uint32_t second = *(uint32_t *)(vr2.data() + i); uint32_t first_value = (first & 0x1); @@ -2134,7 +2134,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { DP(3, "Comparing " << first << " + " << second << " = " << result); *(uint32_t *)(vd.data() + i) = result; } - for (int i = vl_; i < VLMAX; i++) { + for (uint32_t i = vl_; i < VLMAX; i++) { *(uint32_t *)(vd.data() + i) = 0; } } @@ -2145,36 +2145,36 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { auto &vr2 = vreg_file_.at(rsrc1); auto &vd = vreg_file_.at(rdest); if (vtype_.vsew == 8) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint8_t first = *(uint8_t *)(vr1.data() + i); uint8_t second = *(uint8_t *)(vr2.data() + i); uint8_t result = (first * second); DP(3, "Comparing " << first << " + " << second << " = " << result); *(uint8_t *)(vd.data() + i) = result; } - for (int i = vl_; i < VLMAX; i++) { + for (uint32_t i = vl_; i < VLMAX; i++) { *(uint8_t *)(vd.data() + i) = 0; } } else if (vtype_.vsew == 16) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint16_t first = *(uint16_t *)(vr1.data() + i); uint16_t second = *(uint16_t *)(vr2.data() + i); uint16_t result = (first * second); DP(3, "Comparing " << first << " + " << second << " = " << result); *(uint16_t *)(vd.data() + i) = result; } - for (int i = vl_; i < VLMAX; i++) { + for (uint32_t i = vl_; i < VLMAX; i++) { *(uint16_t *)(vd.data() + i) = 0; } } else if (vtype_.vsew == 32) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint32_t first = *(uint32_t *)(vr1.data() + i); uint32_t second = *(uint32_t *)(vr2.data() + i); uint32_t result = (first * second); DP(3, "Comparing " << first << " + " << second << " = " << result); *(uint32_t *)(vd.data() + i) = result; } - for (int i = vl_; i < VLMAX; i++) { + for (uint32_t i = vl_; i < VLMAX; i++) { *(uint32_t *)(vd.data() + i) = 0; } } @@ -2185,36 +2185,36 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { auto &vr2 = vreg_file_.at(rsrc1); auto &vd = vreg_file_.at(rdest); if (vtype_.vsew == 8) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint8_t first = *(uint8_t *)(vr1.data() + i); uint8_t second = *(uint8_t *)(vr2.data() + i); uint8_t result = (first * second); DP(3, "Comparing " << first << " + " << second << " = " << result); *(uint8_t *)(vd.data() + i) += result; } - for (int i = vl_; i < VLMAX; i++) { + for (uint32_t i = vl_; i < VLMAX; i++) { *(uint8_t *)(vd.data() + i) = 0; } } else if (vtype_.vsew == 16) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint16_t first = *(uint16_t *)(vr1.data() + i); uint16_t second = *(uint16_t *)(vr2.data() + i); uint16_t result = (first * second); DP(3, "Comparing " << first << " + " << second << " = " << result); *(uint16_t *)(vd.data() + i) += result; } - for (int i = vl_; i < VLMAX; i++) { + for (uint32_t i = vl_; i < VLMAX; i++) { *(uint16_t *)(vd.data() + i) = 0; } } else if (vtype_.vsew == 32) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint32_t first = *(uint32_t *)(vr1.data() + i); uint32_t second = *(uint32_t *)(vr2.data() + i); uint32_t result = (first * second); DP(3, "Comparing " << first << " + " << second << " = " << result); *(uint32_t *)(vd.data() + i) += result; } - for (int i = vl_; i < VLMAX; i++) { + for (uint32_t i = vl_; i < VLMAX; i++) { *(uint32_t *)(vd.data() + i) = 0; } } @@ -2227,33 +2227,33 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { auto &vr2 = vreg_file_.at(rsrc1); auto &vd = vreg_file_.at(rdest); if (vtype_.vsew == 8) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint8_t second = *(uint8_t *)(vr2.data() + i); uint8_t result = (rsdata[i][0] + second); DP(3, "Comparing " << rsdata[i][0] << " + " << second << " = " << result); *(uint8_t *)(vd.data() + i) = result; } - for (int i = vl_; i < VLMAX; i++) { + for (uint32_t i = vl_; i < VLMAX; i++) { *(uint8_t *)(vd.data() + i) = 0; } } else if (vtype_.vsew == 16) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint16_t second = *(uint16_t *)(vr2.data() + i); uint16_t result = (rsdata[i][0] + second); DP(3, "Comparing " << rsdata[i][0] << " + " << second << " = " << result); *(uint16_t *)(vd.data() + i) = result; } - for (int i = vl_; i < VLMAX; i++) { + for (uint32_t i = vl_; i < VLMAX; i++) { *(uint16_t *)(vd.data() + i) = 0; } } else if (vtype_.vsew == 32) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint32_t second = *(uint32_t *)(vr2.data() + i); uint32_t result = (rsdata[i][0] + second); DP(3, "Comparing " << rsdata[i][0] << " + " << second << " = " << result); *(uint32_t *)(vd.data() + i) = result; } - for (int i = vl_; i < VLMAX; i++) { + for (uint32_t i = vl_; i < VLMAX; i++) { *(uint32_t *)(vd.data() + i) = 0; } } @@ -2263,33 +2263,33 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { auto &vr2 = vreg_file_.at(rsrc1); auto &vd = vreg_file_.at(rdest); if (vtype_.vsew == 8) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint8_t second = *(uint8_t *)(vr2.data() + i); uint8_t result = (rsdata[i][0] * second); DP(3, "Comparing " << rsdata[i][0] << " + " << second << " = " << result); *(uint8_t *)(vd.data() + i) = result; } - for (int i = vl_; i < VLMAX; i++) { + for (uint32_t i = vl_; i < VLMAX; i++) { *(uint8_t *)(vd.data() + i) = 0; } } else if (vtype_.vsew == 16) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint16_t second = *(uint16_t *)(vr2.data() + i); uint16_t result = (rsdata[i][0] * second); DP(3, "Comparing " << rsdata[i][0] << " + " << second << " = " << result); *(uint16_t *)(vd.data() + i) = result; } - for (int i = vl_; i < VLMAX; i++) { + for (uint32_t i = vl_; i < VLMAX; i++) { *(uint16_t *)(vd.data() + i) = 0; } } else if (vtype_.vsew == 32) { - for (int i = 0; i < vl_; i++) { + for (uint32_t i = 0; i < vl_; i++) { uint32_t second = *(uint32_t *)(vr2.data() + i); uint32_t result = (rsdata[i][0] * second); DP(3, "Comparing " << rsdata[i][0] << " + " << second << " = " << result); *(uint32_t *)(vd.data() + i) = result; } - for (int i = vl_; i < VLMAX; i++) { + for (uint32_t i = vl_; i < VLMAX; i++) { *(uint32_t *)(vd.data() + i) = 0; } } @@ -2297,18 +2297,18 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { } } break; case 7: { - vtype_.vill = 0; + vtype_.vill = 0; vtype_.vediv = instr.getVediv(); vtype_.vsew = instr.getVsew(); vtype_.vlmul = instr.getVlmul(); DP(3, "lmul:" << vtype_.vlmul << " sew:" << vtype_.vsew << " ediv: " << vtype_.vediv << "rsrc_" << rsdata[0][0] << "VLMAX" << VLMAX); - int s0 = rsdata[0][0]; + auto s0 = rsdata[0][0]; if (s0 <= VLMAX) { vl_ = s0; } else if (s0 < (2 * VLMAX)) { - vl_ = (int)ceil((s0 * 1.0) / 2.0); + vl_ = (uint32_t)ceil((s0 * 1.0) / 2.0); } else if (s0 >= (2 * VLMAX)) { vl_ = VLMAX; } @@ -2330,7 +2330,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { case RegType::Integer: if (rdest) { DPN(2, "r" << std::dec << rdest << "={"); - for (int t = 0; t < num_threads; ++t) { + for (uint32_t t = 0; t < num_threads; ++t) { if (t) DPN(2, ", "); if (!tmask_.test(t)) { DPN(2, "-"); @@ -2345,7 +2345,7 @@ void Warp::execute(const Instr &instr, pipeline_trace_t *trace) { break; case RegType::Float: DPN(2, "fr" << std::dec << rdest << "={"); - for (int t = 0; t < num_threads; ++t) { + for (uint32_t t = 0; t < num_threads; ++t) { if (t) DPN(2, ", "); if (!tmask_.test(t)) { DPN(2, "-"); diff --git a/sim/simx/instr.h b/sim/simx/instr.h index d855dca0..4aa16ac5 100644 --- a/sim/simx/instr.h +++ b/sim/simx/instr.h @@ -59,19 +59,19 @@ public: , rdest_(0) , func3_(0) , func7_(0) { - for (int i = 0; i < MAX_REG_SOURCES; ++i) { + for (uint32_t i = 0; i < MAX_REG_SOURCES; ++i) { rsrc_type_[i] = RegType::None; } } /* Setters used to "craft" the instruction. */ void setOpcode(Opcode opcode) { opcode_ = opcode; } - void setDestReg(int destReg) { rdest_type_ = RegType::Integer; rdest_ = destReg; } - void setSrcReg(int srcReg) { rsrc_type_[num_rsrcs_] = RegType::Integer; rsrc_[num_rsrcs_++] = srcReg; } - void setDestFReg(int destReg) { rdest_type_ = RegType::Float; rdest_ = destReg; } - void setSrcFReg(int srcReg) { rsrc_type_[num_rsrcs_] = RegType::Float; rsrc_[num_rsrcs_++] = srcReg; } - void setDestVReg(int destReg) { rdest_type_ = RegType::Vector; rdest_ = destReg; } - void setSrcVReg(int srcReg) { rsrc_type_[num_rsrcs_] = RegType::Vector; rsrc_[num_rsrcs_++] = srcReg; } + void setDestReg(uint32_t destReg) { rdest_type_ = RegType::Integer; rdest_ = destReg; } + void setSrcReg(uint32_t srcReg) { rsrc_type_[num_rsrcs_] = RegType::Integer; rsrc_[num_rsrcs_++] = srcReg; } + void setDestFReg(uint32_t destReg) { rdest_type_ = RegType::Float; rdest_ = destReg; } + void setSrcFReg(uint32_t srcReg) { rsrc_type_[num_rsrcs_] = RegType::Float; rsrc_[num_rsrcs_++] = srcReg; } + void setDestVReg(uint32_t destReg) { rdest_type_ = RegType::Vector; rdest_ = destReg; } + void setSrcVReg(uint32_t srcReg) { rsrc_type_[num_rsrcs_] = RegType::Vector; rsrc_[num_rsrcs_++] = srcReg; } void setFunc2(uint32_t func2) { func2_ = func2; } void setFunc3(uint32_t func3) { func3_ = func3; } void setFunc7(uint32_t func7) { func7_ = func7; } @@ -93,10 +93,10 @@ public: uint32_t getFunc3() const { return func3_; } uint32_t getFunc6() const { return func6_; } uint32_t getFunc7() const { return func7_; } - int getNRSrc() const { return num_rsrcs_; } - int getRSrc(int i) const { return rsrc_[i]; } - RegType getRSType(int i) const { return rsrc_type_[i]; } - int getRDest() const { return rdest_; } + uint32_t getNRSrc() const { return num_rsrcs_; } + uint32_t getRSrc(uint32_t i) const { return rsrc_[i]; } + RegType getRSType(uint32_t i) const { return rsrc_type_[i]; } + uint32_t getRDest() const { return rdest_; } RegType getRDType() const { return rdest_type_; } bool hasImm() const { return has_imm_; } Word getImm() const { return imm_; } @@ -116,13 +116,13 @@ private: }; Opcode opcode_; - int num_rsrcs_; + uint32_t num_rsrcs_; bool has_imm_; RegType rdest_type_; Word imm_; RegType rsrc_type_[MAX_REG_SOURCES]; - int rsrc_[MAX_REG_SOURCES]; - int rdest_; + uint32_t rsrc_[MAX_REG_SOURCES]; + uint32_t rdest_; uint32_t func2_; uint32_t func3_; uint32_t func6_; diff --git a/sim/simx/main.cpp b/sim/simx/main.cpp index c0220f9c..c8d179fe 100644 --- a/sim/simx/main.cpp +++ b/sim/simx/main.cpp @@ -18,7 +18,6 @@ using namespace vortex; int main(int argc, char **argv) { int exitcode = 0; - std::string archStr("rv32imf"); std::string imgFileName; int num_cores(NUM_CORES * NUM_CLUSTERS); int num_warps(NUM_WARPS); @@ -29,7 +28,6 @@ int main(int argc, char **argv) { /* Read the command line arguments. */ CommandLineArgFlag fh("-h", "--help", "", showHelp); - CommandLineArgSetter fa("-a", "--arch", "", archStr); CommandLineArgSetter fi("-i", "--image", "", imgFileName); CommandLineArgSetter fc("-c", "--cores", "", num_cores); CommandLineArgSetter fw("-w", "--warps", "", num_warps); @@ -45,7 +43,6 @@ int main(int argc, char **argv) { " -c, --cores Number of cores\n" " -w, --warps Number of warps\n" " -t, --threads Number of threads\n" - " -a, --arch Architecture string\n" " -r, --riscv riscv test\n" " -s, --stats Print stats on exit.\n"; return 0; @@ -55,7 +52,7 @@ int main(int argc, char **argv) { { // create processor configuation - ArchDef arch(archStr, num_cores, num_warps, num_threads); + ArchDef arch(num_cores, num_warps, num_threads); // create memory module RAM ram(RAM_PAGE_SIZE); diff --git a/sim/simx/pipeline.h b/sim/simx/pipeline.h index 18d54e21..41784636 100644 --- a/sim/simx/pipeline.h +++ b/sim/simx/pipeline.h @@ -15,8 +15,8 @@ struct pipeline_trace_t { uint64_t uuid; //-- - int cid; - int wid; + uint32_t cid; + uint32_t wid; ThreadMask tmask; Word PC; @@ -26,7 +26,7 @@ struct pipeline_trace_t { //-- bool wb; RegType rdest_type; - int rdest; + uint32_t rdest; //-- RegMask used_iregs; diff --git a/sim/simx/scoreboard.h b/sim/simx/scoreboard.h index c468860d..b473bfa5 100644 --- a/sim/simx/scoreboard.h +++ b/sim/simx/scoreboard.h @@ -28,7 +28,7 @@ public: } void clear() { - for (int i = 0, n = in_use_iregs_.size(); i < n; ++i) { + for (uint32_t i = 0, n = in_use_iregs_.size(); i < n; ++i) { in_use_iregs_.at(i).reset(); in_use_fregs_.at(i).reset(); in_use_vregs_.at(i).reset(); diff --git a/sim/simx/types.h b/sim/simx/types.h index 69b619eb..9579af36 100644 --- a/sim/simx/types.h +++ b/sim/simx/types.h @@ -8,31 +8,28 @@ #include #include -#if XLEN == 32 -#define uintx_t uint32_t -#define intx_t int32_t -#define uintd_t uint64_t -#define intd_t int64_t -#elif XLEN == 64 -#define uintx_t uint64_t -#define intx_t int64_t -#define uintd_t __uint128_t -#define intd_t __int128_t -#else -#error unsupported XLEN -#endif - namespace vortex { typedef uint8_t Byte; -typedef uintx_t Word; -typedef intx_t WordI; -typedef uintd_t DWord; -typedef intd_t DWordI; -typedef uint64_t FWord; - -typedef uintx_t Addr; +#if XLEN == 32 +typedef uint32_t Word; +typedef int32_t WordI; +typedef uint64_t DWord; +typedef int64_t DWordI; +typedef uint32_t Addr; typedef uint32_t Size; +typedef uint32_t FWord; +#elif XLEN == 64 +typedef uint64_t Word; +typedef int64_t WordI; +typedef __uint128_t DWord; +typedef __int128_t DWordI; +typedef uint64_t Addr; +typedef uint64_t Size; +typedef uint64_t FWord; +#else +#error unsupported XLEN +#endif typedef std::bitset<32> RegMask; typedef std::bitset<32> ThreadMask; @@ -249,7 +246,7 @@ struct MemReq { inline std::ostream &operator<<(std::ostream &os, const MemReq& req) { os << "mem-" << (req.write ? "wr" : "rd") << ": "; - os << "addr=" << req.addr << ", tag=" << req.tag << ", core_id=" << req.core_id; + os << "addr=" << std::hex << req.addr << std::dec << ", tag=" << req.tag << ", core_id=" << req.core_id; os << " (#" << std::dec << req.uuid << ")"; return os; } diff --git a/sim/simx/warp.cpp b/sim/simx/warp.cpp index 5246e4cf..a6a80d1a 100644 --- a/sim/simx/warp.cpp +++ b/sim/simx/warp.cpp @@ -24,7 +24,7 @@ void Warp::clear() { active_ = false; PC_ = STARTUP_ADDR; tmask_.reset(); - for (int i = 0, n = core_->arch().num_threads(); i < n; ++i) { + for (uint32_t i = 0, n = core_->arch().num_threads(); i < n; ++i) { for (auto& reg : ireg_file_.at(i)) { reg = 0; } @@ -41,7 +41,7 @@ void Warp::eval(pipeline_trace_t *trace) { assert(tmask_.any()); DPH(2, "Fetch: coreid=" << core_->id() << ", wid=" << id_ << ", tmask="); - for (int i = 0, n = core_->arch().num_threads(); i < n; ++i) + for (uint32_t i = 0, n = core_->arch().num_threads(); i < n; ++i) DPN(2, tmask_.test(n-i-1)); DPN(2, ", PC=0x" << std::hex << PC_ << " (#" << std::dec << trace->uuid << ")" << std::endl); @@ -68,15 +68,15 @@ void Warp::eval(pipeline_trace_t *trace) { this->execute(*instr, trace); DP(4, "Register state:"); - for (int i = 0; i < core_->arch().num_regs(); ++i) { + for (uint32_t i = 0; i < core_->arch().num_regs(); ++i) { DPN(4, " %r" << std::setfill('0') << std::setw(2) << std::dec << i << ':'); // Integer register file - for (int j = 0; j < core_->arch().num_threads(); ++j) { + for (uint32_t j = 0; j < core_->arch().num_threads(); ++j) { DPN(4, ' ' << std::setfill('0') << std::setw(XLEN/4) << std::hex << ireg_file_.at(j).at(i) << std::setfill(' ') << ' '); } DPN(4, '|'); // Floating point register file - for (int j = 0; j < core_->arch().num_threads(); ++j) { + for (uint32_t j = 0; j < core_->arch().num_threads(); ++j) { DPN(4, ' ' << std::setfill('0') << std::setw(16) << std::hex << freg_file_.at(j).at(i) << std::setfill(' ') << ' '); } DPN(4, std::endl); diff --git a/sim/simx/warp.h b/sim/simx/warp.h index 422b853b..5467b864 100644 --- a/sim/simx/warp.h +++ b/sim/simx/warp.h @@ -32,10 +32,10 @@ struct DomStackEntry { }; struct vtype { - int vill; - int vediv; - int vsew; - int vlmul; + uint32_t vill; + uint32_t vediv; + uint32_t vsew; + uint32_t vlmul; }; class Warp { @@ -85,7 +85,7 @@ public: return 0; } - uint32_t getIRegValue(int reg) const { + uint32_t getIRegValue(uint32_t reg) const { return ireg_file_.at(0).at(reg); } @@ -108,7 +108,7 @@ private: std::stack dom_stack_; struct vtype vtype_; - int vl_; + uint32_t vl_; }; } diff --git a/tests/opencl/BlackScholes/Makefile b/tests/opencl/BlackScholes/Makefile index 30091c87..8a93a45d 100644 --- a/tests/opencl/BlackScholes/Makefile +++ b/tests/opencl/BlackScholes/Makefile @@ -1,3 +1,5 @@ +XLEN ?= 32 + RISCV_TOOLCHAIN_PATH ?= $(wildcard ../../../../riscv-gnu-toolchain/drops) POCL_CC_PATH ?= $(wildcard ../../../../pocl/drops_riscv_cc) POCL_INC_PATH ?= $(wildcard ../include) @@ -19,7 +21,7 @@ VX_SRCS += $(VORTEX_RT_PATH)/fileio/fileio.S VX_SRCS += $(VORTEX_RT_PATH)/tests/tests.c VX_SRCS += $(VORTEX_RT_PATH)/vx_api/vx_api.c -VX_CFLAGS = -nostartfiles -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/startup/vx_link.ld +VX_CFLAGS = -nostartfiles -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/startup/vx_link$(XLEN).ld CXXFLAGS = -g -O0 -march=rv32im -mabi=ilp32 CXXFLAGS += -ffreestanding # program may not begin at main() @@ -50,7 +52,7 @@ $(PROJECT).dump: $(PROJECT).elf $(DMP) -D $(PROJECT).elf > $(PROJECT).dump run: $(PROJECT).hex - POCL_DEBUG=all $(VX_SIMX_PATH)/Vcache_simX -E -a rv32i --core $(PROJECT).hex -s -b 1> emulator.debug + POCL_DEBUG=all $(VX_SIMX_PATH)/Vcache_simX -E --core $(PROJECT).hex -s -b 1> emulator.debug qemu: $(PROJECT).qemu POCL_DEBUG=all $(RISCV_TOOLCHAIN_PATH)/bin/qemu-riscv32 -d in_asm -D debug.log $(PROJECT).qemu diff --git a/tests/opencl/DotProduct/Makefile b/tests/opencl/DotProduct/Makefile index 3f3a68f3..0ca88c3d 100644 --- a/tests/opencl/DotProduct/Makefile +++ b/tests/opencl/DotProduct/Makefile @@ -1,3 +1,5 @@ +XLEN ?= 32 + RISCV_TOOLCHAIN_PATH ?= $(wildcard ../../../../riscv-gnu-toolchain/drops) POCL_CC_PATH ?= $(wildcard ../../../../pocl/drops_riscv_cc) POCL_INC_PATH ?= $(wildcard ../include) @@ -19,7 +21,7 @@ VX_SRCS += $(VORTEX_RT_PATH)/fileio/fileio.S VX_SRCS += $(VORTEX_RT_PATH)/tests/tests.c VX_SRCS += $(VORTEX_RT_PATH)/vx_api/vx_api.c -VX_CFLAGS = -nostartfiles -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/startup/vx_link.ld +VX_CFLAGS = -nostartfiles -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/startup/vx_link$(XLEN).ld CXXFLAGS = -g -O0 -march=rv32im -mabi=ilp32 CXXFLAGS += -ffreestanding # program may not begin at main() @@ -50,7 +52,7 @@ $(PROJECT).dump: $(PROJECT).elf $(DMP) -D $(PROJECT).elf > $(PROJECT).dump run: $(PROJECT).hex - POCL_DEBUG=all $(VX_SIMX_PATH)/Vcache_simX -E -a rv32i --core $(PROJECT).hex -s -b 1> emulator.debug + POCL_DEBUG=all $(VX_SIMX_PATH)/Vcache_simX -E $(PROJECT).hex -s -b 1> emulator.debug qemu: $(PROJECT).qemu POCL_DEBUG=all $(RISCV_TOOLCHAIN_PATH)/bin/qemu-riscv32 -d in_asm -D debug.log $(PROJECT).qemu diff --git a/tests/opencl/VectorHypot/Makefile b/tests/opencl/VectorHypot/Makefile index e58561ca..b836673e 100644 --- a/tests/opencl/VectorHypot/Makefile +++ b/tests/opencl/VectorHypot/Makefile @@ -1,3 +1,5 @@ +XLEN ?= 32 + RISCV_TOOLCHAIN_PATH ?= $(wildcard ../../../../riscv-gnu-toolchain/drops) POCL_CC_PATH ?= $(wildcard ../../../../pocl/drops_riscv_cc) POCL_INC_PATH ?= $(wildcard ../include) @@ -19,7 +21,7 @@ VX_SRCS += $(VORTEX_RT_PATH)/fileio/fileio.S VX_SRCS += $(VORTEX_RT_PATH)/tests/tests.c VX_SRCS += $(VORTEX_RT_PATH)/vx_api/vx_api.c -VX_CFLAGS = -nostartfiles -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/startup/vx_link.ld +VX_CFLAGS = -nostartfiles -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/startup/vx_link$(XLEN).ld CXXFLAGS = -g -O0 -march=rv32im -mabi=ilp32 CXXFLAGS += -ffreestanding # program may not begin at main() @@ -50,7 +52,7 @@ $(PROJECT).dump: $(PROJECT).elf $(DMP) -D $(PROJECT).elf > $(PROJECT).dump run: $(PROJECT).hex - POCL_DEBUG=all $(VX_SIMX_PATH)/Vcache_simX -E -a rv32i --core $(PROJECT).hex -s -b 1> emulator.debug + POCL_DEBUG=all $(VX_SIMX_PATH)/Vcache_simX -E $(PROJECT).hex -s -b 1> emulator.debug qemu: $(PROJECT).qemu POCL_DEBUG=all $(RISCV_TOOLCHAIN_PATH)/bin/qemu-riscv32 -d in_asm -D debug.log $(PROJECT).qemu diff --git a/tests/opencl/bfs/Makefile b/tests/opencl/bfs/Makefile index 13b88729..72a1bdfa 100644 --- a/tests/opencl/bfs/Makefile +++ b/tests/opencl/bfs/Makefile @@ -1,3 +1,5 @@ +XLEN ?= 32 + LLVM_PREFIX ?= /opt/llvm-riscv RISCV_TOOLCHAIN_PATH ?= /opt/riscv-gnu-toolchain SYSROOT ?= $(RISCV_TOOLCHAIN_PATH)/riscv32-unknown-elf @@ -9,7 +11,7 @@ VORTEX_RT_PATH ?= $(realpath ../../../runtime) K_LLCFLAGS += "-O3 -march=riscv32 -target-abi=ilp32f -mcpu=generic-rv32 -mattr=+m,+f -mattr=+vortex -float-abi=hard -code-model=small" K_CFLAGS += "-v -O3 -Wstack-usage=1024 --sysroot=$(SYSROOT) --gcc-toolchain=$(RISCV_TOOLCHAIN_PATH) -march=rv32imf -mabi=ilp32f -Xclang -target-feature -Xclang +vortex -I$(VORTEX_RT_PATH)/include -fno-rtti -fno-exceptions -ffreestanding -nostartfiles -fdata-sections -ffunction-sections" -K_LDFLAGS += "-Wl,-Bstatic,-T$(VORTEX_RT_PATH)/linker/vx_link.ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a -lm" +K_LDFLAGS += "-Wl,-Bstatic,-T$(VORTEX_RT_PATH)/linker/vx_link$(XLEN).ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a -lm" CXXFLAGS += -std=c++11 -O2 -Wall -Wextra -pedantic -Wfatal-errors #CXXFLAGS += -std=c++11 -O0 -g -Wall -Wextra -pedantic -Wfatal-errors diff --git a/tests/opencl/convolution/Makefile b/tests/opencl/convolution/Makefile index e76b5968..10777a55 100644 --- a/tests/opencl/convolution/Makefile +++ b/tests/opencl/convolution/Makefile @@ -1,3 +1,5 @@ +XLEN ?= 32 + LLVM_PREFIX ?= /opt/llvm-riscv RISCV_TOOLCHAIN_PATH ?= /opt/riscv-gnu-toolchain SYSROOT ?= $(RISCV_TOOLCHAIN_PATH)/riscv32-unknown-elf @@ -9,7 +11,7 @@ VORTEX_RT_PATH ?= $(realpath ../../../runtime) K_LLCFLAGS += "-O3 -march=riscv32 -target-abi=ilp32f -mcpu=generic-rv32 -mattr=+m,+f -mattr=+vortex -float-abi=hard -code-model=small" K_CFLAGS += "-v -O3 --sysroot=$(SYSROOT) --gcc-toolchain=$(RISCV_TOOLCHAIN_PATH) -march=rv32imf -mabi=ilp32f -Xclang -target-feature -Xclang +vortex -I$(VORTEX_RT_PATH)/include -fno-rtti -fno-exceptions -ffreestanding -nostartfiles -fdata-sections -ffunction-sections" -K_LDFLAGS += "-Wl,-Bstatic,-T$(VORTEX_RT_PATH)/linker/vx_link.ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a -lm" +K_LDFLAGS += "-Wl,-Bstatic,-T$(VORTEX_RT_PATH)/linker/vx_link$(XLEN).ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a -lm" CXXFLAGS += -std=c++11 -O2 -Wall -Wextra -pedantic -Wfatal-errors #CXXFLAGS += -std=c++11 -O0 -g -Wall -Wextra -pedantic -Wfatal-errors diff --git a/tests/opencl/cutcp/Makefile b/tests/opencl/cutcp/Makefile index 3d694a63..77620fc8 100644 --- a/tests/opencl/cutcp/Makefile +++ b/tests/opencl/cutcp/Makefile @@ -1,3 +1,5 @@ +XLEN ?= 32 + RISCV_TOOLCHAIN_PATH ?= $(wildcard ../../../../riscv-gnu-toolchain/drops) POCL_CC_PATH ?= $(wildcard ../../../../pocl/drops_riscv_cc) POCL_INC_PATH ?= $(wildcard ../include) @@ -19,7 +21,7 @@ VX_SRCS += $(VORTEX_RT_PATH)/fileio/fileio.S VX_SRCS += $(VORTEX_RT_PATH)/tests/tests.c VX_SRCS += $(VORTEX_RT_PATH)/vx_api/vx_api.c -VX_CFLAGS = -nostartfiles -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/startup/vx_link.ld +VX_CFLAGS = -nostartfiles -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/startup/vx_link$(XLEN).ld CXXFLAGS = -g -O0 -march=rv32im -mabi=ilp32 CXXFLAGS += -ffreestanding # program may not begin at main() @@ -52,7 +54,7 @@ $(PROJECT).dump: $(PROJECT).elf $(DMP) -D $(PROJECT).elf > $(PROJECT).dump run: $(PROJECT).hex - POCL_DEBUG=all $(VX_SIMX_PATH)/Vcache_simX -E -a rv32i --core $(PROJECT).hex -s -b 1> emulator.debug + POCL_DEBUG=all $(VX_SIMX_PATH)/Vcache_simX -E $(PROJECT).hex -s -b 1> emulator.debug qemu: $(PROJECT).qemu POCL_DEBUG=all $(RISCV_TOOLCHAIN_PATH)/bin/qemu-riscv32 -d in_asm -D debug.log $(PROJECT).qemu diff --git a/tests/opencl/guassian/Makefile b/tests/opencl/guassian/Makefile index 01be4ae5..2b7ce511 100644 --- a/tests/opencl/guassian/Makefile +++ b/tests/opencl/guassian/Makefile @@ -1,3 +1,5 @@ +XLEN ?= 32 + LLVM_PREFIX ?= /opt/llvm-riscv RISCV_TOOLCHAIN_PATH ?= /opt/riscv-gnu-toolchain SYSROOT ?= $(RISCV_TOOLCHAIN_PATH)/riscv32-unknown-elf @@ -9,7 +11,7 @@ VORTEX_RT_PATH ?= $(realpath ../../../runtime) K_LLCFLAGS += "-O3 -march=riscv32 -target-abi=ilp32f -mcpu=generic-rv32 -mattr=+m,+f -mattr=+vortex -float-abi=hard -code-model=small" K_CFLAGS += "-v -O3 --sysroot=$(SYSROOT) --gcc-toolchain=$(RISCV_TOOLCHAIN_PATH) -march=rv32imf -mabi=ilp32f -Xclang -target-feature -Xclang +vortex -I$(VORTEX_RT_PATH)/include -fno-rtti -fno-exceptions -ffreestanding -nostartfiles -fdata-sections -ffunction-sections" -K_LDFLAGS += "-Wl,-Bstatic,-T$(VORTEX_RT_PATH)/linker/vx_link.ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a -lm" +K_LDFLAGS += "-Wl,-Bstatic,-T$(VORTEX_RT_PATH)/linker/vx_link$(XLEN).ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a -lm" CXXFLAGS += -std=c++11 -O2 -Wall -Wextra -Wfatal-errors #CXXFLAGS += -std=c++11 -O0 -g -Wall -Wextra -Wfatal-errors diff --git a/tests/opencl/kmeans/Makefile b/tests/opencl/kmeans/Makefile index 8251d75a..4d5ff95a 100644 --- a/tests/opencl/kmeans/Makefile +++ b/tests/opencl/kmeans/Makefile @@ -1,3 +1,5 @@ +XLEN ?= 32 + LLVM_PREFIX ?= /opt/llvm-riscv RISCV_TOOLCHAIN_PATH ?= /opt/riscv-gnu-toolchain SYSROOT ?= $(RISCV_TOOLCHAIN_PATH)/riscv32-unknown-elf @@ -9,7 +11,7 @@ VORTEX_RT_PATH ?= $(realpath ../../../runtime) K_LLCFLAGS += "-O3 -march=riscv32 -target-abi=ilp32f -mcpu=generic-rv32 -mattr=+m,+f -mattr=+vortex -float-abi=hard -code-model=small" K_CFLAGS += "-v -O3 --sysroot=$(SYSROOT) --gcc-toolchain=$(RISCV_TOOLCHAIN_PATH) -march=rv32imf -mabi=ilp32f -Xclang -target-feature -Xclang +vortex -I$(VORTEX_RT_PATH)/include -fno-rtti -fno-exceptions -ffreestanding -nostartfiles -fdata-sections -ffunction-sections" -K_LDFLAGS += "-Wl,-Bstatic,-T$(VORTEX_RT_PATH)/linker/vx_link.ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a -lm" +K_LDFLAGS += "-Wl,-Bstatic,-T$(VORTEX_RT_PATH)/linker/vx_link$(XLEN).ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a -lm" CXXFLAGS += -std=c++11 -O2 -Wall -Wextra -pedantic -Wfatal-errors #CXXFLAGS += -std=c++11 -O0 -g -Wall -Wextra -pedantic -Wfatal-errors diff --git a/tests/opencl/lbm/Makefile b/tests/opencl/lbm/Makefile index ffa85d1a..e914c56f 100644 --- a/tests/opencl/lbm/Makefile +++ b/tests/opencl/lbm/Makefile @@ -1,3 +1,5 @@ +XLEN ?= 32 + RISCV_TOOLCHAIN_PATH ?= $(wildcard ../../../../riscv-gnu-toolchain/drops) POCL_CC_PATH ?= $(wildcard ../../../../pocl/drops_riscv_cc) POCL_INC_PATH ?= $(wildcard ../include) @@ -19,7 +21,7 @@ VX_SRCS += $(VORTEX_RT_PATH)/fileio/fileio.S VX_SRCS += $(VORTEX_RT_PATH)/tests/tests.c VX_SRCS += $(VORTEX_RT_PATH)/vx_api/vx_api.c -VX_CFLAGS = -nostartfiles -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/startup/vx_link.ld +VX_CFLAGS = -nostartfiles -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/startup/vx_link$(XLEN).ld CXXFLAGS = -g -O0 -march=rv32im -mabi=ilp32 CXXFLAGS += -ffreestanding # program may not begin at main() @@ -52,7 +54,7 @@ $(PROJECT).dump: $(PROJECT).elf $(DMP) -D $(PROJECT).elf > $(PROJECT).dump run: $(PROJECT).hex - POCL_DEBUG=all $(VX_SIMX_PATH)/Vcache_simX -E -a rv32i --core $(PROJECT).hex -s -b 1> emulator.debug + POCL_DEBUG=all $(VX_SIMX_PATH)/Vcache_simX -E $(PROJECT).hex -s -b 1> emulator.debug qemu: $(PROJECT).qemu POCL_DEBUG=all $(RISCV_TOOLCHAIN_PATH)/bin/qemu-riscv32 -d in_asm -D debug.log $(PROJECT).qemu diff --git a/tests/opencl/mri-q/Makefile b/tests/opencl/mri-q/Makefile index 0aa409b6..0e3429e6 100644 --- a/tests/opencl/mri-q/Makefile +++ b/tests/opencl/mri-q/Makefile @@ -1,3 +1,5 @@ +XLEN ?= 32 + RISCV_TOOLCHAIN_PATH ?= $(wildcard ../../../../riscv-gnu-toolchain/drops) POCL_CC_PATH ?= $(wildcard ../../../../pocl/drops_riscv_cc) POCL_INC_PATH ?= $(wildcard ../include) @@ -19,7 +21,7 @@ VX_SRCS += $(VORTEX_RT_PATH)/fileio/fileio.S VX_SRCS += $(VORTEX_RT_PATH)/tests/tests.c VX_SRCS += $(VORTEX_RT_PATH)/vx_api/vx_api.c -VX_CFLAGS = -nostartfiles -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/startup/vx_link.ld +VX_CFLAGS = -nostartfiles -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/startup/vx_link$(XLEN).ld CXXFLAGS = -g -O0 -march=rv32im -mabi=ilp32 CXXFLAGS += -ffreestanding # program may not begin at main() @@ -52,7 +54,7 @@ $(PROJECT).dump: $(PROJECT).elf $(DMP) -D $(PROJECT).elf > $(PROJECT).dump run: $(PROJECT).hex - POCL_DEBUG=all $(VX_SIMX_PATH)/Vcache_simX -E -a rv32i --core $(PROJECT).hex -s -b 1> emulator.debug + POCL_DEBUG=all $(VX_SIMX_PATH)/Vcache_simX -E $(PROJECT).hex -s -b 1> emulator.debug qemu: $(PROJECT).qemu POCL_DEBUG=all $(RISCV_TOOLCHAIN_PATH)/bin/qemu-riscv32 -d in_asm -D debug.log $(PROJECT).qemu diff --git a/tests/opencl/nearn/Makefile b/tests/opencl/nearn/Makefile index 52d20b38..3f9d067d 100644 --- a/tests/opencl/nearn/Makefile +++ b/tests/opencl/nearn/Makefile @@ -1,3 +1,5 @@ +XLEN ?= 32 + LLVM_PREFIX ?= /opt/llvm-riscv RISCV_TOOLCHAIN_PATH ?= /opt/riscv-gnu-toolchain SYSROOT ?= $(RISCV_TOOLCHAIN_PATH)/riscv32-unknown-elf @@ -11,7 +13,7 @@ VORTEX_RT_PATH ?= $(realpath ../../../runtime) K_LLCFLAGS += "-O3 -march=riscv32 -target-abi=ilp32f -mcpu=generic-rv32 -mattr=+m,+f -mattr=+vortex -float-abi=hard -code-model=small" K_CFLAGS += "-v -O3 --sysroot=$(SYSROOT) --gcc-toolchain=$(RISCV_TOOLCHAIN_PATH) -march=rv32imf -mabi=ilp32f -Xclang -target-feature -Xclang +vortex -I$(VORTEX_RT_PATH)/include -fno-rtti -fno-exceptions -ffreestanding -nostartfiles -fdata-sections -ffunction-sections" -K_LDFLAGS += "-Wl,-Bstatic,-T$(VORTEX_RT_PATH)/linker/vx_link.ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a -lm" +K_LDFLAGS += "-Wl,-Bstatic,-T$(VORTEX_RT_PATH)/linker/vx_link$(XLEN).ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a -lm" CXXFLAGS += -std=c++11 -O2 -Wall -Wextra -Wfatal-errors #CXXFLAGS += -std=c++11 -O0 -g -Wall -Wextra -Wfatal-errors diff --git a/tests/opencl/oclprintf/Makefile b/tests/opencl/oclprintf/Makefile index 2c2fffa5..3339a59f 100644 --- a/tests/opencl/oclprintf/Makefile +++ b/tests/opencl/oclprintf/Makefile @@ -1,3 +1,5 @@ +XLEN ?= 32 + LLVM_PREFIX ?= /opt/llvm-riscv RISCV_TOOLCHAIN_PATH ?= /opt/riscv-gnu-toolchain SYSROOT ?= $(RISCV_TOOLCHAIN_PATH)/riscv32-unknown-elf @@ -11,7 +13,7 @@ VORTEX_RT_PATH ?= $(realpath ../../../runtime) K_LLCFLAGS += "-O3 -march=riscv32 -target-abi=ilp32f -mcpu=generic-rv32 -mattr=+m,+f -mattr=+vortex -float-abi=hard -code-model=small" K_CFLAGS += "-v -O3 --sysroot=$(SYSROOT) --gcc-toolchain=$(RISCV_TOOLCHAIN_PATH) -march=rv32imf -mabi=ilp32f -Xclang -target-feature -Xclang +vortex -I$(VORTEX_RT_PATH)/include -fno-rtti -fno-exceptions -ffreestanding -nostartfiles -fdata-sections -ffunction-sections" -K_LDFLAGS += "-Wl,-Bstatic,-T$(VORTEX_RT_PATH)/linker/vx_link.ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a -lm" +K_LDFLAGS += "-Wl,-Bstatic,-T$(VORTEX_RT_PATH)/linker/vx_link$(XLEN).ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a -lm" CXXFLAGS += -std=c++11 -O2 -Wall -Wextra -Wfatal-errors #CXXFLAGS += -std=c++11 -O0 -g -Wall -Wextra -Wfatal-errors diff --git a/tests/opencl/psort/Makefile b/tests/opencl/psort/Makefile index 747e185b..c739a359 100644 --- a/tests/opencl/psort/Makefile +++ b/tests/opencl/psort/Makefile @@ -1,3 +1,5 @@ +XLEN ?= 32 + LLVM_PREFIX ?= /opt/llvm-riscv RISCV_TOOLCHAIN_PATH ?= /opt/riscv-gnu-toolchain SYSROOT ?= $(RISCV_TOOLCHAIN_PATH)/riscv32-unknown-elf @@ -11,7 +13,7 @@ VORTEX_RT_PATH ?= $(realpath ../../../runtime) K_LLCFLAGS += "-O3 -march=riscv32 -target-abi=ilp32f -mcpu=generic-rv32 -mattr=+m,+f -mattr=+vortex -float-abi=hard -code-model=small" K_CFLAGS += "-v -O3 --sysroot=$(SYSROOT) --gcc-toolchain=$(RISCV_TOOLCHAIN_PATH) -march=rv32imf -mabi=ilp32f -Xclang -target-feature -Xclang +vortex -I$(VORTEX_RT_PATH)/include -fno-rtti -fno-exceptions -ffreestanding -nostartfiles -fdata-sections -ffunction-sections" -K_LDFLAGS += "-Wl,-Bstatic,-T$(VORTEX_RT_PATH)/linker/vx_link.ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a -lm" +K_LDFLAGS += "-Wl,-Bstatic,-T$(VORTEX_RT_PATH)/linker/vx_link$(XLEN).ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a -lm" CXXFLAGS += -std=c++11 -O2 -Wall -Wextra -Wfatal-errors #CXXFLAGS += -std=c++11 -O0 -g -Wall -Wextra -Wfatal-errors diff --git a/tests/opencl/reduce0/Makefile b/tests/opencl/reduce0/Makefile index bb72241f..63fdbdc6 100644 --- a/tests/opencl/reduce0/Makefile +++ b/tests/opencl/reduce0/Makefile @@ -1,3 +1,5 @@ +XLEN ?= 32 + RISCV_TOOLCHAIN_PATH ?= $(wildcard ../../../../riscv-gnu-toolchain/drops) POCL_CC_PATH ?= $(wildcard ../../../../pocl/drops_riscv_cc) POCL_INC_PATH ?= $(wildcard ../include) @@ -19,7 +21,7 @@ VX_SRCS += $(VORTEX_RT_PATH)/fileio/fileio.S VX_SRCS += $(VORTEX_RT_PATH)/tests/tests.c VX_SRCS += $(VORTEX_RT_PATH)/vx_api/vx_api.c -VX_CFLAGS = -nostartfiles -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/startup/vx_link.ld +VX_CFLAGS = -nostartfiles -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/startup/vx_link$(XLEN).ld CXXFLAGS = -g -O0 -march=rv32im -mabi=ilp32 CXXFLAGS += -ffreestanding # program may not begin at main() @@ -50,7 +52,7 @@ $(PROJECT).dump: $(PROJECT).elf $(DMP) -D $(PROJECT).elf > $(PROJECT).dump run: $(PROJECT).hex - POCL_DEBUG=all $(VX_SIMX_PATH)/Vcache_simX -E -a rv32i --core $(PROJECT).hex -s -b 1> emulator.debug + POCL_DEBUG=all $(VX_SIMX_PATH)/Vcache_simX -E $(PROJECT).hex -s -b 1> emulator.debug qemu: $(PROJECT).qemu POCL_DEBUG=all $(RISCV_TOOLCHAIN_PATH)/bin/qemu-riscv32 -d in_asm -D debug.log $(PROJECT).qemu diff --git a/tests/opencl/sad/Makefile b/tests/opencl/sad/Makefile index 129996be..c80d3d18 100644 --- a/tests/opencl/sad/Makefile +++ b/tests/opencl/sad/Makefile @@ -1,3 +1,5 @@ +XLEN ?= 32 + RISCV_TOOLCHAIN_PATH ?= $(wildcard ../../../../riscv-gnu-toolchain/drops) POCL_CC_PATH ?= $(wildcard ../../../../pocl/drops_riscv_cc) POCL_INC_PATH ?= $(wildcard ../include) @@ -19,7 +21,7 @@ VX_SRCS += $(VORTEX_RT_PATH)/fileio/fileio.S VX_SRCS += $(VORTEX_RT_PATH)/tests/tests.c VX_SRCS += $(VORTEX_RT_PATH)/vx_api/vx_api.c -VX_CFLAGS = -nostartfiles -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/startup/vx_link.ld +VX_CFLAGS = -nostartfiles -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/startup/vx_link$(XLEN).ld CXXFLAGS = -g -O0 -march=rv32im -mabi=ilp32 CXXFLAGS += -ffreestanding # program may not begin at main() @@ -52,7 +54,7 @@ $(PROJECT).dump: $(PROJECT).elf $(DMP) -D $(PROJECT).elf > $(PROJECT).dump run: $(PROJECT).hex - POCL_DEBUG=all $(VX_SIMX_PATH)/Vcache_simX -E -a rv32i --core $(PROJECT).hex -s -b 1> emulator.debug + POCL_DEBUG=all $(VX_SIMX_PATH)/Vcache_simX -E $(PROJECT).hex -s -b 1> emulator.debug qemu: $(PROJECT).qemu POCL_DEBUG=all $(RISCV_TOOLCHAIN_PATH)/bin/qemu-riscv32 -d in_asm -D debug.log $(PROJECT).qemu diff --git a/tests/opencl/saxpy/Makefile b/tests/opencl/saxpy/Makefile index 6dc44a19..d962a619 100644 --- a/tests/opencl/saxpy/Makefile +++ b/tests/opencl/saxpy/Makefile @@ -1,3 +1,5 @@ +XLEN ?= 32 + LLVM_PREFIX ?= /opt/llvm-riscv RISCV_TOOLCHAIN_PATH ?= /opt/riscv-gnu-toolchain SYSROOT ?= $(RISCV_TOOLCHAIN_PATH)/riscv32-unknown-elf @@ -11,7 +13,7 @@ OPTS ?= -n1024 K_LLCFLAGS += "-O3 -march=riscv32 -target-abi=ilp32f -mcpu=generic-rv32 -mattr=+m,+f -mattr=+vortex -float-abi=hard -code-model=small" K_CFLAGS += "-v -O3 --sysroot=$(SYSROOT) --gcc-toolchain=$(RISCV_TOOLCHAIN_PATH) -march=rv32imf -mabi=ilp32f -Xclang -target-feature -Xclang +vortex -I$(VORTEX_RT_PATH)/include -fno-rtti -fno-exceptions -ffreestanding -nostartfiles -fdata-sections -ffunction-sections" -K_LDFLAGS += "-Wl,-Bstatic,-T$(VORTEX_RT_PATH)/linker/vx_link.ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a -lm" +K_LDFLAGS += "-Wl,-Bstatic,-T$(VORTEX_RT_PATH)/linker/vx_link$(XLEN).ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a -lm" CXXFLAGS += -std=c++11 -O2 -Wall -Wextra -Wfatal-errors #CXXFLAGS += -std=c++11 -O0 -g -Wall -Wextra -Wfatal-errors diff --git a/tests/opencl/sfilter/Makefile b/tests/opencl/sfilter/Makefile index 423a8976..04129dbe 100644 --- a/tests/opencl/sfilter/Makefile +++ b/tests/opencl/sfilter/Makefile @@ -1,3 +1,5 @@ +XLEN ?= 32 + LLVM_PREFIX ?= /opt/llvm-riscv RISCV_TOOLCHAIN_PATH ?= /opt/riscv-gnu-toolchain SYSROOT ?= $(RISCV_TOOLCHAIN_PATH)/riscv32-unknown-elf @@ -11,7 +13,7 @@ OPTS ?= -n16 K_LLCFLAGS += "-O3 -march=riscv32 -target-abi=ilp32f -mcpu=generic-rv32 -mattr=+m,+f -mattr=+vortex -float-abi=hard -code-model=small" K_CFLAGS += "-v -O3 --sysroot=$(SYSROOT) --gcc-toolchain=$(RISCV_TOOLCHAIN_PATH) -march=rv32imf -mabi=ilp32f -Xclang -target-feature -Xclang +vortex -I$(VORTEX_RT_PATH)/include -fno-rtti -fno-exceptions -ffreestanding -nostartfiles -fdata-sections -ffunction-sections" -K_LDFLAGS += "-Wl,-Bstatic,-T$(VORTEX_RT_PATH)/linker/vx_link.ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a -lm" +K_LDFLAGS += "-Wl,-Bstatic,-T$(VORTEX_RT_PATH)/linker/vx_link$(XLEN).ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a -lm" CXXFLAGS += -std=c++11 -O2 -Wall -Wextra -Wfatal-errors #CXXFLAGS += -std=c++11 -O0 -g -Wall -Wextra -Wfatal-errors diff --git a/tests/opencl/sgemm/Makefile b/tests/opencl/sgemm/Makefile index 64c3b818..74b37ed7 100644 --- a/tests/opencl/sgemm/Makefile +++ b/tests/opencl/sgemm/Makefile @@ -1,3 +1,5 @@ +XLEN ?= 32 + LLVM_PREFIX ?= /opt/llvm-riscv RISCV_TOOLCHAIN_PATH ?= /opt/riscv-gnu-toolchain SYSROOT ?= $(RISCV_TOOLCHAIN_PATH)/riscv32-unknown-elf @@ -11,7 +13,7 @@ VORTEX_RT_PATH ?= $(realpath ../../../runtime) K_LLCFLAGS += "-O3 -march=riscv32 -target-abi=ilp32f -mcpu=generic-rv32 -mattr=+m,+f -mattr=+vortex -float-abi=hard -code-model=small" K_CFLAGS += "-v -O3 --sysroot=$(SYSROOT) --gcc-toolchain=$(RISCV_TOOLCHAIN_PATH) -march=rv32imf -mabi=ilp32f -Xclang -target-feature -Xclang +vortex -I$(VORTEX_RT_PATH)/include -fno-rtti -fno-exceptions -ffreestanding -nostartfiles -fdata-sections -ffunction-sections" -K_LDFLAGS += "-Wl,-Bstatic,-T$(VORTEX_RT_PATH)/linker/vx_link.ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a -lm" +K_LDFLAGS += "-Wl,-Bstatic,-T$(VORTEX_RT_PATH)/linker/vx_link$(XLEN).ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a -lm" CXXFLAGS += -std=c++11 -O2 -Wall -Wextra -Wfatal-errors #CXXFLAGS += -std=c++11 -O0 -g -Wall -Wextra -Wfatal-errors diff --git a/tests/opencl/spmv/Makefile b/tests/opencl/spmv/Makefile index f3c7a13f..062420e6 100644 --- a/tests/opencl/spmv/Makefile +++ b/tests/opencl/spmv/Makefile @@ -1,3 +1,5 @@ +XLEN ?= 32 + RISCV_TOOLCHAIN_PATH ?= $(wildcard ../../../../riscv-gnu-toolchain/drops) POCL_CC_PATH ?= $(wildcard ../../../../pocl/drops_riscv_cc) POCL_INC_PATH ?= $(wildcard ../include) @@ -19,7 +21,7 @@ VX_SRCS += $(VORTEX_RT_PATH)/fileio/fileio.S VX_SRCS += $(VORTEX_RT_PATH)/tests/tests.c VX_SRCS += $(VORTEX_RT_PATH)/vx_api/vx_api.c -VX_CFLAGS = -nostartfiles -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/startup/vx_link.ld +VX_CFLAGS = -nostartfiles -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/startup/vx_link$(XLEN).ld CXXFLAGS = -g -O0 -march=rv32im -mabi=ilp32 CXXFLAGS += -ffreestanding # program may not begin at main() @@ -52,7 +54,7 @@ $(PROJECT).dump: $(PROJECT).elf $(DMP) -D $(PROJECT).elf > $(PROJECT).dump run: $(PROJECT).hex - POCL_DEBUG=all $(VX_SIMX_PATH)/Vcache_simX -E -a rv32i --core $(PROJECT).hex -s -b 1> emulator.debug + POCL_DEBUG=all $(VX_SIMX_PATH)/Vcache_simX -E $(PROJECT).hex -s -b 1> emulator.debug qemu: $(PROJECT).qemu POCL_DEBUG=all $(RISCV_TOOLCHAIN_PATH)/bin/qemu-riscv32 -d in_asm -D debug.log $(PROJECT).qemu diff --git a/tests/opencl/stencil/Makefile b/tests/opencl/stencil/Makefile index 41e05787..bc23211d 100644 --- a/tests/opencl/stencil/Makefile +++ b/tests/opencl/stencil/Makefile @@ -1,3 +1,5 @@ +XLEN ?= 32 + RISCV_TOOLCHAIN_PATH ?= $(wildcard ../../../../riscv-gnu-toolchain/drops) POCL_CC_PATH ?= $(wildcard ../../../../pocl/drops_riscv_cc) POCL_INC_PATH ?= $(wildcard ../include) @@ -19,7 +21,7 @@ VX_SRCS += $(VORTEX_RT_PATH)/fileio/fileio.S VX_SRCS += $(VORTEX_RT_PATH)/tests/tests.c VX_SRCS += $(VORTEX_RT_PATH)/vx_api/vx_api.c -VX_CFLAGS = -nostartfiles -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/startup/vx_link.ld +VX_CFLAGS = -nostartfiles -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/startup/vx_link$(XLEN).ld CXXFLAGS = -g -O0 -march=rv32im -mabi=ilp32 CXXFLAGS += -ffreestanding # program may not begin at main() @@ -53,7 +55,7 @@ $(PROJECT).dump: $(PROJECT).elf $(DMP) -D $(PROJECT).elf > $(PROJECT).dump run: $(PROJECT).hex - POCL_DEBUG=all $(VX_SIMX_PATH)/Vcache_simX -E -a rv32i --core $(PROJECT).hex -s -b 1> emulator.debug + POCL_DEBUG=all $(VX_SIMX_PATH)/Vcache_simX -E $(PROJECT).hex -s -b 1> emulator.debug qemu: $(PROJECT).qemu POCL_DEBUG=all $(RISCV_TOOLCHAIN_PATH)/bin/qemu-riscv32 -d in_asm -D debug.log $(PROJECT).qemu diff --git a/tests/opencl/transpose/Makefile b/tests/opencl/transpose/Makefile index 008e69bc..e75ad63d 100644 --- a/tests/opencl/transpose/Makefile +++ b/tests/opencl/transpose/Makefile @@ -1,3 +1,5 @@ +XLEN ?= 32 + LLVM_PREFIX ?= /opt/llvm-riscv RISCV_TOOLCHAIN_PATH ?= /opt/riscv-gnu-toolchain SYSROOT ?= $(RISCV_TOOLCHAIN_PATH)/riscv32-unknown-elf @@ -9,7 +11,7 @@ VORTEX_RT_PATH ?= $(realpath ../../../runtime) K_LLCFLAGS += "-O3 -march=riscv32 -target-abi=ilp32f -mcpu=generic-rv32 -mattr=+m,+f -mattr=+vortex -float-abi=hard -code-model=small" K_CFLAGS += "-v -O3 --sysroot=$(SYSROOT) --gcc-toolchain=$(RISCV_TOOLCHAIN_PATH) -march=rv32imf -mabi=ilp32f -Xclang -target-feature -Xclang +vortex -I$(VORTEX_RT_PATH)/include -fno-rtti -fno-exceptions -ffreestanding -nostartfiles -fdata-sections -ffunction-sections" -K_LDFLAGS += "-Wl,-Bstatic,-T$(VORTEX_RT_PATH)/linker/vx_link.ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a -lm" +K_LDFLAGS += "-Wl,-Bstatic,-T$(VORTEX_RT_PATH)/linker/vx_link$(XLEN).ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a -lm" CXXFLAGS += -std=c++11 -O2 -Wall -Wextra -pedantic -Wfatal-errors #CXXFLAGS += -std=c++11 -O0 -g -Wall -Wextra -pedantic -Wfatal-errors diff --git a/tests/opencl/vecadd/Makefile b/tests/opencl/vecadd/Makefile index 76db3f46..0e09cf74 100644 --- a/tests/opencl/vecadd/Makefile +++ b/tests/opencl/vecadd/Makefile @@ -1,3 +1,5 @@ +XLEN ?= 32 + LLVM_PREFIX ?= /opt/llvm-riscv RISCV_TOOLCHAIN_PATH ?= /opt/riscv-gnu-toolchain SYSROOT ?= $(RISCV_TOOLCHAIN_PATH)/riscv32-unknown-elf @@ -11,7 +13,7 @@ VORTEX_RT_PATH ?= $(realpath ../../../runtime) K_LLCFLAGS += "-O3 -march=riscv32 -target-abi=ilp32f -mcpu=generic-rv32 -mattr=+m,+f -mattr=+vortex -float-abi=hard -code-model=small" K_CFLAGS += "-v -O3 --sysroot=$(SYSROOT) --gcc-toolchain=$(RISCV_TOOLCHAIN_PATH) -march=rv32imf -mabi=ilp32f -Xclang -target-feature -Xclang +vortex -I$(VORTEX_RT_PATH)/include -fno-rtti -fno-exceptions -ffreestanding -nostartfiles -fdata-sections -ffunction-sections" -K_LDFLAGS += "-Wl,-Bstatic,-T$(VORTEX_RT_PATH)/linker/vx_link.ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a -lm" +K_LDFLAGS += "-Wl,-Bstatic,-T$(VORTEX_RT_PATH)/linker/vx_link$(XLEN).ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a -lm" CXXFLAGS += -std=c++11 -O2 -Wall -Wextra -Wfatal-errors #CXXFLAGS += -std=c++11 -O0 -g -Wall -Wextra -Wfatal-errors diff --git a/tests/regression/basic/Makefile b/tests/regression/basic/Makefile index dcf85e2d..e9da60e4 100644 --- a/tests/regression/basic/Makefile +++ b/tests/regression/basic/Makefile @@ -1,3 +1,5 @@ +XLEN ?= 32 + RISCV_TOOLCHAIN_PATH ?= /opt/riscv-gnu-toolchain VORTEX_DRV_PATH ?= $(realpath ../../../driver) VORTEX_RT_PATH ?= $(realpath ../../../runtime) @@ -12,7 +14,7 @@ VX_CP = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-objcopy VX_CFLAGS += -march=rv32imf -mabi=ilp32f -O3 -Wstack-usage=1024 -ffreestanding -nostartfiles -fdata-sections -ffunction-sections VX_CFLAGS += -I$(VORTEX_RT_PATH)/include -I$(VORTEX_RT_PATH)/../hw -VX_LDFLAGS += -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link.ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a +VX_LDFLAGS += -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link$(XLEN).ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a VX_SRCS = kernel.c diff --git a/tests/regression/demo/Makefile b/tests/regression/demo/Makefile index 798f5780..0821b177 100644 --- a/tests/regression/demo/Makefile +++ b/tests/regression/demo/Makefile @@ -1,3 +1,5 @@ +XLEN ?= 32 + RISCV_TOOLCHAIN_PATH ?= /opt/riscv-gnu-toolchain VORTEX_DRV_PATH ?= $(realpath ../../../driver) VORTEX_RT_PATH ?= $(realpath ../../../runtime) @@ -12,7 +14,7 @@ VX_CP = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-objcopy VX_CFLAGS += -march=rv32imf -mabi=ilp32f -O3 -Wstack-usage=1024 -ffreestanding -nostartfiles -fdata-sections -ffunction-sections VX_CFLAGS += -I$(VORTEX_RT_PATH)/include -I$(VORTEX_RT_PATH)/../hw -VX_LDFLAGS += -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link.ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a +VX_LDFLAGS += -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link$(XLEN).ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a VX_SRCS = kernel.c diff --git a/tests/regression/diverge/Makefile b/tests/regression/diverge/Makefile index 679847af..c2903bcd 100644 --- a/tests/regression/diverge/Makefile +++ b/tests/regression/diverge/Makefile @@ -1,3 +1,5 @@ +XLEN ?= 32 + RISCV_TOOLCHAIN_PATH ?= /opt/riscv-gnu-toolchain VORTEX_DRV_PATH ?= $(realpath ../../../driver) VORTEX_RT_PATH ?= $(realpath ../../../runtime) @@ -12,7 +14,7 @@ VX_CP = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-objcopy VX_CFLAGS += -march=rv32imf -mabi=ilp32f -O3 -Wstack-usage=1024 -ffreestanding -nostartfiles -fdata-sections -ffunction-sections VX_CFLAGS += -I$(VORTEX_RT_PATH)/include -I$(VORTEX_RT_PATH)/../hw -VX_LDFLAGS += -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link.ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a +VX_LDFLAGS += -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link$(XLEN).ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a VX_SRCS = kernel.c diff --git a/tests/regression/dogfood/Makefile b/tests/regression/dogfood/Makefile index 61113c7e..b7204113 100644 --- a/tests/regression/dogfood/Makefile +++ b/tests/regression/dogfood/Makefile @@ -1,3 +1,5 @@ +XLEN ?= 32 + RISCV_TOOLCHAIN_PATH ?= /opt/riscv-gnu-toolchain VORTEX_DRV_PATH ?= $(realpath ../../../driver) VORTEX_RT_PATH ?= $(realpath ../../../runtime) @@ -12,7 +14,7 @@ VX_CP = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-objcopy VX_CFLAGS += -march=rv32imf -mabi=ilp32f -O3 -Wstack-usage=1024 -ffreestanding -nostartfiles -fdata-sections -ffunction-sections VX_CFLAGS += -I$(VORTEX_RT_PATH)/include -I$(VORTEX_RT_PATH)/../hw -VX_LDFLAGS += -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link.ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a +VX_LDFLAGS += -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link$(XLEN).ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a VX_LDFLAGS += -lm diff --git a/tests/regression/fence/Makefile b/tests/regression/fence/Makefile index 3491cb99..099f5340 100644 --- a/tests/regression/fence/Makefile +++ b/tests/regression/fence/Makefile @@ -1,3 +1,5 @@ +XLEN ?= 32 + RISCV_TOOLCHAIN_PATH ?= /opt/riscv-gnu-toolchain VORTEX_DRV_PATH ?= $(realpath ../../../driver) VORTEX_RT_PATH ?= $(realpath ../../../runtime) @@ -12,7 +14,7 @@ VX_CP = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-objcopy VX_CFLAGS += -march=rv32imf -mabi=ilp32f -O3 -Wstack-usage=1024 -ffreestanding -nostartfiles -fdata-sections -ffunction-sections VX_CFLAGS += -I$(VORTEX_RT_PATH)/include -I$(VORTEX_RT_PATH)/../hw -VX_LDFLAGS += -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link.ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a +VX_LDFLAGS += -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link$(XLEN).ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a VX_SRCS = kernel.c diff --git a/tests/regression/io_addr/Makefile b/tests/regression/io_addr/Makefile index 80f62fc6..e90871c3 100644 --- a/tests/regression/io_addr/Makefile +++ b/tests/regression/io_addr/Makefile @@ -1,3 +1,5 @@ +XLEN ?= 32 + RISCV_TOOLCHAIN_PATH ?= /opt/riscv-gnu-toolchain VORTEX_DRV_PATH ?= $(realpath ../../../driver) VORTEX_RT_PATH ?= $(realpath ../../../runtime) @@ -12,7 +14,7 @@ VX_CP = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-objcopy VX_CFLAGS += -march=rv32imf -mabi=ilp32f -O3 -Wstack-usage=1024 -ffreestanding -nostartfiles -fdata-sections -ffunction-sections VX_CFLAGS += -I$(VORTEX_RT_PATH)/include -I$(VORTEX_RT_PATH)/../hw -VX_LDFLAGS += -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link.ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a +VX_LDFLAGS += -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link$(XLEN).ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a VX_SRCS = kernel.c diff --git a/tests/regression/mstress/Makefile b/tests/regression/mstress/Makefile index 024967de..f3068c4a 100644 --- a/tests/regression/mstress/Makefile +++ b/tests/regression/mstress/Makefile @@ -1,3 +1,5 @@ +XLEN ?= 32 + RISCV_TOOLCHAIN_PATH ?= /opt/riscv-gnu-toolchain VORTEX_DRV_PATH ?= $(realpath ../../../driver) VORTEX_RT_PATH ?= $(realpath ../../../runtime) @@ -12,7 +14,7 @@ VX_CP = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-objcopy VX_CFLAGS += -march=rv32imf -mabi=ilp32f -O3 -Wstack-usage=1024 -ffreestanding -nostartfiles -fdata-sections -ffunction-sections VX_CFLAGS += -I$(VORTEX_RT_PATH)/include -I$(VORTEX_RT_PATH)/../hw -VX_LDFLAGS += -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link.ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a +VX_LDFLAGS += -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link$(XLEN).ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a VX_SRCS = kernel.c diff --git a/tests/regression/no_mf_ext/Makefile b/tests/regression/no_mf_ext/Makefile index 99384023..ccf519b9 100644 --- a/tests/regression/no_mf_ext/Makefile +++ b/tests/regression/no_mf_ext/Makefile @@ -1,3 +1,5 @@ +XLEN ?= 32 + RISCV_TOOLCHAIN_PATH ?= /opt/riscv-gnu-toolchain VORTEX_DRV_PATH ?= $(realpath ../../../driver) VORTEX_RT_PATH ?= $(realpath ../../../runtime) @@ -12,7 +14,7 @@ VX_CP = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-objcopy VX_CFLAGS += -march=rv32imf -mabi=ilp32f -O3 -Wstack-usage=1024 -ffreestanding -nostartfiles -fdata-sections -ffunction-sections VX_CFLAGS += -I$(VORTEX_RT_PATH)/include -I$(VORTEX_RT_PATH)/../hw -VX_LDFLAGS += -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link.ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a +VX_LDFLAGS += -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link$(XLEN).ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a VX_SRCS = kernel.c diff --git a/tests/regression/no_smem/Makefile b/tests/regression/no_smem/Makefile index de5a4f78..d8107faf 100644 --- a/tests/regression/no_smem/Makefile +++ b/tests/regression/no_smem/Makefile @@ -1,3 +1,5 @@ +XLEN ?= 32 + RISCV_TOOLCHAIN_PATH ?= /opt/riscv-gnu-toolchain VORTEX_DRV_PATH ?= $(realpath ../../../driver) VORTEX_RT_PATH ?= $(realpath ../../../runtime) @@ -12,7 +14,7 @@ VX_CP = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-objcopy VX_CFLAGS += -march=rv32imf -mabi=ilp32f -O3 -Wstack-usage=1024 -ffreestanding -nostartfiles -fdata-sections -ffunction-sections VX_CFLAGS += -DSM_ENABLE=0 -I$(VORTEX_RT_PATH)/include -I$(VORTEX_RT_PATH)/../hw -VX_LDFLAGS += -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link.ld -Wl,--gc-sections,--defsym=__stack_top=0xfefff000 +VX_LDFLAGS += -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link$(XLEN).ld -Wl,--gc-sections,--defsym=__stack_top=0xfefff000 VX_RUNTIME = $(VORTEX_RT_PATH)/src/vx_start.S $(VORTEX_RT_PATH)/src/vx_perf.c diff --git a/tests/regression/prefetch/Makefile b/tests/regression/prefetch/Makefile index af58821c..348796c1 100644 --- a/tests/regression/prefetch/Makefile +++ b/tests/regression/prefetch/Makefile @@ -1,3 +1,5 @@ +XLEN ?= 32 + RISCV_TOOLCHAIN_PATH ?= /opt/riscv-gnu-toolchain VORTEX_DRV_PATH ?= $(realpath ../../../driver) VORTEX_RT_PATH ?= $(realpath ../../../runtime) @@ -12,7 +14,7 @@ VX_CP = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-objcopy VX_CFLAGS += -march=rv32imf -mabi=ilp32f -O3 -Wstack-usage=1024 -ffreestanding -nostartfiles -fdata-sections -ffunction-sections VX_CFLAGS += -I$(VORTEX_RT_PATH)/include -I$(VORTEX_RT_PATH)/../hw -VX_LDFLAGS += -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link.ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a +VX_LDFLAGS += -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link$(XLEN).ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a VX_SRCS = kernel.c diff --git a/tests/regression/printf/Makefile b/tests/regression/printf/Makefile index a7aeb266..064ff0fa 100644 --- a/tests/regression/printf/Makefile +++ b/tests/regression/printf/Makefile @@ -1,3 +1,5 @@ +XLEN ?= 32 + RISCV_TOOLCHAIN_PATH ?= /opt/riscv-gnu-toolchain VORTEX_DRV_PATH ?= $(realpath ../../../driver) VORTEX_RT_PATH ?= $(realpath ../../../runtime) @@ -12,7 +14,7 @@ VX_CP = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-objcopy VX_CFLAGS += -march=rv32imf -mabi=ilp32f -O3 -Wstack-usage=1024 -ffreestanding -nostartfiles -fdata-sections -ffunction-sections VX_CFLAGS += -I$(VORTEX_RT_PATH)/include -I$(VORTEX_RT_PATH)/../hw -VX_LDFLAGS += -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link.ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a +VX_LDFLAGS += -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link$(XLEN).ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a VX_SRCS = kernel.c diff --git a/tests/regression/sort/Makefile b/tests/regression/sort/Makefile index dfb7db47..96536158 100644 --- a/tests/regression/sort/Makefile +++ b/tests/regression/sort/Makefile @@ -1,4 +1,6 @@ +XLEN ?= 32 + RISCV_TOOLCHAIN_PATH ?= /opt/riscv-gnu-toolchain VORTEX_DRV_PATH ?= $(realpath ../../../driver) VORTEX_RT_PATH ?= $(realpath ../../../runtime) @@ -18,7 +20,7 @@ VX_CFLAGS += -Xclang -target-feature -Xclang +vortex VX_CFLAGS += --sysroot=${SYSROOT} --gcc-toolchain=${RISCV_TOOLCHAIN_PATH} VX_CFLAGS += -I${VORTEX_HW_PATH} -I${VORTEX_RT_PATH}/include -VX_LDFLAGS += -Wl,-Bstatic,-T${VORTEX_RT_PATH}/linker/vx_link.ld,--gc-sections ${VORTEX_RT_PATH}/libvortexrt.a +VX_LDFLAGS += -Wl,-Bstatic,-T${VORTEX_RT_PATH}/linker/vx_link$(XLEN).ld,--gc-sections ${VORTEX_RT_PATH}/libvortexrt.a VX_DPFLAGS = -arch=riscv32 -mcpu=generic-rv32 -mattr=+m,+f -mattr=+vortex diff --git a/tests/regression/tex/Makefile b/tests/regression/tex/Makefile index ff38c514..89fe1e52 100644 --- a/tests/regression/tex/Makefile +++ b/tests/regression/tex/Makefile @@ -1,3 +1,5 @@ +XLEN ?= 32 + RISCV_TOOLCHAIN_PATH ?= /opt/riscv-gnu-toolchain VORTEX_DRV_PATH ?= $(realpath ../../../driver) VORTEX_RT_PATH ?= $(wildcard ../../../runtime) @@ -12,7 +14,7 @@ VX_CP = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-objcopy VX_CFLAGS += -std=c++11 -march=rv32imf -mabi=ilp32f -O3 -Wstack-usage=1024 -ffreestanding -nostartfiles -fdata-sections -ffunction-sections VX_CFLAGS += -DENABLE_SW -I$(VORTEX_RT_PATH)/include -I$(VORTEX_RT_PATH)/../hw -I$(VORTEX_RT_PATH)/../sim/common -I$(VORTEX_RT_PATH)/../third_party -VX_LDFLAGS += -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link.ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a +VX_LDFLAGS += -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link$(XLEN).ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a VX_SRCS = kernel.c diff --git a/tests/riscv/isa/Makefile b/tests/riscv/isa/Makefile index 1f8e0ab3..701e8ca4 100644 --- a/tests/riscv/isa/Makefile +++ b/tests/riscv/isa/Makefile @@ -1,68 +1,50 @@ -ALL_TESTS := $(wildcard *.hex) -ALL_TESTS_32 := $(wildcard rv32*.hex) -ALL_TESTS_64 := $(wildcard rv64*.hex) +XLEN ?= 32 +SIM_DIR=../../../sim -D_TESTS_32 := $(wildcard rv32ud-p-*.hex) +TESTS_32I := $(filter-out rv32ui-p-fence_i.hex, $(wildcard rv32ui-p-*.hex)) +TESTS_32M := $(wildcard rv32um-p-*.hex) +TESTS_32F := $(wildcard rv32uf-p-*.hex) +TESTS_32D := $(wildcard rv32ud-p-*.hex) -EXCLUDED_TESTS_32 := $(V_TESTS) $(D_TESTS_32) -EXCLUDED_TESTS_64 := rv64ud-p-recoding.hex - -TESTS_32 := $(filter-out $(EXCLUDED_TESTS_32), $(ALL_TESTS_32)) -TESTS_64 := $(filter-out $(EXCLUDED_TESTS_64), $(ALL_TESTS_64)) - -### To be deleted later -32I := $(wildcard rv32ui-p-*.hex) -32M := $(wildcard rv32um-p-*.hex) -32F := $(wildcard rv32uf-p-*.hex) -32D := $(wildcard rv32ud-p-*.hex) - -64I := $(wildcard rv64ui-p-*.hex) -64M := $(wildcard rv64um-p-*.hex) -64F := $(wildcard rv64uf-p-*.hex) -64D := $(filter-out rv64ud-p-recoding.hex rv64ud-p-ldst.hex, $(wildcard rv64ud-p-*.hex)) -### +TESTS_64I := $(wildcard rv64ui-p-*.hex) +TESTS_64M := $(wildcard rv64um-p-*.hex) +TESTS_64F := $(wildcard rv64uf-p-*.hex) +TESTS_64D := $(wildcard rv64ud-p-*.hex) all: -### To be deleted later -32i: - $(foreach test, $(32I), ../../../sim/simx/simx -r -a rv32i -c 1 -i $(test) || exit;) +run-simx-32i: + $(foreach test, $(TESTS_32I), $(SIM_DIR)/simx/simx -r -c 1 -i $(test) || exit;) -32m: - $(foreach test, $(32M), ../../../sim/simx/simx -r -a rv32im -c 1 -i $(test) || exit;) +run-simx-32im: + $(foreach test, $(TESTS_32I) $(TESTS_32M), $(SIM_DIR)/simx/simx -r -c 1 -i $(test) || exit;) -32f: - $(foreach test, $(32F), ../../../sim/simx/simx -r -a rv32imf -c 1 -i $(test) || exit;) +run-simx-32imf: + $(foreach test, $(TESTS_32I) $(TESTS_32M) $(TESTS_32F), $(SIM_DIR)/simx/simx -r -c 1 -i $(test) || exit;) -32d: - $(foreach test, $(32D), ../../../sim/simx/simx -r -a rv32imfd -c 1 -i $(test) || exit;) +run-simx-32imfd: + $(foreach test, $(TESTS_32I) $(TESTS_32M) $(TESTS_32F) $(TESTS_32D), $(SIM_DIR)/simx/simx -r -c 1 -i $(test) || exit;) -64i: - $(foreach test, $(64I), ../../../sim/simx/simx -r -a rv64i -c 1 -i $(test) || exit;) +run-simx-64i: + $(foreach test, $(TESTS_64I), $(SIM_DIR)/simx/simx -r -c 1 -i $(test) || exit;) -64m: - $(foreach test, $(64M), ../../../sim/simx/simx -r -a rv64im -c 1 -i $(test) || exit;) +run-simx-64im: + $(foreach test, $(TESTS_64I) $(TESTS_64M), $(SIM_DIR)/simx/simx -r -c 1 -i $(test) || exit;) -64f: - $(foreach test, $(64F), ../../../sim/simx/simx -r -a rv64imf -c 1 -i $(test) || exit;) - -64d: - $(foreach test, $(64D), ../../../sim/simx/simx -r -a rv64imfd -c 1 -i $(test) || exit;) -### - -run-simx: run-simx-32imf - -run-simx-32imf: - $(foreach test, $(TESTS_32), ../../../sim/simx/simx -r -a rv32imf -c 1 -i $(test) || exit;) - -run-simx-32imfd: - $(foreach test, $(TESTS_32) $(D_TESTS_32), ../../../sim/simx/simx -r -a rv32imfd -c 1 -i $(test) || exit;) +run-simx-64imf: + $(foreach test, $(TESTS_64I) $(TESTS_64M) $(TESTS_64F), $(SIM_DIR)/simx/simx -r -c 1 -i $(test) || exit;) run-simx-64imfd: - $(foreach test, $(TESTS_64), ../../../sim/simx/simx -r -a rv64imfd -c 1 -i $(test) || exit;) + $(foreach test, $(TESTS_64I) $(TESTS_64M) $(TESTS_64F) $(TESTS_64D), $(SIM_DIR)/simx/simx -r -c 1 -i $(test) || exit;) + +run-simx-32: run-simx-32imfd + +run-simx-64: run-simx-64imfd + +run-simx: run-simx-$(XLEN) run-rtlsim: - $(foreach test, $(TESTS_32), ../../../sim/rtlsim/rtlsim -r $(test) || exit;) + $(foreach test, $(TESTS_32I) $(TESTS_32M) $(TESTS_32F), $(SIM_DIR)/rtlsim/rtlsim -r $(test) || exit;) clean: \ No newline at end of file diff --git a/tests/runtime/fibonacci/Makefile b/tests/runtime/fibonacci/Makefile index 8d9f0605..39c0c751 100644 --- a/tests/runtime/fibonacci/Makefile +++ b/tests/runtime/fibonacci/Makefile @@ -14,6 +14,8 @@ AR = $(RISCV_TOOLCHAIN_PATH)/bin/$(RISCV_PREFIX)gcc-ar DP = $(RISCV_TOOLCHAIN_PATH)/bin/$(RISCV_PREFIX)objdump CP = $(RISCV_TOOLCHAIN_PATH)/bin/$(RISCV_PREFIX)objcopy +SIM_DIR=../../../sim + ifeq ($(XLEN),32) CFLAGS += -march=rv32imf -mabi=ilp32f else @@ -41,10 +43,10 @@ $(PROJECT).elf: $(SRCS) $(CC) $(CFLAGS) $(SRCS) $(LDFLAGS) -o $(PROJECT).elf run-rtlsim: $(PROJECT).bin - ../../../sim/rtlsim/rtlsim $(PROJECT).bin + $(SIM_DIR)/rtlsim/rtlsim $(PROJECT).bin run-simx: $(PROJECT).bin - ../../../sim/simx/simx -a rv32i -c 1 -i $(PROJECT).bin + $(SIM_DIR)/simx/simx -c 1 -i $(PROJECT).bin .depend: $(SRCS) $(CC) $(CFLAGS) -MM $^ > .depend; diff --git a/tests/runtime/hello/Makefile b/tests/runtime/hello/Makefile index 6150d445..3310bf86 100644 --- a/tests/runtime/hello/Makefile +++ b/tests/runtime/hello/Makefile @@ -14,6 +14,8 @@ AR = $(RISCV_TOOLCHAIN_PATH)/bin/$(RISCV_PREFIX)gcc-ar DP = $(RISCV_TOOLCHAIN_PATH)/bin/$(RISCV_PREFIX)objdump CP = $(RISCV_TOOLCHAIN_PATH)/bin/$(RISCV_PREFIX)objcopy +SIM_DIR=../../../sim + ifeq ($(XLEN),32) CFLAGS += -march=rv32imf -mabi=ilp32f else @@ -41,10 +43,10 @@ $(PROJECT).elf: $(SRCS) $(CC) $(CFLAGS) $(SRCS) $(LDFLAGS) -o $(PROJECT).elf run-rtlsim: $(PROJECT).bin - ../../../sim/rtlsim/rtlsim $(PROJECT).bin + $(SIM_DIR)/rtlsim/rtlsim $(PROJECT).bin run-simx: $(PROJECT).bin - ../../../sim/simx/simx -a rv32i -c 1 -i $(PROJECT).bin + $(SIM_DIR)/simx/simx -c 1 -i $(PROJECT).bin .depend: $(SRCS) $(CC) $(CFLAGS) -MM $^ > .depend; diff --git a/tests/runtime/simple/Makefile b/tests/runtime/simple/Makefile index 5cb7a278..5f89f366 100644 --- a/tests/runtime/simple/Makefile +++ b/tests/runtime/simple/Makefile @@ -14,6 +14,8 @@ AR = $(RISCV_TOOLCHAIN_PATH)/bin/$(RISCV_PREFIX)gcc-ar DP = $(RISCV_TOOLCHAIN_PATH)/bin/$(RISCV_PREFIX)objdump CP = $(RISCV_TOOLCHAIN_PATH)/bin/$(RISCV_PREFIX)objcopy +SIM_DIR=../../../sim + ifeq ($(XLEN),32) CFLAGS += -march=rv32imf -mabi=ilp32f else @@ -41,10 +43,10 @@ $(PROJECT).elf: $(SRCS) $(CC) $(CFLAGS) $(SRCS) $(LDFLAGS) -o $(PROJECT).elf run-rtlsim: $(PROJECT).bin - ../../../sim/rtlsim/rtlsim $(PROJECT).bin + $(SIM_DIR)/rtlsim/rtlsim $(PROJECT).bin run-simx: $(PROJECT).bin - ../../../sim/simx/simx -a rv32i -c 1 -i $(PROJECT).bin + $(SIM_DIR)/simx/simx -c 1 -i $(PROJECT).bin .depend: $(SRCS) $(CC) $(CFLAGS) -MM $^ > .depend;