Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update RV32 and RV64 architectures #127

Merged
merged 51 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from 49 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
f502c8e
exit simulation on loop to self instruction
wysiwyng Jun 7, 2022
9308a8d
add exception members to cpu struct
wysiwyng Jun 7, 2022
e627427
begin coredsl exception stuff
wysiwyng Jun 7, 2022
2843218
Merge remote-tracking branch 'upstream/master' into coredsl_exceptions
wysiwyng Jun 30, 2022
798fb36
initial coredsl exceptions
wysiwyng Jun 30, 2022
a2e31ca
new arch files
wysiwyng Jul 12, 2022
ce46144
add nextPc member
wysiwyng Jul 18, 2022
2494c3f
flush printinstruction
wysiwyng Jul 20, 2022
2640d62
Merge branch 'dev' into coredsl_exceptions
wysiwyng Jul 20, 2022
b49be54
add semihosting
maltevonehren Aug 1, 2022
4c0f858
add semihosting to RISC-V
maltevonehren Aug 1, 2022
8364f7e
avoid fallthrough
maltevonehren Aug 4, 2022
5deddee
update architecture
wysiwyng Aug 25, 2022
765e56a
add 128 bit int types
wysiwyng Nov 4, 2022
4e6f779
add decoding exceptions
wysiwyng Nov 4, 2022
64879f6
add new arch files
wysiwyng Nov 4, 2022
a12fba4
add rv64 arch
wysiwyng Nov 4, 2022
6541ffd
Merge branch 'coredsl_exceptions' of https://github.com/maltevonehren…
wysiwyng Nov 4, 2022
ba6a20c
update arch
wysiwyng Nov 7, 2022
4d408f5
update arch files
wysiwyng Nov 14, 2022
9a15fd3
load correct rv64 core
wysiwyng Nov 14, 2022
7749b6d
update arch
wysiwyng Nov 14, 2022
2dc4aee
update arch
wysiwyng Nov 16, 2022
ade2c57
update arch files
wysiwyng Dec 12, 2022
d751613
Merge branch 'master' into coredsl_exceptions
wysiwyng Dec 15, 2022
741c413
Merge remote-tracking branch 'origin/master' into simexit
wysiwyng Jan 27, 2023
44f695f
make exit on loop-to-self optional
wysiwyng Jan 27, 2023
a6183d4
Merge remote-tracking branch 'origin/simexit' into coredsl_exceptions
wysiwyng Jan 30, 2023
e05f86c
move invalid callback into architectures
wysiwyng Jan 30, 2023
2256d90
update architecture
wysiwyng Feb 7, 2023
a09aea8
update arch
wysiwyng Mar 27, 2023
e109ba8
link arch plugins against jit plugins
wysiwyng Sep 29, 2023
3175875
change file/functionglobalcode to vector
wysiwyng Sep 29, 2023
ca4cb5c
only signal mmu if there is one
wysiwyng Sep 29, 2023
3367f96
add interruptenable class
wysiwyng Sep 29, 2023
62a2ffa
add interrupt handler plugin to bare_etiss
wysiwyng Sep 29, 2023
62bbf61
add unloadblocksall method
wysiwyng Sep 29, 2023
8b7f87c
add icache flush method
wysiwyng Sep 29, 2023
5dc331f
generate error handling pseudo instruction
wysiwyng Sep 29, 2023
7a553ef
update architectures
wysiwyng Sep 29, 2023
9de3932
Revert "generate error handling pseudo instruction"
wysiwyng Sep 29, 2023
d7971c8
Revert "change file/functionglobalcode to vector"
wysiwyng Sep 29, 2023
61422e7
update architecture
wysiwyng Sep 29, 2023
2597630
update architectures, fix rounding mode
wysiwyng Oct 2, 2023
962df67
update architectures
wysiwyng Oct 2, 2023
843a6c7
update architectures
wysiwyng Oct 2, 2023
1fc7c1f
don't use affected regs
wysiwyng Oct 4, 2023
cca5b6a
Merge branch 'master' into coredsl_exceptions
wysiwyng Oct 4, 2023
2a29d8e
update arch
wysiwyng Nov 3, 2023
f97939e
fix irq vector swapped, div / 0 error
wysiwyng Nov 28, 2023
cb89512
use ETISS_BINARY_DIR
wysiwyng Nov 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ArchImpl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ ADD_SUBDIRECTORY(OR1K)
ADD_SUBDIRECTORY(RISCV)
ADD_SUBDIRECTORY(RISCV64)
ADD_SUBDIRECTORY(RV32IMACFD)
ADD_SUBDIRECTORY(RV64IMACFD)
26 changes: 26 additions & 0 deletions ArchImpl/OR1K/OR1KArch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,32 @@ void OR1KArch::initInstrSet(etiss::instr::ModedInstructionSet &mis) const
{
etiss_log(ERROR, "Failed to add instructions of the OR1K instruction set");
}

