add stuff to doc dir
authoradam <adam@megacz.com>
Tue, 3 Jul 2007 07:01:56 +0000 (08:01 +0100)
committeradam <adam@megacz.com>
Tue, 3 Jul 2007 07:01:56 +0000 (08:01 +0100)
doc/archman.tex [new file with mode: 0644]
doc/bytefield.sty [new file with mode: 0644]
doc/register.sty [new file with mode: 0644]

diff --git a/doc/archman.tex b/doc/archman.tex
new file mode 100644 (file)
index 0000000..7100104
--- /dev/null
@@ -0,0 +1,188 @@
+\documentclass[10pt]{book}
+\usepackage{amsmath}
+\usepackage{palatino}
+\usepackage{parskip}
+\usepackage{register}
+\usepackage{bytefield}
+\renewcommand{\ttdefault}{cmtt}
+\title{The FleetTwo Architecture Manual}
+\begin{document}
+\maketitle
+
+\pagebreak
+\section*{Data Formats}
+
+\subsection*{Packet Destination Address (12 bits)}
+
+These bits appear physically within the switch fabric, and have
+``address bit timing.''  The {\tt T} bit is the ``tokenhood'' bit; if
+set, this packet represents a token and it does not cause the switch
+fabric data latches to fire.
+
+{\tt\footnotesize
+\begin{bytefield}{49}
+  \bitheader[b]{37,47,48}\\
+  \bitbox{1}{T} 
+  \bitbox{11}{Destination Address} 
+  \bitbox[l]{37}{} 
+\end{bytefield}
+}
+
+\subsection*{Data Word In Memory (37 bits)}
+
+A word of memory is 37 bits wide.  For convenience, we assume that the
+memory word width is also the width of a pointer as well as the width
+of all on-chip data item registers.
+
+{\tt\footnotesize
+\begin{bytefield}{49}
+  \bitheader[b]{0,36}\\
+  \bitbox[r]{12}{}
+  \bitbox{37}{Data Word} 
+\end{bytefield}
+}
+
+\subsection*{Data Packet In Flight (49 bits)}
+
+A {\it data packet} is a data item in the switch fabric, on its way to
+some destination.
+
+{\tt\footnotesize
+\begin{bytefield}{49}
+  \bitheader[b]{0,36,37,47,48}\\
+  \bitbox{1}{T} 
+  \bitbox{11}{Destination Address} 
+  \bitbox{37}{Data Word} 
+\end{bytefield}
+}
+
+\subsection*{Instruction In Memory (37 bits)}
+
+An instruction must be no wider than a memory word.  The next section
+explains the bits in greater detail.
+
+{\tt\tiny
+\begin{bytefield}{49}
+  \bitheader[b]{0,10,11,17,18-26,36}\\
+  \bitbox[r]{12}{}
+  \bitbox{11}{Instruction Register Address} 
+  \bitbox{1}{K} 
+  \bitbox{1}{L} 
+  \bitbox{1}{Ti} 
+  \bitbox{1}{Di} 
+  \bitbox{1}{Ld} 
+  \bitbox{1}{Do} 
+  \bitbox{1}{To} 
+  \bitbox{1}{Rq} 
+  \bitbox{7}{Count} 
+  \bitbox{11}{Data/Token Destination} 
+\end{bytefield}
+}
+
+\subsection*{Instruction Packet In Flight (49 bits)}
+
+A {\it instruction packet} is an instruction in the instruction horn
+(which may or may not be the same thing as the data horn), on its way
+to some instruction register (BenkoBox).
+
+{\tt\tiny
+\begin{bytefield}{49}
+  \bitheader[b]{0,10,11,17,18-25,37,47,48}\\
+  \bitbox[r]{1}{0} 
+  \bitbox{11}{Instruction Register Address} 
+  \bitbox[lr]{11}{}
+  \bitbox{1}{K} 
+  \bitbox{1}{L} 
+  \bitbox{1}{Ti} 
+  \bitbox{1}{Di} 
+  \bitbox{1}{Ld} 
+  \bitbox{1}{Do} 
+  \bitbox{1}{To} 
+  \bitbox{1}{Rq} 
+  \bitbox{7}{Count} 
+  \bitbox{11}{Data/Token Destination} 
+\end{bytefield}
+}
+
+
+\pagebreak
+
+\section*{Instruction Format Detail}
+
+\setlength{\bitwidth}{5mm}
+{\tt
+\begin{bytefield}{26}
+  \bitheader[b]{0,10,11,17,18-25}\\
+  \bitbox{1}{K} 
+  \bitbox{1}{L} 
+  \bitbox{1}{Ti} 
+  \bitbox{1}{Di} 
+  \bitbox{1}{Ld} 
+  \bitbox{1}{Do} 
+  \bitbox{1}{To} 
+  \bitbox{1}{Rq} 
+  \bitbox{7}{C} 
+  \bitbox{11}{Dest} 
+\end{bytefield}
+}
+
+\begin{itemize}
+
+   \item [\tt K] ({\bf Kill}) if set, this instruction is a kill;
+                 ignore all further directions below.
+
+   \item [\tt L] ({\bf Literal}) if set, use all bits below except
+                 {\tt Count} (17 bits) as a literal, sign extend them,
+                 and load into the data register; ignore all further
+                 directions below except {\tt Count}.
+
+  \item [\tt Ti] ({\bf Token Input}) wait for a token and acknowledge
+                 it; {\tt Ti}=1,{\tt Di}=1 is invalid on inbox
+
+  \item [\tt Di] ({\bf Data Input}) wait for a datum and acknowledge
+                 it
+
+  \item [\tt Dc] ({\bf Data Capture}) capture (latch) a datum; {\tt
+                 Di}=0,{\tt Dc}=1 is invalid.  This bit is ignored if
+                 the {\tt T} (token) bit is set on the incoming
+                 packet.
+
+  \item [\tt Do] ({\bf Data Output}) emit a datum
+
+  \item [\tt To] ({\bf Token Output}) emit a token; {\tt To}=1,{\tt
+                 Do}=1 is invalid on outbox
+
+  \item [\tt Rq] ({\bf ReQueue}) if set, instructions having nonzero
+                 count are ``Re-Queued'' in the instruction queue
+                 after execution (see below); otherwise instructions
+                 with nonzero count are executed again immediately.
+
+   \item [\tt C] ({\bf Count}) {\it After} executing:
+\begin{verbatim}
+if Count==0 { discard this instruction }
+else {
+    if Count<1111111 { decrement count }
+    if Rq=1 and L=0 {
+       put this instruction back into the instruction fifo
+    } else {
+       execute this instruction again
+    }
+}
+\end{verbatim}               
+
+\item [\tt Dest] ({\bf Data/Token Destination})
+   Any packets (token or datum) emitted {\it to the switch fabric}
+   will be emitted with this address in the packet's destination
+   field.
+\end{itemize}
+
+\subsection*{Notes}
+\begin{itemize}
+\item A "standing" instruction is encoded as {\tt Count}=$\text{\tt 1111111}_\text{two}$
+
+\item A {\tt clog} is encoded as a "standing" {\tt nop} ({\tt Ti},
+      {\tt Di}, {\tt Dc}, {\tt Do}, {\tt To} all cleared)
+
+\item An {\tt unclog} is encoded as {\tt K=1},{\tt Ti=1}
+
+\end{itemize}
diff --git a/doc/bytefield.sty b/doc/bytefield.sty
new file mode 100644 (file)
index 0000000..55adde2
--- /dev/null
@@ -0,0 +1,310 @@
+%%
+%% This is file `bytefield.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bytefield.dtx  (with options: `package')
+%% 
+%% This is a generated file.
+%% 
+%% Copyright (C) 2005 by Scott Pakin <scott+bf@pakin.org>
+%% 
+%% This file may be distributed and/or modified under the conditions of
+%% the LaTeX Project Public License, either version 1.3a of this license
+%% or (at your option) any later version.  The latest version of this
+%% license is in:
+%% 
+%%    http://www.latex-project.org/lppl.txt
+%% 
+%% and version 1.3a or later is part of all distributions of LaTeX version
+%% 2004/10/11 or later.
+%% 
+\NeedsTeXFormat{LaTeX2e}[1999/12/01]
+\ProvidesPackage{bytefield}
+    [2005/07/31 v1.2a Network protocol diagrams]
+\RequirePackage{calc}[1998/07/07]
+\def\bf@newdimen#1{\advance\count11 by 1
+  \ch@ck1\insc@unt\dimen% Check room
+  \allocationnumber=\count11
+  \dimendef#1=\allocationnumber
+  \wlog{\string#1=\string\dimen\the\allocationnumber\space (locally)}}
+\newlength{\bytefield@height}
+\newif\ifcounting@words
+\newlength{\bytefield@height@increment}
+\DeclareRobustCommand{\inc@bytefield@height}[1]{%
+  \setlength{\bytefield@height@increment}{#1}%
+  \global\advance\bytefield@height by \bytefield@height@increment}
+\newcounter{bits@wide}
+\newsavebox{\entire@bytefield@picture}
+\newenvironment{bytefield}[1]{%
+  \setcounter{bits@wide}{#1}%
+  \let\old@nl=\\%
+  \let\amp=&%
+  \catcode`\&=10
+  \openup -1pt
+  \setlength{\bytefield@height}{0pt}%
+  \setlength{\unitlength}{1pt}%
+  \counting@wordstrue
+  \begin{lrbox}{\entire@bytefield@picture}%
+  \renewcommand{\\}{%
+    \amp\show@wordlabelr\cr%
+    \ignorespaces\counting@wordstrue\make@lspace\amp}%
+  \vbox\bgroup\ialign\bgroup##\amp##\amp##\cr\amp%
+}{%
+  \amp\show@wordlabelr\cr\egroup\egroup%
+  \end{lrbox}%
+  \usebox{\entire@bytefield@picture}}
+\newlength{\bitwidth}
+\AtBeginDocument{\settowidth{\bitwidth}{\tiny 99i}}
+\newlength{\byteheight}
+\AtBeginDocument{\setlength{\byteheight}{4ex}}
+\newlength{\units@wide}
+\newlength{\units@tall}
+\DeclareRobustCommand{\bitbox}[3][lrtb]{%
+  \setlength{\units@wide}{\bitwidth * #2}%
+  \parse@bitbox@arg{#1}%
+  \draw@bit@picture{\strip@pt\units@wide}{\strip@pt\byteheight}{#3}}
+\DeclareRobustCommand{\wordbox}[3][lrtb]{%
+  \setlength{\units@wide}{\bitwidth * \value{bits@wide}}%
+  \setlength{\units@tall}{\byteheight * #2}%
+  \parse@bitbox@arg{#1}%
+  \draw@bit@picture{\strip@pt\units@wide}{\strip@pt\units@tall}{#3}}
+\DeclareRobustCommand{\draw@bit@picture}[3]{%
+  \begin{picture}(#1,#2)%
+    \put(0,0){\makebox(#1,#2){\parbox[c]{#1\unitlength}{%
+      \bf@newdimen\height
+      \bf@newdimen\depth
+      \bf@newdimen\totalheight
+      \bf@newdimen\width
+      \height=#2\unitlength
+      \depth=0pt%
+      \totalheight=#2\unitlength
+      \width=#1\unitlength
+      \def\widthunits{#1}%
+      \def\heightunits{#2}%
+      \centering #3}}}%
+    \ifbitbox@top
+      \put(0,#2){\line(1,0){#1}}
+    \fi
+    \ifbitbox@bottom
+      \put(0,0){\line(1,0){#1}}
+    \fi
+    \ifbitbox@left
+      \put(0,0){\line(0,1){#2}}
+    \fi
+    \ifbitbox@right
+      \put(#1,0){\line(0,1){#2}}
+    \fi
+  \end{picture}%
+  \ifcounting@words
+    \inc@bytefield@height{\unitlength * \real{#2}}%
+    \counting@wordsfalse
+  \fi
+  \ignorespaces}
+\newif\ifbitbox@top
+\newif\ifbitbox@bottom
+\newif\ifbitbox@left
+\newif\ifbitbox@right
+\def\parse@bitbox@arg#1{%
+  \bitbox@topfalse
+  \bitbox@bottomfalse
+  \bitbox@leftfalse
+  \bitbox@rightfalse
+  \parse@bitbox@sides#1X}
+\def\parse@bitbox@sides#1{%
+  \ifx#1X%
+  \else
+    \ifx#1t%
+      \bitbox@toptrue
+    \else
+      \ifx#1b%
+        \bitbox@bottomtrue
+      \else
+        \ifx#1l%
+          \bitbox@lefttrue
+        \else
+          \ifx#1r%
+            \bitbox@righttrue
+          \fi
+        \fi
+      \fi
+    \fi
+    \expandafter\parse@bitbox@sides
+  \fi}
+\newlength{\units@high}
+\DeclareRobustCommand{\skippedwords}[1][2ex]{%
+  \setlength{\units@wide}{\bitwidth * \value{bits@wide}}%
+  \setlength{\units@high}{1pt * \ratio{\units@wide}{6.0pt}}%
+  \setlength{\units@tall}{#1 + \units@high}%
+  \edef\num@wide{\strip@pt\units@wide}%
+  \edef\num@tall{\strip@pt\units@tall}%
+  \edef\num@high{\strip@pt\units@high}%
+  \begin{picture}(\num@wide,\num@tall)
+    \put(0,\num@tall){\line(6,-1){\num@wide}}
+    \put(\num@wide,0){\line(-6,1){\num@wide}}
+    \put(0,0){\line(0,1){\num@high}}
+    \put(\num@wide,\num@tall){\line(0,-1){\num@high}}
+  \end{picture}%
+  \ifcounting@words
+    \inc@bytefield@height{\unitlength * \real{\num@tall}}%
+    \counting@wordsfalse
+  \fi}
+\DeclareRobustCommand{\bitheader}[2][l]{%
+  \parse@bitbox@arg{lrtb}%
+  \setlength{\units@wide}{\bitwidth * \value{bits@wide}}%
+  \setlength{\units@tall}{\heightof{\tiny 9}}%
+  \setlength{\units@high}{\units@tall * -1}%
+  \def\bit@endianness{#1}%
+  \begin{picture}(\strip@pt\units@wide,\strip@pt\units@tall)%
+                 (0,\strip@pt\units@high)
+    \parse@range@list#2,X,
+  \end{picture}%
+  \ifcounting@words
+    \inc@bytefield@height{\unitlength * \real{\strip@pt\units@tall}}%
+    \counting@wordsfalse
+  \fi
+  \ignorespaces}
+\def\parse@range@list#1,{%
+  \ifx X#1
+  \else
+    \parse@range#1-#1-#1\relax
+    \expandafter\parse@range@list
+  \fi}
+\newlength{\header@xpos}
+\newcounter{header@val}
+\newcounter{max@header@val}
+\def\parse@range#1-#2-#3\relax{%
+  \setcounter{header@val}{#1}
+  \setcounter{max@header@val}{#2 + 1}
+  \loop
+    \ifnum\value{header@val}<\value{max@header@val}%
+      \if\bit@endianness b%
+        \setlength{\header@xpos}{%
+          \bitwidth * (\value{bits@wide}-\value{header@val}-1)}
+      \else
+        \setlength{\header@xpos}{\bitwidth * \value{header@val}}
+      \fi
+      \put(\strip@pt\header@xpos,0){%
+        \makebox(\strip@pt\bitwidth,\strip@pt\units@tall){%
+          \tiny \theheader@val}}
+      \addtocounter{header@val}{1}
+  \repeat}
+\newlength{\curlyshrinkage}
+\setlength{\curlyshrinkage}{5pt}
+\newlength{\curlyspace}
+\AtBeginDocument{\setlength{\curlyspace}{1ex}}
+\newlength{\labelspace}
+\AtBeginDocument{\setlength{\labelspace}{0.5ex}}
+\newbox{\curly@box}
+\def\store@rcurly#1#2{%
+  \begingroup
+    \bf@newdimen\curly@height%
+    \setlength{\curly@height}{#2 - \curlyshrinkage}%
+    \bf@newdimen\half@curly@height%
+    \setlength{\half@curly@height}{0.5\curly@height}%
+    \bf@newdimen\curly@shift%
+    \setlength{\curly@shift}{\half@curly@height + 0.5\curlyshrinkage}%
+    \global\sbox{#1}{\raisebox{\curly@shift}{%
+      $\xdef\old@axis{\the\fontdimen22\textfont2}$%
+      $\fontdimen22\textfont2=0pt%
+       \left.\vrule height\half@curly@height
+                    width 0pt
+                    depth\half@curly@height\right\}$%
+      $\fontdimen22\textfont2=\old@axis$}}%
+  \endgroup
+}
+\def\store@lcurly#1#2{%
+  \begingroup
+    \bf@newdimen\curly@height%
+    \setlength{\curly@height}{#2 - \curlyshrinkage}%
+    \bf@newdimen\half@curly@height%
+    \setlength{\half@curly@height}{0.5\curly@height}%
+    \bf@newdimen\curly@shift%
+    \setlength{\curly@shift}{\half@curly@height + 0.5\curlyshrinkage}%
+    \global\sbox{#1}{\raisebox{\curly@shift}{%
+      $\xdef\old@axis{\the\fontdimen22\textfont2}$%
+      $\fontdimen22\textfont2=0pt%
+       \left\{\vrule height\half@curly@height
+                     width 0pt
+                     depth\half@curly@height\right.$%
+      $\fontdimen22\textfont2=\old@axis$}}%
+  \endgroup
+}
+\def\show@wordlabelr{}
+\newlength{\wordlabelr@start}
+\newlength{\wordlabelr@end}
+\newenvironment{wordgroupr}[1]{%
+  \global\wordlabelr@start=\bytefield@height
+  \gdef\wordlabelr@text{#1}%
+  \ignorespaces%
+}{%
+  \global\wordlabelr@end=\bytefield@height
+  \gdef\show@wordlabelr{%
+    \sbox{\word@label@box}{%
+      \begin{tabular}[b]{@{}l@{}}\wordlabelr@text\end{tabular}}%
+    \settowidth{\label@box@width}{\usebox{\word@label@box}}%
+    \setlength{\label@box@height}{\wordlabelr@end-\wordlabelr@start}%
+    \store@rcurly{\curly@box}{\label@box@height}%
+    \bf@newdimen\total@box@width%
+    \setlength{\total@box@width}{%
+      \curlyspace +
+      \widthof{\usebox{\curly@box}} +
+      \labelspace +
+      \label@box@width}%
+    \begin{picture}(\strip@pt\total@box@width,0)
+      \put(0,0){%
+        \hspace*{\curlyspace}%
+        \usebox{\curly@box}%
+        \hspace*{\labelspace}%
+        \makebox(\strip@pt\label@box@width,\strip@pt\label@box@height){%
+          \usebox{\word@label@box}}}
+    \end{picture}%
+    \gdef\show@wordlabelr{}}%
+  \ignorespaces}
+\newlength{\wordlabell@start}
+\newlength{\wordlabell@end}
+\newlength{\total@lbox@width}
+\gdef\make@lspace{}
+\newenvironment{wordgroupl}[1]{%
+  \global\wordlabell@start=\bytefield@height
+  \gdef\wordlabell@text{#1}%
+  \sbox{\word@label@box}{%
+    \begin{tabular}[b]{@{}l@{}}\wordlabell@text\end{tabular}}%
+  \settowidth{\label@box@width}{\usebox{\word@label@box}}%
+  \store@lcurly{\curly@box}{5cm}%
+  \setlength{\total@lbox@width}{%
+    \curlyspace +
+    \widthof{\usebox{\curly@box}} +
+    \labelspace +
+    \label@box@width}%
+  \global\total@lbox@width=\total@lbox@width
+  \gdef\make@lspace{%
+    \hspace*{\total@lbox@width}%
+    \gdef\make@lspace{}}%
+  \ignorespaces%
+}{%
+  \global\wordlabell@end=\bytefield@height
+  \bf@newdimen\starting@point
+  \setlength{\starting@point}{%
+    -\total@lbox@width - \bitwidth*\value{bits@wide}}%
+  \sbox{\word@label@box}{%
+    \begin{tabular}[b]{@{}l@{}}\wordlabell@text\end{tabular}}%
+  \settowidth{\label@box@width}{\usebox{\word@label@box}}%
+  \setlength{\label@box@height}{\wordlabell@end-\wordlabell@start}%
+  \store@lcurly{\curly@box}{\label@box@height}%
+  \begin{picture}(0,0)
+    \put(\strip@pt\starting@point,0){%
+      \makebox(\strip@pt\label@box@width,\strip@pt\label@box@height){%
+        \usebox{\word@label@box}}%
+      \hspace*{\labelspace}%
+      \usebox{\curly@box}%
+      \hspace*{\curlyspace}}
+  \end{picture}%
+  \ignorespaces}
+\newlength{\label@box@width}
+\newlength{\label@box@height}
+\newsavebox{\word@label@box}
+\endinput
+%%
+%% End of file `bytefield.sty'.
diff --git a/doc/register.sty b/doc/register.sty
new file mode 100644 (file)
index 0000000..3e1755a
--- /dev/null
@@ -0,0 +1,358 @@
+%%
+%% This is file `register.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% register.dtx  (with options: `package')
+%% Register diagrams with field descriptions.
+%% 
+%% This program is provided under the terms of the
+%% LaTeX Project Public License distributed from CTAN
+%% archives in directory macros/latex/base/lppl.txt.
+%% 
+%% Author: Matthew Lovell (lovell@indra.com)
+%% 
+
+
+
+\ProvidesPackage{register} [2007/03/08 v1.5 Register macros with
+hyperref/LyX support]
+
+\RequirePackage{ifthen}[1997/11/02]
+\RequirePackage{graphicx}[1997/06/09]
+\RequirePackage{float}[2001/07/25]
+\RequirePackage{calc}[1998/06/07]
+\DeclareOption{LyX}{\setboolean{RegisterLyX}{true}}
+\DeclareOption{hyperref}{\setboolean{RegisterHyperref}{true}}
+\DeclareOption{TRflags}{\setboolean{RegisterTRFlags}{true}}
+\DeclareOption{TRboxed}{\setboolean{RegisterTRBoxed}{true}}
+
+\DeclareOption*{%  Emit a warning for other options
+  \PackageWarning{register}{Unknown option '\CurrentOption'}%
+}
+
+\newboolean{RegisterLyX}
+\newboolean{RegisterHyperref}
+\newboolean{RegisterTRFlags}
+\newboolean{RegisterTRBoxed}
+
+\setboolean{RegisterLyX}{false}
+\setboolean{RegisterHyperref}{false}
+\setboolean{RegisterTRFlags}{false}
+\setboolean{RegisterTRBoxed}{false}
+
+\ProcessOptions\relax  % Process package options
+\newboolean{RegisterContext}
+\setboolean{RegisterContext}{false}
+\floatstyle{plaintop} \@ifundefined{chapter}
+{\newfloat{Regfloat}{tbp}{rdf}[section]}
+{\newfloat{Regfloat}{tbp}{rdf}[chapter]}
+\floatname{Regfloat}{Register}
+\newlength{\regWidth}
+\newlength{\regFieldLen}
+\newlength{\regLabelAdjust}
+\newlength{\regResetHeight}
+\newlength{\regResetDepth}
+\newlength{\regResetDrop}
+\newlength{\regDescSkip}
+\setlength{\regWidth}{0.95\textwidth}
+\newcommand{\regBitWidth}{32}
+\newcommand{\regResetName}{Reset}
+\newcommand{\regBitSize}{\tiny}
+\newcommand{\regBitFamily}{\sffamily}
+\newcommand{\regResetSize}{\scriptsize}
+\newcommand{\regLabelSize}{\footnotesize}
+\newcommand{\regLabelFamily}{\rmfamily}
+\newcommand{\regDescFamily}{\bf}
+\newlength{\regdescsep}
+\newlength{\oldregdescsep}
+\setlength{\regdescsep}{-\medskipamount}
+
+\newsavebox{\Label}
+\newsavebox{\RotatedLabel}
+\newcounter{upperbit}
+\newcounter{lowerbit}
+\newenvironment{reglist}[1][M]
+  {\begin{list}{}
+    {\settowidth{\labelwidth}{\regDescFamily #1}
+     \addtolength{\labelwidth}{\labelsep}
+     \setlength{\leftmargin}{\labelwidth}
+     \addtolength{\leftmargin}{\labelsep}
+     \addtolength{\leftmargin}{0.5\regDescSkip}
+     \addtolength{\rightmargin}{0.5\regDescSkip}
+     \setlength{\topsep}{0pt}
+     \setlength{\itemsep}{0pt}
+     \setlength{\parsep}{0.5\baselineskip}
+     \renewcommand{\makelabel}[1]{\regDescFamily ##1 \hfill}}}
+  {\end{list}}
+\newenvironment{regdesc}[1][0.90\textwidth]%
+{%
+ \setlength{\regDescSkip}{\textwidth - #1}%
+ \vspace{\regdescsep}%
+\ifthenelse{\boolean{RegisterLyX}}{%
+  \renewenvironment{lyxlist}[1]
+    {\begin{list}{}
+      {\settowidth{\labelwidth}{\regDescFamily ##1}
+       \addtolength{\labelwidth}{\labelsep}
+       \setlength{\leftmargin}{\labelwidth}
+       \addtolength{\leftmargin}{\labelsep}
+       \addtolength{\leftmargin}{0.5\regDescSkip}
+       \addtolength{\rightmargin}{0.5\regDescSkip}
+       \setlength{\topsep}{0pt}
+       %\setlength{\partopsep}{0pt}
+       \renewcommand{\makelabel}[1]{\regDescFamily ####1 \hfill}}}
+    {\end{list}}}{}%
+ % endif
+ % set spacing appropriately
+ \leftskip 0.5\regDescSkip%
+ \rightskip 0.5\regDescSkip%
+ \parfillskip=\z@ plus 1fil%
+ \parskip=0.5\baselineskip \advance\parskip by 0pt plus 2pt%
+}% end begin{regdesc}
+{\vskip\baselineskip}
+\newcommand{\regnewline}{\\*}
+\newenvironment{register}[3]
+{\begin{Regfloat}[#1]%
+  \setlength{\leftskip}{0pt}%
+  \setlength{\oldregdescsep}{\regdescsep}%
+  \setlength{\regdescsep}{0.5\baselineskip}%
+  \setlength{\partopsep}{0pt}%
+  \setlength{\topsep}{0pt}%
+  \setboolean{RegisterContext}{true}%
+  \ifthenelse{\equal{#3}{}}%
+  {\caption[#2]{\textsc{#2}}}% else
+  {\caption[#2]{\textsc{#2} ({#3})}}%
+  \centering}
+{% restore lengths
+  \leftskip\z@%
+  \rightskip\z@%
+  \parfillskip=\z@ plus 1fil%
+  \setlength{\regdescsep}{\oldregdescsep}%
+  \setboolean{RegisterContext}{false}%
+  \end{Regfloat}}
+\def\regUnderScore{_}%
+\def\regFiller#1{\def\regInner{#1}%
+\ifx\regInner\regUnderScore%
+\else%
+\ifnum\count0>0%
+\hfill#1%
+\else#1\fi%
+\fi%
+\advance\count0 by 1%
+}
+\def\regSpread#1{\count0=0{}\regSpreadaux#1\empty}
+\def\regSpreadaux#1#2\empty{\def\aux{#1}%\show#1%
+\ifx\aux\empty%
+\else%
+\def\aux{#2}%
+\regFiller{#1}%
+\ifx\aux\empty%
+\else%
+\regSpreadaux#2\empty%
+\fi\fi}
+\newcommand{\setRegLengths}{%
+  % Compute basic width of a single bit
+  \settowidth{\regFieldLen}{\regLabelSize \regResetName}%
+  \setlength{\regFieldLen}{\regWidth - \regFieldLen}%
+  \setlength{\regFieldLen}{\regFieldLen / \regBitWidth}%
+  % Figure out height and depth of reset field in current font
+  % Is there a more ``official'' method to do this?
+  \settodepth{\regResetDepth}{\regResetSize ()jgpq}%
+  \settoheight{\regResetHeight}{\regResetSize ()ABCjkl}%
+  \addtolength{\regResetHeight}{\regResetDepth}%
+  % Compute how far to drop the reset fields down.  The value at
+  % the end is effectively the separation between the bit position
+  % box and the reset value box.
+  \setlength{\regResetDrop}{\regResetHeight + 2\fboxsep - 2\fboxrule + 3pt}%
+}
+\newcommand{\regMakeFieldName}[1]{%
+  % Create box to hold label
+  \savebox{\Label}{\regLabelSize\regLabelFamily #1}%
+}
+\newcommand{\regRotateFieldName}{%
+  \savebox{\RotatedLabel}{\rotatebox[origin=lB]{45}{\usebox{\Label}}}%
+  \makebox[0pt][l]{\raisebox{\regResetHeight + \fboxsep + \depth + 1pt}%
+        {\hspace{\regLabelAdjust}\usebox{\RotatedLabel}}}%
+}
+\newcommand{\typesetRegBits}[1]{%
+  \ifthenelse{#1 > 1}%
+    {\framebox[\regFieldLen][c]%
+        {\regBitSize \rule[-1\regResetDepth]{0pt}{\regResetHeight}%
+           \regBitFamily\arabic{upperbit} \hfill \arabic{lowerbit}}}%
+    {\framebox[\regFieldLen][c]%
+        {\regBitSize \rule[-1\regResetDepth]{0pt}{\regResetHeight}%
+           \regBitFamily\arabic{lowerbit}}}%
+}
+\newcommand{\typesetRegReset}[1]{%
+ % Typeset reset value in a framebox
+  \makebox[0pt][l]{\raisebox{-1\regResetDrop}{\framebox[\regFieldLen][c]%
+        % Place an invisible rule to control the box
+        % surrounding the reset field
+        {\regResetSize \rule[-1\regResetDepth]{0pt}{\regResetHeight}\regSpread{#1}}}}%
+}
+\newcommand{\regfield}[4]{%
+  % Compute overall field length
+  \setRegLengths%
+  \setlength{\regFieldLen}{#2\regFieldLen + \fboxrule}%
+  % Figure out bit positions
+  \setcounter{lowerbit}{#3}%
+  \setcounter{upperbit}{#3 + #2 - 1}%
+  \regMakeFieldName{#1}%
+  % Figure out how far over to place label, accounting for height
+  \setlength{\regLabelAdjust}{0.5\regFieldLen - 0.707107\ht\Label}%
+  % Now, rotate and type the label
+  \regRotateFieldName%
+  \typesetRegReset{#4}%
+  % Typeset bit positions in a framebox
+  \typesetRegBits{#2}%
+  \hspace{-1\fboxrule}%
+}
+\newcommand{\regfieldb}[3]{%
+  % Compute overall field length
+  \setRegLengths%
+  \setlength{\regFieldLen}{#2\regFieldLen + \fboxrule}%
+  % Figure out bit positions
+  \setcounter{lowerbit}{#3}%
+  \setcounter{upperbit}{#3 + #2 - 1}%
+  % Create box to hold label
+  \regMakeFieldName{#1}%
+  % Figure out how far over to place label, accounting for height
+  \setlength{\regLabelAdjust}{0.5\regFieldLen - 0.707107\ht\Label}%
+  % Now, rotate and typeset the label
+  \regRotateFieldName%
+  % Typeset bit positions
+  \typesetRegBits{#2}%
+  \hspace{-1\fboxrule}%
+}
+\newcommand{\regbits}[3]{%
+  % Compute overall field length
+  \setRegLengths%
+  \setlength{\regFieldLen}{#2\regFieldLen + \fboxrule}%
+  % Figure out bit positions
+  \setcounter{lowerbit}{#3}%
+  \setcounter{upperbit}{#3 + #2 - 1}%
+  % Create box to hold label
+  \regMakeFieldName{#1}%
+  % Figure out how far over to place label, accounting for height
+  \setlength{\regLabelAdjust}{0.5\regFieldLen - 0.707107\ht\Label}%
+  % Now, rotate and typeset the label
+  \regRotateFieldName%
+  % Typeset field value
+  \framebox[\regFieldLen][c]%
+        {\tiny\regSpread{#3}}%
+  \hspace{-1\fboxrule}%
+}
+\newcommand{\regspace}[1]{%
+  % Compute overall field length
+  \setRegLengths%
+  \setlength{\regFieldLen}{#1\regFieldLen + \fboxrule}%
+  \makebox[\regFieldLen]{}%
+}
+
+\newcommand{\reglabel}[1]{%
+  \settowidth{\regFieldLen}{\regLabelSize \regResetName}%
+  \setlength{\regResetDrop}{\regResetDrop + 0.5\fboxsep}%
+  $\,$\raisebox{-1\regResetDrop}{\makebox[\regFieldLen][l]%
+    {\regLabelSize\regBitFamily #1}}%
+}
+
+\newcommand{\reglabelb}[1]{%
+  \settowidth{\regFieldLen}{\regLabelSize \regResetName}%
+  $\,$\raisebox{-0.5\fboxsep}{\makebox[\regFieldLen][l]%
+    {\regLabelSize\regBitFamily #1}}%
+}
+\ifthenelse{\boolean{RegisterHyperref}}{%
+  % Define a counter for the hyperref package.  Otherwise,
+  % the hyperlinks to registers don't work correctly
+  \@namedef{theHRegfloat}{\theRegfloat}
+
+  % Define a bookmark level for Regfloats (for hyperref package)
+  \def\toclevel@Regfloat{0}
+}{}
+\newcommand{\listofregisters}{%
+  \@ifundefined{ext@Regfloat}{\float@error{Regfloat}}{%
+    \@ifundefined{chapter}{\def\@tempa{\section*}}%
+      {\def\@tempa{\chapter*}}%
+    \@tempa{List of Registers\@mkboth{\uppercase{List of Registers}}%
+       {\uppercase{List of Registers}}}%
+    \addcontentsline{toc}{chapter}{List of Registers}%
+    \@starttoc{\@nameuse{ext@Regfloat}}}}
+\newcommand\l@Regfloat{\@dottedtocline{1}{1.5em}{2.3em}}
+\@ifundefined{chapter}{}
+{% Adjust chapter definition slightly for Regfloats
+\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
+  \if@mainmatter
+    \refstepcounter{chapter}%
+    \typeout{\@chapapp\space\thechapter.}%
+    \addcontentsline{toc}{chapter}%
+    {\protect\numberline{\thechapter}#1}%
+  \else
+    \addcontentsline{toc}{chapter}{#1}%
+  \fi
+  \else
+    \addcontentsline{toc}{chapter}{#1}%
+  \fi
+  \chaptermark{#1}%
+    \addtocontents{lof}{\protect\addvspace{10\p@}}%
+    \addtocontents{lot}{\protect\addvspace{10\p@}}%
+    \addtocontents{rdf}{\protect\addvspace{10\p@}}% --- Add space ---
+  \if@twocolumn
+    \@topnewpage[\@makechapterhead{#2}]%
+  \else
+    \@makechapterhead{#2}%
+    \@afterheading
+  \fi}
+}
+\newcommand\@GetTRSecondParam{}
+\long\def\@GetTRSecondParam#1#2#3\@nil{#2}
+\newcommand*{\GetTRPageRef}[1]{%
+  \expandafter\expandafter\expandafter\@GetTRSecondParam
+    \csname r@#1\endcsname
+    0% dummy, if the reference is undefined
+    \@nil
+}
+
+\newcommand{\TRfamily}{\sffamily}
+\newcounter{T@peReleaseTag}
+\newlength{\TRwidth}
+\setlength{\TRwidth}{\marginparwidth}
+\newlength{\T@peReleaseDepth}
+
+\newcommand{\TRwriteout}[1]{%
+  \makebox[\TRwidth][c]{%
+    \raisebox{\T@peReleaseDepth}{%
+     \ifthenelse{\boolean{RegisterTRBoxed}}%
+       {\fbox{\TRfamily #1}}%
+       {\TRfamily #1}}}%
+}
+
+\newcommand{\TRrightlabel}[1]{%
+  % Place a strut in order to set line depth
+  \mbox{}\strut\settodepth{\T@peReleaseDepth}{\strut}%
+   \vadjust{\hspace{\textwidth}\hspace{\marginparsep}%
+   \smash{\rlap{\TRwriteout{#1}}}}}
+
+\ifthenelse{\boolean{@twoside}}{
+  % Two-sided document
+  \newcommand{\TRleftlabel}[1]{%
+    % Place a strut in order to set line depth
+    \mbox{}\strut\settodepth{\T@peReleaseDepth}{\strut}%
+    \vadjust{\smash{\llap{\TRwriteout{#1}}\kern\marginparsep}}}
+}{
+  % Otherwise, the command is the same as rightlabel
+  \newcommand{\TRleftlabel}[1]{%
+    \TRrightlabel{#1}}
+}
+\ifthenelse{\boolean{RegisterTRFlags}}{
+\newcommand{\TR}[1]{%
+  \stepcounter{T@peReleaseTag}%
+  \label{TapeReleaseTag-\theT@peReleaseTag}%
+  \ifthenelse{\isodd{\GetTRPageRef{TapeReleaseTag-\theT@peReleaseTag}}}%
+   {\TRrightlabel{TR\hspace{1pt}#1}}%
+   {\TRleftlabel{TR\hspace{1pt}#1}}%
+}}
+{\newcommand{\TR}[1]{}}
+\endinput
+%%
+%% End of file `register.sty'.