Commits

Benoît Allard  committed 89cab82

Copy the wiki to a sphinx project

  • Participants
  • Parent commits e247edd

Comments (0)

Files changed (29)

-syntax:glob
-
-*.pyc
-*.vcd*
-
+glob:docs/_build
+glob:*.pyc
+glob:*.vcd*

File docs/Makefile

+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS    =
+SPHINXBUILD   = sphinx-build
+PAPER         =
+BUILDDIR      = _build
+
+# Internal variables.
+PAPEROPT_a4     = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+# the i18n builder cannot share the environment and doctrees with the others
+I18NSPHINXOPTS  = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+
+.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
+
+help:
+	@echo "Please use \`make <target>' where <target> is one of"
+	@echo "  html       to make standalone HTML files"
+	@echo "  dirhtml    to make HTML files named index.html in directories"
+	@echo "  singlehtml to make a single large HTML file"
+	@echo "  pickle     to make pickle files"
+	@echo "  json       to make JSON files"
+	@echo "  htmlhelp   to make HTML files and a HTML help project"
+	@echo "  qthelp     to make HTML files and a qthelp project"
+	@echo "  devhelp    to make HTML files and a Devhelp project"
+	@echo "  epub       to make an epub"
+	@echo "  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+	@echo "  latexpdf   to make LaTeX files and run them through pdflatex"
+	@echo "  text       to make text files"
+	@echo "  man        to make manual pages"
+	@echo "  texinfo    to make Texinfo files"
+	@echo "  info       to make Texinfo files and run them through makeinfo"
+	@echo "  gettext    to make PO message catalogs"
+	@echo "  changes    to make an overview of all changed/added/deprecated items"
+	@echo "  linkcheck  to check all external links for integrity"
+	@echo "  doctest    to run all doctests embedded in the documentation (if enabled)"
+
+clean:
+	-rm -rf $(BUILDDIR)/*
+
+html:
+	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+	@echo
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+dirhtml:
+	$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+	@echo
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+singlehtml:
+	$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
+	@echo
+	@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
+
+pickle:
+	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+	@echo
+	@echo "Build finished; now you can process the pickle files."
+
+json:
+	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+	@echo
+	@echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+	@echo
+	@echo "Build finished; now you can run HTML Help Workshop with the" \
+	      ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+qthelp:
+	$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+	@echo
+	@echo "Build finished; now you can run "qcollectiongenerator" with the" \
+	      ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+	@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/PureDarwin.qhcp"
+	@echo "To view the help file:"
+	@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/PureDarwin.qhc"
+
+devhelp:
+	$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
+	@echo
+	@echo "Build finished."
+	@echo "To view the help file:"
+	@echo "# mkdir -p $$HOME/.local/share/devhelp/PureDarwin"
+	@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/PureDarwin"
+	@echo "# devhelp"
+
+epub:
+	$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
+	@echo
+	@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
+
+latex:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo
+	@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+	@echo "Run \`make' in that directory to run these through (pdf)latex" \
+	      "(use \`make latexpdf' here to do that automatically)."
+
+latexpdf:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo "Running LaTeX files through pdflatex..."
+	$(MAKE) -C $(BUILDDIR)/latex all-pdf
+	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+text:
+	$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
+	@echo
+	@echo "Build finished. The text files are in $(BUILDDIR)/text."
+
+man:
+	$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
+	@echo
+	@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
+
+texinfo:
+	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+	@echo
+	@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
+	@echo "Run \`make' in that directory to run these through makeinfo" \
+	      "(use \`make info' here to do that automatically)."
+
+info:
+	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+	@echo "Running Texinfo files through makeinfo..."
+	make -C $(BUILDDIR)/texinfo info
+	@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
+
+gettext:
+	$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
+	@echo
+	@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
+
+changes:
+	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+	@echo
+	@echo "The overview file is in $(BUILDDIR)/changes."
+
+linkcheck:
+	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+	@echo
+	@echo "Link check complete; look for any errors in the above output " \
+	      "or in $(BUILDDIR)/linkcheck/output.txt."
+
+doctest:
+	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+	@echo "Testing of doctests in the sources finished, look at the " \
+	      "results in $(BUILDDIR)/doctest/output.txt."

File docs/_static/Core.png

Added
New image

File docs/_static/DWARF.png

Added
New image

File docs/_static/Fold.png

Added
New image

File docs/_static/Gemini.png

Added
New image

File docs/_static/Modules.png

Added
New image

File docs/_static/Proc-fsm.png

Added
New image

File docs/_static/Proc.png

Added
New image

File docs/_static/RAM.png

Added
New image

File docs/conf.py

+# -*- coding: utf-8 -*-
+#
+# PureDarwin documentation build configuration file, created by
+# sphinx-quickstart on Tue Mar 20 19:33:26 2012.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys, os
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+#sys.path.insert(0, os.path.abspath('.'))
+
+# -- General configuration -----------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = []
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The encoding of source files.
+#source_encoding = 'utf-8-sig'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = u'PureDarwin'
+copyright = u'2012, Benoit Allard'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version = '0.5'
+# The full version, including alpha/beta/rc tags.
+release = '0.5'
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+exclude_patterns = ['_build']
+
+# The reST default role (used for this markup: `text`) to use for all documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# A list of ignored prefixes for module index sorting.
+#modindex_common_prefix = []
+
+
+# -- Options for HTML output ---------------------------------------------------
+
+# The theme to use for HTML and HTML Help pages.  See the documentation for
+# a list of builtin themes.
+html_theme = 'default'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further.  For a list of options available for each theme, see the
+# documentation.
+#html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+#html_theme_path = []
+
+# The name for this set of Sphinx documents.  If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar.  Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_domain_indices = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+#html_show_sourcelink = True
+
+# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
+#html_show_sphinx = True
+
+# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
+#html_show_copyright = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it.  The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# This is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = None
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'PureDarwindoc'
+
+
+# -- Options for LaTeX output --------------------------------------------------
+
+latex_elements = {
+# The paper size ('letterpaper' or 'a4paper').
+#'papersize': 'letterpaper',
+
+# The font size ('10pt', '11pt' or '12pt').
+#'pointsize': '10pt',
+
+# Additional stuff for the LaTeX preamble.
+#'preamble': '',
+}
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, documentclass [howto/manual]).
+latex_documents = [
+  ('index', 'PureDarwin.tex', u'PureDarwin Documentation',
+   u'Benoit Allard', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# If true, show page references after internal links.
+#latex_show_pagerefs = False
+
+# If true, show URL addresses after external links.
+#latex_show_urls = False
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_domain_indices = True
+
+
+# -- Options for manual page output --------------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+    ('index', 'puredarwin', u'PureDarwin Documentation',
+     [u'Benoit Allard'], 1)
+]
+
+# If true, show URL addresses after external links.
+#man_show_urls = False
+
+
+# -- Options for Texinfo output ------------------------------------------------
+
+# Grouping the document tree into Texinfo files. List of tuples
+# (source start file, target name, title, author,
+#  dir menu entry, description, category)
+texinfo_documents = [
+  ('index', 'PureDarwin', u'PureDarwin Documentation',
+   u'Benoit Allard', 'PureDarwin', 'One line description of project.',
+   'Miscellaneous'),
+]
+
+# Documents to append as an appendix to all manuals.
+#texinfo_appendices = []
+
+# If false, no module index is generated.
+#texinfo_domain_indices = True
+
+# How to display URL addresses: 'footnote', 'no', or 'inline'.
+#texinfo_show_urls = 'footnote'

File docs/darwin.rst

+Darwin
+======
+
+From Wikipedia_:
+
+    Darwin was a programming game invented in August 1961 by Victor
+    A. Vyssotsky, Robert Morris Sr., and M. Douglas McIlroy. The game
+    was developed at Bell Labs, and played on an **IBM 7090
+    mainframe** there. The game was only played for a few weeks before
+    Morris developed an "ultimate" program that eventually brought the
+    game to an end, as no-one managed to produce anything that could
+    defeat it.
+
+.. _Wikipedia: http://en.wikipedia.org/wiki/Darwin_%28programming_game%29

File docs/index.rst

+.. PureDarwin documentation master file, created by
+   sphinx-quickstart on Tue Mar 20 19:33:26 2012.
+   You can adapt this file completely to your liking, but it should at least
+   contain the root `toctree` directive.
+
+Welcome to PureDarwin's documentation!
+======================================
+
+Contents:
+
+.. toctree::
+   :maxdepth: 2
+
+   introduction
+   darwin
+   redcode
+   redcode/ISA
+   redcode/IMP
+   redcode/Dwarf
+   redcode/Gemini
+   modules
+   modules/core
+   modules/core/ram
+   modules/core/fold
+   modules/taskqueue
+   modules/proc
+   modules/pspace
+   todo
+   status
+
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
+

File docs/introduction.rst

+Introduction
+============
+
+**puredarwin** is a pure Hardware Implementation of CoreWar.
+
+Darwin ???
+----------
+
+:doc:`darwin` is the predecessor of the CoreWar *game*.
+
+CoreWar ?
+---------
+
+( `corewar.co.uk`_ | `corewar.info`_ | `corewars.org`_ )
+
+.. _corewar.co.uk: http://corewar.co.uk/
+.. _corewar.info: http://www.corewar.info/
+.. _corewars.org: http://www.corewars.org
+
+In Corewar, programs are fighting each other in the same memory space,
+the goal is to kill the other programs by making them execute illegal
+instructions.
+
+Programs are written in assembly, :doc:`redcode` is the name of the
+assembly used.
+
+pure Hardware Implementation ?
+------------------------------
+
+Our world is made of two kind of people, the one that write software,
+and the one that design hardware. In the past, the former were slaved
+by the later, this is less and less true. Anyway, I made my study in
+the hardware field, and I'm now spending my day at $paying_job writing
+software.
+
+Our goal here is to achieve a silicon running CoreWar game engine.
+
+Actually, when I speak about an implementation of CoreWar, I am truly
+speaking about an implementation of MARS (**M**\emory **A**\rray
+**R**\edcode **S**\imulator) ... even if my implementation is everything
+but a simulator !
+
+This implementation is split into :doc:`modules`.
+
+The code is written in an unexpected language when in comes to
+Hardware Design, I choose Python to help me with that task. Bare
+Python is of course not able to describe Hardware Modules, that's
+where MyHDL comes into the scene. MyHDL
+advertise itself as being able to output VHDL as well as Verilog, I'm
+curious of the result. Anyway, I don't own any FPGA, ASIC or even
+Lattice right now, so gtkwave will be my best guess when it comes to
+simulation for some time.
+
+.. _MyHDL: http://www.myhdl.org/

File docs/make.bat

+@ECHO OFF
+
+REM Command file for Sphinx documentation
+
+if "%SPHINXBUILD%" == "" (
+	set SPHINXBUILD=sphinx-build
+)
+set BUILDDIR=_build
+set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
+set I18NSPHINXOPTS=%SPHINXOPTS% .
+if NOT "%PAPER%" == "" (
+	set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
+	set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
+)
+
+if "%1" == "" goto help
+
+if "%1" == "help" (
+	:help
+	echo.Please use `make ^<target^>` where ^<target^> is one of
+	echo.  html       to make standalone HTML files
+	echo.  dirhtml    to make HTML files named index.html in directories
+	echo.  singlehtml to make a single large HTML file
+	echo.  pickle     to make pickle files
+	echo.  json       to make JSON files
+	echo.  htmlhelp   to make HTML files and a HTML help project
+	echo.  qthelp     to make HTML files and a qthelp project
+	echo.  devhelp    to make HTML files and a Devhelp project
+	echo.  epub       to make an epub
+	echo.  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter
+	echo.  text       to make text files
+	echo.  man        to make manual pages
+	echo.  texinfo    to make Texinfo files
+	echo.  gettext    to make PO message catalogs
+	echo.  changes    to make an overview over all changed/added/deprecated items
+	echo.  linkcheck  to check all external links for integrity
+	echo.  doctest    to run all doctests embedded in the documentation if enabled
+	goto end
+)
+
+if "%1" == "clean" (
+	for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
+	del /q /s %BUILDDIR%\*
+	goto end
+)
+
+if "%1" == "html" (
+	%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The HTML pages are in %BUILDDIR%/html.
+	goto end
+)
+
+if "%1" == "dirhtml" (
+	%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
+	goto end
+)
+
+if "%1" == "singlehtml" (
+	%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
+	goto end
+)
+
+if "%1" == "pickle" (
+	%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished; now you can process the pickle files.
+	goto end
+)
+
+if "%1" == "json" (
+	%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished; now you can process the JSON files.
+	goto end
+)
+
+if "%1" == "htmlhelp" (
+	%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished; now you can run HTML Help Workshop with the ^
+.hhp project file in %BUILDDIR%/htmlhelp.
+	goto end
+)
+
+if "%1" == "qthelp" (
+	%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished; now you can run "qcollectiongenerator" with the ^
+.qhcp project file in %BUILDDIR%/qthelp, like this:
+	echo.^> qcollectiongenerator %BUILDDIR%\qthelp\PureDarwin.qhcp
+	echo.To view the help file:
+	echo.^> assistant -collectionFile %BUILDDIR%\qthelp\PureDarwin.ghc
+	goto end
+)
+
+if "%1" == "devhelp" (
+	%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished.
+	goto end
+)
+
+if "%1" == "epub" (
+	%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The epub file is in %BUILDDIR%/epub.
+	goto end
+)
+
+if "%1" == "latex" (
+	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
+	goto end
+)
+
+if "%1" == "text" (
+	%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The text files are in %BUILDDIR%/text.
+	goto end
+)
+
+if "%1" == "man" (
+	%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The manual pages are in %BUILDDIR%/man.
+	goto end
+)
+
+if "%1" == "texinfo" (
+	%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
+	goto end
+)
+
+if "%1" == "gettext" (
+	%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
+	goto end
+)
+
+if "%1" == "changes" (
+	%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.The overview file is in %BUILDDIR%/changes.
+	goto end
+)
+
+if "%1" == "linkcheck" (
+	%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Link check complete; look for any errors in the above output ^
+or in %BUILDDIR%/linkcheck/output.txt.
+	goto end
+)
+
+if "%1" == "doctest" (
+	%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Testing of doctests in the sources finished, look at the ^
+results in %BUILDDIR%/doctest/output.txt.
+	goto end
+)
+
+:end

File docs/modules.rst

+Modules
+=======
+
+We have to split the design into modules
+
+.. figure:: _static/Modules.png
+
+   Architecture
+
+* The :doc:`modules/core` alias the **Memory**
+* The :doc:`modules/taskqueue` alias the **Scheduler** unit
+* The :doc:`modules/proc` alias the **Processing** unit
+* The :doc:`modules/pspace` or the Process **private Storage** space

File docs/modules/core.rst

+The Core
+========
+
+
+The Core is the main **Memory** were the programs fight
+themselves. (As opposed to *each-others*, as nothing prevent you to
+hurt yourself.)
+
+.. image:: ../_static/Core.png
+
+As we can see, the Core is split into RAM modules that each of them
+store a logical part of the Instructions. there are exactly **6** of
+them. One for each part:
+
+#. OpCode
+#. Modifier
+#. AMode
+#. ANumber
+#. BMode
+#. BNumber
+
+Ports
+-----
+
+input
+^^^^^
+
+Control Signals
+~~~~~~~~~~~~~~~
+
+* pc
+* Wofs
+* din
+* ROfs
+* we
+
+Synchronous signals
+~~~~~~~~~~~~~~~~~~~
+
+* clk
+* rst_n
+
+Parameters
+~~~~~~~~~~
+
+* maxSize: the depth of each internal RAM
+
+
+output
+^^^^^^
+
+As every good memory, we only have one output port being the data at
+the ``ROfs`` address.
+
+* dout
+
+Sub-processes
+-------------
+
+The Core has one main combinatorial subprocess that just split the
+incoming Instruction in chuncks for the RAM modules, and join back the
+chunks from the RAM modules into one Instruction for the others
+:doc:`../modules`.
+
+internal Signals
+----------------
+
+Internal signals are only intercommunication signals between the
+sub-modules.
+
+Submodules
+----------
+
+RAM
+^^^
+
+See :doc:`core/ram`.
+
+The basic component of the Core is a RAM with both a read and a write
+address bus. This will allow us to make asynchronous read, while
+making synchronous write.
+
+Fold
+^^^^
+
+See :doc:`core/fold`.
+
+The Fold module just care about the fact that all our Read/Write are
+relative to the current Instruction Pointer. The Core itself, through
+this module takes offset as Input and translate those Offset as
+Absolute Addresses.
+

File docs/modules/core/fold.rst

+Fold
+====
+
+.. image:: ../../_static/Fold.png
+
+Ports
+-----
+
+input
+^^^^^
+
+Control ports
+~~~~~~~~~~~~~
+
+* PC: The current Program Counter
+* Offset
+
+parameters
+~~~~~~~~~~
+
+* limit: Folding limit
+* maxSize: Size of the :doc:`../core`
+
+output
+^^^^^^
+
+* Address
+
+Sub-processes
+-------------
+
+This module is composed of three sub-modules:
+
+* Modulo is used to calculate a temporary value
+* Folding to Fold the Address into its Read (or Write) boundary.
+* Addition to make the Address Absolute. (This step also includes a
+  Modulo)
+
+For the two first steps, the Cref provides the following listing:
+
+.. code-block:: c
+
+   /* There is one support function used to limit the range of */
+   /* reading from Core and writing to Core relative to the    */
+   /* current instruction.  Behaviour is as expected (a small  */
+   /* core within Core) only if the limits are factors of the  */
+   /* size of Core.                                            */
+
+   static Address Fold(
+      Address  pointer,    /* The pointer to fold into the desired range.  */
+      Address  limit,      /* The range limit.                             */
+      Address  M           /* The size of Core.                            */
+   ) {
+      Address  result;
+
+      result = pointer % limit;
+      if ( result > (limit/2) ) {
+         result += M - limit;
+      };
+      return(result);
+   }
+
+Internal Signals
+----------------
+
+We have two internal signals to interconnect our three
+sub-process. Each one of them representing our output at its different
+stage of processing.

