Skip to content

Commit a5d945c

Browse files
committed
Add CGetTop to the RISC-V instruction reference
1 parent 3b51f8b commit a5d945c

File tree

6 files changed

+44
-4
lines changed

6 files changed

+44
-4
lines changed

app-isaquick-riscv.tex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ \chapter{CHERI-RISC-V ISA Quick Reference}
4747

4848
\rvcheriisaquick{CGetAddr}
4949

50+
\rvcheriisaquick{CGetTop}
51+
5052
\dcnote{CGetPCC is a Special}
5153

5254
\dcnote{CGetPCCSetOffset is AIUPC}

chap-isaref-riscv.tex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ \section{CHERI-RISC-V Instructions}
262262
\input{insn-riscv/cgetperm}
263263
\input{insn-riscv/cgetsealed}
264264
\input{insn-riscv/cgettag}
265+
\input{insn-riscv/cgettop}
265266
\input{insn-riscv/cgettype}
266267
\input{insn-riscv/cincoffset}
267268
\input{insn-riscv/cincoffsetimm}

def-riscv-insns.tex

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@
2525
\rvcherisrcdest[name=CGetOffset]{6}{rd}{cs1}
2626
\rvcherisrcdest[name=CGetFlags]{7}{rd}{cs1}
2727
\rvcherisrcdest[name=CGetAddr]{F}{rd}{cs1}
28-
29-
% Mark as noref and reserved until landing of
30-
% https://github.com/CTSRD-CHERI/sail-cheri-riscv/pull/59
31-
\rvcherisrcdest[name=CGetTop,noref,tablesuffix=\rvcherireservedfootnotemark]{18}{cd}{cs1}
28+
\rvcherisrcdest[name=CGetTop]{18}{cd}{cs1}
3229

3330
% Mark as noref and reserved until landing of
3431
% https://github.com/CTSRD-CHERI/sail-cheri-riscv/pull/55

insn-riscv/cgettop.tex

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
\clearpage
2+
\phantomsection
3+
\addcontentsline{toc}{subsection}{CGetTop}
4+
\insnriscvlabel{cgettop}
5+
\subsection*{CGetTop}
6+
7+
\subsubsection*{Format}
8+
9+
\rvcheriasm{CGetTop}
10+
11+
\begin{center}
12+
\rvcheriheader
13+
\rvcheribitbox{CGetTop}
14+
\end{center}
15+
16+
\sailRISCVisarefbody{CGetTop}

sail_latex_riscv/commands.tex

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
\providecommand\saildoclabelled[2]{\phantomsection\label{#1}#2}
22
\providecommand\saildocval[2]{#1 #2}
3+
\providecommand\saildocoutcome[2]{#1 #2}
34
\providecommand\saildocfcl[2]{#1 #2}
45
\providecommand\saildoctype[2]{#1 #2}
56
\providecommand\saildocfn[2]{#1 #2}
@@ -5245,6 +5246,19 @@ \subsection*{Notes}
52455246
\end{itemize}
52465247
}{\lstinputlisting[language=sail]{sail_latex_riscv/fclCGetLenzexecute33a689e3a631b9b905b85461d3814943.tex}}}}
52475248

5249+
\newcommand{\sailRISCVfclCGetTopexecute}{\saildoclabelled{sailRISCVfclCGetTopzexecute}{\saildocfcl{Integer register \emph{rd} is set equal to the \textbf{top} field (\saildocabbrev{i.e.} one past the
5250+
last addressable byte) of capability register \emph{cs1}.
5251+
5252+
\subsection*{Notes}
5253+
5254+
5255+
\begin{itemize}
5256+
\item Due to the compressed representation of capabilities, the actual top
5257+
of capabilities can be $2^{\hyperref[sailRISCVzxlen]{{xlen}}}$; \hyperref[sailRISCVzCGetTop]{\lstinline{CGetTop}} will return the
5258+
maximum value of $2^{\hyperref[sailRISCVzxlen]{{xlen}}}-1$ in this case.
5259+
\end{itemize}
5260+
}{\lstinputlisting[language=sail]{sail_latex_riscv/fclCGetTopzexecute33a689e3a631b9b905b85461d3814943.tex}}}}
5261+
52485262
\newcommand{\sailRISCVfclCGetTagexecute}{\saildoclabelled{sailRISCVfclCGetTagzexecute}{\saildocfcl{The low bit of integer register \emph{rd} is set to the \textbf{tag} field of \emph{cs1}.
52495263
All other bits of \emph{rd} are cleared.
52505264

@@ -14380,3 +14394,9 @@ \subsection*{Exceptions}
1438014394
\ifstrequal{#1}{x7}{\hyperref[sailRISCVregisterzx7]{#2}}{}%
1438114395
\ifstrequal{#1}{x8}{\hyperref[sailRISCVregisterzx8]{#2}}{}%
1438214396
\ifstrequal{#1}{x9}{\hyperref[sailRISCVregisterzx9]{#2}}{}}
14397+
14398+
\newcommand{\sailRISCVoutcome}[1]{
14399+
}
14400+
14401+
\newcommand{\sailRISCVrefoutcome}[2]{
14402+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
let capVal = #\hyperref[sailRISCVzC]{C}#(cs1);
2+
let top = #\hyperref[sailRISCVzgetCapTop]{getCapTop}#(capVal);
3+
#\hyperref[sailRISCVzX]{X}#(rd) = #\hyperref[sailRISCVztozybits]{to\_bits}#(sizeof(xlen), if top > cap_max_addr then cap_max_addr else top);
4+
RETIRE_SUCCESS

0 commit comments

Comments
 (0)