mis.foreach(
[](etiss::instr::VariableInstructionSet &vis) {
vis.foreach(
[](etiss::instr::InstructionSet &is) {
is.getInvalid().addCallback(
[](etiss::instr::BitArray &ba, CodeSet &cs, etiss::instr::InstructionContext &ic) {
etiss_uint32 error_code = 0;
static etiss::instr::BitArrayRange R_error_code_0(31, 0);
error_code += R_error_code_0.read(ba) << 0;

std::stringstream ss;
ss << "\t\t//trap_entry 32\n";
ss << "\t\treturn " << std::to_string(error_code) << "U;";
//#if DEBUG
ss << " // @0x" << std::hex << ic.current_address_ << std::dec << ": " << ba;
//#endif
ss << "\n";
cs.append(CodePart::APPENDEDRETURNINGREQUIRED).code() = ss.str();
return true;
},
0);
}
);
}
);
}

void OR1KArch::initCodeBlock(etiss::CodeBlock &cb) const
Expand Down
23 changes: 23 additions & 0 deletions ArchImpl/RISCV/RISCVArchSpecificImp.h
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,29 @@ void RISCVArch::initInstrSet(etiss::instr::ModedInstructionSet &mis) const
etiss::instr::VariableInstructionSet *vis = mis.get(1);
using namespace etiss;
using namespace etiss::instr;

vis->foreach(
[](InstructionSet &is) {
is.getInvalid().addCallback(
[](BitArray &ba, CodeSet &cs, InstructionContext &ic) {
etiss_uint32 error_code = 0;
static BitArrayRange R_error_code_0(31, 0);
error_code += R_error_code_0.read(ba) << 0;

std::stringstream ss;
ss << "\t\t//trap_entry 32\n";
ss << "\t\treturn " << std::to_string(error_code) << "U;";
//#if DEBUG
ss << " // @0x" << std::hex << ic.current_address_ << std::dec << ": " << ba;
//#endif
ss << "\n";
cs.append(CodePart::APPENDEDRETURNINGREQUIRED).code() = ss.str();
return true;
},
0);
}
);