File docs/modules/core/ram.rst

+The RAM
+=======
+
+.. image:: ../../_static/RAM.png
+
+Ports
+-----
+
+input
+^^^^^
+
+Control Signals
+~~~~~~~~~~~~~~~
+
+* raddr
+* waddr
+* din
+* we
+
+Synchronisation Signals
+~~~~~~~~~~~~~~~~~~~~~~~
+
+* clk
+* rst_n (not taken into account in the current implementation)
+
+Parameters
+~~~~~~~~~~
+
+* width: the width (in bits) of the RAM
+* depth: the depth (in number of cell) of the RAM
+
+output
+^^^^^^
+
+Control Signals
+~~~~~~~~~~~~~~~
+
+* dout
+
+sub-process
+-----------
+
+read
+^^^^
+
+Read is completely combinatorial and simply return on ``dout`` the
+value of the RAM @ ``raddr``.
+
+write
+^^^^^
+
+Write is triggered by the clock, and write ``din`` to the RAM if
+``we`` is set.

File docs/modules/proc.rst

+The Proc
+========
+
+This is the Processing unit. Its main characteristic is that is has to
+be a state-less Module, as no state should subsist between
+processes. This same processing unit will be called by each of the
+Programs to try destroy each other. Every time, with a new
+instruction, and at the end of the processing, everything is done.
+
+.. image:: ../_static/Proc.png
+
+Ports
+-----
+
+input
+^^^^^
+
+Control Signals
+~~~~~~~~~~~~~~~
+
+* Instr
+* PC
+* RData
+
+Synchronous signals
+~~~~~~~~~~~~~~~~~~~
+
+* clk
+* rst_n
+
+Synchronisation signals
+~~~~~~~~~~~~~~~~~~~~~~~
+
+* req
+
+output
+^^^^^^
+
+Control Signals
+~~~~~~~~~~~~~~~
+
+* IPOut1
+* we1
+* IPOut2
+* we2
+* WOfs
+* WData
+* we
+* ROfs
+
+Synchronisation signals
+~~~~~~~~~~~~~~~~~~~~~~~
+
+* ack
+
+State-machine
+-------------
+
+.. image:: ../_static/Proc-fsm.png
+
+Sub-processes
+-------------
+
+* link is actually just a splitter *à la* VHDL aliases.
+* fsm is our FSM.
+
+MUXs
+^^^^
+
+the following process are just MUX that dispatch the info acording to the FSM state.
+
+* fsmcore
+* updateROfs
+* updateIRX
+* updatewe
+* updatewdata
+
+Sub-modules
+-----------
+
+EvalOp
+^^^^^^
+
+Evaluate the operand part of the Instruction (Mode + Number). This one
+is instanciated twice, once for each of the Operands.
+
+OutQueue
+^^^^^^^^
+
+Make the Instruction readable for the :doc:`taskqueue`.
+
+OutCore
+^^^^^^^
+
+Make the Instruction readable for the :doc:`core`.

