OpenCores
URL https://opencores.org/ocsvn/openarty/openarty/trunk

Subversion Repositories openarty

[/] [openarty/] [trunk/] [doc/] [src/] [spec.tex] - Diff between revs 49 and 55

Only display areas with differences | Details | Blame | View Log

Rev 49 Rev 55
\documentclass{gqtekspec}
\documentclass{gqtekspec}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%%
%% Filename:    spec.tex
%% Filename:    spec.tex
%%
%%
%% Project:     OpenArty, an entirely open SoC based upon the Arty platform
%% Project:     OpenArty, an entirely open SoC based upon the Arty platform
%%
%%
%% Purpose:
%% Purpose:
%%
%%
%% Creator:     Dan Gisselquist, Ph.D.
%% Creator:     Dan Gisselquist, Ph.D.
%%              Gisselquist Technology, LLC
%%              Gisselquist Technology, LLC
%%
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%%
%% Copyright (C) 2015-2016, Gisselquist Technology, LLC
%% Copyright (C) 2015-2016, Gisselquist Technology, LLC
%%
%%
%% This program is free software (firmware): you can redistribute it and/or
%% This program is free software (firmware): you can redistribute it and/or
%% modify it under the terms of  the GNU General Public License as published
%% modify it under the terms of  the GNU General Public License as published
%% by the Free Software Foundation, either version 3 of the License, or (at
%% by the Free Software Foundation, either version 3 of the License, or (at
%% your option) any later version.
%% your option) any later version.
%%
%%
%% This program is distributed in the hope that it will be useful, but WITHOUT
%% This program is distributed in the hope that it will be useful, but WITHOUT
%% ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
%% ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
%% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
%% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
%% for more details.
%% for more details.
%%
%%
%% You should have received a copy of the GNU General Public License along
%% You should have received a copy of the GNU General Public License along
%% with this program.  (It's in the $(ROOT)/doc directory, run make with no
%% with this program.  (It's in the $(ROOT)/doc directory, run make with no
%% target there if the PDF file isn't present.)  If not, see
%% target there if the PDF file isn't present.)  If not, see
%% <http://www.gnu.org/licenses/> for a copy.
%% <http://www.gnu.org/licenses/> for a copy.
%%
%%
%% License:     GPL, v3, as defined and found on www.gnu.org,
%% License:     GPL, v3, as defined and found on www.gnu.org,
%%              http://www.gnu.org/licenses/gpl.html
%%              http://www.gnu.org/licenses/gpl.html
%%
%%
%%
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%%
%%
%%
\usepackage{import}
\usepackage{import}
\usepackage{bytefield}
\usepackage{bytefield}
\usepackage{listings}
\usepackage{listings}
\project{OpenArty}
\project{OpenArty}
\title{Specification}
\title{Specification}
\author{Dan Gisselquist, Ph.D.}
\author{Dan Gisselquist, Ph.D.}
\email{dgisselq (at)  ieee.org}
\email{dgisselq (at)  ieee.org}
\revision{Rev.~0.0}
\revision{Rev.~0.0}
\begin{document}
\begin{document}
\pagestyle{gqtekspecplain}
\pagestyle{gqtekspecplain}
\titlepage
\titlepage
\begin{license}
\begin{license}
Copyright (C) \theyear\today, Gisselquist Technology, LLC
Copyright (C) \theyear\today, Gisselquist Technology, LLC
 
 
This project is free software (firmware): you can redistribute it and/or
This project is free software (firmware): you can redistribute it and/or
modify it under the terms of  the GNU General Public License as published
modify it under the terms of  the GNU General Public License as published
by the Free Software Foundation, either version 3 of the License, or (at
by the Free Software Foundation, either version 3 of the License, or (at
your option) any later version.
your option) any later version.
 
 
This program is distributed in the hope that it will be useful, but WITHOUT
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.
for more details.
 
 
You should have received a copy of the GNU General Public License along
You should have received a copy of the GNU General Public License along
with this program.  If not, see \texttt{http://www.gnu.org/licenses/} for a copy.
with this program.  If not, see \texttt{http://www.gnu.org/licenses/} for a copy.
\end{license}
\end{license}
\begin{revisionhistory}
\begin{revisionhistory}
0.0 &  6/20/2016 & Gisselquist & First Draft \\\hline
0.0 &  6/20/2016 & Gisselquist & First Draft \\\hline
0.0 & 10/21/2016 & Gisselquist & More Comments Added\\\hline
0.0 & 10/21/2016 & Gisselquist & More Comments Added\\\hline
0.0 & 11/18/2016 & Gisselquist & Added a getting started section\\\hline
0.0 & 11/18/2016 & Gisselquist & Added a getting started section\\\hline
\end{revisionhistory}
\end{revisionhistory}
% Revision History
% Revision History
% Table of Contents, named Contents
% Table of Contents, named Contents
\tableofcontents
\tableofcontents
\listoffigures
\listoffigures
\listoftables
\listoftables
\begin{preface}
\begin{preface}
\end{preface}
\end{preface}
 
 
\chapter{Introduction}\label{ch:intro}
\chapter{Introduction}\label{ch:intro}
\pagenumbering{arabic}
\pagenumbering{arabic}
\setcounter{page}{1}
\setcounter{page}{1}
 
 
At {\$ 99}, the Arty is a very economical FPGA platform for doing
At {\$ 99}, the Arty is a very economical FPGA platform for doing
a lot of things.  It was designed to support the MicroBlaze soft CPU platform,
a lot of things.  It was designed to support the MicroBlaze soft CPU platform,
and as a result it has a lot more memory plus ethernet support.  Put together,
and as a result it has a lot more memory plus ethernet support.  Put together,
it feels like it was designed for soft--core CPU development.  Indeed, it has
it feels like it was designed for soft--core CPU development.  Indeed, it has
an amazing capability for its price.
an amazing capability for its price.
 
 
Instructions and examples for using the Arty, however, tend to focus on
Instructions and examples for using the Arty, however, tend to focus on
schematic design development techniques.  While these may seem like an
schematic design development techniques.  While these may seem like an
appropriate way to introduce a beginner to hardware design, these techniques
appropriate way to introduce a beginner to hardware design, these techniques
introduce a whole host of problems.
introduce a whole host of problems.
 
 
The first and perhaps biggest problem is that it can be difficult to trouble
The first and perhaps biggest problem is that it can be difficult to trouble
shoot what is going on.  This is a combination of two factors.  The first is
shoot what is going on.  This is a combination of two factors.  The first is
that many of the reference schematic designs make use of proprietary IP.  In
that many of the reference schematic designs make use of proprietary IP.  In
an effort to protect both their IP and themselves, companies providing such
an effort to protect both their IP and themselves, companies providing such
IP resources often make them opaque, and difficult to see the internals of.
IP resources often make them opaque, and difficult to see the internals of.
As a result, it can be difficult to understand why that IP isn't working in
As a result, it can be difficult to understand why that IP isn't working in
your design.  Further, while many simulation tools exist, only the Xilinx tools
your design.  Further, while many simulation tools exist, only the Xilinx tools
will allow full simulation of Xilinx proprietary IP.  Finally, while it may be
will allow full simulation of Xilinx proprietary IP.  Finally, while it may be
simple to select a part and ``wire'' it up within a schematic, most IP
simple to select a part and ``wire'' it up within a schematic, most IP
components have many, many configuration options which are then hidden from the
components have many, many configuration options which are then hidden from the
user within the simplified component.  These options may be the difference
user within the simplified component.  These options may be the difference
between successfully using the component and an exercise in frustration.
between successfully using the component and an exercise in frustration.
Put together, all of these features of schematic design make the design more
Put together, all of these features of schematic design make the design more
difficult to troubleshoot, and often even impossible to troubleshoot using
difficult to troubleshoot, and often even impossible to troubleshoot using
open source tools such as Verilator.
open source tools such as Verilator.
 
 
Another problem is that schematic based designs often hide their FPGA resource
Another problem is that schematic based designs often hide their FPGA resource
usage.  They can easily become resource hogs, leaving the designer unaware
usage.  They can easily become resource hogs, leaving the designer unaware
of the consequences of what he/she is implementing.  As an example, the memory
of the consequences of what he/she is implementing.  As an example, the memory
interface generated by Xilinx's Memory Interface Generator (MIG) consumes
interface generated by Xilinx's Memory Interface Generator (MIG) consumes
nearly a full quarter of the Arty's FPGA resources, while delaying responses
nearly a full quarter of the Arty's FPGA resources, while delaying responses
to requests by upwards of 250~ns.  Further, while Xilinx touts its MicroBlaze
to requests by upwards of 250~ns.  Further, while Xilinx touts its MicroBlaze
processor as only using 800--2500 LUTs, the MicroBlaze architecture requires
processor as only using 800--2500 LUTs, the MicroBlaze architecture requires
it be connected to four separate AXI busses, with each of those having
it be connected to four separate AXI busses, with each of those having
five channels, all with their requests and acknowledgement flags.  These
five channels, all with their requests and acknowledgement flags.  These
can therefore easily consume all of the resources within an architecture, before
can therefore easily consume all of the resources within an architecture, before
providing any of the benefit the designer was looking for when they chose to
providing any of the benefit the designer was looking for when they chose to
use an FPGA.
use an FPGA.
 
 
 
 
% What is old
% What is old
%       Arty, XuLA, Learnables using schematic drawing techniques
%       Arty, XuLA, Learnables using schematic drawing techniques
% What does the old lack?
% What does the old lack?
%       Arty lacks open interfaces, instead using MIG and CoreGen w/ AXI bus
%       Arty lacks open interfaces, instead using MIG and CoreGen w/ AXI bus
% What is new
% What is new
%       OpenArty has its own memory interface controller, and runs everything
%       OpenArty has its own memory interface controller, and runs everything
%       off of an open Wishbone bus structure.
%       off of an open Wishbone bus structure.
% What does the new have that the old lacks
% What does the new have that the old lacks
%
%
% What performance gain can be expected?
% What performance gain can be expected?
%
%
 
 
Here in this project, we present another alternative.
Here in this project, we present another alternative.
 
 
First, the OpenArty is entirely built in Verilog, and (with the exception of
First, the OpenArty is entirely built in Verilog, and (with the exception of
the MIG controller), it is entirely buit out of OpenSource IP.\footnote{I'm
the MIG controller), it is entirely buit out of OpenSource IP.\footnote{I'm
still hoping to place an open memory controller into this design.  This
still hoping to place an open memory controller into this design.  This
controller is written in logic, but does not yet connect to any hardware ports.}
controller is written in logic, but does not yet connect to any hardware ports.}
 
 
Second, configuration options, such as cache sizes, can be fine tuned via a
Second, configuration options, such as cache sizes, can be fine tuned via a
CPU options file.
CPU options file.
 
 
Third, as you will find from examining the RTL sources, this project uses only
Third, as you will find from examining the RTL sources, this project uses only
one bus, and that bus has ony one channel associated with it: a Wishbone Bus.
one bus, and that bus has ony one channel associated with it: a Wishbone Bus.
This helps to limit the logic associated with trying to read and write from
This helps to limit the logic associated with trying to read and write from
the CPU, although it may increase problems with fanout.
the CPU, although it may increase problems with fanout.
 
 
Finally, because the OpenArty project is made from open source components, the
Finally, because the OpenArty project is made from open source components, the
entire design, together with several of its peripherals, can be simulated using
entire design, together with several of its peripherals, can be simulated using
Verilator.  This makes it possible to run programs on the ZipCPU within the
Verilator.  This makes it possible to run programs on the ZipCPU within the
OpenArty design, and find and examine where such programs (or their peripherals)
OpenArty design, and find and examine where such programs (or their peripherals)
fail.
fail.
 
 
Overall, the goals of this OpenArty project include:
Overall, the goals of this OpenArty project include:
\begin{enumerate}
\begin{enumerate}
\item Use entirely open interfaces
\item Use entirely open interfaces
 
 
        This means not using the Memory Interface Generator (MIG), the
        This means not using the Memory Interface Generator (MIG), the
        Xilinx CoreGen IP, etc.
        Xilinx CoreGen IP, etc.
 
 
        (This goal has not yet been achieved.)
        (This goal has not yet been achieved.)
 
 
\item Use all of Arty's on--board hardware: Flash, DDR3-SDRAM, Ethernet, and
\item Use all of Arty's on--board hardware: Flash, DDR3-SDRAM, Ethernet, and
        everything else at their full and fastest speed(s).  For example, the
        everything else at their full and fastest speed(s).  For example, the
        flash will need to be clocked at 82~MHz, not the 50~MHz I've clocked
        flash will need to be clocked at 82~MHz, not the 50~MHz I've clocked
        it at in previous projects.  The DDR3 SDRAM memory should also be able
        it at in previous projects.  The DDR3 SDRAM memory should also be able
        to support pipelined 32--bit interactions over the Wishbone bus at a
        to support pipelined 32--bit interactions over the Wishbone bus at a
        162~MHz clock.  Finally, the Ethernet controller should be supported
        162~MHz clock.  Finally, the Ethernet controller should be supported
        by a DMA capable interface that can drive the ethernet at its full
        by a DMA capable interface that can drive the ethernet at its full
        100Mbps rate.
        100Mbps rate.
 
 
        (Of these, only the ethernet goal has been met.)
        (Of these, only the ethernet goal has been met.)
 
 
\item Run using a 162.5~MHz system clock, if for no other reason than to gain
\item Run using a 162.5~MHz system clock, if for no other reason than to gain
        the experience of building logic that can run that fast.\footnote{The
        the experience of building logic that can run that fast.\footnote{The
        original goal was to run at 200~MHz.  However, the memory controller
        original goal was to run at 200~MHz.  However, the memory controller
        cannot run faster than about 82~MHz.  If we run it at 81.25~MHz and
        cannot run faster than about 82~MHz.  If we run it at 81.25~MHz and
        double that clock to get our logic clock, that now places us at
        double that clock to get our logic clock, that now places us at
        162.5~MHz.  200~MHz is \ldots too fast for DDR3 transfers using the
        162.5~MHz.  200~MHz is \ldots too fast for DDR3 transfers using the
        Artix--7 chip on the Arty.}
        Artix--7 chip on the Arty.}
 
 
        While the wishbone bus has been upgraded so that it may run at
        While the wishbone bus has been upgraded so that it may run at
        200~MHz, the CPU and memory controller cannot handle this speed (yet).
        200~MHz, the CPU and memory controller cannot handle this speed (yet).
 
 
\item Modify the ZipCPU to support an MMU and a data cache, and perhaps even
\item Modify the ZipCPU to support an MMU and a data cache, and perhaps even
        a floating point unit.
        a floating point unit.
 
 
        (These are still in development.)
        (These are still in development.)
 
 
\item The default configuration will also include four Pmods: a USBUART,
\item The default configuration will also include four Pmods: a USBUART,
        a GPS, an SDCard, and an OLEDrgb.
        a GPS, an SDCard, and an OLEDrgb.
 
 
        (These have all been tested, and are known to work.)
        (These have all been tested, and are known to work.)
\end{enumerate}
\end{enumerate}
 
 
I intend to demonstrate this project with a couple programs:
I intend to demonstrate this project with a couple programs:
\begin{enumerate}
\begin{enumerate}
\item An NTP Server
\item An NTP Server
 
 
        While the GPS tracking circuit is in place, and while it appears to be
        While the GPS tracking circuit is in place, and while it appears to be
        able to track a GPS signal to within about 100ns or so, the
        able to track a GPS signal to within about 100ns or so, the
        network stack has yet to be built.
        network stack has yet to be built.
 
 
\item A ZipOS that can actually load and run programs from the SD Card, rather
\item A ZipOS that can actually load and run programs from the SD Card, rather
        than just a static memory image stored in flash on start-up.
        than just a static memory image stored in flash on start-up.
 
 
        This will require a functioning memory management unit (MMU), which
        This will require a functioning memory management unit (MMU), which
        will be a new addition to the ZipCPU created to support this project.
        will be a new addition to the ZipCPU created to support this project.
 
 
        For those not familiar with MMU's, an MMU translates memory addresses
        For those not familiar with MMU's, an MMU translates memory addresses
        from a virtual address space to a physical address space.  This allows
        from a virtual address space to a physical address space.  This allows
        every program running on the ZipCPU to believe that they own the entire
        every program running on the ZipCPU to believe that they own the entire
        memory address space, while allowing the operating system to allocate
        memory address space, while allowing the operating system to allocate
        actual physical memory addresses as necessary to support whatever
        actual physical memory addresses as necessary to support whatever
        program needs more (or less) memory.
        program needs more (or less) memory.
 
 
        At this point, the MMU has been written and has passed its bench
        At this point, the MMU has been written and has passed its bench
        testing phase.  It has not (yet) been integrated with the CPU.
        testing phase.  It has not (yet) been integrated with the CPU.
\end{enumerate}
\end{enumerate}
 
 
 
 
\chapter{Getting Started}\label{ch:getting-started}
\chapter{Getting Started}\label{ch:getting-started}
\section{Building the Core}
\section{Building the Core}
%
%
\section{Building the board support files}
\section{Building the board support files}
The OpenArty project comes with a series of board support programs that are
The OpenArty project comes with a series of board support programs that are
designed to run from a Linux command line.  The C++ source code for these
designed to run from a Linux command line.  The C++ source code for these
programs can be found in the sw/host directory.  These programs have two
programs can be found in the sw/host directory.  These programs have two
dependencies: the ZipCPU load program depends upon libelf, and the ZipCPU
dependencies: the ZipCPU load program depends upon libelf, and the ZipCPU
debugger depends upon the ncurses library.  If you have these two libraries,
debugger depends upon the ncurses library.  If you have these two libraries,
your build should proceed without problems.
your build should proceed without problems.  If now, you may get them simply
 
by ussuing a:
 
\begin{lstlisting}[language=bash]
 
% sudo apt-get install ncurses-dev libelf-dev texinfo
 
\end{lstlisting}
 
 
 
 
% TODO: Remove the dependency on ZIPD.
% TODO: Remove the dependency on ZIPD.
 
 
A make in the sw/host directory should build all of these support programs.
A make in the sw/host directory should build all of these support programs.
These include:
These include:
\begin{itemize}
\begin{itemize}
\item {\tt wbregs}: a program to read and write addresses on the wishbone bus,
\item {\tt wbregs}: a program to read and write addresses on the wishbone bus,
        and hence to test peripherals independent of the CPU.
        and hence to test peripherals independent of the CPU.
\item {\tt netuart}: a program to convert the UART device provided by the board
\item {\tt netuart}: a program to convert the UART device provided by the board
        to a TCP/IP device that can be connected to anywhere.
        to a TCP/IP device that can be connected to anywhere.
\item {\tt wbsettime}: a simple program to set the time on the real-time clock
\item {\tt wbsettime}: a simple program to set the time on the real-time clock
        core within the board.
        core within the board.
\item {\tt dumpflash}: reads the current contents from the flash memory into a
\item {\tt dumpflash}: reads the current contents from the flash memory into a
        local file
        local file
\item {\tt wbprogram}: programs new configuations into the flash
\item {\tt wbprogram}: programs new configuations into the flash
\item {\tt netsetup}: reads and decodes the MDIO interface from the ethernet
\item {\tt netsetup}: reads and decodes the MDIO interface from the ethernet
        PHY controller
        PHY controller
\item {\tt manping}: pings a computer using the ethernet packet interface.
\item {\tt manping}: pings a computer using the ethernet packet interface.
        This program does not have any ARP handling, so while it will wait
        This program does not have any ARP handling, so while it will wait
        for a reply, the reply typically comes back in the form of an ARP
        for a reply, the reply typically comes back in the form of an ARP
        request rather than the ping response.
        request rather than the ping response.
\item {\tt zipload}: Loads a program onto the ZipCPU, adjusting flash, block
\item {\tt zipload}: Loads a program onto the ZipCPU, adjusting flash, block
        RAM, and or SDRAM memory to do so.  May also start the program running
        RAM, and or SDRAM memory to do so.  May also start the program running
        if requested.
        if requested.
\item {\tt zipstate}: Returns information about whether or not the CPU is
\item {\tt zipstate}: Returns information about whether or not the CPU is
        running, is running in user mode, is waiting for an interrupt,
        running, is running in user mode, is waiting for an interrupt,
        has halted, etc.
        has halted, etc.
\item {\tt zipdbg}: a debugger with the capability to halt, reset and step
\item {\tt zipdbg}: a debugger with the capability to halt, reset and step
        the CPU, as well as to inspect the state of the CPU following any
        the CPU, as well as to inspect the state of the CPU following any
        unexpected halt.
        unexpected halt.
\end{itemize}
\end{itemize}
 
 
 
\section{Building the Verilator Simulation}
 
If you are at all interested in building the verilator simulation, you will
 
also need Verilator and GTKMM-3.0.  To get these, you may type:
 
\begin{lstlisting}[language=bash]
 
% sudo apt-get install verilator libgtkmm-3.0-dev
 
\end{lstlisting}
 
At this point, a {\tt make} in the {\tt rtl} directory, followed by a
 
{\tt make} in the {\tt bench/cpp} directory will build a Verilator simulation
 
named {\tt busmaster\_tb}.  You may run this program in place of {\tt netuart},
 
and then access the simulated Arty using the regular board support packages.
 
This simulation will use the TCP/IP port given in {\tt bench/cpp/port.h}, which
 
should be set identically to the port given in {\tt sw/host/port.h} used by
 
{\tt netuart}.
 
 
 
 
 
 
 
 
\section{Initially installing the core}
\section{Initially installing the core}
The OpenArty core may be installed onto the board via the Xilinx Hardware
The OpenArty core may be installed onto the board via the Xilinx Hardware
Manager.  If properly set up, you should be able to open the hardware
Manager.  If properly set up, you should be able to open the hardware
manager after you build an initial bit stream, open the Arty, select the
manager after you build an initial bit stream, open the Arty, select the
toplevel bit file, and request Xilinx to load the file.
toplevel bit file, and request Xilinx to load the file.
 
 
If you are successful, the four color LEDs will blank while the hardware
If you are successful, the four color LEDs will blank while the hardware
manager is loading the hardware, and then turn to varying intensities of red.
manager is loading the hardware, and then turn to varying intensities of red.
 
 
\section{Connecting the PMods}
\section{Connecting the PMods}
The OpenArty project is designed to work with four PMods: PModUSBUART,
The OpenArty project is designed to work with four PMods: PModUSBUART,
PModGPS, PModSD, and PModOLEDrgb.  These four provide the device with
PModGPS, PModSD, and PModOLEDrgb.  These four provide the device with
serial port access, absolute time and position information, access to an
serial port access, absolute time and position information, access to an
SD card, and the ability to control a small display.
SD card, and the ability to control a small display.
 
 
If you do not have any of these devices, and wish to recover the logic used
If you do not have any of these devices, and wish to recover the logic used
by them, you may comment out the defines for {\tt GPS\_CLOCK},
by them, you may comment out the defines for {\tt GPS\_CLOCK},
{\tt SDCARD\_ACCESS}, and {\tt OLEDRGBACCESS} found in the {\tt rtl/busmaster.v}
{\tt SDCARD\_ACCESS}, and {\tt OLEDRGBACCESS} found in the {\tt rtl/busmaster.v}
file.  This will recover all but the logic used by the PModUSBUART and PModGPS
file.  This will recover all but the logic used by the PModUSBUART and PModGPS
serial ports, while replacing the registers with read--only memory values of
serial ports, while replacing the registers with read--only memory values of
zero.
zero.
 
 
The {\tt arty.xdc} file is designed so that these PMods can be connected as
The {\tt arty.xdc} file is designed so that these PMods can be connected as
shown in Fig.~\ref{fig:pmod-pic}.
shown in Fig.~\ref{fig:pmod-pic}.
\begin{figure}\begin{center}
\begin{figure}\begin{center}
\includegraphics[width=4in]{../gfx/openarty.eps}
\includegraphics[width=4in]{../gfx/openarty.eps}
\caption{Showing how the PMods are Connected}\label{fig:pmod-pic}
\caption{Showing how the PMods are Connected}\label{fig:pmod-pic}
\end{center}\end{figure}
\end{center}\end{figure}
In this example, the PModOLED is connected to PMod port JB, and the PModSD is
In this example, the PModOLED is connected to PMod port JB, and the PModSD is
connected to PMod port JD.  Both the PModGPS and the PModUSBUART are both
connected to PMod port JD.  Both the PModGPS and the PModUSBUART are both
connected to port JC, with the GPS connected on top and the USBUART on the
connected to port JC, with the GPS connected on top and the USBUART on the
bottom.
bottom.
 
 
\section{Testing the peripherals}
\section{Testing the peripherals}
OpenArty has been designed so that all of the peripherals live on a
OpenArty has been designed so that all of the peripherals live on a
memory--mapped wishbone bus.  This bus can be accessed, either by the ZipCPU
memory--mapped wishbone bus.  This bus can be accessed, either by the ZipCPU
or by the host controller.  Because of this model, peripherals may be tested
or by the host controller.  Because of this model, peripherals may be tested
and known to work before the CPU is ever turned on.  Two programs make this
and known to work before the CPU is ever turned on.  Two programs make this
possible: netuart and wbregs.  Other programs may be built upon this model,
possible: netuart and wbregs.  Other programs may be built upon this model,
as long as they access the bus using the interface outlined in devbus.h.
as long as they access the bus using the interface outlined in devbus.h.
 
 
Of the two programs, netuart simply turns the USB serial port interface of
Of the two programs, netuart simply turns the USB serial port interface of
the device into a TCP/IP interface.  Netuart takes one argument, the
the device into a TCP/IP interface.  Netuart takes one argument, the
name of the serial port device which the Arty USB driver has created.  In
name of the serial port device which the Arty USB driver has created.  In
my case, this tends to be /dev/ttyUSB1, although it has been known to change
my case, this tends to be /dev/ttyUSB1, although it has been known to change
from time to time:
from time to time:
 
 
\begin{lstlisting}[language=bash]
\begin{lstlisting}[language=bash]
% netuart /dev/ttyUSB1
% netuart /dev/ttyUSB1
\end{lstlisting}
\end{lstlisting}
 
 
All of the other board support files connect to the TCP/IP port generated
All of the other board support files connect to the TCP/IP port generated
by netuart.  The port.h file is a compiled-in file, outlining where this
by netuart.  The port.h file is a compiled-in file, outlining where this
port can be found.  By default, netuart listens to port {\tt 6510} on
port can be found.  By default, netuart listens to port {\tt 6510} on
{\tt localhost}, but it can be configured to listen to any port.  The other
{\tt localhost}, but it can be configured to listen to any port.  The other
board support files will try to connect to netuart at the host and port
board support files will try to connect to netuart at the host and port
listed in port.h.  Hence, if properly configured, you should be able to
listed in port.h.  Hence, if properly configured, you should be able to
access your Arty to command it, configure it, reload it, etc., from anywhere
access your Arty to command it, configure it, reload it, etc., from anywhere
you have internet access--in my case, from anywhere in the house.
you have internet access--in my case, from anywhere in the house.
 
 
Once you run netuart, you should then be able to watch, as a part of the
Once you run netuart, you should then be able to watch, as a part of the
standard output stream of netuart, all of the interaction with the board.
standard output stream of netuart, all of the interaction with the board.
While this may be useful for debugging, it's not all that legible to the
While this may be useful for debugging, it's not all that legible to the
user.   Lines that start with \hbox{``\#''} are lines from the device that are not
user.   Lines that start with \hbox{``\#''} are lines from the device that are not
going to any client.  A common line you will see is \hbox{``\# 0''}.  This is
going to any client.  A common line you will see is \hbox{``\# 0''}.  This is
just the device saying that its command capability is idle.  Lines that start
just the device saying that its command capability is idle.  Lines that start
with \hbox{``< ''} are commands going to the device, and lines starting with
with \hbox{``< ''} are commands going to the device, and lines starting with
\hbox{``> ''} are responses from the core.  So, at this point, run netuart and
\hbox{``> ''} are responses from the core.  So, at this point, run netuart and
wait a couple of seconds.  If you do not see a \hbox{``\# 0''} line, then try a
wait a couple of seconds.  If you do not see a \hbox{``\# 0''} line, then try a
different serial port, check that your core is properly configured, etc.  Once
different serial port, check that your core is properly configured, etc.  Once
you do see a \hbox{``\# 0''} line, then you are ready for the next step.
you do see a \hbox{``\# 0''} line, then you are ready for the next step.
 
 
The easiest way to test the peripherals is via the wbregs command.  This
The easiest way to test the peripherals is via the wbregs command.  This
command is similar to the ancient peek and poke commands.  It takes one
command is similar to the ancient peek and poke commands.  It takes one
or two arguments.  If given one argument, it reads from that address on the
or two arguments.  If given one argument, it reads from that address on the
bus.  If given two arguments, it writes the value of the second argument to
bus.  If given two arguments, it writes the value of the second argument to
the bus location given by the first argument.  Hence one argument peeks
the bus location given by the first argument.  Hence one argument peeks
at the memory bus, two arguments pokes a value onto the memory bus.
at the memory bus, two arguments pokes a value onto the memory bus.
 
 
Perhaps an example will help.  At this point, try typing:
Perhaps an example will help.  At this point, try typing:
 
 
\begin{lstlisting}[language=bash]
\begin{lstlisting}[language=bash]
% wbregs version
% wbregs version
\end{lstlisting}
\end{lstlisting}
 
 
This should return and print a 32-bit hexadecimal value to your screen,
This should return and print a 32-bit hexadecimal value to your screen,
indicating the date of when you last ran make in the root directory before
indicating the date of when you last ran make in the root directory before
building and installing your configuration into the device.  This can be
building and installing your configuration into the device.  This can be
very useful to know what configuration you are running, and whether or not
very useful to know what configuration you are running, and whether or not
you have made the changes you thought you had made.
you have made the changes you thought you had made.
 
 
You may have noticed that wbregs read from address 0x0100, but did so by name.
You may have noticed that wbregs read from address 0x0100, but did so by name.
Most of the peripherals have names for their addresses.  The C language
Most of the peripherals have names for their addresses.  The C language
names for these addresses can be found in regdefs.h, and a mapping to
names for these addresses can be found in regdefs.h, and a mapping to
wbregs address names can be found in regdefs.cpp.
wbregs address names can be found in regdefs.cpp.
 
 
Shall we try another?  Let's try adjusting the LEDs.  To turn all the LEDs off,
Shall we try another?  Let's try adjusting the LEDs.  To turn all the LEDs off,
\begin{lstlisting}[language=bash]
\begin{lstlisting}[language=bash]
% wbregs leds 0x0f0
% wbregs leds 0x0f0
\end{lstlisting}
\end{lstlisting}
To turn them all back on again,
To turn them all back on again,
\begin{lstlisting}[language=bash]
\begin{lstlisting}[language=bash]
% wbregs leds 0x0ff
% wbregs leds 0x0ff
\end{lstlisting}
\end{lstlisting}
To turn the low order LED off without changing any others, write
To turn the low order LED off without changing any others, write
\begin{lstlisting}[language=bash]
\begin{lstlisting}[language=bash]
% wbregs leds 0x010
% wbregs leds 0x010
\end{lstlisting}
\end{lstlisting}
 
 
Having fun?  Try running the program startupex.sh from the sw directory.
Having fun?  Try running the program startupex.sh from the sw directory.
This will set some LEDs and Color LEDs in a fun, startup--looking, pattern.
This will set some LEDs and Color LEDs in a fun, startup--looking, pattern.
 
 
Ready to test the UART?   Using minicom, connect to the PModUSBUART.  It
Ready to test the UART?   Using minicom, connect to the PModUSBUART.  It
should also be connected to a /dev/ttyUSBx serial port device.  If you aren't
should also be connected to a /dev/ttyUSBx serial port device.  If you aren't
sure, start minicom with:
sure, start minicom with:
\begin{lstlisting}[language=bash]
\begin{lstlisting}[language=bash]
% minicom -D /dev/ttyUSB2
% minicom -D /dev/ttyUSB2
\end{lstlisting}
\end{lstlisting}
Then, configure minicom to use 115,200 Baud, 8-data bits, one stop bit, and
Then, configure minicom to use 115,200 Baud, 8-data bits, one stop bit, and
no parity.
no parity.
 
 
Once you've done that, we can test it by sending a character across the UART
Once you've done that, we can test it by sending a character across the UART
port:
port:
\begin{lstlisting}[language=bash]
\begin{lstlisting}[language=bash]
% wbregs tx 90
% wbregs tx 90
\end{lstlisting}
\end{lstlisting}
This should send a `Z' over the UART port.  Did you see a `Z' in minicom?
This should send a `Z' over the UART port.  Did you see a `Z' in minicom?
If not, did you set the baud rate right?  The UART is supposed to be set
If not, did you set the baud rate right?  The UART is supposed to be set
for 115,200 Baud, 8N1 by default.  If not, you can set it to that by writing
for 115,200 Baud, 8N1 by default.  If not, you can set it to that by writing
wbregs setup 705.  The 705 comes from the clock rate, in Hz, divided by
wbregs setup 705.  The 705 comes from the clock rate, in Hz, divided by
115200.  By leaving other higher order bits at zero, this becomes the default
115200.  By leaving other higher order bits at zero, this becomes the default
baud rate of an 8N1 serial port channel.
baud rate of an 8N1 serial port channel.
 
 
Another fun program to run is {\tt netsetup}.  This program takes no arguments,
Another fun program to run is {\tt netsetup}.  This program takes no arguments,
and just reads and decodes the network registers via the MDIO port.  The
and just reads and decodes the network registers via the MDIO port.  The
decoded result will be sent to the screen.
decoded result will be sent to the screen.
 
 
\section{Subsequent Core Updates}
\section{Subsequent Core Updates}
The board support file {\tt wbprogram} can be used to write .bit or .bin
The board support file {\tt wbprogram} can be used to write .bit or .bin
files to the flash, so that the core can be updated once an initial core
files to the flash, so that the core can be updated once an initial core
is installed and running.
is installed and running.
Although wbprogram expects the filename to end in either '.bit' or '.bin',
Although wbprogram expects the filename to end in either '.bit' or '.bin',
this is primarily to keep a user from doing something they don't intend to
this is primarily to keep a user from doing something they don't intend to
do.
do.
 
 
The basic usage of the wbprogram command is:
The basic usage of the wbprogram command is:
\begin{lstlisting}[language=bash]
\begin{lstlisting}[language=bash]
% wbprogram [@address] file
% wbprogram [@address] file
\end{lstlisting}
\end{lstlisting}
wbprogram then copies the file to the flash, starting at the Arty address
wbprogram then copies the file to the flash, starting at the Arty address
of {\tt @address}.  If no address is given, wbprogram writes the file at the
of {\tt @address}.  If no address is given, wbprogram writes the file at the
beginning of flash.
beginning of flash.
 
 
An example of how to do this can be found in the {\tt program.sh}.
An example of how to do this can be found in the {\tt program.sh}.
{\tt program.sh} places the new configuration file into the alternate
{\tt program.sh} places the new configuration file into the alternate
configuration location.  (An alternate script, zprog.sh, places the new
configuration location.  (An alternate script, zprog.sh, places the new
configuration at the beginning of the flash, where the FPGA loader will look
configuration at the beginning of the flash, where the FPGA loader will look
for it upon power up.)  Once {\tt program.sh} places the new configuration
for it upon power up.)  Once {\tt program.sh} places the new configuration
into flash, it then commands the FPGA via the ICAPE2 interface and an IPROG
into flash, it then commands the FPGA via the ICAPE2 interface and an IPROG
command to reconfigure itself using this new configuration.  As a result, this
command to reconfigure itself using this new configuration.  As a result, this
can be used to load subsequent configurations into the FLASH.
can be used to load subsequent configurations into the FLASH.
 
 
\section{Building the ZipCPU tool-chain}
\section{Building the ZipCPU tool-chain}
At this point, you should have some confidence that your configuration and
At this point, you should have some confidence that your configuration and
hardware are working.  Therefore, let's transition to getting the ZipCPU
hardware are working.  Therefore, let's transition to getting the ZipCPU
on the hardware up and running.  To do this, we'll start with getting a copy
on the hardware up and running.
 
To do this, we'll start with getting a copy
of the ZipCPU toolchain and building it.  Pick a directory to work in, and
of the ZipCPU toolchain and building it.  Pick a directory to work in, and
then issue:
then issue:
\begin{lstlisting}[language=bash]
\begin{lstlisting}[language=bash]
% git clone https://github.com/ZipCPU/zipcpu
% git clone https://github.com/ZipCPU/zipcpu
\end{lstlisting}
\end{lstlisting}
to get a copy of the ZipCPU project, together with toolchain, and then
to get a copy of the ZipCPU project, together with toolchain.  You'll also
in the master directory, type:
need to double check that you have the pre-requisite packages to build this
 
tool chain, so on an Ubuntu~14 machine you would issue:
 
\begin{lstlisting}[language=bash]
 
% sudo apt-get install flex bison libbison-dev
 
% sudo apt-get install libgmp10 libgmp-dev libmpfr-dev libmpc-dev libelf-dev
 
% sudo apt-get install libisl-dev
 
\end{lstlisting}
 
Once these are all in place, you can then switch to the master ZipCPU
 
directory and type,
\begin{lstlisting}[language=bash]
\begin{lstlisting}[language=bash]
% cd zipcpu; make
% cd zipcpu; make
\end{lstlisting}
\end{lstlisting}
(you may need to issue the make command a couple of times \ldots)
(you may need to issue the make command a couple of times \ldots)
 
 
This will build the GCC compiler for the ZipCPU from source.
This will build the GCC compiler for the ZipCPU from source.
It will also install this new compiler into the zipcpu/sw/install/cross-tools.
It will also install this new compiler into the zipcpu/sw/install/cross-tools.
This new compiler will be called zip-gcc.
This new compiler will be called zip-gcc.
 
 
This will also build a copy of the binutils programs for the ZipCPU.  These
This will also build a copy of the binutils programs for the ZipCPU.  These
include the assembler, {\tt zip-gas}, linker, {\tt zip-ld}, disassembler,
include the assembler, {\tt zip-gas}, linker, {\tt zip-ld}, disassembler,
{\tt zip-objdump}, and many more useful programs.
{\tt zip-objdump}, and many more useful programs.
 
 
The next step to using this toolchain is to place it into your path.
The next step to using this toolchain is to place it into your path.
\begin{lstlisting}[language=bash]
\begin{lstlisting}[language=bash]
% export PATH=$PATH:$PWD/zipcpu/install/cross-tools/bin
% export PATH=$PATH:$PWD/zipcpu/install/cross-tools/bin
\end{lstlisting}
\end{lstlisting}
Once the toolchain is in your path,
Once the toolchain is in your path,
\begin{lstlisting}[language=bash]
\begin{lstlisting}[language=bash]
% which zip-gcc
% which zip-gcc
/home/.../zipcpu/sw/install/cross-tools/bin/zip-gcc
/home/.../zipcpu/sw/install/cross-tools/bin/zip-gcc
\end{lstlisting}
\end{lstlisting}
should return the location of where this toolchain exists in your path.
should return the location of where this toolchain exists in your path.
 
 
\section{Building your first ZipCPU program}
\section{Building your first ZipCPU program}
Several example programs for the OpenArty project can be found in the
Several example programs for the OpenArty project can be found in the
{\tt sw/board} directory.  These can be used to test various peripherals from
{\tt sw/board} directory.  These can be used to test various peripherals from
the perspective of the CPU itself.
the perspective of the CPU itself.
 
 
As a test of the build process, a good first progam to build would be
As a test of the build process, a good first progam to build would be
{\tt exstartup}.  This program is very similar to the {\tt startupex.sh} shell
{\tt exstartup}.  This program is very similar to the {\tt startupex.sh} shell
script you tried earlier.  It simply plays with the color LEDs and some
script you tried earlier.  It simply plays with the color LEDs and some
on board timers.   Once that is finished, it goes into a loop controlling
on board timers.   Once that is finished, it goes into a loop controlling
both the normal and the color LEDs based upon the button state and the switch
both the normal and the color LEDs based upon the button state and the switch
settings.
settings.
 
 
To build {\tt exstartup}, simply type {\tt make exstartup} from the
To build {\tt exstartup}, simply type {\tt make exstartup} from the
{\tt sw/board} directory of the {\tt openarty} project.  (Don't forget to
{\tt sw/board} directory of the {\tt openarty} project.  (Don't forget to
include the ZipCPU toolchain into your path before you do this!)
include the ZipCPU toolchain into your path before you do this!)
 
 
\section{Loading a program}
\section{Loading a program}
Now that you have built your {\tt exstartup} program, it's time to load it
Now that you have built your {\tt exstartup} program, it's time to load it
onto the board and start it up.  The {\tt zipload} program can be used to
onto the board and start it up.  The {\tt zipload} program can be used to
do this.  {\tt zipload} can be found in the sw/host directory.  To load a
do this.  {\tt zipload} can be found in the sw/host directory.  To load a
ZipCPU program into the Arty, just type {\tt zipload} and the program name,
ZipCPU program into the Arty, just type {\tt zipload} and the program name,
such as {\tt exstartup} in this case.  To start the program immediately
such as {\tt exstartup} in this case.  To start the program immediately
after loading it, pass the `-r' option to {\tt zipload}.  In our case, you
after loading it, pass the `-r' option to {\tt zipload}.  In our case, you
would type:
would type:
\begin{lstlisting}[language=bash]
\begin{lstlisting}[language=bash]
% zipload -r exstartup
% zipload -r exstartup
\end{lstlisting}
\end{lstlisting}
 
 
Hopefully, you can see the {\tt exstartup} program now toggling the LED's.
Hopefully, you can see the {\tt exstartup} program now toggling the LED's.
Once the initial display stops, you can adjust the switches and press buttons
Once the initial display stops, you can adjust the switches and press buttons
to see how that affects the result.
to see how that affects the result.
 
 
If you wish to restart the {\tt exstartup} program, or indeed to run another
If you wish to restart the {\tt exstartup} program, or indeed to run another
program, you can just run {\tt zipload} again with the new program name.  This
program, you can just run {\tt zipload} again with the new program name.  This
will halt the previous program, and then load the new one into memory.  As
will halt the previous program, and then load the new one into memory.  As
before, if you use the `-r' option, the program will be started automatically.
before, if you use the `-r' option, the program will be started automatically.
 
 
\section{Some other test programs}
\section{Some other test programs}
If you have the PModUSBUART, you might wish to try running a ``Hello, World''
If you have the PModUSBUART, you might wish to try running a ``Hello, World''
program.  This can be found in the hello.c file.  It prints ``Hello, World''
program.  This can be found in the hello.c file.  It prints ``Hello, World''
to the PModUSBUART once every ten seconds.  Had enough of it?  You can stop
to the PModUSBUART once every ten seconds.  Had enough of it?  You can stop
the CPU by typing {\tt wbregs cpu 0x0400}.  This sends a halt command to the
the CPU by typing {\tt wbregs cpu 0x0400}.  This sends a halt command to the
debug register of the ZipCPU.  More information about this debug register, and
debug register of the ZipCPU.  More information about this debug register, and
other things that can be done via the debug register, can be found in the
other things that can be done via the debug register, can be found in the
ZipCPU specification.
ZipCPU specification.
 
 
If you have both the PModUSBUART as well as the PModGPS, the {\tt gpsdump.c}
If you have both the PModUSBUART as well as the PModGPS, the {\tt gpsdump.c}
program can be used to forward the NMEA stream from the GPS to the USBUART.
program can be used to forward the NMEA stream from the GPS to the USBUART.
This should give you some confidence that the PModGPS is working.
This should give you some confidence that the PModGPS is working.
 
 
As a third test, {\tt oledtest.c} will initialize the OLEDrgb device and cause
As a third test, {\tt oledtest.c} will initialize the OLEDrgb device and cause
it to display one of two images in an alternating fashion.
it to display one of two images in an alternating fashion.
 
 
\chapter{Architecture}\label{ch:architecture}
\chapter{Architecture}\label{ch:architecture}
My philosophy in peripherals is to keep them simple.  If there is a default
My philosophy in peripherals is to keep them simple.  If there is a default
mode on the peripheral, setting that mode should not require turning any bits
mode on the peripheral, setting that mode should not require turning any bits
on.  If a peripheral encounters an error condition, a bit may be turned on to
on.  If a peripheral encounters an error condition, a bit may be turned on to
indicate this fact, otherwise status bits will be left in the off position.
indicate this fact, otherwise status bits will be left in the off position.
 
 
\subsection{Bus Structure}
\subsection{Bus Structure}
The OpenArty project contains four bus masters, three of them within the CPU.
The OpenArty project contains four bus masters, three of them within the CPU.
These masters are the instruction fetch unit, the data read/write unit,
These masters are the instruction fetch unit, the data read/write unit,
and the direct memory access peripheral within the ZipCPU, as well as an
and the direct memory access peripheral within the ZipCPU, as well as an
external debug port which can be commanded from over the main UART port
external debug port which can be commanded from over the main UART port
connecting the Arty to its host.
connecting the Arty to its host.
 
 
There is also a second minor peripheral bus located within the ZipCPU
There is also a second minor peripheral bus located within the ZipCPU
ZipSystem.  This bus provides access to a number of peripherals within the
ZipSystem.  This bus provides access to a number of peripherals within the
ZipSystem, such as timers, counters, and the direct memory access controller.
ZipSystem, such as timers, counters, and the direct memory access controller.
This bus will also be used to configure the memory management unit once
This bus will also be used to configure the memory management unit once
integrated.  This bus is only visible to the CPU, and located starting at
integrated.  This bus is only visible to the CPU, and located starting at
address {\tt 0xc0000000}.
address {\tt 0xc0000000}.
 
 
The ZipCPU debug port is also available on the bus.  This port, however, is
The ZipCPU debug port is also available on the bus.  This port, however, is
only visible to the external debug port.  It can be found at address
only visible to the external debug port.  It can be found at address
{\tt 0x08000000} for the control register, and {\tt 0x08000001} for the
{\tt 0x08000000} for the control register, and {\tt 0x08000001} for the
data register.
data register.
 
 
Once the MMU has been integrated, it will be placed between the instruction
Once the MMU has been integrated, it will be placed between the instruction
fetch unit, data read/write unit, and the rest of the peripheral bus.
fetch unit, data read/write unit, and the rest of the peripheral bus.
 
 
The actual bus chosen for this design is the Wishbone Bus, based upon the
The actual bus chosen for this design is the Wishbone Bus, based upon the
pipeline mode defined in the B4 specification.  All optional wires required
pipeline mode defined in the B4 specification.  All optional wires required
by this bus structure have been removed, such as the tag lines, the cycle
by this bus structure have been removed, such as the tag lines, the cycle
type identifier, the burst type, and so forth.  This was done to simplify
type identifier, the burst type, and so forth.  This was done to simplify
the logic within the core.
the logic within the core.
 
 
However, because of the complicated bus structure--particularly because of the
However, because of the complicated bus structure--particularly because of the
number of masters and slaves on the bus and the speed for which the bus is
number of masters and slaves on the bus and the speed for which the bus is
defined, there are a number of delays and arbiters placed on the bus.  As a
defined, there are a number of delays and arbiters placed on the bus.  As a
result, the stall wire which is supposed to be depend upon combinational logic
result, the stall wire which is supposed to be depend upon combinational logic
only, has been registered at a number of locations.  What this means is that
only, has been registered at a number of locations.  What this means is that
there are a variety of delays as commands propagate through the bus structure.
there are a variety of delays as commands propagate through the bus structure.
Most of these are variable, in that they can be turned on or off at build time,
Most of these are variable, in that they can be turned on or off at build time,
or even that the stall line may (or may not) be registered as configured.
or even that the stall line may (or may not) be registered as configured.
 
 
All interactions between bus masters and any peripherals passes through the
All interactions between bus masters and any peripherals passes through the
interconnect, located in {\tt busmaster.v}.  This interconnect divides the
interconnect, located in {\tt busmaster.v}.  This interconnect divides the
slaves into separate groups.  The first group of slaves are those for which the
slaves into separate groups.  The first group of slaves are those for which the
bus is supposed to provide fast access to.  These are the DDR3 SDRAM, the
bus is supposed to provide fast access to.  These are the DDR3 SDRAM, the
flash, the block RAM, and the network.  The next group of slaves will have their
flash, the block RAM, and the network.  The next group of slaves will have their
acknowledgements delayed by an additional clock.  The final group of slaves
acknowledgements delayed by an additional clock.  The final group of slaves
are those single register slaves whose results may be known ahead of any read,
are those single register slaves whose results may be known ahead of any read,
and who only require one clock to access.  These are grouped together and
and who only require one clock to access.  These are grouped together and
controlled from within {\tt fastio.v}.
controlled from within {\tt fastio.v}.
 
 
Further information about the Wishbone bus structure found within this core
Further information about the Wishbone bus structure found within this core
can be found either on the Wishbone datasheet (Ch.~\ref{ch:wishbone}), or in
can be found either on the Wishbone datasheet (Ch.~\ref{ch:wishbone}), or in
the memory map table in the Registers chapter (Ch.~\ref{ch:registers}).
the memory map table in the Registers chapter (Ch.~\ref{ch:registers}).
 
 
\subsection{DDR3 SDRAM}
\subsection{DDR3 SDRAM}
 
 
{\em It is the intention of this project to use a completely open source
{\em It is the intention of this project to use a completely open source
DDR3 SDRAM controller.  While the controller has been written, it has yet to
DDR3 SDRAM controller.  While the controller has been written, it has yet to
be successfully connected to the physical pins of the port.  Until that time,
be successfully connected to the physical pins of the port.  Until that time,
the design is running using a Wishbone to AXI bus bridge.  Memory may still
the design is running using a Wishbone to AXI bus bridge.  Memory may still
be read or written, after an initial pipeline delay of roughly 27~clocks per
be read or written, after an initial pipeline delay of roughly 27~clocks per
access, at one access per clock.}
access, at one access per clock.}
 
 
{\em The open source SDRAM controller should be able to achieve a delay closer
{\em The open source SDRAM controller should be able to achieve a delay closer
to 9~clocks per access--once I figure out how to connect it to the PHY.}
to 9~clocks per access--once I figure out how to connect it to the PHY.}
 
 
\subsection{Flash}
\subsection{Flash}
\subsection{Block RAM}
\subsection{Block RAM}
 
 
The block RAM on this board has been arranged into one 32kW section.
The block RAM on this board has been arranged into one 32kW section.
Programs that use block RAM will run fastest using the block RAM, both for
Programs that use block RAM will run fastest using the block RAM, both for
instructions as well as for memory.
instructions as well as for memory.
 
 
\subsection{Ethernet}
\subsection{Ethernet}
 
 
The ether net controller has been split into three parts.  The first part is
The ether net controller has been split into three parts.  The first part is
an area of packet memory.  This part is simple: it acts like memory.  The
an area of packet memory.  This part is simple: it acts like memory.  The
receive memory is read only, whereas the transmit memory is both read and
receive memory is read only, whereas the transmit memory is both read and
write.  Packets received by the controller will be found in the receive memory,
write.  Packets received by the controller will be found in the receive memory,
packets transmitted must be in the transmit area of memory.  The octets
packets transmitted must be in the transmit area of memory.  The octets
may be found in memory with the first octet in the most significant byte.
may be found in memory with the first octet in the most significant byte.
This is the easy part.
This is the easy part.
 
 
The format of the packets within this memory is a touch more interesting.
The format of the packets within this memory is a touch more interesting.
With no options turned on, the first 6~bytes are the destination MAC
With no options turned on, the first 6~bytes are the destination MAC
address, the next 6~bytes will be the source MAC address, and the {\em next
address, the next 6~bytes will be the source MAC address, and the {\em next
4~bytes} will be the EtherType repeated twice.  This was done to align the
4~bytes} will be the EtherType repeated twice.  This was done to align the
packet, and particularly the IP header, onto word boundaries.  If the hardware
packet, and particularly the IP header, onto word boundaries.  If the hardware
CRC has been turned off, the packet must contain its own CRC as well as
CRC has been turned off, the packet must contain its own CRC as well as
ensuring that it has a minimum packet length (64 octets) when including that
ensuring that it has a minimum packet length (64 octets) when including that
CRC.
CRC.
 
 
With all options turned on, however, things are a touch simpler.  The first
With all options turned on, however, things are a touch simpler.  The first
two words of the packet contain the destination MAC (for a transmit packet)
two words of the packet contain the destination MAC (for a transmit packet)
or the source MAC (for a received packet), followed by the two--octet
or the source MAC (for a received packet), followed by the two--octet
EtherType.  At this point the packet is word--aligned prior to the IP header.
EtherType.  At this point the packet is word--aligned prior to the IP header.
Since broadcast packets are sent to a special destination MAC other than
Since broadcast packets are sent to a special destination MAC other than
our own, a flag in the command register will indicate this fact.
our own, a flag in the command register will indicate this fact.
 
 
 
 
The second part of the controller is the MDIO interface.  This follows from
The second part of the controller is the MDIO interface.  This follows from
the specification, and can be used to toggle the LED's on the ethernet,
the specification, and can be used to toggle the LED's on the ethernet,
to force the ethernet into a particular mode, either 10M or 100M, to control
to force the ethernet into a particular mode, either 10M or 100M, to control
auto--negotiation of the speed, and more.  Reads or writes to MDIO memory
auto--negotiation of the speed, and more.  Reads or writes to MDIO memory
addresses will command reads or writes via the MDIO port from the FPGA to the
addresses will command reads or writes via the MDIO port from the FPGA to the
ethernet PHY.  As the PHY can only handle 16--bit words, only 16~bits will
ethernet PHY.  As the PHY can only handle 16--bit words, only 16~bits will
ever be transferred as a result of any read/write command, the top 16~bits
ever be transferred as a result of any read/write command, the top 16~bits
are automatically set to zero.  Further details of this capability may be
are automatically set to zero.  Further details of this capability may be
found within the specification for the chip.
found within the specification for the chip.
 
 
The MDIO interface may be ignored.  If ignored, the defaults within the
The MDIO interface may be ignored.  If ignored, the defaults within the
interface will naturally set up the network connection in full duplex mode (if
interface will naturally set up the network connection in full duplex mode (if
your hardware supports it), at the highest speed the network will support.
your hardware supports it), at the highest speed the network will support.
However, if you ignore this interface you may not know what problems you are
However, if you ignore this interface you may not know what problems you are
suffering from this interface, if any.  The {\tt netsetup} program has been
suffering from this interface, if any.  The {\tt netsetup} program has been
provided, among the host software, to help diagnose how the various MDIO
provided, among the host software, to help diagnose how the various MDIO
registers have been set, and what the status is that is being reported from
registers have been set, and what the status is that is being reported from
the PHY.
the PHY.
 
 
The third part of the controller is the packet command interface.  This
The third part of the controller is the packet command interface.  This
consists of two command registers, one for reading and one for writing.
consists of two command registers, one for reading and one for writing.
Before doing anything with the network, it must first be taken out of
Before doing anything with the network, it must first be taken out of
reset.  According to the specification for the network chip, this must
reset.  According to the specification for the network chip, this must
happen a minimum of one second after power up.  This may be done by simply
happen a minimum of one second after power up.  This may be done by simply
writing to the transmit command register with the reset bit turned off.
writing to the transmit command register with the reset bit turned off.
 
 
To send a packet, simply write the number of octets in the packet to the
To send a packet, simply write the number of octets in the packet to the
transmit control register and set the GO bit ({\tt 0x04000}).  Other bits
transmit control register and set the GO bit ({\tt 0x04000}).  Other bits
in this control register can be used to turn off the hardware MAC generation
in this control register can be used to turn off the hardware MAC generation
(and removal upon receive), the hardware CRC checking, and/or the hardware
(and removal upon receive), the hardware CRC checking, and/or the hardware
IP header checksum validation (but not generation).  The GO bit will remain
IP header checksum validation (but not generation).  The GO bit will remain
high while the packet is being sent, and only transition to low once the
high while the packet is being sent, and only transition to low once the
packet is away.  While the packet is being sent, a zero may be written to the
packet is away.  While the packet is being sent, a zero may be written to the
command register to cancel the packet--although this is not recommended.
command register to cancel the packet--although this is not recommended.
 
 
Packets are automatically received without intervention.  Once a packet has been
Packets are automatically received without intervention.  Once a packet has been
received, the available bit will be set in the receive command register and
received, the available bit will be set in the receive command register and
a receive packet interrupt will be generated.  The ethernet port will then
a receive packet interrupt will be generated.  The ethernet port will then
halt/stall until a user has reset the receive interface so that it may
halt/stall until a user has reset the receive interface so that it may
receive the next packet.  Without clearing this interface, the receive port
receive the next packet.  Without clearing this interface, the receive port
will not accept further packets.  Other status bits in this interface are
will not accept further packets.  Other status bits in this interface are
used to indicate whether packets have been missed (because the interface was
used to indicate whether packets have been missed (because the interface was
busy), or thrown out due to some error such as a CRC error or a more general
busy), or thrown out due to some error such as a CRC error or a more general
error.\footnote{It should be possible to extend this interface so that further
error.\footnote{It should be possible to extend this interface so that further
packets may be read as long as the memory isn't yet full.  This is left as an
packets may be read as long as the memory isn't yet full.  This is left as an
exercise to others.}
exercise to others.}
 
 
\subsection{SD Card}
\subsection{SD Card}
\subsection{GPS Tracking}
\subsection{GPS Tracking}
\subsection{Configuration port}
\subsection{Configuration port}
 
 
The registers associated with the ICAPE2 port have been made accessible
The registers associated with the ICAPE2 port have been made accessible
to the core via the {\tt wbicapetwo} core.  More information about the meaning
to the core via the {\tt wbicapetwo} core.  More information about the meaning
of these registers can be found in Xilinx's ``7--Series FPGAs Configuration
of these registers can be found in Xilinx's ``7--Series FPGAs Configuration
User's Guide''.
User's Guide''.
 
 
Testing with the OpenArty board has tended to focus on the warmboot capability.
Testing with the OpenArty board has tended to focus on the warmboot capability.
Using this capability, a user is able to command the FPGA to reload its
Using this capability, a user is able to command the FPGA to reload its
configuration.  In support of this, two configuration areas have been
configuration.  In support of this, two configuration areas have been
defined within memory.  The first is the default configuration, found at
defined within memory.  The first is the default configuration, found at
the beginning of the flash.  This configuration is sometimes called the ``golden
the beginning of the flash.  This configuration is sometimes called the ``golden
configuration'' within Xilinx's documentation because it is the configuration
configuration'' within Xilinx's documentation because it is the configuration
that the Xilinx device will always start up from after a power on reset.  On
that the Xilinx device will always start up from after a power on reset.  On
the OpenArty, a second configuration may immediately follow the first in flash.
the OpenArty, a second configuration may immediately follow the first in flash.
Commanding the FPGA to reload it's configuration is as simple as
Commanding the FPGA to reload it's configuration is as simple as
setting the WBSTAR (warm boot start address) register to the location of the
setting the WBSTAR (warm boot start address) register to the location of the
new configuration within the flash, and then writing a 15 (a.k.a. IPROG)
new configuration within the flash, and then writing a 15 (a.k.a. IPROG)
to the FPGA command register (offset 4 from the beginning of the ICAPE2
to the FPGA command register (offset 4 from the beginning of the ICAPE2
addresses).  Examples of doing this are found in the
addresses).  Examples of doing this are found in the
{\tt sw/host/zprog.sh} and {\tt sw/host/program.sh} scripts.  The former
{\tt sw/host/zprog.sh} and {\tt sw/host/program.sh} scripts.  The former
programs the default configuration and then switches to it,
programs the default configuration and then switches to it,
 
 
This configuration capability makes it possible for a user to 1) reprogram
This configuration capability makes it possible for a user to 1) reprogram
the flash with an experimental configuration in the second configuration
the flash with an experimental configuration in the second configuration
location, and 2) test the configuration without actually touching the board.
location, and 2) test the configuration without actually touching the board.
If the configuration doesn't work well enough to be communicated with, the
If the configuration doesn't work well enough to be communicated with, the
board may simply be powered down and it will come back up with the initial
board may simply be powered down and it will come back up with the initial
or golden configuration.  If the golden configuration ever gets corrupted,
or golden configuration.  If the golden configuration ever gets corrupted,
or loaded with a configuration that will not work, then the user will need to
or loaded with a configuration that will not work, then the user will need to
reload the FPGA from the JTAG port.
reload the FPGA from the JTAG port.
 
 
\subsection{OLED}
\subsection{OLED}
\subsection{Real Time Clock}
\subsection{Real Time Clock}
 
 
The Arty board contains a real time clock core together with a companion
The Arty board contains a real time clock core together with a companion
real time date/calendar core.  The clock core itself contains not only current
real time date/calendar core.  The clock core itself contains not only current
time, but also a stopwatch, seconds timer, and alarm.  The real time date core
time, but also a stopwatch, seconds timer, and alarm.  The real time date core
can be used to maintain the current date.  The real--time clock core uses the
can be used to maintain the current date.  The real--time clock core uses the
GPS PPS output, as schooled by the GPS tracking circuit, in order to synchronize
GPS PPS output, as schooled by the GPS tracking circuit, in order to synchronize
their subsecond timing to the GPS itself.  Further, the real--time clock core
their subsecond timing to the GPS itself.  Further, the real--time clock core
then creates a synchronization wire for the real--time date core.
then creates a synchronization wire for the real--time date core.
 
 
Neither of these cores exports its subsecond precision to the rest of the
Neither of these cores exports its subsecond precision to the rest of the
design.  This must be done using either the internal GPS tracking wires, or
design.  This must be done using either the internal GPS tracking wires, or
by reading the time information from the tracking test bench.
by reading the time information from the tracking test bench.
 
 
\subsection{LEDs}
\subsection{LEDs}
 
 
The Arty board contains two sets of LEDs: a plain set of LEDs, and a colored
The Arty board contains two sets of LEDs: a plain set of LEDs, and a colored
set of LEDs.
set of LEDs.
 
 
The plain set of LEDs is controlled simply from the LED register.  This register
The plain set of LEDs is controlled simply from the LED register.  This register
can be used to turn these LEDs on and off, either individually or as a whole.
can be used to turn these LEDs on and off, either individually or as a whole.
It has been designed for atomic access, so only one write to this register
It has been designed for atomic access, so only one write to this register
is necessary to set any particular LED.
is necessary to set any particular LED.
 
 
The color LEDs are slightly different.  Each color LED is supported by its
The color LEDs are slightly different.  Each color LED is supported by its
own register, which controls three pulse width modulation controllers.  Three
own register, which controls three pulse width modulation controllers.  Three
groups of eight bits within the color LED register control the PWM thresholds,
groups of eight bits within the color LED register control the PWM thresholds,
first for red, then green, and then in the lowest bits for blue.  These are
first for red, then green, and then in the lowest bits for blue.  These are
used to turn on and off the various color components of the LEDs.  Using this
used to turn on and off the various color components of the LEDs.  Using this
method, there are $2^{24}$ different colors each of these LEDs may be set
method, there are $2^{24}$ different colors each of these LEDs may be set
to.
to.
 
 
\subsection{Buttons}
\subsection{Buttons}
\subsection{Switches}
\subsection{Switches}
\subsection{Startup counter}
\subsection{Startup counter}
 
 
A startup counter has been placed into the basic peripheral I/O area.  This
A startup counter has been placed into the basic peripheral I/O area.  This
counter simply counts the clocks since startup.  Upon rollover, the high
counter simply counts the clocks since startup.  Upon rollover, the high
order bit remains set.  This can be used to sequence the start up of components
order bit remains set.  This can be used to sequence the start up of components
within the design if so desired.
within the design if so desired.
 
 
\subsection{GPS UART}
\subsection{GPS UART}
The GPS UART, debug control UART, as well as the auxilliary UART, are all
The GPS UART, debug control UART, as well as the auxilliary UART, are all
based upon the same underlying UART IP core, sometimes known as the WBUART32
based upon the same underlying UART IP core, sometimes known as the WBUART32
core.  The setup register is defined within the documentation for that core,
core.  The setup register is defined within the documentation for that core,
and provides for a large baud rate selection, 5-8 data bits, 1-2 stop bits,
and provides for a large baud rate selection, 5-8 data bits, 1-2 stop bits,
and several parity choices.  Within OpenArty, the GPS core is initialized
and several parity choices.  Within OpenArty, the GPS core is initialized
to 9.6~kBaud, 8 data bits, no parity, and one stop bit.
to 9.6~kBaud, 8 data bits, no parity, and one stop bit.
 
 
When a value is ready to be read from the GPS uart, the GPS interrupt line
When a value is ready to be read from the GPS uart, the GPS interrupt line
will go high.  Once read, and only when read, will this interrupt line reset.
will go high.  Once read, and only when read, will this interrupt line reset.
If the read is successful, only bits within the bottom eight will be set.
If the read is successful, only bits within the bottom eight will be set.
If a read is attempted when there is no data, when the UART is in a reset
If a read is attempted when there is no data, when the UART is in a reset
condition, or when there has been a framing or parity error (were parity
condition, or when there has been a framing or parity error (were parity
to be turned on), the upper bits of the UART port will be set.
to be turned on), the upper bits of the UART port will be set.
 
 
In a like manner, the GPS device can be written to.  Certain strings, if sent
In a like manner, the GPS device can be written to.  Certain strings, if sent
to the UART, can be used to change the UARTs baud rate, its serial port
to the UART, can be used to change the UARTs baud rate, its serial port
settings, or even its reporting interval.  As with the read port, the transmit
settings, or even its reporting interval.  As with the read port, the transmit
port will interrupt the CPU when it is idle.  Writing a character to this
port will interrupt the CPU when it is idle.  Writing a character to this
port will reset the interrupt.  Setting bits other than the bottom eight may
port will reset the interrupt.  Setting bits other than the bottom eight may
result in a break condition being set on this port as well.
result in a break condition being set on this port as well.
 
 
Interacting with a controller can therefore be somewhat tricky.  The
Interacting with a controller can therefore be somewhat tricky.  The
interrupt controller will trigger whenever the port is ready to be read from,
interrupt controller will trigger whenever the port is ready to be read from,
and will re--trigger every clock until the port has been read from.  At this
and will re--trigger every clock until the port has been read from.  At this
point, the interrupt controller may be reset.  If this is an auxilliary
point, the interrupt controller may be reset.  If this is an auxilliary
interrupt controller, such as the bus interrupt controller or the ZipSystem's
interrupt controller, such as the bus interrupt controller or the ZipSystem's
auxiliary controller, the auxiliary controller will then need to be reset,
auxiliary controller, the auxiliary controller will then need to be reset,
and the bit in the primary controller associated with the auxiliary controller
and the bit in the primary controller associated with the auxiliary controller
as well.  It is for this reason that the UARTs have been placed on the
as well.  It is for this reason that the UARTs have been placed on the
primary controller only.
primary controller only.
 
 
It should also be possible to use the DMA to read from (or write to) either
It should also be possible to use the DMA to read from (or write to) either
UART port.
UART port.
 
 
\subsection{Auxilliary UART}
\subsection{Auxilliary UART}
 
 
The Auxilliary UART has roughly the same structure as the GPS UART, save that
The Auxilliary UART has roughly the same structure as the GPS UART, save that
it's default configuration is for a 115,200~Baud configuration with 8~data bits,
it's default configuration is for a 115,200~Baud configuration with 8~data bits,
no stop bits, and no parity.  Reads, writes, and interrupts are treated in
no stop bits, and no parity.  Reads, writes, and interrupts are treated in
the same fashion.
the same fashion.
 
 
\subsection{GPIO}
\subsection{GPIO}
 
 
A General Purpose I/O controller has been placed within the design as well.
A General Purpose I/O controller has been placed within the design as well.
This controller can handle 16--generic input wires, and set 16--generic output
This controller can handle 16--generic input wires, and set 16--generic output
wires.  A single register is used to read both input and output wire values,
wires.  A single register is used to read both input and output wire values,
as well as to set output values when written to.
as well as to set output values when written to.
 
 
However, to use this controller, you will need to manually configure it
However, to use this controller, you will need to manually configure it
(i.e.~change the Verilog source) within the core, in order to wire the various
(i.e.~change the Verilog source) within the core, in order to wire the various
GPIO values up to a device of interest.  This was done for the simple reason
GPIO values up to a device of interest.  This was done for the simple reason
that wiring anything new up to the controller will require Verilog changes
that wiring anything new up to the controller will require Verilog changes
anyway.  For this reason, the controller has no way of setting wires to high
anyway.  For this reason, the controller has no way of setting wires to high
impedence, or pulling them up or down.  Such control may be done within the
impedence, or pulling them up or down.  Such control may be done within the
top level design if necessary.
top level design if necessary.
 
 
This controller will set an interrupt if ever any of the input wires within
This controller will set an interrupt if ever any of the input wires within
it are changed.  The interrupt may be cleared in the interrupt controller.
it are changed.  The interrupt may be cleared in the interrupt controller.
 
 
\subsection{Linker Script}
\subsection{Linker Script}
 
 
A linker script has been created to capture the memory structure needed by
A linker script has been created to capture the memory structure needed by
a program.  This script may be found in {\tt sw/board/arty.ld}.  It is a
a program.  This script may be found in {\tt sw/board/arty.ld}.  It is a
sample script, using it is not required.
sample script, using it is not required.
 
 
The script defines three types of memory to the linker: flash, block RAM, and
The script defines three types of memory to the linker: flash, block RAM, and
SDRAM.  Programs using this script will naturally start in flash (acting as
SDRAM.  Programs using this script will naturally start in flash (acting as
a ROM memory).  A bootloader must then be used to copy, from flash, those
a ROM memory).  A bootloader must then be used to copy, from flash, those
sections of the program that are to be placed in block RAM or SDRAM into
sections of the program that are to be placed in block RAM or SDRAM into
their particular memory locations.
their particular memory locations.
 
 
The block RAM locations are reserved for the user kernel, and specifically for
The block RAM locations are reserved for the user kernel, and specifically for
any part of the code in the {\tt .kernel} section.  C attributes, or assembly
any part of the code in the {\tt .kernel} section.  C attributes, or assembly
{\tt .section} commands, must be used to place items within this section.
{\tt .section} commands, must be used to place items within this section.
A final symbol within this section, {\_top\_of\_stack}, is used so that the
A final symbol within this section, {\_top\_of\_stack}, is used so that the
initial boot loader knows what to set the initial kernel stack to.
initial boot loader knows what to set the initial kernel stack to.
 
 
The rest of the initial program's memory is placed into
The rest of the initial program's memory is placed into
SDRAM.\footnote{Hopefully,
SDRAM.\footnote{Hopefully,
I'll get a data cache running on the ZipCPU to speed this up.}  At the end,
I'll get a data cache running on the ZipCPU to speed this up.}  At the end,
a {\tt \_top\_of\_heap} symbol is set to reference the final location in the
a {\tt \_top\_of\_heap} symbol is set to reference the final location in the
setup.  This symbol can then be used as a starting point for a memory allocator.
setup.  This symbol can then be used as a starting point for a memory allocator.
 
 
An example bootloader is provided in {\tt sw/board} that can be linked with
An example bootloader is provided in {\tt sw/board} that can be linked with
any (bare metal, supervisor) program in order to properly load it into memory.
any (bare metal, supervisor) program in order to properly load it into memory.
 
 
\chapter{Software}
\chapter{Software}
\section{Directory Structure}
\section{Directory Structure}
\section{Zip CPU Tool Chain}
\section{Zip CPU Tool Chain}
\section{Bench Test Software}
\section{Bench Test Software}
\section{Host Software}
\section{Host Software}
\begin{itemize}
\begin{itemize}
\item {\tt readflash}: As I am loathe to remove anything from
\item {\tt readflash}: As I am loathe to remove anything from
        a device that came factory installed, the
        a device that came factory installed, the
        {\tt readflash} program reads the original installed
        {\tt readflash} program reads the original installed
        configuration from the flash and dumps it to a file.
        configuration from the flash and dumps it to a file.
 
 
\item {\tt wbregs}: This program offers a capability very similar to the
\item {\tt wbregs}: This program offers a capability very similar to the
        PEEK and POKE capability Apple user's may remember from before the
        PEEK and POKE capability Apple user's may remember from before the
        days of Macintosh.  {\tt wbregs <address>} will read from the
        days of Macintosh.  {\tt wbregs <address>} will read from the
        Wishbone bus the value at the given address.  Likewise
        Wishbone bus the value at the given address.  Likewise
        {\tt wbregs <address> <value>} will write the given value into the
        {\tt wbregs <address> <value>} will write the given value into the
        given address.  While both address and value have the semantics of
        given address.  While both address and value have the semantics of
        numbers acceptable to {\tt strtoul()}, the address can also be a named
        numbers acceptable to {\tt strtoul()}, the address can also be a named
        address.  Supported names can be found in {\tt regdefs.cpp}, and their
        address.  Supported names can be found in {\tt regdefs.cpp}, and their
        register mapping in {\tt regdefs.h}.
        register mapping in {\tt regdefs.h}.
\item {\tt ziprun}:
\item {\tt ziprun}:
\item {\tt zipload}:
\item {\tt zipload}:
\end{itemize}
\end{itemize}
 
 
\section{Zip CPU Programs}
\section{Zip CPU Programs}
\begin{itemize}
\begin{itemize}
\item {\tt ntpserver}:
\item {\tt ntpserver}:
\item {\tt goldenstart}:
\item {\tt goldenstart}:
\end{itemize}
\end{itemize}
\section{ZipOS}
\section{ZipOS}
\subsection{System Calls}
\subsection{System Calls}
\begin{itemize}
\begin{itemize}
\item {\tt int wait(unsigned event\_mask, int timeout)}
\item {\tt int wait(unsigned event\_mask, int timeout)}
\item {\tt int clear(unsigned event\_mask, int timeout)}
\item {\tt int clear(unsigned event\_mask, int timeout)}
\item {\tt void post(unsigned event\_mask)}
\item {\tt void post(unsigned event\_mask)}
\item {\tt void yield(void) }
\item {\tt void yield(void) }
\item {\tt int read(int fid, void *buf, int len)}
\item {\tt int read(int fid, void *buf, int len)}
\item {\tt int write(int fid, void *buf, int len)}
\item {\tt int write(int fid, void *buf, int len)}
\item {\tt unsigned time(void) }
\item {\tt unsigned time(void) }
% \item SEMGET
% \item SEMGET
% \item SEMPUT
% \item SEMPUT
\item {\tt void *malloc(void)}
\item {\tt void *malloc(void)}
\item {\tt void free(void *buf)}
\item {\tt void free(void *buf)}
% \item FORK
% \item FORK
% \item opendir
% \item opendir
% \item EXEC
% \item EXEC
% \item OPEN
% \item OPEN
\end{itemize}
\end{itemize}
\subsection{Scheduler}
\subsection{Scheduler}
 
 
\chapter{Operation}\label{ch:operation}
\chapter{Operation}\label{ch:operation}
 
 
\chapter{Registers}\label{ch:registers}
\chapter{Registers}\label{ch:registers}
There are several address regions within the {\tt OpenArty}, as shown in
There are several address regions within the {\tt OpenArty}, as shown in
Tbl.~\ref{tbl:memregions}.
Tbl.~\ref{tbl:memregions}.
\begin{table}[htbp]
\begin{table}[htbp]
\begin{center}\begin{tabular}{|p{2.25in}|p{0.6in}|p{0.45in}|p{2.0in}|}\hline
\begin{center}\begin{tabular}{|p{2.25in}|p{0.6in}|p{0.35in}|p{2.0in}|}\hline
\rowcolor[gray]{0.85} Binary Address & Base & Size(W) & Purpose \\\hline\hline
\rowcolor[gray]{0.85} Binary Address & \multicolumn{1}{c|}{Base} & \multicolumn{1}{c|}{Size} & Purpose \\\hline\hline
\scalebox{0.9}{\tt 0000 0000 0000 0000 0001 000x xxxx} & \scalebox{0.9}{\tt 0x00000100} & \hfill 32 & Peripheral I/O Control \\\hline
\scalebox{0.8}{\tt 00 0000 0000 0000 0000 0100 0xxx xx--} & \scalebox{0.9}{\tt 0x00000400} & \hfill 128 & Peripheral I/O Control \\\hline
\scalebox{0.9}{\tt 0000 0000 0000 0000 0001 0010 0yyx} & \scalebox{0.9}{\tt 0x00000120} & \hfill 8 & Debug scope control\\\hline
\scalebox{0.8}{\tt 00 0000 0000 0000 0000 0100 100y yx--} & \scalebox{0.9}{\tt 0x00000480} & \hfill 32& Debug scope control\\\hline
\scalebox{0.9}{\tt 0000 0000 0000 0000 0001 0010 10xx} & \scalebox{0.9}{\tt 0x00000128} & \hfill 4 & RTC control\\\hline
\scalebox{0.8}{\tt 00 0000 0000 0000 0000 0100 1010 xx--} & \scalebox{0.9}{\tt 0x000004a0} & \hfill 16 & RTC control\\\hline
\scalebox{0.9}{\tt 0000 0000 0000 0000 0001 0010 11xx} & \scalebox{0.9}{\tt 0x0000012c} & \hfill 4 & SDCard controller\\\hline
\scalebox{0.8}{\tt 00 0000 0000 0000 0000 0100 1011 xx--} & \scalebox{0.9}{\tt 0x000004b0} & \hfill 16 & OLEDrgb control\\\hline
\scalebox{0.9}{\tt 0000 0000 0000 0000 0001 0011 00xx} & \scalebox{0.9}{\tt 0x00000130} & \hfill 4 & GPS Clock loop control\\\hline
\scalebox{0.8}{\tt 00 0000 0000 0000 0000 0100 1100 xx--} & \scalebox{0.9}{\tt 0x000004c0} & \hfill 16 & AUX UART\\\hline
\scalebox{0.9}{\tt 0000 0000 0000 0000 0001 0011 01xx} & \scalebox{0.9}{\tt 0x00000134} & \hfill 4 & OLEDrgb control\\\hline
\scalebox{0.8}{\tt 00 0000 0000 0000 0000 0100 1101 xx--} & \scalebox{0.9}{\tt 0x000004d0} & \hfill 16 & GPS UART\\\hline
\scalebox{0.9}{\tt 0000 0000 0000 0000 0001 0011 1xxx} & \scalebox{0.9}{\tt 0x00000138} & \hfill 8 & Network packet interface\\\hline
\scalebox{0.8}{\tt 00 0000 0000 0000 0000 0100 1110 xx--} & \scalebox{0.9}{\tt 0x000004e0} & \hfill 16 & SDCard controller\\\hline
\scalebox{0.9}{\tt 0000 0000 0000 0000 0001 0100 0xxx} & \scalebox{0.9}{\tt 0x00000140} & \hfill 8 & GPS Testbench\\\hline
\scalebox{0.8}{\tt 00 0000 0000 0000 0000 0101 0000 xx--} & \scalebox{0.9}{\tt 0x00000500} & \hfill 16 & GPS Clock loop control\\\hline
\scalebox{0.9}{\tt 0000 0000 0000 0000 0001 0100 1xxx} & \scalebox{0.9}{\tt 0x00000148} & \hfill  8 & {\em Unused}\\\hline
%\scalebox{0.8}{\tt 00 0000 0000 0000 0001 0101 0001 ----} & \scalebox{0.9}{\tt 0x00000148} & \hfill 16 & {\em Unused}\\\hline
\scalebox{0.9}{\tt 0000 0000 0000 0000 0001 0101 xxxx} & \scalebox{0.9}{\tt 0x00000150} & \hfill 16 & {\em Unused}\\\hline
\scalebox{0.8}{\tt 00 0000 0000 0000 0000 0101 001x xx--} & \scalebox{0.9}{\tt 0x00000520} & \hfill 32 & GPS Testbench\\\hline
\scalebox{0.9}{\tt 0000 0000 0000 0000 0001 011x xxxx} & \scalebox{0.9}{\tt 0x00000160} & \hfill 32 & {\em Unused}\\\hline
\scalebox{0.8}{\tt 00 0000 0000 0000 0000 0101 010x xx--} & \scalebox{0.9}{\tt 0x00000540} & \hfill 32 & Network packet interface\\\hline
\scalebox{0.9}{\tt 0000 0000 0000 0000 0001 100x xxxx} & \scalebox{0.9}{\tt 0x00000180} & \hfill 32 & {\em Unused}\\\hline
%\scalebox{0.8}{\tt 00 0000 0000 0000 0001 0101 011- ----} & \scalebox{0.9}{\tt 0x00000150} & \hfill 16 & {\em Unused}\\\hline
\scalebox{0.9}{\tt 0000 0000 0000 0000 0001 101x xxxx} & \scalebox{0.9}{\tt 0x000001a0} & \hfill 32 & Ethernet configuration registers\\\hline
\scalebox{0.8}{\tt 00 0000 0000 0000 0000 0101 1xxx xx--} & \scalebox{0.9}{\tt 0x00000580} & \hfill 128 & Ethernet MIO configuration\\\hline
\scalebox{0.9}{\tt 0000 0000 0000 0000 0001 110x xxxx} & \scalebox{0.9}{\tt 0x000001c0} & \hfill 32 & Extended Flash Control Port\\\hline
\scalebox{0.8}{\tt 00 0000 0000 0000 0000 0110 0xxx xx--} & \scalebox{0.9}{\tt 0x00000600} & \hfill 128 & Extended Flash Control Port\\\hline
\scalebox{0.9}{\tt 0000 0000 0000 0000 0001 111x xxxx} & \scalebox{0.9}{\tt 0x000001e0} & \hfill 32 & ICAPE2 Configuration Port\\\hline
\scalebox{0.8}{\tt 00 0000 0000 0000 0000 0110 1xxx xx--} & \scalebox{0.9}{\tt 0x00000680} & \hfill 128 & ICAPE2 Configuration Port\\\hline
\scalebox{0.9}{\tt 0000 0000 0000 0000 10xx xxxx xxxx} & \scalebox{0.9}{\tt 0x00000800} & \hfill 1k & Ethernet RX Buffer\\\hline
%\scalebox{0.8}{\tt 00 0000 0000 0000 0000 0111 ---- ----} & \scalebox{0.9}{\tt 0x00000150} & \hfill 16 & {\em Unused}\\\hline
\scalebox{0.9}{\tt 0000 0000 0000 0000 11xx xxxx xxxx} & \scalebox{0.9}{\tt 0x00000c00} & \hfill 1k & Ethernet TX Buffer\\\hline
%\scalebox{0.8}{\tt 00 0000 0000 0000 0000 1--- ---- ----} & \scalebox{0.9}{\tt 0x00000150} & \hfill 16 & {\em Unused}\\\hline
\scalebox{0.9}{\tt 0000 0000 0000 1xxx xxxx xxxx xxxx} & \scalebox{0.9}{\tt 0x00008000} & \hfill 32k & On-chip Block RAM\\\hline
%\scalebox{0.8}{\tt 00 0000 0000 0000 0001 ---- ---- ----} & \scalebox{0.9}{\tt 0x00000150} & \hfill 16 & {\em Unused}\\\hline
\scalebox{0.9}{\tt 0000 01xx xxxx xxxx xxxx xxxx xxxx} & \scalebox{0.9}{\tt 0x00400000} & \hfill 4M & QuadSPI Flash\\\hline
\scalebox{0.8}{\tt 00 0000 0000 0000 0010 xxxx xxxx xxxx} & \scalebox{0.9}{\tt 0x00002000} & \hfill 4k & Ethernet RX Buffer\\\hline
\scalebox{0.9}{\tt 0000 0100 0000 0000 0000 0000 0000} & \scalebox{0.9}{\tt 0x00400000} & & Configuration Start\\\hline
\scalebox{0.8}{\tt 00 0000 0000 0000 0011 xxxx xxxx xxxx} & \scalebox{0.9}{\tt 0x00003000} & \hfill 4k & Ethernet TX Buffer\\\hline
\scalebox{0.9}{\tt 0000 0100 0111 0000 0000 0000 0000} & \scalebox{0.9}{\tt 0x00470000} & & Alternate Configuration\\\hline
\scalebox{0.8}{\tt 00 0000 0000 001x xxxx xxxx xxxx xxxx} & \scalebox{0.9}{\tt 0x00020000} & \hfill 128k & On-chip Block RAM\\\hline
\scalebox{0.9}{\tt 0000 0100 1110 0000 0000 0000 0000} & \scalebox{0.9}{\tt 0x004e0000} & & CPU Reset Address\\\hline
\scalebox{0.8}{\tt 00 0001 xxxx xxxx xxxx xxxx xxxx xxxx} & \scalebox{0.9}{\tt 0x01000000} & \hfill 16M & QuadSPI Flash\\\hline
\scalebox{0.9}{\tt 01xx xxxx xxxx xxxx xxxx xxxx xxxx} & \scalebox{0.9}{\tt 0x04000000} & \hfill 64M & DDR3 SDRAM\\\hline
\scalebox{0.8}{\tt 00 0001 0000 0000 0000 0000 0000 0000} & \scalebox{0.9}{\tt 0x01000000} & & Configuration Start\\\hline
\scalebox{0.9}{\tt 1000 0000 0000 0000 0000 0000 000x} & \scalebox{0.9}{\tt 0x08000000} & \hfill 2 & ZipCPU debug control port---only visible to debug WB master\\\hline
\scalebox{0.8}{\tt 00 0001 0100 0111 0000 0000 0000 0000} & \scalebox{0.9}{\tt 0x011c0000} & & Alternate Configuration\\\hline
 
\scalebox{0.8}{\tt 00 0001 0000 1110 0000 0000 0000 0000} & \scalebox{0.9}{\tt 0x01380000} & & CPU Reset Address\\\hline
 
\scalebox{0.8}{\tt 01 xxxx xxxx xxxx xxxx xxxx xxxx xxxx} & \scalebox{0.9}{\tt 0x10000000} & \hfill 256M & DDR3 SDRAM\\\hline
 
\scalebox{0.8}{\tt 10 0000 0000 0000 0000 0000 0000 0x00} & \scalebox{0.9}{\tt 0x20000000} & \hfill 8 & ZipCPU debug control port---only visible to debug WB master\\\hline
\end{tabular}
\end{tabular}
\caption{Address Regions}\label{tbl:memregions}
\caption{Address Regions}\label{tbl:memregions}
\end{center}\end{table}
\end{center}\end{table}
These address regions include both read and write memory regions, such as the
These address regions include both read and write memory regions, such as the
block RAM, the SDRAM, and the Ethernet TX buffer, as well as read only memory
block RAM, the SDRAM, and the Ethernet TX buffer, as well as read only memory
regions, such as the flash memory and the Ethernet RX buffer, as well as a
regions, such as the flash memory and the Ethernet RX buffer, as well as a
whole lot of memory mapped peripherals.  The purpose of this chapter will be
whole lot of memory mapped peripherals.  The purpose of this chapter will be
to describe how these memory mapped peripherals are organized, as well as
to describe how these memory mapped peripherals are organized, as well as
the specific details of how they may be used.
the specific details of how they may be used.
 
 
This address map information is also contained in a couple other locations.
This address map information is also contained in a couple other locations.
First, {\tt sw/host/regdefs.h} maps all of the OpenArty registers to
First, {\tt sw/host/regdefs.h} maps all of the OpenArty registers to
C++ names, whereas {\tt sw/host/regdefs.cpp} maps these C++ names to a more
C++ names, whereas {\tt sw/host/regdefs.cpp} maps these C++ names to a more
human readable form which is used by {\tt wbregs}.  Second, these registers
human readable form which is used by {\tt wbregs}.  Second, these registers
are also given names as part of several various structures within
are also given names as part of several various structures within
{\tt sw/board/artyboard.h}.  And then, of course, they are also listed here.
{\tt sw/board/artyboard.h}.  And then, of course, they are also listed here.
 
 
\section{ZipSystem}
\section{ZipSystem}
The ZipSystem wrapper around the ZipCPU provides access to roughly twenty
The ZipSystem wrapper around the ZipCPU provides access to roughly twenty
registers that are tightly integrated with the ZipCPU.  These registers are
registers that are tightly integrated with the ZipCPU.  These registers are
shown in Tbl.~\ref{tbl:zipio}
shown in Tbl.~\ref{tbl:zipio}
\begin{table}[htbp]
\begin{table}[htbp]
\begin{center}\begin{tabular}{|p{0.9in}|p{0.45in}|p{3.5in}|}\hline
\begin{center}\begin{tabular}{|p{0.9in}|p{0.35in}|p{2.5in}|}\hline
\rowcolor[gray]{0.85} Base & Size(W) & Purpose \\\hline\hline
\rowcolor[gray]{0.85} Address & \multicolumn{1}{c|}{Size} & Purpose \\\hline\hline
\scalebox{0.9}{\tt 0xc0000000} & 1 & Primary Zip PIC\\\hline
\scalebox{0.9}{\tt 0xff000000} & 4 & Primary Zip PIC\\\hline
\scalebox{0.9}{\tt 0xc0000001} & 1 & Watchdog Timer\\\hline
\scalebox{0.9}{\tt 0xff000004} & 4 & Watchdog Timer\\\hline
\scalebox{0.9}{\tt 0xc0000002} & 1 & Bus Watchdog Timer\\\hline
\scalebox{0.9}{\tt 0xff000008} & 4 & Bus Watchdog Timer\\\hline
\scalebox{0.9}{\tt 0xc0000003} & 1 & Alternate Zip PIC\\\hline
\scalebox{0.9}{\tt 0xff00000c} & 4 & Alternate Zip PIC\\\hline
\scalebox{0.9}{\tt 0xc0000004} & 1 & ZipTimer-A\\\hline
\scalebox{0.9}{\tt 0xff000010} & 4 & ZipTimer-A\\\hline
\scalebox{0.9}{\tt 0xc0000005} & 1 & ZipTimer-B\\\hline
\scalebox{0.9}{\tt 0xff000014} & 4 & ZipTimer-B\\\hline
\scalebox{0.9}{\tt 0xc0000006} & 1 & ZipTimer-C\\\hline
\scalebox{0.9}{\tt 0xff000018} & 4 & ZipTimer-C\\\hline
\scalebox{0.9}{\tt 0xc0000007} & 1 & ZipJiffies\\\hline
\scalebox{0.9}{\tt 0xff00001c} & 4 & ZipJiffies\\\hline
\scalebox{0.9}{\tt 0xc0000008} & 1 & Master task counter\\\hline
%
\scalebox{0.9}{\tt 0xc0000009} & 1 & Master prefetch stall counter\\\hline
\scalebox{0.9}{\tt 0xff000020} & 4 & Master task counter\\\hline
\scalebox{0.9}{\tt 0xc000000a} & 1 & Master memory stall counter\\\hline
\scalebox{0.9}{\tt 0xff000024} & 4 & Master prefetch stall counter\\\hline
\scalebox{0.9}{\tt 0xc000000b} & 1 & Master instruction counter\\\hline
\scalebox{0.9}{\tt 0xff000028} & 4 & Master memory stall counter\\\hline
\scalebox{0.9}{\tt 0xc000000c} & 1 & User task counter\\\hline
\scalebox{0.9}{\tt 0xff00002c} & 4 & Master instruction counter\\\hline
\scalebox{0.9}{\tt 0xc000000d} & 1 & User prefetch stall counter\\\hline
\scalebox{0.9}{\tt 0xff000030} & 4 & User task counter\\\hline
\scalebox{0.9}{\tt 0xc000000e} & 1 & User memory stall counter\\\hline
\scalebox{0.9}{\tt 0xff000034} & 4 & User prefetch stall counter\\\hline
\scalebox{0.9}{\tt 0xc000000f} & 1 & User instruction counter\\\hline
\scalebox{0.9}{\tt 0xff000038} & 4 & User memory stall counter\\\hline
\scalebox{0.9}{\tt 0xc0000010} & 1 & DMA command register\\\hline
\scalebox{0.9}{\tt 0xff00003c} & 4 & User instruction counter\\\hline
\scalebox{0.9}{\tt 0xc0000011} & 1 & DMA length\\\hline
%
\scalebox{0.9}{\tt 0xc0000012} & 1 & DMA source address\\\hline
\scalebox{0.9}{\tt 0xff000040} & 4 & DMA command register\\\hline
\scalebox{0.9}{\tt 0xc0000013} & 1 & DMA destination address\\\hline
\scalebox{0.9}{\tt 0xff000044} & 4 & DMA length\\\hline
\scalebox{0.9}{\tt 0xc0000040} & 2 & {\em Reserved for MMU context register}\\\hline
\scalebox{0.9}{\tt 0xff000048} & 4 & DMA source address\\\hline
\scalebox{0.9}{\tt 0x0c0000080} & 32 & {\em Reserved for MMU TLB}\\\hline
\scalebox{0.9}{\tt 0xff00004c} & 4 & DMA destination address\\\hline
 
%
 
\scalebox{0.9}{\tt 0xff000050} & 8 & {\em Reserved for MMU context register}\\\hline
 
\scalebox{0.9}{\tt 0xff8xxxxx} & ? & {\em Reserved for MMU TLB}\\\hline
\end{tabular}
\end{tabular}
\caption{ZipSystem Addresses}\label{tbl:zipio}
\caption{ZipSystem Addresses}\label{tbl:zipio}
\end{center}\end{table}
\end{center}\end{table}
and described in detail within the ZipCPU specification.
and described in detail within the ZipCPU specification.
 
 
Unlike the rest of the address map, these registers are only visible to the
Unlike the rest of the address map, these registers are only visible to the
ZipCPU.  While many of them may be read via the debug port, in general accessing
ZipCPU.  While many of them may be read via the debug port, in general accessing
these registers via the {\tt wbregs} command is not so straight forward.
these registers via the {\tt wbregs} command is not so straight forward.
 
 
\section{Peripheral I/O Control}
\section{Peripheral I/O Control}
The first section of memory--mapped I/O for the ZipCPU is found near address
The first section of memory--mapped I/O for the ZipCPU is found near address
{\tt 0x100}.  These peripherals are specifically peripherals that can be
{\tt 0x100}.  These peripherals are specifically peripherals that can be
accessed without ever stalling the bus, and with a known and fixed (minimum)
accessed without ever stalling the bus, and with a known and fixed (minimum)
delay.  Tbl.~\ref{tbl:ioregs}
delay.  Tbl.~\ref{tbl:ioregs}
\begin{table}[htbp]
\begin{table}[htbp]
\begin{center}\begin{reglist}
\begin{center}\begin{reglist}
VERSION  &\scalebox{0.8}{\tt 0x0100} & 32 & R & Build date\\\hline
VERSION  &\scalebox{0.8}{\tt 0x0400} & 32 & R & Build date\\\hline
PIC      &\scalebox{0.8}{\tt 0x0101} & 32 & R/W & Bus Interrupt Controller \\\hline
PIC      &\scalebox{0.8}{\tt 0x0404} & 32 & R/W & Bus Interrupt Controller \\\hline
BUSERR   &\scalebox{0.8}{\tt 0x0102} & 32 & R & Last Bus Error Address\\\hline
BUSERR   &\scalebox{0.8}{\tt 0x0408} & 32 & R & Last Bus Error Address\\\hline
PWRCOUNT &\scalebox{0.8}{\tt 0x0103} & 32 & R & Ticks since startup\\\hline
PWRCOUNT &\scalebox{0.8}{\tt 0x040c} & 32 & R & Ticks since startup (roughly)\\\hline
BTNSW    &\scalebox{0.8}{\tt 0x0104} & 32 & R/W & Button/Switch controller\\\hline
BTNSW    &\scalebox{0.8}{\tt 0x0410} & 32 & R/W & Button/Switch controller\\\hline
LEDCTRL  &\scalebox{0.8}{\tt 0x0105} & 32 & R/W & LED Controller \\\hline
LEDCTRL  &\scalebox{0.8}{\tt 0x0414} & 32 & R/W & LED Controller \\\hline
AUXSETUP &\scalebox{0.8}{\tt 0x0106} & 29 & R/W & Auxilliary UART config\\\hline
RTCDATE  &\scalebox{0.8}{\tt 0x0418} & 32 & R/W & BCD Calendar Date\\\hline
GPSSETUP &\scalebox{0.8}{\tt 0x0107} & 29 & R/W & GPS UART config\\\hline
GPIO     &\scalebox{0.8}{\tt 0x041c} & 32 & R/W & GPIO controller\\\hline
CLR-LEDx &\scalebox{0.8}{\tt 0x0108-b} & 32 & R/W & Color LED controller\\\hline
CLR-LEDx &\scalebox{0.8}{\tt 0x0420-c} & 32 & R/W & Color LED controller\\\hline
RTCDATE  &\scalebox{0.8}{\tt 0x010c} & 32 & R/W & BCD Calendar Date\\\hline
GPSSECS  &\scalebox{0.8}{\tt 0x0430} & 32 & R/W & {\em Reserved for a one-up seconds counter}\\\hline
GPIO     &\scalebox{0.8}{\tt 0x010d} & 32 & R/W & {\em Reserved for} GPIO controller\\\hline
GPSSUB   &\scalebox{0.8}{\tt 0x0414} & 32 & R/W & GPS PPS tracking subsecond info\\\hline
UARTRX   &\scalebox{0.8}{\tt 0x010e} & 32 & R/W & Aux UART receive byte\\\hline
GPSSTEP  &\scalebox{0.8}{\tt 0x0418} & 32 & R/W & Current GPS step size, units TBD\\\hline
UARTTX   &\scalebox{0.8}{\tt 0x010f} & 32 & R/W & Aux UART transmit byte\\\hline
% Unused  &\scalebox{0.8}{\tt 0x041c--0x047f} & 32 & {\em Unused, writes ignored, returns zero upon read}\\\hline
GPSRX    &\scalebox{0.8}{\tt 0x0110} & 32 & R/W & GPS UART receive byte\\\hline
 
GPSTX    &\scalebox{0.8}{\tt 0x0111} & 32 & R/W & GPS UART transmit byte\\\hline
 
GPSSECS  &\scalebox{0.8}{\tt 0x0112} & 32 & R/W & {\em Reserved for a one-up seconds counter}\\\hline
 
GPSSUB   &\scalebox{0.8}{\tt 0x0113} & 32 & R/W & GPS PPS tracking subsecond info\\\hline
 
GPSSTEP  &\scalebox{0.8}{\tt 0x0114} & 32 & R/W & Current GPS step size, units TBD\\\hline
 
% 0x010c-0x010f
% 0x010c-0x010f
\end{reglist}
\end{reglist}
 
% UARTRX   &\scalebox{0.8}{\tt 0x0430} & 32 & R/W & Aux UART receive byte\\\hline
 
% UARTTX   &\scalebox{0.8}{\tt 0x0434} & 32 & R/W & Aux UART transmit byte\\\hline
 
% GPSRX    &\scalebox{0.8}{\tt 0x0438} & 32 & R/W & GPS UART receive byte\\\hline
 
% GPSTX    &\scalebox{0.8}{\tt 0x0411} & 32 & R/W & GPS UART transmit byte\\\hline
 
% AUXSETUP &\scalebox{0.8}{\tt 0x0418} & 29 & R/W & Auxilliary UART config\\\hline
 
% GPSSETUP &\scalebox{0.8}{\tt 0x041c} & 29 & R/W & GPS UART config\\\hline
\caption{I/O Peripheral Registers}\label{tbl:ioregs}
\caption{I/O Peripheral Registers}\label{tbl:ioregs}
\end{center}\end{table}
\end{center}\end{table}
shows the addresses of these I/O peripherals included as part of OpenArty.
shows the addresses of these I/O peripherals included as part of OpenArty.
We'll walk through each of these peripherals in turn, describing how they work.
We'll walk through each of these peripherals in turn, describing how they work.
 
 
\subsection{Version}
\subsection{Version}
One of the simpler peripherals on the board is the {\tt VERSION} peripheral.
One of the simpler peripherals on the board is the {\tt VERSION} peripheral.
This simple returns the date stamp found within {\tt rtl/builddate.v}.  This
This simple returns the date stamp found within {\tt rtl/builddate.v}.  This
stamp is updated any time a {\tt make} command is issued in the main OpenArty
stamp is updated any time a {\tt make} command is issued in the main OpenArty
project directory.  Reads from this address return this value, writes to this
project directory.  Reads from this address return this value, writes to this
address are ignored.
address are ignored.
 
 
This peripheral is {\em very} useful, especially when trying to determine which
This peripheral is {\em very} useful, especially when trying to determine which
version of your configuration you are using, and whether or not the
version of your configuration you are using, and whether or not the
configuration has been changed or updated as you had intended by loading a new
configuration has been changed or updated as you had intended by loading a new
configuration, by writing a configuration to the flash and issuing an IPROG
configuration, by writing a configuration to the flash and issuing an IPROG
command, etc.
command, etc.
 
 
\subsection{Interrupt Controller}
\subsection{Interrupt Controller}
The OpenArty design maintains three interrupt controllers.  Two of them
The OpenArty design maintains three interrupt controllers.  Two of them
(a primary and an auxiliary) are found within the ZipSystem, and the third is
(a primary and an auxiliary) are found within the ZipSystem, and the third is
located on the bus itself.  In terms of functionality, all three interrupt
located on the bus itself.  In terms of functionality, all three interrupt
controllers are the same, and documented in the ZipCPU specification.  Of
controllers are the same, and documented in the ZipCPU specification.  Of
these, the primary interrupt controller for the
these, the primary interrupt controller for the
entire design is the primary interrupt controller within the ZipSystem.
entire design is the primary interrupt controller within the ZipSystem.
This interrupt controller accepts as inputs, the output of the auxilliary
This interrupt controller accepts as inputs, the output of the auxilliary
interrupt controller.
interrupt controller.
Hence, even though the CPU only supports a single interrupt line, by cascading
Hence, even though the CPU only supports a single interrupt line, by cascading
it with a second controller, many more interrupts can be supported.
it with a second controller, many more interrupts can be supported.
 
 
The third interrupt controller is the bus interrupt controller.  While the
The third interrupt controller is the bus interrupt controller.  While the
CPU can read and write this controller, the interrupt line from this controller
CPU can read and write this controller, the interrupt line from this controller
goes to the host interface.  If you see, as an example, an \hbox{``> 4''} in
goes to the host interface.  If you see, as an example, an \hbox{``> 4''} in
your {\tt netuart} window, then you will know that OpenArty has sent an
your {\tt netuart} window, then you will know that OpenArty has sent an
interrupt to a waiting host program.  If what you saw instead was a
interrupt to a waiting host program.  If what you saw instead was a
\hbox{``\# 4''}, then the interrupt was sent, but no one was listening.
\hbox{``\# 4''}, then the interrupt was sent, but no one was listening.
 
 
The primary interrupt controller handles interrupts from the sources listed
The primary interrupt controller handles interrupts from the sources listed
in Tbl.~\ref{tbl:sys-ints}.
in Tbl.~\ref{tbl:sys-ints}.
\begin{table}[htbp]
\begin{table}[htbp]
\begin{center}\begin{tabular}{|p{0.9in}|p{0.75in}|p{0.75in}|p{3.00in}|}\hline
\begin{center}\begin{tabular}{|p{1.0in}|c|r|p{3.00in}|}\hline
\rowcolor[gray]{0.85} Name & Bit Mask & DMAC ID &Description \\\hline\hline
\rowcolor[gray]{0.85} Name & Bit Mask & DMAC ID &Description \\\hline\hline
SYS\_DMAC   & 0x0001 && The DMA controller is idle.\\\hline
SYS\_DMAC   & 0x0001 && The DMA controller is idle.\\\hline
SYS\_JIF    & 0x0002 & 1 & A Jiffies timer has expired.\\\hline
SYS\_JIF    & 0x0002 & 1 & A Jiffies timer has expired.\\\hline
SYS\_TMC    & 0x0004 & 2 & Timer C has timed out.\\\hline
SYS\_TMC    & 0x0004 & 2 & Timer C has timed out.\\\hline
SYS\_TMB    & 0x0008 & 3 & Timer C has timed out.\\\hline
SYS\_TMB    & 0x0008 & 3 & Timer C has timed out.\\\hline
SYS\_TMA    & 0x0010 & 4 & Timer C has timed out.\\\hline
SYS\_TMA    & 0x0010 & 4 & Timer C has timed out.\\\hline
SYS\_AUX    & 0x0020 & 5 & The auxilliary interrupt controller sends an interrupt\\\hline
SYS\_AUX    & 0x0020 & 5 & The auxilliary interrupt controller sends an interrupt\\\hline
SYS\_PPS    & 0x0040 & 6 & An interrupt marking the top of the second\\\hline
SYS\_PPS    & 0x0040 & 6 & An interrupt marking the top of the second\\\hline
SYS\_NETRX  & 0x0080 & 7 & A packet has been received via the network\\\hline
SYS\_NETRX  & 0x0080 & 7 & A packet has been received via the network\\\hline
SYS\_NETTX  & 0x0100 & 8 & The network controller is idle, having sent its
SYS\_NETTX  & 0x0100 & 8 & The network controller is idle, having sent its
                        last packet\\\hline
                        last packet\\\hline
SYS\_UARTRX & 0x200 &  9 & A character has been received via the UART\\\hline
SYS\_UARTRXF & 0x0200 &  9 & The receive UART FIFO is half-full\\\hline
SYS\_UARTTX & 0x400 & 10 & The transmit UART is idle, and ready for its next
SYS\_UARTTXF & 0x0400 & 10 & The transmit UART FIFO is less than half-full\\\hline
                character.\\\hline
SYS\_GPSRXF  & 0x0800 & 11 & The GPS receive UART FIFO is half-full\\\hline
SYS\_GPSRX  & 0x0800 & 11 & A character has been received via GPS\\\hline
SYS\_GPSTXF  & 0x1000 & 12 & The GPS transmit UART FIFO is half-empty\\\hline
SYS\_GPSTX  & 0x1000 & 12 & The GPS serial port transmit is idle\\\hline
SYS\_BUS    & 0x2000 & 13 & The BUS interrupt controller sends an interrupt\\\hline
SYS\_SDCARD & 0x2000 & 13 & The SD-Card controller has become idle\\\hline
 
SYS\_OLED   & 0x4000 & 14 & The OLED port is idle\\\hline
SYS\_OLED   & 0x4000 & 14 & The OLED port is idle\\\hline
\end{tabular}
\end{tabular}
\caption{Primary System Interrupts}\label{tbl:sys-ints}
\caption{Primary System Interrupts}\label{tbl:sys-ints}
\end{center}\end{table}
\end{center}\end{table}
These interrupts are listed together with the
These interrupts are listed together with the
mask that would need to be used when referencing them to the interrupt
mask that would need to be used when referencing them to the interrupt
controller.  In a similar fashion, the auxilliary interrupt controller accepts
controller.  In a similar fashion, the auxilliary interrupt controller accepts
inputs from the sources listed in Tbl.~\ref{tbl:aux-ints}.
inputs from the sources listed in Tbl.~\ref{tbl:aux-ints}.
\begin{table}[htbp]
\begin{table}[htbp]
\begin{center}\begin{tabular}{|p{0.9in}|p{0.75in}|p{0.75in}|p{3.00in}|}\hline
\begin{center}\begin{tabular}{|p{0.9in}|c|r|p{3.00in}|}\hline
\rowcolor[gray]{0.85} Name & Bit Mask & DMAC ID &Description \\\hline\hline
\rowcolor[gray]{0.85} Name & Bit Mask & DMAC ID &Description \\\hline\hline
AUX\_UIC & 0x0001 & 16 & The user instruction counter has overflowed.\\\hline
AUX\_UIC & 0x0001 & 16 & The user instruction counter has overflowed.\\\hline
AUX\_UPC & 0x0002 & 17 & The user prefetch stall counter has overflowed.\\\hline
AUX\_UPC & 0x0002 & 17 & The user prefetch stall counter has overflowed.\\\hline
AUX\_UOC & 0x0004 & 18 & The user ops stall counter has overflowed.\\\hline
AUX\_UOC & 0x0004 & 18 & The user ops stall counter has overflowed.\\\hline
AUX\_UTC & 0x0008 & 19 & The user clock tick counter has overflowed.\\\hline
AUX\_UTC & 0x0008 & 19 & The user clock tick counter has overflowed.\\\hline
AUX\_MIC & 0x0010 & 20 & The supervisor instruction counter has overflowed.\\\hline
AUX\_MIC & 0x0010 & 20 & The supervisor instruction counter has overflowed.\\\hline
AUX\_MPC & 0x0020 & 21 & The supervisor prefetch stall counter has overflowed.\\\hline
AUX\_MPC & 0x0020 & 21 & The supervisor prefetch stall counter has overflowed.\\\hline
AUX\_MOC & 0x0040 & 22 & The supervisor ops stall counter has overflowed.\\\hline
AUX\_MOC & 0x0040 & 22 & The supervisor ops stall counter has overflowed.\\\hline
AUX\_MTC & 0x0080 & 23 & The supervisor clock tick counter has overflowed.\\\hline
AUX\_MTC & 0x0080 & 23 & The supervisor clock tick counter has overflowed.\\\hline
AUX\_RTC    & 0x0100 & 24& An alarm or timer has taken place (assuming the RTC
%
                is installed, and includes both alarm or timer)\\\hline
AUX\_PPD    & 0x0100 & 24& True at midnight\\\hline
AUX\_BTN    & 0x0200 & 25 & A button has been pressed\\\hline
AUX\_UARTRX & 0x0200 & 25& A byte has been received from the AUX UART port and is ready to be read\\\hline
AUX\_SWITCH & 0x0400 & 26 & A switch has changed state\\\hline
AUX\_UARTTX & 0x0400 & 26& There's room for another byte in the TXFIFO queue\\\hline
AUX\_FLASH  & 0x0800 & 27 & The flash controller has completed a write/erase cycle\\\hline
AUX\_GPSRX  & 0x0800 & 27& A byte has been received in the GPS UART interface, and is now ready to be read\\\hline
AUX\_SCOPE  & 0x1000 & 28 & The Scope has completed its collection\\\hline
AUX\_GPSTX  & 0x1000 & 28& There's room in the GPS UART transmit FIFO for another byte\\\hline
AUX\_GPIO   & 0x2000 & 29 & The GPIO input lines have changed values.\\\hline
 
\end{tabular}
\end{tabular}
\caption{Auxilliary System Interrupts}\label{tbl:aux-ints}
\caption{Auxilliary System Interrupts}\label{tbl:aux-ints}
\end{center}\end{table}
\end{center}\end{table}
These interrupt mask constants are also defined in {\tt sw/board/artyboard.h}
These interrupt mask constants are also defined in {\tt sw/board/artyboard.h}
and {\tt sw/board/zipsys.h}.
and {\tt sw/board/zipsys.h}.
 
 
Finally, the bus interrupt controller handles the interrupts from the sources
Finally, the bus interrupt controller handles the interrupts from the sources
listed in Tbl.~\ref{tbl:bus-ints}.
listed in Tbl.~\ref{tbl:bus-ints}.
\begin{table}[htbp]
\begin{table}[htbp]
\begin{center}\begin{tabular}{|p{0.9in}|p{0.75in}|p{3.75in}|}\hline
\begin{center}\begin{tabular}{|p{0.9in}|c|p{3.75in}|}\hline
\rowcolor[gray]{0.85} Name & Bit Mask & Description \\\hline\hline
\rowcolor[gray]{0.85} Name & Bit Mask & Description \\\hline\hline
BUS\_BUTTON & 0x0001 & A Button has been pressed. \\\hline
BUS\_BUTTON & 0x0001 & A Button has been pressed. \\\hline
BUS\_SWITCH & 0x0002 & The Scope has completed its collection\\\hline
BUS\_SWITCH & 0x0002 & The Scope has completed its collection\\\hline
BUS\_PPS    & 0x0004 & Top of the second\\\hline
BUS\_PPS    & 0x0004 & Top of the second\\\hline
BUS\_RTC    & 0x0008 & An alarm or timer has taken place (assuming the RTC
BUS\_RTC    & 0x0008 & An alarm or timer has taken place (assuming the RTC
                is installed, and includes both alarm or timer)\\\hline
                is installed, and includes both alarm or timer)\\\hline
BUS\_NETRX & 0x0010 & A packet has been received via the network\\\hline
BUS\_NETRX & 0x0010 & A packet has been received via the network\\\hline
BUS\_NETTX & 0x0020 & The network controller is idle, having sent its
BUS\_NETTX & 0x0020 & The network controller is idle, having sent its
                        last packet\\\hline
                        last packet\\\hline
BUS\_UARTRX & 0x0040 & A character has been received via the UART\\\hline
BUS\_UARTRX & 0x0040 & A character has been received via the UART\\\hline
BUS\_UARTTX & 0x0080 & The transmit UART is idle, and ready for its next
BUS\_UARTTX & 0x0080 & The transmit UART is idle, and ready for its next
                character.\\\hline
                character.\\\hline
BUS\_GPIO   & 0x0100 & The GPIO input lines have changed values.\\\hline
BUS\_GPIO   & 0x0100 & The GPIO input lines have changed values.\\\hline
BUS\_FLASH  & 0x0200 & The flash device has finished either its erase or
BUS\_FLASH  & 0x0200 & The flash device has finished either its erase or
                write cycle, and is ready for its next command. (Alternate
                write cycle, and is ready for its next command. (Alternate
        config only.)\\\hline
        config only.)\\\hline
BUS\_SCOPE  & 0x0400 & A scope has completed collecting.\\\hline
BUS\_SCOPE  & 0x0400 & A scope has completed collecting.\\\hline
BUS\_GPSRX  & 0x0800 & A character has been received via GPS\\\hline
BUS\_GPSRX  & 0x0800 & A character has been received via GPS\\\hline
BUS\_SDCARD & 0x1000 & The SD-Card controller has become idle\\\hline
BUS\_SDCARD & 0x1000 & The SD-Card controller has become idle\\\hline
BUS\_OLED   & 0x2000 & The OLED interface has become idle\\\hline
BUS\_OLED   & 0x2000 & The OLED interface has become idle\\\hline
BUS\_ZIP    & 0x4000 & True if the ZipCPU has come to a halt\\\hline
BUS\_ZIP    & 0x4000 & True if the ZipCPU has come to a halt\\\hline
\end{tabular}
\end{tabular}
\caption{Bus Interrupts}\label{tbl:bus-ints}
\caption{Bus Interrupts}\label{tbl:bus-ints}
\end{center}\end{table}
\end{center}\end{table}
You may notice that there is a lot of overlap between these interrupt sources.
You may notice that there is a lot of overlap between these interrupt sources.
That is so that the host can also receive many of the same interrupts the ZipCPU
That is so that the host can also receive many of the same interrupts the ZipCPU
can receive.
can receive.
 
 
\subsection{Last Bus Error Address}
\subsection{Last Bus Error Address}
Should an attempt be made to access a non--existant memory address, or should
Should an attempt be made to access a non--existant memory address, or should
multiple devices all return their data at the same time on the bus, a bus
multiple devices all return their data at the same time on the bus, a bus
error will be created.  When and if this happens, the address on the bus
error will be created.  When and if this happens, the address on the bus
when this error was created will be placed into the last bus error address.
when this error was created will be placed into the last bus error address.
This is the only way to set this address.
This is the only way to set this address.
 
 
\subsection{Power counter}
\subsection{Power counter}
Some peripherals may require a certain amount of time from power up or startup
Some peripherals may require a certain amount of time from power up or startup
until they can be accessed.  Guaranteeing this amount of time is the purpose
until they can be accessed.  Guaranteeing this amount of time is the purpose
of the power counter.  This simple read only register simply counts up from
of the power counter.  This simple read only register simply counts up from
zero on every clock, with the exception that once the high order bit is set
zero on every clock, with the exception that once the high order bit is set
then it is never cleared.
then it is never cleared.
 
 
\subsection{Button and Switch Register}
\subsection{Button and Switch Register}
btn-now / 4'h0 / btncfg / swcfg / btnstate / swstate
btn-now / 4'h0 / btncfg / swcfg / btnstate / swstate
The button and switch register includes a variety of fields for reading the
The button and switch register includes a variety of fields for reading the
current state of the buttons and switches, and for controlling the two related
current state of the buttons and switches, and for controlling the two related
interrupts.  The register is separated into several fields, however, as shown
interrupts.  The register is separated into several fields, however, as shown
in Fig.~\ref{fig:btnsw}.
in Fig.~\ref{fig:btnsw}.
\begin{figure}\begin{center}\begin{bytefield}[endianness=big]{32}
\begin{figure}\begin{center}\begin{bytefield}[endianness=big]{32}
\bitheader{0-31}\\
\bitheader{0-31}\\
\bitbox{8}{\em Ignored}
\bitbox{8}{\em Ignored}
\bitbox{4}{BNOW}
\bitbox{4}{BNOW}
\bitbox{4}{4'h0}
\bitbox{4}{4'h0}
\bitbox{4}{BCFG}
\bitbox{4}{BCFG}
\bitbox{4}{SCFG}
\bitbox{4}{SCFG}
\bitbox{4}{BTN}
\bitbox{4}{BTN}
\bitbox{4}{SW}
\bitbox{4}{SW}
\end{bytefield}
\end{bytefield}
\caption{Button/Switch register layout}\label{fig:btnsw}
\caption{Button/Switch register layout}\label{fig:btnsw}
\end{center}\end{figure}
\end{center}\end{figure}
The current state of the buttons and switches can be read through the {\tt BNOW}
The current state of the buttons and switches can be read through the {\tt BNOW}
and {\tt SW} bit--fields.
and {\tt SW} bit--fields.
 
 
The {\tt BTN} field contains one bit per button.  When a button is pressed,
The {\tt BTN} field contains one bit per button.  When a button is pressed,
the respective bit in this field will be set.  It will then remain set until
the respective bit in this field will be set.  It will then remain set until
cleared.  To clear a value in this bit--field, write a `1' to the position you
cleared.  To clear a value in this bit--field, write a `1' to the position you
wish to clear.
wish to clear.
 
 
Then {\tt BCFG} field controls which buttons will trigger a button interrupt.
Then {\tt BCFG} field controls which buttons will trigger a button interrupt.
Should a button be pressed while its corresponding value within this field
Should a button be pressed while its corresponding value within this field
is a `1', a button interrupt pulse will be issued.  To set a bit within this
is a `1', a button interrupt pulse will be issued.  To set a bit within this
field, you need to not only write the corresponding bit value, but you must
field, you need to not only write the corresponding bit value, but you must
also set an enable bit within the {\tt BTN} field.  Hence, writing a
also set an enable bit within the {\tt BTN} field.  Hence, writing a
{\tt 0x0f0f0} will set all of the bits within this field, while {\tt 0x0f000}
{\tt 0x0f0f0} will set all of the bits within this field, while {\tt 0x0f000}
will have no effect, and {\tt 0x0030} will clear two bits.  Notice also that,
will have no effect, and {\tt 0x0030} will clear two bits.  Notice also that,
when clearing a button press from the {\tt BTN} bits, the corresponding
when clearing a button press from the {\tt BTN} bits, the corresponding
{\tt BCFG} bits will also be cleared.
{\tt BCFG} bits will also be cleared.
 
 
Finally, the {\tt SCFG} field controls whether or not changing a switch value
Finally, the {\tt SCFG} field controls whether or not changing a switch value
will cause an interrupt.  As with the {\tt BCFG} field, changing a value
will cause an interrupt.  As with the {\tt BCFG} field, changing a value
in this register requires writing to the {\tt SW} field as an enable.
in this register requires writing to the {\tt SW} field as an enable.
 
 
The use of the enable bit--field lines was added so that reads and writes to
The use of the enable bit--field lines was added so that reads and writes to
this register wouldn't need special atomic access protections, so that some
this register wouldn't need special atomic access protections, so that some
configuration bits could be changed without setting all of them, and so that
configuration bits could be changed without setting all of them, and so that
changes during writes wouldn't go unnoticed.
changes during writes wouldn't go unnoticed.
 
 
\subsection{LED control register}
\subsection{LED control register}
The LED control register has a layout similar and enable field similar to that
The LED control register has a layout similar and enable field similar to that
of the button/switch control register.  These fields can be seen in
of the button/switch control register.  These fields can be seen in
Fig.~\ref{fig:ledctrl}
Fig.~\ref{fig:ledctrl}
\begin{figure}\begin{center}\begin{bytefield}[endianness=big]{32}
\begin{figure}\begin{center}\begin{bytefield}[endianness=big]{32}
\bitheader{0-31}\\
\bitheader{0-31}\\
\bitbox{24}{\em Ignored}
\bitbox{24}{\em Ignored}
\bitbox{4}{ENB}
\bitbox{4}{ENB}
\bitbox{4}{LED}
\bitbox{4}{LED}
\end{bytefield}
\end{bytefield}
\caption{LED control register layout}\label{fig:ledctrl}
\caption{LED control register layout}\label{fig:ledctrl}
\end{center}\end{figure}
\end{center}\end{figure}
The bottom four {\tt LED} bits of this register will always contain the current
The bottom four {\tt LED} bits of this register will always contain the current
state of the LEDs.  To change an LED's state, write to this register the new
state of the LEDs.  To change an LED's state, write to this register the new
state with the corresponding {\tt ENB} (enable) bit set.  Hence writing a
state with the corresponding {\tt ENB} (enable) bit set.  Hence writing a
{\tt 0x0c0} will turn off LED's two and three, while writing a {\tt 0x033} will
{\tt 0x0c0} will turn off LED's two and three, while writing a {\tt 0x033} will
set LED's zero and one, and writing a {\tt 0x0f} will be ignored.
set LED's zero and one, and writing a {\tt 0x0f} will be ignored.
 
 
\subsection{UART setup registers}
\subsection{UART setup registers}
There are two UART setup registers: one for controlling the PModUSBUART setup
There are two UART setup registers: one for controlling the PModUSBUART setup
and the other for controlling the PMod GPS NMEA UART.  These follow the format
and the other for controlling the PMod GPS NMEA UART.  These follow the format
given in the {\tt wbuart32} project, with a bit field shown in
given in the {\tt wbuart32} project, with a bit field shown in
Fig.~\ref{fig:uartsetup}.
Fig.~\ref{fig:uartsetup}.
\begin{figure}\begin{center}\begin{bytefield}[endianness=big]{32}
\begin{figure}\begin{center}\begin{bytefield}[endianness=big]{32}
\bitheader{0-31}\\
\bitheader{0-31}\\
\bitbox{2}{00}
\bitbox{2}{00}
\bitbox{2}{N}
\bitbox{2}{N}
\bitbox{1}{S}
\bitbox{1}{S}
\bitbox{1}{P}
\bitbox{1}{P}
\bitbox{1}{F}
\bitbox{1}{F}
\bitbox{1}{T}
\bitbox{1}{T}
\bitbox{24}{Clocks per Baud}
\bitbox{24}{Clocks per Baud}
\end{bytefield}
\end{bytefield}
\caption{UART setup register format}\label{fig:uartsetup}
\caption{UART setup register format}\label{fig:uartsetup}
\end{center}\end{figure}
\end{center}\end{figure}
In general, the only control needed to set these registers is to set their
In general, the only control needed to set these registers is to set their
baud rate based upon the number of clocks per baud.  Hence, to set a
baud rate based upon the number of clocks per baud.  Hence, to set a
9600~baud rate, given an 82.5~MHz clock rate, one would set this register to
9600~baud rate, given an 82.5~MHz clock rate, one would set this register to
{\tt 8594}.  The high order bits are designed so that writing a zero to them
{\tt 8594}.  The high order bits are designed so that writing a zero to them
sets the interface for 8--data bits, no parity, and one stop bit.
sets the interface for 8--data bits, no parity, and one stop bit.
 
 
The number of data bits may be adjusted by changing the $N$ field from zero,
The number of data bits may be adjusted by changing the $N$ field from zero,
for eight data bits, on up to three, for five data bits.
for eight data bits, on up to three, for five data bits.
 
 
The $S$ bit determines whether or not the system will insert and require an
The $S$ bit determines whether or not the system will insert and require an
extra stop bit.  Setting it to zero sets the system to require only a single
extra stop bit.  Setting it to zero sets the system to require only a single
stop bit.
stop bit.
 
 
The $P$ bit controls whether or not parity is enabled, and the $F$ bit controls
The $P$ bit controls whether or not parity is enabled, and the $F$ bit controls
whether or not the parity is fixed.  $T$ controls what type of parity is then
whether or not the parity is fixed.  $T$ controls what type of parity is then
used.  By setting $P$ to zero, parity checking and generation is turned off.
used.  By setting $P$ to zero, parity checking and generation is turned off.
 
 
Finally, the auxiliary UART (i.e. the PMod USBUART) defaults to 115,200 Baud,
Finally, the auxiliary UART (i.e. the PMod USBUART) defaults to 115,200 Baud,
8N1, whereas the GPS UART defaults to 9600 Baud, 8N1.  Both may be adjusted
8N1, whereas the GPS UART defaults to 9600 Baud, 8N1.  Both may be adjusted
via this register.
via this register.
 
 
\subsection{Color LED registers}
\subsection{Color LED registers}
 
 
Since the Arty has four color LEDs, the OpenArty has four register words to
Since the Arty has four color LEDs, the OpenArty has four register words to
control those LEDs.  These registers are split into three bit fields, an
control those LEDs.  These registers are split into three bit fields, an
8--bit red, 8--bit green, and an 8--bit blue bit field.  The top eight bits
8--bit red, 8--bit green, and an 8--bit blue bit field.  The top eight bits
are ignored.  Unlike many of the other OpenArty registers, these bit fields
are ignored.  Unlike many of the other OpenArty registers, these bit fields
may be read or written with no special enable values.
may be read or written with no special enable values.
 
 
\subsection{RTC date register}
\subsection{RTC date register}
The real--time--clock date register format is shown in Fig.~\ref{fig:rtcdate}.
The real--time--clock date register format is shown in Fig.~\ref{fig:rtcdate}.
\begin{figure}\begin{center}\begin{bytefield}[endianness=big]{32}
\begin{figure}\begin{center}\begin{bytefield}[endianness=big]{32}
\bitheader{0-31}\\
\bitheader{0-31}\\
\bitbox{16}{Year}
\bitbox{16}{Year}
        \bitbox{8}{Month}
        \bitbox{8}{Month}
        \bitbox{8}{Day}\\
        \bitbox{8}{Day}\\
\bitbox{4}{Y}
\bitbox{4}{Y}
        \bitbox{4}{Y} \bitbox{4}{Y} \bitbox{4}{Y}
        \bitbox{4}{Y} \bitbox{4}{Y} \bitbox{4}{Y}
\bitbox{4}{M} \bitbox{4}{M}
\bitbox{4}{M} \bitbox{4}{M}
\bitbox{4}{D} \bitbox{4}{D}\\
\bitbox{4}{D} \bitbox{4}{D}\\
\end{bytefield}
\end{bytefield}
\caption{RTC Date register layout}\label{fig:rtcdate}
\caption{RTC Date register layout}\label{fig:rtcdate}
\end{center}\end{figure}
\end{center}\end{figure}
This is also a very simple register, containing eight binary coded decimal
This is also a very simple register, containing eight binary coded decimal
(BCD) digits.  Due to the nature of this setup, the date can be read quickly
(BCD) digits.  Due to the nature of this setup, the date can be read quickly
from the hexadecimal value of the register, and dates can be compared validly
from the hexadecimal value of the register, and dates can be compared validly
to determine if a date is earlier or later than any other.  Writes to the
to determine if a date is earlier or later than any other.  Writes to the
date register will set the date, otherwise the date will automatically
date register will set the date, otherwise the date will automatically
increment whenever the Real Time Clock rolls over into the next day.
increment whenever the Real Time Clock rolls over into the next day.
 
 
Unlike the Linux {\tt ctime} system call, the month value ranges from
Unlike the Linux {\tt ctime} system call, the month value ranges from
one to twelve.  The day of the month ranges from 1~to 31, or whatever is
one to twelve.  The day of the month ranges from 1~to 31, or whatever is
appropriate for the current month.
appropriate for the current month.
 
 
\subsection{General Purpose I/O}
\subsection{General Purpose I/O}
% TODO
% TODO
The General Purpose I/O controller will be the same as the controller from the
The General Purpose I/O controller will be the same as the controller from the
S6~SoC once installed.
S6~SoC once installed.
 
 
\subsection{UART Data Registers}
\subsection{UART Data Registers}
Each of the two UARTs, PMod USBUART and PMod GPS, has two data registers and
Each of the two UARTs, PMod USBUART and PMod GPS, has two data registers and
two interrupts associated with it: one for receive and one for transmit.
two interrupts associated with it: one for receive and one for transmit.
As with the rest of the Arty I/O design, these are designed so that unused
As with the rest of the Arty I/O design, these are designed so that unused
extra bits will be zero, and can (usually) quietly be ignored.
extra bits will be zero, and can (usually) quietly be ignored.
 
 
The receive UART register format is shown in Fig.~\ref{fig:rxuart}.
The receive UART register format is shown in Fig.~\ref{fig:rxuart}.
\begin{figure}\begin{center}\begin{bytefield}[endianness=big]{32}
\begin{figure}\begin{center}\begin{bytefield}[endianness=big]{32}
\bitheader{0-31}\\
\bitheader{0-31}\\
\bitbox{20}{\em Always zero}
\bitbox{20}{\em Always zero}
\bitbox{1}{B} \bitbox{1}{F} \bitbox{1}{P} \bitbox{1}{I}
\bitbox{1}{B} \bitbox{1}{F} \bitbox{1}{P} \bitbox{1}{I}
\bitbox{8}{Data}\\
\bitbox{8}{Data}\\
\end{bytefield}
\end{bytefield}
\caption{Receive UART register layout}\label{fig:rxuart}
\caption{Receive UART register layout}\label{fig:rxuart}
\end{center}\end{figure}
\end{center}\end{figure}
This register may only be read, writes are silently ignored.  If no receive
This register may only be read, writes are silently ignored.  If no receive
value is present, the $I$ bit will be set.  If either a parity error, $P$, or
value is present, the $I$ bit will be set.  If either a parity error, $P$, or
frame error (stop bit not high), $F$, have occurred, those respective bits will
frame error (stop bit not high), $F$, have occurred, those respective bits will
be high.  The error bits are cleared upon successfully receiving a word across
be high.  The error bits are cleared upon successfully receiving a word across
the interface.  Finally, the $B$ bit indicates the line is in a {\tt BREAK}
the interface.  Finally, the $B$ bit indicates the line is in a {\tt BREAK}
condition.
condition.
 
 
The interface has been designed for one of two means of accessing it.  The
The interface has been designed for one of two means of accessing it.  The
interface may be polled.  In that case, anding the result with {\tt 0x0f00}
interface may be polled.  In that case, anding the result with {\tt 0x0f00}
will tell whether the result is invalid.  The interface may also be read upon
will tell whether the result is invalid.  The interface may also be read upon
a receive interrupt.  In that case, the same bit fields apply, but the $I$ bit
a receive interrupt.  In that case, the same bit fields apply, but the $I$ bit
will be guaranteed to be low.  Finally, the interrupt line will continue
will be guaranteed to be low.  Finally, the interrupt line will continue
generating an interrupt input to the interrupt controller until it has been
generating an interrupt input to the interrupt controller until it has been
read.  Therefore, handling receive UART interrupts requires reading the receive
read.  Therefore, handling receive UART interrupts requires reading the receive
data and then resetting the interrupt controller.  This also means, though, that
data and then resetting the interrupt controller.  This also means, though, that
the receive port should work quite well with the DMA controller.
the receive port should work quite well with the DMA controller.
 
 
As currently implemented, neither transmit nor receive UARTs have attached
As currently implemented, neither transmit nor receive UARTs have attached
FIFOs.  Hence, once a value is ready to be read, it must be read before the
FIFOs.  Hence, once a value is ready to be read, it must be read before the
next value is available to be read.
next value is available to be read.
 
 
The transmit UART register is shown in Fig.~\ref{fig:txuart}.
The transmit UART register is shown in Fig.~\ref{fig:txuart}.
\begin{figure}\begin{center}\begin{bytefield}[endianness=big]{32}
\begin{figure}\begin{center}\begin{bytefield}[endianness=big]{32}
\bitheader{0-31}\\
\bitheader{0-31}\\
\bitbox{20}{\em Always zero}
\bitbox{20}{\em Always zero}
        \bitbox{1}{R}
        \bitbox{1}{R}
        \bitbox{1}{O}
        \bitbox{1}{O}
        \bitbox{1}{B}
        \bitbox{1}{B}
        \bitbox{1}{S}
        \bitbox{1}{S}
        \bitbox{8}{Data}\\
        \bitbox{8}{Data}\\
\end{bytefield}
\end{bytefield}
\caption{Transmit UART register layout}\label{fig:txuart}
\caption{Transmit UART register layout}\label{fig:txuart}
\end{center}\end{figure}
\end{center}\end{figure}
Of these bits, the data register is the most important.  Writes to the transmit
Of these bits, the data register is the most important.  Writes to the transmit
UART, with only the bottom eight bits set, will send those bits out the
UART, with only the bottom eight bits set, will send those bits out the
data port.  Writes with the $B$, or {\tt BREAK} bit, set will place the
data port.  Writes with the $B$, or {\tt BREAK} bit, set will place the
transmitter into a {\tt BREAK} condition.  This condition is only cleared by
transmitter into a {\tt BREAK} condition.  This condition is only cleared by
writing with the $B$ bit clear.  The $S$ bit is a read-only busy bit, true if
writing with the $B$ bit clear.  The $S$ bit is a read-only busy bit, true if
the device is still busy sending the last character.  Finally, the $R$ and $O$
the device is still busy sending the last character.  Finally, the $R$ and $O$
bits reflect the current value read on the receive port and the current value
bits reflect the current value read on the receive port and the current value
being placed onto the transmit port respectively.
being placed onto the transmit port respectively.
 
 
As with the receive register, the transmit register has been designed to either
As with the receive register, the transmit register has been designed to either
be used in a polling or interrupt fashion.  When polled, the $S$ bit may be
be used in a polling or interrupt fashion.  When polled, the $S$ bit may be
checked to determine if the transmitter is still busy sending the last
checked to determine if the transmitter is still busy sending the last
character.  When the $S$ bit is clear, the UART transmitter will be responsive
character.  When the $S$ bit is clear, the UART transmitter will be responsive
to another character written to it.  In interrupt mode, the device will
to another character written to it.  In interrupt mode, the device will
constantly trigger an interrupt into the interrupt controller whenever  it is
constantly trigger an interrupt into the interrupt controller whenever  it is
idle.  As with the receive, the only way to reset this interrupt is to send
idle.  As with the receive, the only way to reset this interrupt is to send
a character and then reset the bit in the interrupt controller.
a character and then reset the bit in the interrupt controller.
 
 
\subsection{System seconds counter}
\subsection{System seconds counter}
As part of tracking the current time, it is important to have an accurate
As part of tracking the current time, it is important to have an accurate
seconds counter that increments with every second.  That's what this register
seconds counter that increments with every second.  That's what this register
provides.  This plus the subsecond register should be the current time.
provides.  This plus the subsecond register should be the current time.
 
 
The problem is setting this register.  While the subsecond time register can be
The problem is setting this register.  While the subsecond time register can be
set using the PPS signal from the GPS, this seconds register will need to be
set using the PPS signal from the GPS, this seconds register will need to be
calculated from the NMEA data stream.  To make this work, this register has been
calculated from the NMEA data stream.  To make this work, this register has been
set up so that not only does it increment by one on the top of any second, but
set up so that not only does it increment by one on the top of any second, but
when written to the register will be bumped by whatever value is written to it.
when written to the register will be bumped by whatever value is written to it.
Hence, to step it forward by a second, write a {\tt 32'h1} to it.  To step it
Hence, to step it forward by a second, write a {\tt 32'h1} to it.  To step it
backwards, write a {\tt 32'hffffffff}.
backwards, write a {\tt 32'hffffffff}.
 
 
\subsection{GPS Subsecond time}
\subsection{GPS Subsecond time}
As part of being able to provide highly accurate time resolution, it is
As part of being able to provide highly accurate time resolution, it is
important to be able to read the current time at any given time.  This
important to be able to read the current time at any given time.  This
register provides the sub--seconds value associated with the current time.
register provides the sub--seconds value associated with the current time.
It is specifically the amount of time since the top of the last second
It is specifically the amount of time since the top of the last second
times $2^{32}$.  As such, it rolls over at the top of each second.  The
times $2^{32}$.  As such, it rolls over at the top of each second.  The
top bit can be used as an indication of the second half of the second, etc.
top bit can be used as an indication of the second half of the second, etc.
 
 
\subsection{GPS derived clock step}
\subsection{GPS derived clock step}
This 32--bit value is closely related to the sytem clock frequency.  It is a
This 32--bit value is closely related to the sytem clock frequency.  It is a
{\tt step} value designed so that a $2^{48}$ bit counter, incremented by this
{\tt step} value designed so that a $2^{48}$ bit counter, incremented by this
{\tt step} value on every clock tick, will roll over after one second.  To
{\tt step} value on every clock tick, will roll over after one second.  To
convert this to the GPS derived clock frequency, apply the formula:
convert this to the GPS derived clock frequency, apply the formula:
\begin{eqnarray}
\begin{eqnarray}
f_{\mbox{\tiny CLK}} &=& \frac{2^{48}}{\mbox{\tt STEP}}
f_{\mbox{\tiny CLK}} &=& \frac{2^{48}}{\mbox{\tt STEP}}
\end{eqnarray}
\end{eqnarray}
 
 
\section{Debugging Scopes}
\section{Debugging Scopes}
\section{Real--Time Clock}
\section{Real--Time Clock}
% TODO write something more meaningful
% TODO write something more meaningful
The real--time clock controller is part of the {\tt rtcclock} project which
The real--time clock controller is part of the {\tt rtcclock} project which
should also be found near this distribution.  The manual for that project
should also be found near this distribution.  The manual for that project
should describe the four registers, clock, timer, stopwatch, and alarm, that
should describe the four registers, clock, timer, stopwatch, and alarm, that
can be controlled herein.
can be controlled herein.
 
 
\section{SD Card controller}
\section{SD Card controller}
% TODO write something more meaningful
% TODO write something more meaningful
The SD card controller is part of the {\tt sdspi} project which
The SD card controller is part of the {\tt sdspi} project which
should also be found near this distribution.  The manual for that project
should also be found near this distribution.  The manual for that project
should describe the four registers, control, data, and the two FIFO's registers,
should describe the four registers, control, data, and the two FIFO's registers,
that can be controlled herein.
that can be controlled herein.
 
 
\section{GPS PPS Tracking Loop control}
\section{GPS PPS Tracking Loop control}
The coefficients for the PLL that tracks the GPS PPS can be controlled via the
The coefficients for the PLL that tracks the GPS PPS can be controlled via the
registers listed in Tbl.~\ref{tbl:gpsctrl}.
registers listed in Tbl.~\ref{tbl:gpsctrl}.
\begin{table}
\begin{table}
\begin{center}\begin{reglist}
\begin{center}\begin{reglist}
alpha  &\scalebox{0.8}{\tt 0x0130} & 8 & R/W & Recursive Error Averaging Coefficient\\\hline
alpha  &\scalebox{0.8}{\tt 0x0500} & 8 & R/W & Recursive Error Averaging Coefficient\\\hline
beta   &\scalebox{0.8}{\tt 0x0131} & 32 & R/W & Phase Tracking Coefficient\\\hline
beta   &\scalebox{0.8}{\tt 0x0504} & 32 & R/W & Phase Tracking Coefficient\\\hline
gamma  &\scalebox{0.8}{\tt 0x0132} & 32 & R/W & Frequency Tracking Coefficient\\\hline
gamma  &\scalebox{0.8}{\tt 0x0508} & 32 & R/W & Frequency Tracking Coefficient\\\hline
defstep&\scalebox{0.8}{\tt 0x0133} & 32 & R/W & Default clock step\\\hline
defstep&\scalebox{0.8}{\tt 0x050c} & 32 & R/W & Default clock step\\\hline
\end{reglist}
\end{reglist}
\caption{GPS PPS Tracking Control Registers}\label{tbl:gpsctrl}
\caption{GPS PPS Tracking Control Registers}\label{tbl:gpsctrl}
\end{center}\end{table}
\end{center}\end{table}
 
 
\section{GPS testbench info}
\section{GPS testbench info}
 
 
The GPS PPS tracking core found within the Arty was originally tested using
The GPS PPS tracking core found within the Arty was originally tested using
a GPS testbench.  Since simulation and performance measurement was a chalelnge,
a GPS testbench.  Since simulation and performance measurement was a chalelnge,
that testbench has been given a permanent place within the Arty.  Within it,
that testbench has been given a permanent place within the Arty.  Within it,
there are eight registers, grouped into five variables.  These registers are
there are eight registers, grouped into five variables.  These registers are
designed so that, if read in a burst fashion, none of the registers will
designed so that, if read in a burst fashion, none of the registers will
change during the burst--guaranteeing their coherency.
change during the burst--guaranteeing their coherency.
 
 
The first two registers will be ignored, unless specifically enabled by
The first two registers will be ignored, unless specifically enabled by
defining {\tt GPSTB} in busmaster.v.  They are designed to see how the
defining {\tt GPSTB} in busmaster.v.  They are designed to see how the
GPS tracking circuit will respond to an absolutely accurate input.  The
GPS tracking circuit will respond to an absolutely accurate input.  The
first, the {\tt tb\_maxcount} value, sets the number of clocks per simulated
first, the {\tt tb\_maxcount} value, sets the number of clocks per simulated
PPS tick.  The second, the {\tt tb\_jump} value, when written to will cause
PPS tick.  The second, the {\tt tb\_jump} value, when written to will cause
the PPS to suddenly be displaced in phase by the value written.  Both of these
the PPS to suddenly be displaced in phase by the value written.  Both of these
are ignored unless the test bench was configured to produce a simulated
are ignored unless the test bench was configured to produce a simulated
PPS signal.
PPS signal.
 
 
The third register is the 64--bit error.  Specifically, this is the value of
The third register is the 64--bit error.  Specifically, this is the value of
the GPS step counter at the top of the second.  In a perfect world, with
the GPS step counter at the top of the second.  In a perfect world, with
perfect tracking, it should be zero.  In a wonderful world with nearly perfect
perfect tracking, it should be zero.  In a wonderful world with nearly perfect
tracking, this register should be less than the GPS step size.
tracking, this register should be less than the GPS step size.
 
 
The fourth register is the 64--bit count register.  This indicates the current
The fourth register is the 64--bit count register.  This indicates the current
time, in 64--bit precision.  The top 32--bits of this register are the same
time, in 64--bit precision.  The top 32--bits of this register are the same
as the sub--seconds register presented earlier.
as the sub--seconds register presented earlier.
 
 
The final register is the 64--bit step register.  This register is very similar
The final register is the 64--bit step register.  This register is very similar
to the 32--bit {\tt STEP} register discussed earlier.  It is designed so that,
to the 32--bit {\tt STEP} register discussed earlier.  It is designed so that,
when multiplied by the clock frequency in Hertz, the result should equal
when multiplied by the clock frequency in Hertz, the result should equal
$2^{64}$.  The register, though, captures the current state of the GPS tracking
$2^{64}$.  The register, though, captures the current state of the GPS tracking
circuit's estimate of the clock speed of the processor in this fashion.
circuit's estimate of the clock speed of the processor in this fashion.
 
 
\section{OLEDrgb control}
\section{OLEDrgb control}
The OLEDrgb can be controlled by four registers, listed in
The OLEDrgb can be controlled by four registers, listed in
Tbl.~\ref{tbl:oledctrl}.
Tbl.~\ref{tbl:oledctrl}.
\begin{table}
\begin{table}
\begin{center}\begin{reglist}
\begin{center}\begin{reglist}
CTRL &\scalebox{0.8}{\tt 0x0130} & 32 & R/W & Control register\\\hline
CTRL &\scalebox{0.8}{\tt 0x04b0} & 32 & R/W & Control register\\\hline
REGA &\scalebox{0.8}{\tt 0x0131} & 32 & R/W & First excess control word\\\hline
REGA &\scalebox{0.8}{\tt 0x04b4} & 32 & R/W & First excess control word\\\hline
REGB &\scalebox{0.8}{\tt 0x0132} & 32 & R/W & Second excess control word\\\hline
REGB &\scalebox{0.8}{\tt 0x04b8} & 32 & R/W & Second excess control word\\\hline
DATA &\scalebox{0.8}{\tt 0x0133} & 32 & R/W & Data and power register\\\hline
DATA &\scalebox{0.8}{\tt 0x04bc} & 32 & R/W & Data and power register\\\hline
\end{reglist}
\end{reglist}
\caption{OLED Control Registers}\label{tbl:oledctrl}
\caption{OLED Control Registers}\label{tbl:oledctrl}
\end{center}\end{table}
\end{center}\end{table}
The first three are used to send information across the control port of the
The first three are used to send information across the control port of the
OLEDrgb, the last is used to adjust the power, reset, and I/O line voltage,
OLEDrgb, the last is used to adjust the power, reset, and I/O line voltage,
as well as to send data values to the device.
as well as to send data values to the device.
 
 
Unlike the flash, network MDIO registers, or ICAPE port, reads and writes
Unlike the flash, network MDIO registers, or ICAPE port, reads and writes
of this device will not stall the wishbone bus, and will complete immediately.
of this device will not stall the wishbone bus, and will complete immediately.
Commands issued to the device while the controller is busy will therefore be
Commands issued to the device while the controller is busy will therefore be
quietly ignored.
quietly ignored.
 
 
Working with the device starts by powering it up.  This sequence is given
Working with the device starts by powering it up.  This sequence is given
by the manufacturer, and it requires the use of data register.  This data
by the manufacturer, and it requires the use of data register.  This data
register has one of two interpretations, as shown in Fig.~\ref{fig:odata}.
register has one of two interpretations, as shown in Fig.~\ref{fig:odata}.
\begin{figure}\begin{center}\begin{bytefield}[endianness=big]{32}
\begin{figure}\begin{center}\begin{bytefield}[endianness=big]{32}
\bitheader{0-31}\\
\bitheader{0-31}\\
        \bitbox{16}{16'h00}
        \bitbox{16}{16'h00}
        \bitbox{16}{Data}\\
        \bitbox{16}{Data}\\
\bitbox{13}{13'h00}
\bitbox{13}{13'h00}
        \bitbox{1}{R} \bitbox{1}{V} \bitbox{1}{E}
        \bitbox{1}{R} \bitbox{1}{V} \bitbox{1}{E}
        \bitbox{13}{13'h00}
        \bitbox{13}{13'h00}
        \bitbox{1}{R} \bitbox{1}{V} \bitbox{1}{E} \\
        \bitbox{1}{R} \bitbox{1}{V} \bitbox{1}{E} \\
\end{bytefield}
\end{bytefield}
\caption{OLED data register: Data write format, and power control read/write format}\label{fig:odata}
\caption{OLED data register: Data write format, and power control read/write format}\label{fig:odata}
\end{center}\end{figure}
\end{center}\end{figure}
In the first interpretation, data may be sent to the port by simply
In the first interpretation, data may be sent to the port by simply
writing that data to the port, while leaving the top sixteen bits zero.
writing that data to the port, while leaving the top sixteen bits zero.
(We'll get to this later.)  In the second interpretation, the reset and
(We'll get to this later.)  In the second interpretation, the reset and
power bits may be adjusted by setting the upper bit high (an enable bit),
power bits may be adjusted by setting the upper bit high (an enable bit),
together with the corresponding lower bit to the value desired.
together with the corresponding lower bit to the value desired.
 
 
The $R$ bit will be zero if the device is in a reset state (an active low
The $R$ bit will be zero if the device is in a reset state (an active low
reset).  The $V$ bit is one if the VCC output is enabled.  The $E$ bit is one
reset).  The $V$ bit is one if the VCC output is enabled.  The $E$ bit is one
if the PMod is enabled, otherwise the power to the PMod is cut.  Adjusting
if the PMod is enabled, otherwise the power to the PMod is cut.  Adjusting
these bits requires writing a `1' to the bit you wish to change, and then
these bits requires writing a `1' to the bit you wish to change, and then
at the same time writing the value you wish to change it to in the lower order
at the same time writing the value you wish to change it to in the lower order
bits.  Hence writing a {\tt 0x010001} to the device will turn the power on,
bits.  Hence writing a {\tt 0x010001} to the device will turn the power on,
whereas a {\tt 0x010000} will turn it off.  Likewise {\tt 0x040000} will place
whereas a {\tt 0x010000} will turn it off.  Likewise {\tt 0x040000} will place
the device into reset (active low), and {\tt 0x040004} will release the reset
the device into reset (active low), and {\tt 0x040004} will release the reset
line.
line.
 
 
Reads from this port simply return the current values of the $R$, $V$, and
Reads from this port simply return the current values of the $R$, $V$, and
$E$ bits in the least significant 3--bits.
$E$ bits in the least significant 3--bits.
 
 
The power--up sequence for the device is shown below:
The power--up sequence for the device is shown below:
\begin{enumerate}
\begin{enumerate}
\item Wait a quarter second from configuration start
\item Wait a quarter second from configuration start
\item Power up the device, writing a {\tt 0x050005} to the data port to
\item Power up the device, writing a {\tt 0x050005} to the data port to
        power up, but without setting the reset line yet.
        power up, but without setting the reset line yet.
\item Wait four microseconds.
\item Wait four microseconds.
\item Activate the reset line, by writing a {\tt 0x040000} to this data port.
\item Activate the reset line, by writing a {\tt 0x040000} to this data port.
\item Wait another four microseconds.
\item Wait another four microseconds.
\item Clear the reset, by writing a {\tt 0x040004} to this data port.
\item Clear the reset, by writing a {\tt 0x040004} to this data port.
\item Wait another four microseconds.
\item Wait another four microseconds.
\item Initialize the display.
\item Initialize the display.
\end{enumerate}
\end{enumerate}
 
 
At this point, a series of commands need to be sent to the devices control
At this point, a series of commands need to be sent to the devices control
port.  These commands are written to the control register.  The control
port.  These commands are written to the control register.  The control
register accepts several different types of writes, as shown in
register accepts several different types of writes, as shown in
Fig.~\ref{fig:octrl}.
Fig.~\ref{fig:octrl}.
\begin{figure}\begin{center}\begin{bytefield}[endianness=big]{32}
\begin{figure}\begin{center}\begin{bytefield}[endianness=big]{32}
\bitheader{0-31}\\
\bitheader{0-31}\\
        \bitbox{24}{24'h00}
        \bitbox{24}{24'h00}
        \bitbox{8}{8'data}\\
        \bitbox{8}{8'data}\\
\bitbox{15}{15'h00}\bitbox{1}{1}\bitbox{16}{16'data} \\
\bitbox{15}{15'h00}\bitbox{1}{1}\bitbox{16}{16'data} \\
\bitbox{4}{4'h2}\bitbox{4}{}\bitbox{24}{24'data} \\
\bitbox{4}{4'h2}\bitbox{4}{}\bitbox{24}{24'data} \\
\bitbox{4}{N-1}\bitbox{4}{}\bitbox{24}{24'data} \\
\bitbox{4}{N-1}\bitbox{4}{}\bitbox{24}{24'data} \\
\end{bytefield}
\end{bytefield}
\caption{Four separate OLED control register write formats}\label{fig:octrl}
\caption{Four separate OLED control register write formats}\label{fig:octrl}
\end{center}\end{figure}
\end{center}\end{figure}
To send a single byte of data, write that byte to the control port.
To send a single byte of data, write that byte to the control port.
Two bytes require setting bit sixteen, and they are sent high order byte first.
Two bytes require setting bit sixteen, and they are sent high order byte first.
Sending three or more bytes requires setting the number of bytes you wish to
Sending three or more bytes requires setting the number of bytes you wish to
send, $N$, minus one to the top four bits, followed by the first three bytes,
send, $N$, minus one to the top four bits, followed by the first three bytes,
high order byte first.  To send longer commands, place the next four bytes
high order byte first.  To send longer commands, place the next four bytes
into register {\tt A}, and the next four after that into register {\tt B}.
into register {\tt A}, and the next four after that into register {\tt B}.
In this manner, the device can send commands of up to 11~bytes in length,
In this manner, the device can send commands of up to 11~bytes in length,
although most commands may be sent and received with writing only a single
although most commands may be sent and received with writing only a single
word to the control port.
word to the control port.
 
 
The actual set of commands used to initialize the display is rather complex.
The actual set of commands used to initialize the display is rather complex.
Please examine the {\tt oledtest.c} ZipCPU program for an example of how
Please examine the {\tt oledtest.c} ZipCPU program for an example of how
this might be accomplished.  That program sends a series of commands to the
this might be accomplished.  That program sends a series of commands to the
control port, waiting for the port to become idle inbetween.  When using polled
control port, waiting for the port to become idle inbetween.  When using polled
I/O, the low order bit of the control register will be `1' if the port is busy,
I/O, the low order bit of the control register will be `1' if the port is busy,
zero if not.
zero if not.
 
 
\section{Internal Configuration Access Port}
\section{Internal Configuration Access Port}
% TODO write something more meaningful
% TODO write something more meaningful
The Xilinx ICAPE2 controller is part of the {\tt wbicapetwo} project which
The Xilinx ICAPE2 controller is part of the {\tt wbicapetwo} project which
should also be found near this distribution.  The ICAPE port offers access to
should also be found near this distribution.  The ICAPE port offers access to
the internal Xilinx configuration registers.  The exact meaning of these registers is rather complex, and so users are referred to the Xilinx configuration
the internal Xilinx configuration registers.  The exact meaning of these registers is rather complex, and so users are referred to the Xilinx configuration
user guide for more detail.
user guide for more detail.
 
 
For now, two registers are worth mentioning.  The first is the WBSTAR register,
For now, two registers are worth mentioning.  The first is the WBSTAR register,
{\tt 0x01f0}, and the second is the command register, {\tt 0x01e4}.
{\tt 0x01f0}, and the second is the command register, {\tt 0x01e4}.
Writes to the {\tt WBSTAR} register will set the address that the Xilinx
Writes to the {\tt WBSTAR} register will set the address that the Xilinx
chip will configure itself from upon any warm start configuration request.
chip will configure itself from upon any warm start configuration request.
(Cold starts always configure from the beginning of flash.)  This address
(Cold starts always configure from the beginning of flash.)  This address
is relative to the start of the flash, and counted in octets rather than
is relative to the start of the flash, and counted in octets rather than
bus words.  Hence, to command the Xilinx chip to configure itself from an
bus words.  Hence, to command the Xilinx chip to configure itself from an
OpenArty address of {\tt 0x470000}, you would drop the four and multiply by
OpenArty address of {\tt 0x470000}, you would drop the four and multiply by
four, and write {\tt 0x1c0000} to this register.
four, and write {\tt 0x1c0000} to this register.
 
 
The second register worth mentioning is the command register.  Writing a
The second register worth mentioning is the command register.  Writing a
15~to this register issues an {\tt IPROG} command, causing the FPGA to
15~to this register issues an {\tt IPROG} command, causing the FPGA to
reload itself from the address given in the {\tt WBSTAR} register.
reload itself from the address given in the {\tt WBSTAR} register.
 
 
Put together, this is the meaning of the two lines in {\tt program.sh}:
Put together, this is the meaning of the two lines in {\tt program.sh}:
\begin{lstlisting}[language=bash]
\begin{lstlisting}[language=bash]
$WBREGS wbstar 0x01c00000
$WBREGS wbstar 0x01c00000
$WBREGS fpgacmd 15
$WBREGS fpgacmd 15
\end{lstlisting}
\end{lstlisting}
 
 
The success of this configuration request may be determined from the
The success of this configuration request may be determined from the
{\tt BOOTSTS} register, as discussed in the Xilinx's
{\tt BOOTSTS} register, as discussed in the Xilinx's
{\em 7 Series FPGAs Configuration: User Guide}.
{\em 7 Series FPGAs Configuration: User Guide}.
 
 
\section{Network Packet interface control}
\section{Network Packet interface control}
Tbl.~\ref{tbl:netpkt}
Tbl.~\ref{tbl:netpkt}
\begin{table}
\begin{table}
\begin{center}\begin{reglist}
\begin{center}\begin{reglist}
NETRX  &\scalebox{0.8}{\tt 0x0138} & 32 & R/W & Packet receive control register\\\hline
NETRX  &\scalebox{0.8}{\tt 0x0540} & 32 & R/W & Packet receive control register\\\hline
NETTX  &\scalebox{0.8}{\tt 0x0139} & 32 & R/W & Packet transmit control register\\\hline
NETTX  &\scalebox{0.8}{\tt 0x0544} & 32 & R/W & Packet transmit control register\\\hline
MACHI &\scalebox{0.8}{\tt 0x013a} & 16 & R/W & Ethernet MAC, hi order 16-bits\\\hline
MACHI &\scalebox{0.8}{\tt 0x0548} & 16 & R/W & Ethernet MAC, hi order 16-bits\\\hline
MACLO &\scalebox{0.8}{\tt 0x013b} & 32 & R/W & Ethernet MAC, low order 32-bits\\\hline
MACLO &\scalebox{0.8}{\tt 0x054c} & 32 & R/W & Ethernet MAC, low order 32-bits\\\hline
RXMISS  &\scalebox{0.8}{\tt 0x013c} & 32 & R & Number of valid receive packets missed\\\hline
RXMISS  &\scalebox{0.8}{\tt 0x0550} & 32 & R & Number of valid receive packets missed\\\hline
RXERR&\scalebox{0.8}{\tt 0x013d} & 32 & R & Number of packets not properly received\\\hline
RXERR&\scalebox{0.8}{\tt 0x0554} & 32 & R & Number of packets not properly received\\\hline
RXCRC&\scalebox{0.8}{\tt 0x013e} & 32 & R & Packets received with CRC errors\\\hline
RXCRC&\scalebox{0.8}{\tt 0x0558} & 32 & R & Packets received with CRC errors\\\hline
{\em Unused} &\scalebox{0.8}{\tt 0x013f} & 32 & R & Reads zero (Reserved for transmit collision counting)\\\hline
{\em Unused} &\scalebox{0.8}{\tt 0x013f} & 32 & R & Reads zero (Reserved for transmit collision counting)\\\hline
\end{reglist}
\end{reglist}
\caption{Network Packet control registers}\label{tbl:netpkt}
\caption{Network Packet control registers}\label{tbl:netpkt}
\end{center}\end{table}
\end{center}\end{table}
 
shows the eight registers used by the packet interface.  The first two of these
 
are used for receiving and sending packets respectively.  We'll discuss these
 
two in a moment.  The next two locations allow you to set your own MAC address.
 
Doing so will allow the network interface, if so configured, to insert your
 
MAC address into packets and filter incoming packets for only those containing
 
your MAC.  The last four values are reserved for internal performance counters.
 
 
From the standpoint of configuring this interface, the network transmit
From the standpoint of configuring this interface, the network transmit
control register needs to be configured first.  The bits in this register
control register needs to be configured first.  The bits in this register
are shown in Fig.~\ref{fig:nettx}.
are shown in Fig.~\ref{fig:nettx}.
\begin{figure}\begin{center}\begin{bytefield}[endianness=big]{32}
\begin{figure}\begin{center}\begin{bytefield}[endianness=big]{32}
\bitheader{0-31}\\
\bitheader{0-31}\\
        \bitbox{4}{0000}
        \bitbox{4}{0000}
        \bitbox{4}{AW}
        \bitbox{4}{AW}
        \bitbox{5}{00000}
        \bitbox{5}{00000}
        \bitbox{1}{I}
        \bitbox{1}{I}
        \bitbox{1}{R}
        \bitbox{1}{R}
        \bitbox{1}{M}
        \bitbox{1}{M}
        \bitbox{1}{C}
        \bitbox{1}{C}
        \bitbox{1}{B}
        \bitbox{1}{B}
        \bitbox{4}{}
        \bitbox{4}{}
        \bitbox{10}{Len}\\
        \bitbox{10}{Len}\\
\end{bytefield}
\end{bytefield}
\caption{Network transmit control register, NETTX}\label{fig:nettx}
\caption{Network transmit control register, NETTX}\label{fig:nettx}
\end{center}\end{figure}
\end{center}\end{figure}
By default, the network device is held in a reset state until released by
By default, the network device is held in a reset state until released by
writing a `0' to the $R$ value of this register.  Other bits in this register
writing a `0' to the $R$ value of this register.  Other bits in this register
include the $I$ bit, which turns off the hardware IP packet header checksum
include the $I$ bit, which turns off the hardware IP packet header checksum
check when set, the $M$, which turns off hardware MAC filtering when set,
check when set, the $M$, which turns off hardware MAC filtering when set,
and $C$, which turns off hardware CRC checking and filtering.  These bits
and $C$, which turns off hardware CRC checking and filtering.  These bits
are designed so that the natural state of the register is to set them to
are designed so that the natural state of the register is to set them to
zero, enabling all hardware checking.  Finally, the $B$ bit will be set to
zero, enabling all hardware checking.  Finally, the $B$ bit will be set to
indicate the interface is busy sending a packet.
indicate the interface is busy sending a packet.
 
 
The other field of this control register is the log address width field.
The other field of this control register is the log address width field.
This field specifies the size of the packet buffers, such that there are
This field specifies the size of the packet buffers, such that there are
a maximum of $2^{\mbox{\tiny AW}}$ octets in each packet.
a maximum of $2^{\mbox{\tiny AW}}$ octets in each packet.
 
 
To use the network transmitter:
To use the network transmitter:
\begin{enumerate}
\begin{enumerate}
\item Set the $R$ bit to zero.  This will activate the interface,
\item Set the $R$ bit to zero.  This will activate the interface,
        removing it from reset.
        removing it from reset.
\item Set the local hardware MAC address into the {\tt MACHI}
\item Set the local hardware MAC address into the {\tt MACHI}
        and {\tt MACLO} registers.  (The {\tt MACHI} register holds the top
        and {\tt MACLO} registers.  (The {\tt MACHI} register holds the top
        16~bits, in its lower 16~bits.)
        16~bits, in its lower 16~bits.)
\item Write a packet into the transmit packet memory area, starting at the
\item Write a packet into the transmit packet memory area, starting at the
        zero address.
        zero address.
        \begin{enumerate}
        \begin{enumerate}
        \item If the hardware MAC option, $M$ bit, is set to zero, then
        \item If the hardware MAC option, $M$ bit, is set to zero, then
                hardware MAC generation is on.  Place bits {\tt 47\ldots 16}
                hardware MAC generation is on.  Place bits {\tt 47\ldots 16}
                of the destination MAC in the first word (address 0 of the
                of the destination MAC in the first word (address 0 of the
                TX memory), and fill the next word with the last bits of the
                TX memory), and fill the next word with the last bits of the
                destination MAC and the sixteen bits of the EtherType.
                destination MAC and the sixteen bits of the EtherType.
        \item If the hardware MAC option is off, i.e. $M=0$, then the
        \item If the hardware MAC option is off, i.e. $M=0$, then the
                first two words contain the destination MAC as before,
                first two words contain the destination MAC as before,
                but the second word also contains the top 16--bits of the
                but the second word also contains the top 16--bits of the
                source MAC.  The third word contains the bottom bits of the
                source MAC.  The third word contains the bottom bits of the
                source MAC.  The fourth word then contains the EtherType
                source MAC.  The fourth word then contains the EtherType
                field twice.  Any IP packet then begins on the fifth word.
                field twice.  Any IP packet then begins on the fifth word.
        \item If the hardware CRC option is off, $C=1$, then a CRC will need
        \item If the hardware CRC option is off, $C=1$, then a CRC will need
                to be generated and placed into the last 4--octets of the
                to be generated and placed into the last 4--octets of the
                message.
                message.
        \item Octets are transmitted from from high order bits to low order
        \item Octets are transmitted from from high order bits to low order
                bits.  Hence the first octet transmitted will be from
                bits.  Hence the first octet transmitted will be from
                bits 31--24 of a given word, the second octet from bits
                bits 31--24 of a given word, the second octet from bits
                23--16, etc.
                23--16, etc.
        \end{enumerate}
        \end{enumerate}
\item Once the memory for the packet has been set, sending the packet
\item Once the memory for the packet has been set, sending the packet
        is as simple as writing the packet length (in octets), together with
        is as simple as writing the packet length (in octets), together with
        any flag bits, to the network transmit control register.
        any flag bits, to the network transmit control register.
\item If using polled I/O, the transmit control register may be examined to
\item If using polled I/O, the transmit control register may be examined to
        see when its busy bit clears.  At that point, another packet may be
        see when its busy bit clears.  At that point, another packet may be
        loaded into memory.
        loaded into memory.
\item If using interrupt driven I/O, a network transmit idle interrupt will be
\item If using interrupt driven I/O, a network transmit idle interrupt will be
        generated once the transmission is complete.  (This interrupt will
        generated once the transmission is complete.  (This interrupt will
        remain high until another packet transmit command is issued.)
        remain high until another packet transmit command is issued.)
\item To send a subsequent packet, one need only set the memory and write
\item To send a subsequent packet, one need only set the memory and write
        the transmit command to the control register.  This will reset the
        the transmit command to the control register.  This will reset the
        interrupt input to the interrupt controller, so a transmit complete
        interrupt input to the interrupt controller, so a transmit complete
        interrupt may be noticed again.
        interrupt may be noticed again.
\end{enumerate}
\end{enumerate}
 
 
The network receive command register is similar to the transmit
The network receive command register is similar to the transmit
command register.  It is shown in Fig.~\ref{fig:netrx}.
command register.  It is shown in Fig.~\ref{fig:netrx}.
\begin{figure}\begin{center}\begin{bytefield}[endianness=big]{32}
\begin{figure}\begin{center}\begin{bytefield}[endianness=big]{32}
\bitheader{0-31}\\
\bitheader{0-31}\\
        \bitbox{4}{0000}
        \bitbox{4}{0000}
        \bitbox{4}{AW}
        \bitbox{4}{AW}
        \bitbox{4}{0000}
        \bitbox{4}{0000}
        \bitbox{1}{B}
        \bitbox{1}{B}
        \bitbox{1}{C}
        \bitbox{1}{C}
        \bitbox{1}{E}
        \bitbox{1}{E}
        \bitbox{1}{M}
        \bitbox{1}{M}
        \bitbox{1}{S}
        \bitbox{1}{S}
        \bitbox{1}{V}
        \bitbox{1}{V}
        \bitbox{4}{}
        \bitbox{4}{}
        \bitbox{10}{Len}\\
        \bitbox{10}{Len}\\
\end{bytefield}
\end{bytefield}
\caption{Network receive control register, NETRX}\label{fig:netrx}
\caption{Network receive control register, NETRX}\label{fig:netrx}
\end{center}\end{figure}
\end{center}\end{figure}
Unlike the transmit command register, there are no configuration fields in
Unlike the transmit command register, there are no configuration fields in
the network receive command register.  The receive configuration bits,
the network receive command register.  The receive configuration bits,
controlling such things as whether or not the device it in reset, or whether
controlling such things as whether or not the device it in reset, or whether
or not to have the hardware filter out bad
or not to have the hardware filter out bad
CRC's, bad IP header checksums, or MAC addresses not for our machine---these
CRC's, bad IP header checksums, or MAC addresses not for our machine---these
bits are shared with the transmit configuration register.  On receive,
bits are shared with the transmit configuration register.  On receive,
bits are set to indicate the success or failure of a received packet.
bits are set to indicate the success or failure of a received packet.
$C$ is set if a packet is received with a CRC error.  $E$ is set if there
$C$ is set if a packet is received with a CRC error.  $E$ is set if there
was some error in packet receiption.  $M$ is set if a packet is received
was some error in packet receiption.  $M$ is set if a packet is received
and the memory still contains the last packet, causing a packet Miss.
and the memory still contains the last packet, causing a packet Miss.
$S$ is set if the receive port is busy.  $V$ is set if a valid packet can be
$S$ is set if the receive port is busy.  $V$ is set if a valid packet can be
found in the receive memory.  Each of these status bits may be individually
found in the receive memory.  Each of these status bits may be individually
cleared by writing a `1' to that respective bit.  Writing a `1' to the valid
cleared by writing a `1' to that respective bit.  Writing a `1' to the valid
bit, $V$, also clears the receive port so that another packet may be
bit, $V$, also clears the receive port so that another packet may be
received.
received.
 
 
If the interface is on and no valid packet has been received, then the
If the interface is on and no valid packet has been received, then the
packet receive logic is activated.  Any packet received with a valid length
packet receive logic is activated.  Any packet received with a valid length
(64~bytes or more), a valid CRC (if hardware CRC checking is on), either our
(64~bytes or more), a valid CRC (if hardware CRC checking is on), either our
MAC address (as programmed into the configuration) or a broadcast address,
MAC address (as programmed into the configuration) or a broadcast address,
and a valid IP header (if it's an IP packet), will be copied into the receive
and a valid IP header (if it's an IP packet), will be copied into the receive
memory.  Once the packet has been received, the $V$ bit will be set high.
memory.  Once the packet has been received, the $V$ bit will be set high.
If the packet was a broadcast packet, the $B$ bit will also be set.  Writing
If the packet was a broadcast packet, the $B$ bit will also be set.  Writing
a `1' to the $V$ bit of this port will clear the packet firmware, and release
a `1' to the $V$ bit of this port will clear the packet firmware, and release
it to receive another packet.
it to receive another packet.
 
 
This port may be operated as either polled or interrupt drive I/O.  If polled,
This port may be operated as either polled or interrupt drive I/O.  If polled,
then check the $V$ bit.  Once the $V$ bit is one, a packet is ready to be
then check the $V$ bit.  Once the $V$ bit is one, a packet is ready to be
read from the port.  At the same time $V$ is set to one, an interrupt will
read from the port.  At the same time $V$ is set to one, an interrupt will
be generated.  This interrupt will not clear until $V$ is cleared.
be generated.  This interrupt will not clear until $V$ is cleared.
 
 
 
 
\section{Ethernet MDIO configuration registers}
\section{Ethernet MDIO configuration registers}
The ethernet PHY has 32~address configuration address registers available
The ethernet PHY has 32~address configuration address registers available
to the board via an MDIO interface.  These are 16--bit registers that may be
to the board via an MDIO interface.  These are 16--bit registers that may be
read from, or written to the device.  The current implementation locks the
read from, or written to the device.  The current implementation locks the
bus while reading from or writing to the device until the operation is
bus while reading from or writing to the device until the operation is
complete.
complete.
 
 
Using these registers, one can tell if the Ethernet is in 10Mbps mode, or
Using these registers, one can tell if the Ethernet is in 10Mbps mode, or
100Mbps mode, or even whether or not a cable is connected.
100Mbps mode, or even whether or not a cable is connected.
 
 
A simple register to query to know if this interface is working is the LEDCR
A simple register to query to know if this interface is working is the LEDCR
register, {\tt 0x01b8}.
register, {\tt 0x01b8}.
This register will be set to {\tt 0x0ffff} upon startup, and until the network
This register will be set to {\tt 0x0ffff} upon startup, and until the network
port has been turned on.  Once turned on, this register will default to all
port has been turned on.  Once turned on, this register will default to all
zeros.  To manually turn both the LEDs on, write a {\tt 0x030} to the LEDCR
zeros.  To manually turn both the LEDs on, write a {\tt 0x030} to the LEDCR
register.  To manually turn them off, write a {\tt 0x036}.  A value of
register.  To manually turn them off, write a {\tt 0x036}.  A value of
{\tt 0x00} will set them back to the default mode of indicating the link
{\tt 0x00} will set them back to the default mode of indicating the link
status and speed.
status and speed.
 
 
Please examine the specification for the ethernet PHY for more information
Please examine the specification for the ethernet PHY for more information
about these registers, what their bits mean, and how the device can be
about these registers, what their bits mean, and how the device can be
controlled.
controlled.
 
 
\section{Flash Memory}
\section{Flash Memory}
% \section{Extended Flash configuration port}
% \section{Extended Flash configuration port}
From the standpoint of a user program, flash memory should just work.  This
From the standpoint of a user program, flash memory should just work.  This
flash memory was designed with that purpose in mind.  Reads are designed to
flash memory was designed with that purpose in mind.  Reads are designed to
just work.
just work.
 
 
If only all that a flash required was reading, life would be good.  However,
If only all that a flash required was reading, life would be good.  However,
flash chips have a rather complex protocol for reading, erasing, and programming
flash chips have a rather complex protocol for reading, erasing, and programming
them.  This has made the interface more complex.
them.  This has made the interface more complex.
 
 
Still, reads are \ldots nearly simple.  Reads from the flash
Still, reads are \ldots nearly simple.  Reads from the flash
memory will automatically be done in Quad--SPI mode and leave the device in
memory will automatically be done in Quad--SPI mode and leave the device in
Execuste--In--Place (XIP) mode upon completion.  This means that any initial
Execuste--In--Place (XIP) mode upon completion.  This means that any initial
read burst will take $22+8N$ QSPI clocks for $N$ words, whereas subsequent
read burst will take $22+8N$ QSPI clocks for $N$ words, whereas subsequent
reads will only require $14+8N$ QSPI clocks.  Reading from any of the device
reads will only require $14+8N$ QSPI clocks.  Reading from any of the device
registers will transition the device out of XIP mode, and back into the
registers will transition the device out of XIP mode, and back into the
extended register mode.
extended register mode.
 
 
Writes are more difficult.  Changing the contents of a flash chip requires
Writes are more difficult.  Changing the contents of a flash chip requires
either erasing a sector (or subsector) in order to turns all the zeros to ones
either erasing a sector (or subsector) in order to turns all the zeros to ones
in that sector (or subsector), or it requires writing a page in order to
in that sector (or subsector), or it requires writing a page in order to
selectively turn some of the ones back to zeros.  The interface used in the
selectively turn some of the ones back to zeros.  The interface used in the
OpenArty is designed to allow the user complete flexibility over the control
OpenArty is designed to allow the user complete flexibility over the control
of the flash device, without requiring the device to be commanded explicitly
of the flash device, without requiring the device to be commanded explicitly
over a SPI (or QSPI) port.  (The device is connected via such a port, the
over a SPI (or QSPI) port.  (The device is connected via such a port, the
interface tries to hide that fact.)
interface tries to hide that fact.)
 
 
The result is that there are many registers used for reading, writing, and
The result is that there are many registers used for reading, writing, and
controlling the flash.  A quick list of these registers is shown in
controlling the flash.  A quick list of these registers is shown in
Tbl.~\ref{tbl:flctl}.
Tbl.~\ref{tbl:flctl}.
\begin{table}
\begin{table}
\begin{center}\begin{reglist}
\begin{center}\begin{reglist}
ewreg  &\scalebox{0.8}{\tt 0x0180} & 32 & R & Erase/write control and status\\\hline
EWREG  &\scalebox{0.8}{\tt 0x0600} & 32 & R & Erase/write control and status\\\hline
status      &\scalebox{0.8}{\tt 0x0181} & 8 & R/W & Bus Interrupt Controller \\\hline
ESTATUS      &\scalebox{0.8}{\tt 0x0604} & 8 & R/W & Bus Interrupt Controller \\\hline
nvconf   &\scalebox{0.8}{\tt 0x0182} & 16 & R & Last Bus Error Address\\\hline
NVCONF   &\scalebox{0.8}{\tt 0x0608} & 16 & R & Last Bus Error Address\\\hline
vconf &\scalebox{0.8}{\tt 0x0183} & 8 & R & Ticks since startup\\\hline
VCONF &\scalebox{0.8}{\tt 0x060c} & 8 & R & Ticks since startup\\\hline
evonc    &\scalebox{0.8}{\tt 0x0184} & 8 & R/W & Button/Switch controller\\\hline
EVCONF    &\scalebox{0.8}{\tt 0x0610} & 8 & R/W & Button/Switch controller\\\hline
lock  &\scalebox{0.8}{\tt 0x0185} & 8 & R/W & LED Controller \\\hline
LOCK  &\scalebox{0.8}{\tt 0x0614} & 8 & R/W & LED Controller \\\hline
flagstatus&\scalebox{0.8}{\tt 0x0186} & 8 & R/W & Auxilliary UART config\\\hline
flagstatus&\scalebox{0.8}{\tt 0x0618} & 8 & R/W & Auxilliary UART config\\\hline
clear   &\scalebox{0.8}{\tt 0x0187} & 8 & R/W & Clear status on write\\\hline
CLEAR   &\scalebox{0.8}{\tt 0x061c} & 8 & R/W & Clear status on write\\\hline
Device ID &\scalebox{0.8}{\tt 0x0188-}\hfill & 5x32 & R & Device ID\\
DevID &\scalebox{0.8}{\tt 0x0620-}\hfill & 5x32 & R & Device ID\\
        &\scalebox{0.8}{\tt -0x018c}\hfill & & & \\\hline
        &\scalebox{0.8}{\tt -0x0630}\hfill & & & \\\hline
% asyncID &\scalebox{0.8}{\tt 0x018d} & 32 & R/W & Asynch Read ID.  Write starts the ASynch read, 0xff returned until complete\\\hline
% asyncID &\scalebox{0.8}{\tt 0x018d} & 32 & R/W & Asynch Read ID.  Write starts the ASynch read, 0xff returned until complete\\\hline
asyncOTP  &\scalebox{0.8}{\tt 0x18e} & 32 & W & Asynch Read OTP.  Write starts the ASynch read, 0xff returned until complete\\\hline
% asyncOTP  &\scalebox{0.8}{\tt 0x18e} & 32 & W & Asynch Read OTP.  Write starts the ASynch read, 0xff returned until complete\\\hline
OTP     &\scalebox{0.8}{\tt 0x0190-}\hfill &16x32 & R/W & OTP Memory\\
OTP     &\scalebox{0.8}{\tt 0x0640-}\hfill &16x32 & R/W & OTP Memory\\
        &\scalebox{0.8}{\hfill\tt -0x19f} & & & \\\hline
        &\scalebox{0.8}{\hfill\tt -0x19f} & & & \\\hline
% 0x010c-0x010f
% 0x010c-0x010f
\end{reglist}
\end{reglist}
\caption{Flash control registers}\label{tbl:flctl}
\caption{Flash control registers}\label{tbl:flctl}
\end{center}\end{table}
\end{center}\end{table}
Many of these registers are defined by the flash itself, and the interface
Many of these registers are defined by the flash itself, and the interface
just provides access to them.  These include the status, non--volatile
just provides access to them.  These include the status, non--volatile
configuration, volatile configuration, the extended volatile configuration,
configuration, volatile configuration, the extended volatile configuration,
and flag status registers.  In a similar fashion, the Device ID may be read
and flag status registers.  In a similar fashion, the Device ID may be read
from the device as well.  These registers are defined in the flash
from the device as well.  These registers are defined in the flash
specification.
specification.
 
 
One piece of configuration is required, though, before this interface will work
One piece of configuration is required, though, before this interface will work
properly either reading or writing.  That is that the fast read (or write)
properly either reading or writing.  That is that the fast read (or write)
delay must be set to eight clocks.  To do this, write a {\tt 0x08b} needs to be
delay must be set to eight clocks.  To do this, write a {\tt 0x08b} needs to be
written to the volatile configuration register.\footnote{To get the ZipCPU to
written to the volatile configuration register.\footnote{To get the ZipCPU to
start automatically upon power up, or indeed to have the flash start up in a
start automatically upon power up, or indeed to have the flash start up in a
working mode, the non--volatile configuration register will need to be adjusted
working mode, the non--volatile configuration register will need to be adjusted
to contain this information on power up.  Please consult the chip specification
to contain this information on power up.  Please consult the chip specification
to determine what to set that register to.}  To set the volatile configuration
to determine what to set that register to.}  To set the volatile configuration
register, disable the write protect found in the erase/write control register,
register, disable the write protect found in the erase/write control register,
and then write the new value to the volatile configuration register.
and then write the new value to the volatile configuration register.
 
 
Perhaps the most important register of this interface is the erase/write
Perhaps the most important register of this interface is the erase/write
control register.  This register enables or disables the write protect for
control register.  This register enables or disables the write protect for
the flash, and issues any erase sector or subsector commands.  The register
the flash, and issues any erase sector or subsector commands.  The register
itself is a bitfield, shown in Fig.~\ref{fig:fewbits}.
itself is a bitfield, shown in Fig.~\ref{fig:fewbits}.
\begin{figure}\begin{center}\begin{bytefield}[endianness=big]{32}
\begin{figure}\begin{center}\begin{bytefield}[endianness=big]{32}
\bitheader{0-31}\\
\bitheader{0-31}\\
        \bitbox{1}{W}
        \bitbox{1}{W}
        \bitbox{1}{E}
        \bitbox{1}{E}
        \bitbox{1}{Q}
        \bitbox{1}{Q}
        \bitbox{1}{S}
        \bitbox{1}{S}
        \bitbox{1}{I}
        \bitbox{1}{I}
        \bitbox{1}{V}
        \bitbox{1}{V}
        \bitbox{1}{X}
        \bitbox{1}{X}
        \bitbox{1}{}
        \bitbox{1}{}
        \bitbox{10}{Sector}
        \bitbox{10}{Sector}
        \bitbox{4}{Sub}
        \bitbox{4}{Sub}
        \bitbox{10}{Key}\\
        \bitbox{10}{Key}\\
\end{bytefield}
\end{bytefield}
\caption{Flash Erase/Write control register layout}\label{fig:fewbits}
\caption{Flash Erase/Write control register layout}\label{fig:fewbits}
\end{center}\end{figure}
\end{center}\end{figure}
The bits in this register are:
The bits in this register are:
 
 
$W$ is a Write-In-Progress bit.  It will be one when read if the device
$W$ is a Write-In-Progress bit.  It will be one when read if the device
is busy erasing or writing.  Upon any transition back to zero, the controller
is busy erasing or writing.  Upon any transition back to zero, the controller
will issue an interrupt.  This bit is also the Erase Command bit.  Write a
will issue an interrupt.  This bit is also the Erase Command bit.  Write a
`1' to this bit to command the flash to erase either a sector or a subsector.
`1' to this bit to command the flash to erase either a sector or a subsector.
 
 
$E$ is a write--enable bit.  Write a `1' to this bit to disable write
$E$ is a write--enable bit.  Write a `1' to this bit to disable write
protection, and a `0' to this bit to re-enable write protection.  (I highly
protection, and a `0' to this bit to re-enable write protection.  (I highly
recommend keeping write protection enabled.  I had an error in one of my
recommend keeping write protection enabled.  I had an error in one of my
programs once that erroneously started walking through peripheral register
programs once that erroneously started walking through peripheral register
space and \ldots)
space and \ldots)
 
 
$Q$ is set if Quad SPI mode is enabled.  This is currently hardwired to true
$Q$ is set if Quad SPI mode is enabled.  This is currently hardwired to true
within the design, so this bit will never change.
within the design, so this bit will never change.
 
 
$S$ is the subsector erase bit.  Upon any command to erase the device, if this
$S$ is the subsector erase bit.  Upon any command to erase the device, if this
bit is set then only a subsector will be erased.  If this bit is cleared,
bit is set then only a subsector will be erased.  If this bit is cleared,
the erase command will erase an entire sector.
the erase command will erase an entire sector.
 
 
The $I$ bit is set when the device ID has been read into a local RAM memory.
The $I$ bit is set when the device ID has been read into a local RAM memory.
Hence, reading from the device ID initially takes many clocks, but subsequent
Hence, reading from the device ID initially takes many clocks, but subsequent
reads should be very fast.
reads should be very fast.
 
 
The $V$ bit will be set upon any write violation, such as trying to write to
The $V$ bit will be set upon any write violation, such as trying to write to
the device with the write protect enabled.  This bit is cleared upon any
the device with the write protect enabled.  This bit is cleared upon any
write to the erase/write control register.
write to the erase/write control register.
 
 
$X$ is the XIP mode.  This is set any time bit 3 of the volatile configuration
$X$ is the XIP mode.  This is set any time bit 3 of the volatile configuration
register is set, and cleared upon any read from non--flash memory.
register is set, and cleared upon any read from non--flash memory.
 
 
Twenty four bits constitute the sector address.  When commanding the device
Twenty four bits constitute the sector address.  When commanding the device
to erase a sector, the register neds to know the top 10 of them.  When
to erase a sector, the register neds to know the top 10 of them.  When
commanding the device to erase a subsector, the controller needs the top
commanding the device to erase a subsector, the controller needs the top
14~bits.  The bottom 10~bits are a key.  Set these to {\tt 10'h1be} in order
14~bits.  The bottom 10~bits are a key.  Set these to {\tt 10'h1be} in order
to command a (sub)sector erase, or even to just adjust the sector address
to command a (sub)sector erase, or even to just adjust the sector address
kept and maintained in this register.
kept and maintained in this register.
 
 
Erasing a sector requires two writes to the erase/write command register.
Erasing a sector requires two writes to the erase/write command register.
The first write simply disables the write protect.  To do this, write a
The first write simply disables the write protect.  To do this, write a
{\tt 0x40000000} to the register.  The second write must be the sector
{\tt 0x40000000} to the register.  The second write must be the sector
address added or OR'd to {\tt 0xc00001be}.  When erasing a subsector,
address added or OR'd to {\tt 0xc00001be}.  When erasing a subsector,
set the subsector bit for these two commands.
set the subsector bit for these two commands.
 
 
Writing to a page is similar.  In that case, first disable the write protect
Writing to a page is similar.  In that case, first disable the write protect
as before, and then write (via burst mode) the new page values to the device.
as before, and then write (via burst mode) the new page values to the device.
The actual write is sent to the device as soon as the burst mode is complete.
The actual write is sent to the device as soon as the burst mode is complete.
Hence, writing in separate commands, or writing more than a page (64~words),
Hence, writing in separate commands, or writing more than a page (64~words),
will stall the bus.
will stall the bus.
 
 
While the write or erase is going on, the erase/write control register may be
While the write or erase is going on, the erase/write control register may be
read.  Once the erase or write has completed, an interrupt will be generated.
read.  Once the erase or write has completed, an interrupt will be generated.
Unlike the UART interrupts, this interrupt does not perpetually generate itself
Unlike the UART interrupts, this interrupt does not perpetually generate itself
until cleared.  Hence, you may wish to clear the flash interrupt before
until cleared.  Hence, you may wish to clear the flash interrupt before
an erase/write operation, and then check for the interrupt upon completion.
an erase/write operation, and then check for the interrupt upon completion.
Further, while the erase/write operation is ongoing, you must not try to read
Further, while the erase/write operation is ongoing, you must not try to read
from flash memory.  (It is likely to cause a bus error \ldots)
from flash memory.  (It is likely to cause a bus error \ldots)
 
 
The EQSPI lock register returns the lock register value associated with the
The EQSPI lock register returns the lock register value associated with the
currently selected sector.
currently selected sector.
 
 
The OTP registers reference one--time--programmable memory on the flash.
The OTP registers reference one--time--programmable memory on the flash.
This memory, once programmed, {\em can not be cleared}!  Programming this
This memory, once programmed, {\em can not be cleared}!  Programming this
memory constitues changing certain of the default `1's to zeros, depending
memory constitues changing certain of the default `1's to zeros, depending
upon the values you write to these registers.  They are written in a fashion
upon the values you write to these registers.  They are written in a fashion
similar to writing/programming a page as described above.
similar to writing/programming a page as described above.
 
 
\chapter{Wishbone Datasheet}\label{ch:wishbone}
\chapter{Wishbone Datasheet}\label{ch:wishbone}
 
 
The master and slave interfaces have been simplified with the following
The master and slave interfaces have been simplified with the following
requirement: the {\tt STB} line is not allowed to be high unless the {\tt CYC}
requirement: the {\tt STB} line is not allowed to be high unless the {\tt CYC}
line is high.  In this fashion, a slave may often be able to ignore {\tt CYC}
line is high.  In this fashion, a slave may often be able to ignore {\tt CYC}
and only act on the presence of {\tt STB}, knowing that {\tt CYC} must be
and only act on the presence of {\tt STB}, knowing that {\tt CYC} must be
active at the same time.
active at the same time.
 
 
\chapter{Clocks}\label{ch:clocks}
\chapter{Clocks}\label{ch:clocks}
\begin{table}\begin{center}
\begin{table}\begin{center}
\begin{clocklist}
\begin{clocklist}
{\tt i\_clk\_100mhz} & Ext & \multicolumn{2}{c|}{100} &
{\tt i\_clk\_100mhz} & Ext & \multicolumn{2}{c|}{100} &
        100~MHz Crystal Oscillator \\\hline
        100~MHz Crystal Oscillator \\\hline
{\em Future }{\tt s\_clk} & PLL & 152 & 166 & Internal Logic, Wishbone Clock \\\hline
{\em Future }{\tt s\_clk} & PLL & 152 & 166 & Internal Logic, Wishbone Clock \\\hline
{\tt s\_clk} & PLL & 83.33 & 75.76& DDR3 SDRAM Controller Clock \\\hline
{\tt s\_clk} & PLL & 83.33 & 75.76& DDR3 SDRAM Controller Clock \\\hline
\multicolumn{2}{|c|}{\tt mem\_clk\_200mhz} & 200~MHz & & MIG Reference clock for PHASER generation\\\hline
\multicolumn{2}{|c|}{\tt mem\_clk\_200mhz} & 200~MHz & & MIG Reference clock for PHASER generation\\\hline
{\tt ddr3\_ck\_}$x$ & DDR & 166.67 & 303 & DDR3 Command Clock\\\hline
{\tt ddr3\_ck\_}$x$ & DDR & 166.67 & 303 & DDR3 Command Clock\\\hline
{\tt o\_qspi\_sck} & DDR & 95 & & QSPI Flash clock \\\hline
{\tt o\_qspi\_sck} & DDR & 95 & & QSPI Flash clock \\\hline
{\tt o\_sd\_clk} & Logic & 50 & 0.100 & SD--Card clock \\\hline
{\tt o\_sd\_clk} & Logic & 50 & 0.100 & SD--Card clock \\\hline
{\tt o\_oled\_sck} & Logic & 166 & & OLED SPI clock \\\hline
{\tt o\_oled\_sck} & Logic & 166 & & OLED SPI clock \\\hline
{\tt o\_eth\_mdclk} & Logic & 25 & 2.5 & Ethernet MDIO controller clock\\\hline
{\tt o\_eth\_mdclk} & Logic & 25 & 2.5 & Ethernet MDIO controller clock\\\hline
\end{clocklist}
\end{clocklist}
\caption{OpenArty clocks}\label{tbl:clocks}
\caption{OpenArty clocks}\label{tbl:clocks}
\end{center}\end{table}
\end{center}\end{table}
 
 
\chapter{I/O Ports}
\chapter{I/O Ports}
 
 
Table.~\ref{tbl:ioports}
Table.~\ref{tbl:ioports}
\begin{table}[htbp]
\begin{table}[htbp]
\begin{center}
\begin{center}
\begin{portlist}
\begin{portlist}
i\_clk\_100mhz & 1 & Input & Clock\\\hline
i\_clk\_100mhz & 1 & Input & Clock\\\hline
o\_qspi\_cs\_n & 1 & Output & Quad SPI Flash chip select\\\hline
o\_qspi\_cs\_n & 1 & Output & Quad SPI Flash chip select\\\hline
o\_qspi\_sck & 1 & Output & Quad SPI Flash clock\\\hline
o\_qspi\_sck & 1 & Output & Quad SPI Flash clock\\\hline
io\_qspi\_dat & 4 & Input/Output & Four-wire SPI flash data bus\\\hline
io\_qspi\_dat & 4 & Input/Output & Four-wire SPI flash data bus\\\hline
i\_btn & 4 & Input  & Inputs from the two on-board push-buttons\\\hline
i\_btn & 4 & Input  & Inputs from the two on-board push-buttons\\\hline
i\_sw  & 4 & Input  & Inputs from the two on-board push-buttons\\\hline
i\_sw  & 4 & Input  & Inputs from the two on-board push-buttons\\\hline
o\_led & 4 & Output & Outputs controlling the four on-board LED's\\\hline
o\_led & 4 & Output & Outputs controlling the four on-board LED's\\\hline
o\_clr\_led0 & 3 & Output & \\\hline
o\_clr\_led0 & 3 & Output & \\\hline
o\_clr\_led1 & 3 & Output & \\\hline
o\_clr\_led1 & 3 & Output & \\\hline
o\_clr\_led2 & 3 & Output & \\\hline
o\_clr\_led2 & 3 & Output & \\\hline
o\_clr\_led3 & 3 & Output & \\\hline
o\_clr\_led3 & 3 & Output & \\\hline
i\_uart\_rx & 1 & Input &  UART receive input\\\hline
i\_uart\_rx & 1 & Input &  UART receive input\\\hline
o\_uart\_tx & 1 & Output & UART transmit output\\\hline\hline
o\_uart\_tx & 1 & Output & UART transmit output\\\hline\hline
i\_aux\_rx & 1 & Input &  Auxiliary/Pmod UART receive input\\\hline
i\_aux\_rx & 1 & Input &  Auxiliary/Pmod UART receive input\\\hline
o\_aux\_tx & 1 & Output & Auxiliary/Pmod UART transmit output\\\hline
o\_aux\_tx & 1 & Output & Auxiliary/Pmod UART transmit output\\\hline
i\_aux\_rts & 1 & Input &  Auxiliary/Pmod UART receive input\\\hline
i\_aux\_rts & 1 & Input &  Auxiliary/Pmod UART ready--to--send\\\hline
o\_aux\_cts & 1 & Output & Auxiliary/Pmod UART transmit output\\\hline\hline
o\_aux\_cts & 1 & Output & Auxiliary/Pmod UART clear--to--send\\\hline\hline
i\_gps\_rx & 1 & Input &  GPS/Pmod UART receive input\\\hline
i\_gps\_rx & 1 & Input &  GPS/Pmod UART receive input\\\hline
o\_gps\_tx & 1 & Output & GPS/Pmod UART transmit output\\\hline
o\_gps\_tx & 1 & Output & GPS/Pmod UART transmit output\\\hline
i\_gps\_pps & 1 & Input & GPS Part-per-second (PPS) signal\\\hline
i\_gps\_pps & 1 & Input & GPS Part-per-second (PPS) signal\\\hline
i\_gps\_3df & 1 & Input & GPS\\\hline\hline
i\_gps\_3df & 1 & Input & GPS\\\hline\hline
o\_oled\_cs\_n & 1 & Output & \\\hline
o\_oled\_cs\_n & 1 & Output & \\\hline
o\_oled\_sck & 1 & Output & \\\hline
o\_oled\_sck & 1 & Output & \\\hline
o\_oled\_mosi & 1 & Output & \\\hline
o\_oled\_mosi & 1 & Output & \\\hline
i\_oled\_miso & 1 & Input & \\\hline
i\_oled\_miso & 1 & Input & \\\hline
o\_oled\_reset & 1 & Output & \\\hline
o\_oled\_reset & 1 & Output & \\\hline
o\_oled\_dc & 1 & Output & \\\hline
o\_oled\_dc & 1 & Output & \\\hline
o\_oled\_en & 1 & Output & \\\hline
o\_oled\_en & 1 & Output & \\\hline
o\_oled\_pmen & 1 & Output & \\\hline\hline
o\_oled\_pmen & 1 & Output & \\\hline\hline
o\_sd\_sck & 1 & Output & SD Clock\\\hline
o\_sd\_sck & 1 & Output & SD Clock\\\hline
i\_sd\_cd & 1 & Input & Card Detect\\\hline
i\_sd\_cd & 1 & Input & Card Detect\\\hline
i\_sd\_wp & 1 & Input & Write Protect\\\hline
i\_sd\_wp & 1 & Input & Write Protect\\\hline
io\_cmd & 1 & In/Output & SD Bi-directional command wire\\\hline
io\_cmd & 1 & In/Output & SD Bi-directional command wire\\\hline
io\_sd & 4 & In/Output & SD Bi-directional data lines\\\hline\hline
io\_sd & 4 & In/Output & SD Bi-directional data lines\\\hline\hline
o\_cls\_cs\_n & 1 & Output & CLS Display chip select\\\hline
o\_cls\_cs\_n & 1 & Output & CLS Display chip select\\\hline
o\_cls\_sck & 1 & Output & CLS Display clock\\\hline
o\_cls\_sck & 1 & Output & CLS Display clock\\\hline
o\_cls\_mosi & 1 & Output & CLS Display MOSI\\\hline
o\_cls\_mosi & 1 & Output & CLS Display MOSI\\\hline
i\_cls\_miso & 1 & Input & CLS Display MISO\\\hline\hline
i\_cls\_miso & 1 & Input & CLS Display MISO\\\hline\hline
\end{portlist}
\end{portlist}
\caption{List of IO ports}\label{tbl:ioports}
\caption{List of IO ports}\label{tbl:ioports}
\end{center}\end{table}
\end{center}\end{table}
lists the various I/O ports associated with OpenArty.
lists the various I/O ports associated with OpenArty.
 
 
 
 
% Appendices
% Appendices
% Index
% Index
\end{document}
\end{document}
 
 
 
 
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.