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

implement mtvt CSR to support CLIC vectored mode #119

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion src/Emulator/Cores/RiscV/RegisterDescription.cs
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,8 @@ public static void AddCSRFeature(ref List<GDBFeatureDescriptor> features, uint r
csrGroup.Registers.Add(new GDBRegisterDescriptor((uint)RiscV32Registers.MEDELEG, registerWidth, "medeleg", intType, "csr"));
csrGroup.Registers.Add(new GDBRegisterDescriptor((uint)RiscV32Registers.MIDELEG, registerWidth, "mideleg", intType, "csr"));
}


csrGroup.Registers.Add(new GDBRegisterDescriptor((uint)RiscV32Registers.MTVT, registerWidth, "mtvt","", "csr"));
csrGroup.Registers.Add(new GDBRegisterDescriptor((uint)RiscV32Registers.MSTATUS, registerWidth, "mstatus", "", "csr"));
csrGroup.Registers.Add(new GDBRegisterDescriptor((uint)RiscV32Registers.MISA, registerWidth, "misa", "", "csr"));
csrGroup.Registers.Add(new GDBRegisterDescriptor((uint)RiscV32Registers.MIE, registerWidth, "mie", "mie_type", "csr"));
Expand Down
14 changes: 14 additions & 0 deletions src/Emulator/Cores/RiscV/RiscV32Registers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,18 @@ public RegisterValue SPTBR
}
}
[Register]
public RegisterValue MTVT
{
get
{
return GetRegisterValue32((int)RiscV32Registers.MTVT);
}
set
{
SetRegisterValue32((int)RiscV32Registers.MTVT, value);
}
}
[Register]
public RegisterValue MSTATUS
{
get
Expand Down Expand Up @@ -773,6 +785,7 @@ protected override void InitializeRegisters()
{ RiscV32Registers.STVAL, new CPURegister(388, 32, isGeneral: false, isReadonly: false, aliases: new [] { "STVAL" }) },
{ RiscV32Registers.SIP, new CPURegister(389, 32, isGeneral: false, isReadonly: false, aliases: new [] { "SIP" }) },
{ RiscV32Registers.SATP, new CPURegister(449, 32, isGeneral: false, isReadonly: false, aliases: new [] { "SATP", "SPTBR" }) },
{ RiscV32Registers.MTVT, new CPURegister(775, 32, isGeneral: false, isReadonly: false, aliases: new [] { "MTVT" }) },
{ RiscV32Registers.MSTATUS, new CPURegister(833, 32, isGeneral: false, isReadonly: false, aliases: new [] { "MSTATUS" }) },
{ RiscV32Registers.MISA, new CPURegister(834, 32, isGeneral: false, isReadonly: false, aliases: new [] { "MISA" }) },
{ RiscV32Registers.MEDELEG, new CPURegister(835, 32, isGeneral: false, isReadonly: false, aliases: new [] { "MEDELEG" }) },
Expand Down Expand Up @@ -811,6 +824,7 @@ public enum RiscV32Registers
SIP = 389,
SATP = 449,
SPTBR = 449,
MTVT= 775,
MSTATUS = 833,
MISA = 834,
MEDELEG = 835,
Expand Down