File docs/modules/pspace.rst

+pSpace
+======
+
+Not implemented

File docs/modules/taskqueue.rst

+Task-Queue
+==========
+
+The task queue is a collection of ``FiFo``\s. One for each Warrior
+keeping track of the current tasks running for each Warrior.
+
+Sub-process
+-----------
+
+MUXs
+^^^^
+
+One to direct the input to the right FIFO, another one to read the
+right task from the right FIFO.
+
+Sub-modules
+-----------
+
+FIFO
+^^^^
+
+It is a FIFO that can queue two tasks in the same cycle.
+
+One synchronous sub-process that reacts on ``clk`` and ``rst_n``.
+

File docs/redcode.rst

+RedCode
+=======
+
+RedCode is the assembly language used to program the MARS Virtual
+Machine.
+
+We will regard here only the the details we need to look at as
+hardware designer. The rest is left to the dozen of good tutorials you
+will find on the Internet. If you don't know where to start, Google_
+might be your friend that time. That said, don't expect any easy talk
+in there.
+
+.. _Google: http://www.google.com/search?q=redcode+tutorial+corewar+mars+assembly+core
+
+They are different version of the standard defining the RedCode
+language, ranging from '86, '88 and extended ('94 has never been
+confirmed as a standard). We will try to implement most of the
+extended feature, while keeping compatibility with the previous
+standards.
+
+Instruction Set
+---------------
+
+See :doc:`redcode/ISA`.
+
+Address Mode
+------------
+
+First thing to kno. Is that memory access inside the MARS are relative
+to the current instruction pointer (noted IP here below). As seen from
+a program, all addresses are relative to the one of the currently
+executed instruction.
+
+To keep a low memory footprint, RedCode has 5 address mode:
+
+.. table:: RedCode address modes
+
+   =========================================== ==================== ========================== ============ ============
+    Name                                        Relative operation   Absolute operation         A-Notation   B-Notation 
+   =========================================== ==================== ========================== ============ ============
+    Immediate Memory Addressing                 0                    IP                         ``#``        ``#``
+    Direct Memory Addressing                    *x*                  IP + *x*                   ``$``        ``$``
+    Indirect Memory Adressing                   [IP + *x*\]          IP + *x* + [IP + *x*\]     ``*``        ``@``
+    Post Increment Indirect Memory Addressing   [IP + *x*\]++        IP + *x* + [IP + *x*]++    ``{``        ``<``
+    Pre Decrement Indirect Memory Addressing    --[IP + *x*\]        IP + *x* + --[IP + *x*/]   ``}``        ``>``
+   =========================================== ==================== ========================== ============ ============
+
+The last three one actually count double as we can address the first
+operand or the second operand on those addresses in Memory.
+
+Out of those one, the last two one are pretty unusual, even for an
+experienced assembly programmer, just because of the fact that those
+Memory addressing modes *modify* the memory content instead of just
+pointing to it.
+
+Examples
+--------
+
+ * :doc:`redcode/IMP`
+ * :doc:`redcode/Dwarf`
+ * :doc:`redcode/Gemini`