vis->length_updater_ = [](VariableInstructionSet &, InstructionContext &ic, BitArray &ba) {
std::function<void(InstructionContext & ic, etiss_uint32 opRd)> updateRiscvInstrLength =
[](InstructionContext &ic, etiss_uint32 opRd) {
Expand Down
23 changes: 23 additions & 0 deletions ArchImpl/RISCV64/RISCV64ArchSpecificImp.h
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,29 @@ void RISCV64Arch::initInstrSet(etiss::instr::ModedInstructionSet &mis) const

using namespace etiss;
using namespace etiss::instr;

vis->foreach(
[](InstructionSet &is) {
is.getInvalid().addCallback(
[](BitArray &ba, CodeSet &cs, InstructionContext &ic) {
etiss_uint32 error_code = 0;
static BitArrayRange R_error_code_0(31, 0);
error_code += R_error_code_0.read(ba) << 0;

std::stringstream ss;
ss << "\t\t//trap_entry 32\n";
ss << "\t\treturn " << std::to_string(error_code) << "U;";
//#if DEBUG
ss << " // @0x" << std::hex << ic.current_address_ << std::dec << ": " << ba;
//#endif
ss << "\n";
cs.append(CodePart::APPENDEDRETURNINGREQUIRED).code() = ss.str();
return true;
},
0);
}
);

vis->length_updater_ = [](VariableInstructionSet &, InstructionContext &ic, BitArray &ba) {
std::function<void(InstructionContext & ic, etiss_uint32 opRd)> updateRiscvInstrLength =
[](InstructionContext &ic, etiss_uint32 opRd) {
Expand Down
16 changes: 12 additions & 4 deletions ArchImpl/RV32IMACFD/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
# Generated on Wed, 25 May 2022 18:09:21 +0200.
# Generated on Fri, 03 Nov 2023 13:22:23 +0100.
#
# This file contains the CMake build info for the RV32IMACFD core architecture.

PROJECT(RV32IMACFD)

SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
SET(CMAKE_INSTALL_RPATH "\$ORIGIN/../../include/jit/etiss/jit")

ADD_LIBRARY(${PROJECT_NAME} SHARED
RV32IMACFDArch.cpp
RV32IMACFDArchLib.cpp
RV32IMACFDArchSpecificImp.cpp
RV32IMACFDFuncs.c
RV32IMACFDInstr.cpp
RV32IMACFD_RISCVBaseInstr.cpp
RV32IMACFD_RV32IInstr.cpp
RV32IMACFD_RV32ICInstr.cpp
RV32IMACFD_RV32MInstr.cpp
RV32IMACFD_ZicsrInstr.cpp
RV32IMACFD_RV32FInstr.cpp
RV32IMACFD_RV32FCInstr.cpp
RV32IMACFD_RV32DInstr.cpp
Expand All @@ -23,9 +25,15 @@ ADD_LIBRARY(${PROJECT_NAME} SHARED
RV32IMACFD_tum_retInstr.cpp
RV32IMACFD_RV32AInstr.cpp
RV32IMACFD_tum_rvaInstr.cpp
RV32IMACFD_tum_semihostingInstr.cpp
)

FILE(COPY "${CMAKE_CURRENT_LIST_DIR}/${PROJECT_NAME}Funcs.h" DESTINATION "${ETISS_BINARY_DIR}/include/jit/Arch/${PROJECT_NAME}")
add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${CMAKE_CURRENT_LIST_DIR}/${PROJECT_NAME}Funcs.h"
"${ETISS_BINARY_DIR}/include/jit/Arch/${PROJECT_NAME}"
)
INSTALL(FILES "${CMAKE_CURRENT_LIST_DIR}/${PROJECT_NAME}Funcs.h" DESTINATION "include/jit/Arch/${PROJECT_NAME}")

ETISSPluginArch(${PROJECT_NAME})
5 changes: 4 additions & 1 deletion ArchImpl/RV32IMACFD/RV32IMACFD.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Generated on Tue, 01 Mar 2022 00:20:25 +0100.
* Generated on Fri, 03 Nov 2023 13:22:23 +0100.
*
* This file contains the registers for the RV32IMACFD core architecture.
*/
Expand Down Expand Up @@ -54,6 +54,9 @@ struct RV32IMACFD {
etiss_uint8 PRIV;
etiss_uint32 DPC;
etiss_uint32 FCSR;
etiss_uint32 MSTATUS;
etiss_uint32 MIE;
etiss_uint32 MIP;
etiss_uint32 *CSR[4096];
etiss_uint32 ins_CSR[4096];
etiss_uint64 F[32];
Expand Down
15 changes: 11 additions & 4 deletions ArchImpl/RV32IMACFD/RV32IMACFDArch.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Generated on Tue, 01 Mar 2022 00:20:25 +0100.
* Generated on Fri, 03 Nov 2023 13:22:23 +0100.
*
* This file contains the architecture class for the RV32IMACFD core architecture.
*/
Expand Down Expand Up @@ -35,8 +35,6 @@
*********************************************************************************************************************************/

#include "RV32IMACFDArch.h"

#define ETISS_ARCH_STATIC_FN_ONLY
#include "RV32IMACFDFuncs.h"

#define RV32IMACFD_DEBUG_CALL 0
Expand Down Expand Up @@ -67,6 +65,7 @@ void RV32IMACFDArch::resetCPU(ETISS_CPU * cpu,etiss::uint64 * startpointer)

if (startpointer) cpu->instructionPointer = *startpointer & ~((etiss::uint64)0x1);
else cpu->instructionPointer = 0x0; // reference to manual
cpu->nextPc = cpu->instructionPointer;
cpu->mode = 1;
cpu->cpuTime_ps = 0;
cpu->cpuCycleTime_ps = 31250;
Expand Down Expand Up @@ -122,6 +121,9 @@ void RV32IMACFDArch::resetCPU(ETISS_CPU * cpu,etiss::uint64 * startpointer)
rv32imacfdcpu->PRIV = 0;
rv32imacfdcpu->DPC = 0;
rv32imacfdcpu->FCSR = 0;
rv32imacfdcpu->MSTATUS = 0;
rv32imacfdcpu->MIE = 0;
rv32imacfdcpu->MIP = 0;
for (int i = 0; i < 32; ++i) {
rv32imacfdcpu->F[i] = 0;
}
Expand Down Expand Up @@ -160,6 +162,9 @@ void RV32IMACFDArch::resetCPU(ETISS_CPU * cpu,etiss::uint64 * startpointer)
rv32imacfdcpu->X[30] = &rv32imacfdcpu->T5;
rv32imacfdcpu->X[31] = &rv32imacfdcpu->T6;
rv32imacfdcpu->CSR[3] = &rv32imacfdcpu->FCSR;
rv32imacfdcpu->CSR[768] = &rv32imacfdcpu->MSTATUS;
rv32imacfdcpu->CSR[772] = &rv32imacfdcpu->MIE;
rv32imacfdcpu->CSR[836] = &rv32imacfdcpu->MIP;

rv32imacfdcpu->PRIV = 3;
rv32imacfdcpu->DPC = 0;
Expand Down Expand Up @@ -207,7 +212,9 @@ void RV32IMACFDArch::initCodeBlock(etiss::CodeBlock & cb) const
{
cb.fileglobalCode().insert("#include \"Arch/RV32IMACFD/RV32IMACFD.h\"\n");
cb.fileglobalCode().insert("#include \"Arch/RV32IMACFD/RV32IMACFDFuncs.h\"\n");
cb.functionglobalCode().insert("etiss_uint32 exception = 0;\n");
cb.functionglobalCode().insert("cpu->exception = 0;\n");
cb.functionglobalCode().insert("cpu->return_pending = 0;\n");
cb.functionglobalCode().insert("etiss_uint32 mem_ret_code = 0;\n");
}

etiss::plugin::gdb::GDBCore & RV32IMACFDArch::getGDBCore()
Expand Down
5 changes: 4 additions & 1 deletion ArchImpl/RV32IMACFD/RV32IMACFDArch.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Generated on Thu, 24 Feb 2022 17:15:20 +0100.
* Generated on Fri, 03 Nov 2023 13:22:23 +0100.
*
* This file contains the architecture class for the RV32IMACFD core architecture.
*/
Expand All @@ -10,6 +10,7 @@
#include "etiss/CPUArch.h"
#include "etiss/Instruction.h"
#include "etiss/InterruptVector.h"
#include "etiss/InterruptEnable.h"
#include "RV32IMACFD.h"
#include "RV32IMACFDGDBCore.h"

Expand Down Expand Up @@ -89,6 +90,8 @@ class RV32IMACFDArch : public etiss::CPUArch {
*/
virtual etiss::InterruptVector * createInterruptVector(ETISS_CPU * cpu);
virtual void deleteInterruptVector(etiss::InterruptVector * vec, ETISS_CPU * cpu);
virtual etiss::InterruptEnable* createInterruptEnable(ETISS_CPU *cpu);
virtual void deleteInterruptEnable(etiss::InterruptEnable* en, ETISS_CPU* cpu);

/**
@brief get the GDBcore for RV32IMACFD architecture
Expand Down
2 changes: 1 addition & 1 deletion ArchImpl/RV32IMACFD/RV32IMACFDArchLib.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Generated on Thu, 24 Feb 2022 17:15:20 +0100.
* Generated on Fri, 03 Nov 2023 13:22:23 +0100.
*
* This file contains the library interface for the RV32IMACFD core architecture.
*/
Expand Down
Loading
Loading