aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2016-06-01 13:16:29 -0700
committerAndrew Waterman <waterman@eecs.berkeley.edu>2016-06-01 13:16:29 -0700
commit1783043af1d4af65914f5ff2e167202abb7576c0 (patch)
treee385aba35270f45a693126667123a33d218f3411
parentc8bea5d3b61b04381221398f4085e34281a788b6 (diff)
downloadriscv-opcodes-1783043af1d4af65914f5ff2e167202abb7576c0.zip
riscv-opcodes-1783043af1d4af65914f5ff2e167202abb7576c0.tar.gz
riscv-opcodes-1783043af1d4af65914f5ff2e167202abb7576c0.tar.bz2
Add dret instruction and debug CSRs. (#5)
-rw-r--r--encoding.h23
-rw-r--r--opcodes1
-rwxr-xr-xparse-opcodes3
3 files changed, 27 insertions, 0 deletions
diff --git a/encoding.h b/encoding.h
index 149f855..7ba1df1 100644
--- a/encoding.h
+++ b/encoding.h
@@ -33,6 +33,29 @@
#define SSTATUS32_SD 0x80000000
#define SSTATUS64_SD 0x8000000000000000
+#define DCSR_XDEBUGVER (3<<30)
+#define DCSR_NDRESET (1<<29)
+#define DCSR_FULLRESET (1<<28)
+#define DCSR_HWBPCOUNT (0xfff<<16)
+#define DCSR_EBREAKM (1<<15)
+#define DCSR_EBREAKH (1<<14)
+#define DCSR_EBREAKS (1<<13)
+#define DCSR_EBREAKU (1<<12)
+#define DCSR_STOPCYCLE (1<<10)
+#define DCSR_STOPTIME (1<<9)
+#define DCSR_CAUSE (7<<6)
+#define DCSR_DEBUGINT (1<<5)
+#define DCSR_HALT (1<<3)
+#define DCSR_STEP (1<<2)
+#define DCSR_PRV (3<<0)
+
+#define DCSR_CAUSE_NONE 0
+#define DCSR_CAUSE_SWBP 1
+#define DCSR_CAUSE_HWBP 2
+#define DCSR_CAUSE_DEBUGINT 3
+#define DCSR_CAUSE_STEP 4
+#define DCSR_CAUSE_HALT 5
+
#define MIP_SSIP (1 << IRQ_S_SOFT)
#define MIP_HSIP (1 << IRQ_H_SOFT)
#define MIP_MSIP (1 << IRQ_M_SOFT)
diff --git a/opcodes b/opcodes
index 7b6fc2a..c98b19f 100644
--- a/opcodes
+++ b/opcodes
@@ -119,6 +119,7 @@ uret 11..7=0 19..15=0 31..20=0x002 14..12=0 6..2=0x1C 1..0=3
sret 11..7=0 19..15=0 31..20=0x102 14..12=0 6..2=0x1C 1..0=3
hret 11..7=0 19..15=0 31..20=0x202 14..12=0 6..2=0x1C 1..0=3
mret 11..7=0 19..15=0 31..20=0x302 14..12=0 6..2=0x1C 1..0=3
+dret 11..7=0 19..15=0 31..20=0x7b2 14..12=0 6..2=0x1C 1..0=3
sfence.vm 11..7=0 rs1 31..20=0x104 14..12=0 6..2=0x1C 1..0=3
wfi 11..7=0 19..15=0 31..20=0x105 14..12=0 6..2=0x1C 1..0=3
csrrw rd rs1 imm12 14..12=1 6..2=0x1C 1..0=3
diff --git a/parse-opcodes b/parse-opcodes
index 04bf70f..66fcd73 100755
--- a/parse-opcodes
+++ b/parse-opcodes
@@ -93,6 +93,9 @@ csrs = [
(0x704, 'mscycle_delta'),
(0x705, 'mstime_delta'),
(0x706, 'msinstret_delta'),
+ (0x7b0, 'dcsr'),
+ (0x7b1, 'dpc'),
+ (0x7b2, 'dscratch'),
# Standard Machine RO
(0xF00, 'mcycle'),