File docs/redcode/Dwarf.rst

+Dwarf
+=====
+
+.. code-block:: nasm
+
+   ;redcode
+   ;name Dwarf
+   ;author A. K. Dewdney
+   ;assert CORESIZE % 5 == 0
+
+   	DAT		-1
+   	ADD	#5,	-1	; start address
+   	MOV	#0,	@-2
+   	JMP	-2
+
+Another version put the Bomb after itself
+
+.. code-block:: nasm
+
+   ;redcode
+   	ADD	#4,	3
+   	MOV	#2,	@2
+   	JMP	-2
+
+Here is the result of a simulation on my MARS:
+
+.. figure:: ../_static/DWARF.png
+
+   Dwarf simulation

File docs/redcode/Gemini.rst

+Gemini
+======
+
+Code
+----
+
+.. code-block:: nasm
+
+   ;redcode
+   ;name Gemini
+   ;author A. K. Dewdney
+   ;assert 1
+
+   	DAT		0
+   	DAT		99
+   	MOV	@-2,	@-1 ; start address
+   	SNE	-3,	#9
+   	JMP	4
+   	ADD	#1,	-5
+   	ADD	#1,	-5
+   	JMP	-5
+   	MOV	#99,	93
+   	JMP	93
+
+Simulation
+----------
+
+.. figure:: ../_static/Gemini.png
+
+   Waveforms

File docs/redcode/IMP.rst

+IMP
+===
+
+.. code-block:: nasm
+
+   ;redcode
+   ;name Imp
+   ;author A. K. Dewdney
+   ;assert 1
+
+   	MOV	0,	1
+

File docs/redcode/ISA.rst

+RedCode Instruction Set
+=======================
+
+One feature of a processor running RedCode is that it has to implement
+some OS functionnalities at the silicon level. I'm mainly speacking
+here of the ``SPL`` instruction, and derivated ones. That
+instruction queue a new task in the task queue. For an unix
+developer, it is a :manpage:`fork(2)` at the silicon level. 
+
+The typical example is:
+
+.. code-block:: nasm
+
+   SPL 0            ; execution starts here
+   MOV 0, 1
+
+Since the ``SPL`` points to itself, after one cycle the processes will
+be like this:
+
+.. code-block:: nasm
+
+   SPL 0            ; second process is here
+   MOV 0, 1         ; first process is here
+
+After both of the processes have executed, the core will now look like:
+
+.. code-block:: nasm
+
+   SPL 0            ; third process is here
+   MOV 0, 1         ; second process is here
+   MOV 0, 1         ; first process is here
+
+So this code evidently launches a series of imps, one after
+another. It will keep on doing this until the imps have circled the
+whole core and overwrite the ``SPL``. 

File docs/status.rst

+Status
+======
+
+``hg log`` is your friend ...
+
+``Tue Mar 20 20:31:35 CET 2012``
+--------------------------------
+
+Reorganizing everything ...
+
+``Wed Dec  2 00:48:03 CET 2009``
+--------------------------------
+
+A good simulation basis
+^^^^^^^^^^^^^^^^^^^^^^^
+
+I realized the incapacity of MyHDL to synthesize anything. That's not
+bad in itself, Actually, I did not ordered my ALTERA yet, so, I'm not
+able to check any synthesis. And better yet, till now, even If I tried
+to keep to a synthetizable MyHDL, I never used it. I used MyHDL, (I
+have to admit it, without realizing it), as a prototyping tool, and
+thanks to it, I got results !
+
+The current repository also has a good base for simulation, lots of
+components are there, :doc:`modules/pspace` is still missing, and some
+function implementation might also be missing, but a good basis is
+there.
+
+Try it if you feel you can, and don't forget to report Issues !

File docs/todo.rst

+ToDo
+====
+
+Loader
+------
+
+Description of the trouble
+^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+My main trouble at the moment is to find a way to Load the programms
+inside the Virtual Machine. The MARS had been designed as a **closed
+system**, with absolutely no input, and one output, namely the result
+of the *fight*.
+
+That means that my current question doesn't get answered by design: 
+
+   How to get the programs in the Core of ``puredarwin`` MARS ?
+
+I made a first try with an RS232 Module (self-designed) where the goal
+would be to load the Programs via a serial line ... I'm not entirely
+satisfied with that solution. Actually, I'm not sure that it would be
+practical.
+
+Solution
+^^^^^^^^
+
+Do not use any loader
+~~~~~~~~~~~~~~~~~~~~~
+
+For the moment, I would advice using ``rev 548b16a67881`` and
+`traceProc.py`_ as a main to simulate. This testModule also has a
+correct simulation implementation for the Queue and the Core. This
+shouldn't be a trouble to test a program on this MARS.
+
+.. _traceProc.py: http://bitbucket.org/benallard/puredarwin/src/tip/traceProc.py
+
+Quality of this solution
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+This solution makes some sense as the MyHDL module are actually not
+*directly* intended for synthesis. So, using simulation *tricks*
+in order to *simulate* is not seen as a betrayal.