diff doc/general/ede.lyx~ @ 27:a542cd390efd

long overdue update
author james <jb302@eecs.qmul.ac.uk>
date Wed, 02 Apr 2014 14:11:50 +0100
parents 84716cd835dd
children c0c2e99b6bb0
line wrap: on
line diff
--- a/doc/general/ede.lyx~	Thu Mar 06 20:24:49 2014 +0000
+++ b/doc/general/ede.lyx~	Wed Apr 02 14:11:50 2014 +0100
@@ -11,8 +11,8 @@
 \fontencoding global
 \font_roman lmodern
 \font_sans lmss
-\font_typewriter cmtt
-\font_default_family default
+\font_typewriter lmtt
+\font_default_family sfdefault
 \use_non_tex_fonts false
 \font_sc false
 \font_osf false
@@ -71,7 +71,7 @@
 \begin_layout Abstract
 The ELB816 Development Environment consists of an assembler, emulator and
  debugger for the ELB816 microprocessor system.
- This report details the design and usage of each of these elements.
+ This report details the design and usage of each of its elements.
 \end_layout
 
 \begin_layout Standard
@@ -82,42 +82,240 @@
 \end_layout
 
 \begin_layout Standard
-\begin_inset Index idx
+\begin_inset CommandInset toc
+LatexCommand tableofcontents
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage newpage
+\end_inset
+
+
+\end_layout
+
+\begin_layout Part
+Introduction and Specification
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
 status open
 
 \begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Section
+Motivations
+\end_layout
+
+\begin_layout Standard
+The ELB816 architecture is designed to be a 
+\begin_inset Quotes eld
+\end_inset
+
+simple to understand 8-bit microprocessor system to help learn about microproces
+sor electronics.
+\begin_inset Quotes erd
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+The combination of an ELB816 emulator, debugger and assembler could be used
+ as a set of tools for learning or teaching microprocessor programming without
+ the intricacies of real-world commercial microprocessors getting in the
+ way of a fundamental understanding of the subject.
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+A PC based emulator would allow students to quickly develop and debug programs
+ written in a simple assembly language on any modern desktop or laptop and
+ an MCS-51 port running on an 8052 would allow students to test programs
+ in an actual circuit.
+\end_layout
+
+\begin_layout Section
+Project Aims
+\end_layout
+
+\begin_layout Itemize
+Develop an assembler for the ELB816 assembly language.
+\end_layout
+
+\begin_layout Itemize
+Develop an emulated programmable microprocessor system based on the ELB816
+ architecture.
+\end_layout
+
+\begin_layout Itemize
+Develop a debugger that allows interactive debugging of programs running
+ on the emulator.
+\end_layout
+
+\begin_layout Section
+Methodology
+\end_layout
+
+\begin_layout Subsection
 Assembler
 \end_layout
 
+\begin_layout Description
+Language: Python
+\end_layout
+
+\begin_layout Description
+Priority: First
+\end_layout
+
+\begin_layout Standard
+The assembler will be developed before anything else so that it can subsequently
+ be used to assemble test programs during development of the emulator.
+ 
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage newpage
 \end_inset
 
 
 \end_layout
 
-\begin_layout Standard
-\begin_inset Index idx
-status open
-
-\begin_layout Plain Layout
+\begin_layout Subsection
 Emulator
 \end_layout
 
-\end_inset
-
-
+\begin_layout Description
+Language: C
 \end_layout
 
+\begin_layout Description
+Priority: Second
+\end_layout
+
 \begin_layout Standard
-\begin_inset Index idx
-status open
-
-\begin_layout Plain Layout
+The emulator will use only standard libraries in order to ensure it is portable
+ between compilers and platforms.
+ Specifically GCC for x86 and Keil C51 for Intel MCS-51.
+ The emulator will first be developed on Linux to facilitated rapid development.
+ It will be ported to MCS-51 once it is complete
+\end_layout
+
+\begin_layout Subsection
 Debugger
 \end_layout
 
+\begin_layout Description
+Language: C/Python
+\end_layout
+
+\begin_layout Description
+Priority: Second
+\end_layout
+
+\begin_layout Standard
+The debug interface will be developed along side the emulator.
+ It will consist of a simple text based interface built into the emulator
+ that will read commands using C's 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+stdio.h
+\end_layout
+
 \end_inset
 
-
+ library.
+ This means that on Linux the commands will be issued using 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+STDIN
+\end_layout
+
+\end_inset
+
+ and on the MCS-51 version they will be issued over a serial interface.
+ Python will be used to provide a cleaner interface for common debug procedures
+ such as writing programs to memory and setting break-points.
+ 
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+The remainder of this report is split into three parts, one for each component
+ of the project, and will attempt to demonstrate the design and usage of
+ each of these components.
+ 
 \end_layout
 
 \begin_layout Standard
@@ -247,13 +445,14 @@
 \end_layout
 
 \begin_layout Standard
-The following sections detail the design and behavior of the assembler.
+The following sections details the design and behavior of the assembler.
  However it must be noted that these are abstract and high level descriptions
  that do not fully explain minor routines, but give an overview of the entire
  process.
  The full source code is attached in the Appendix and should be referenced
  for a deeper understanding of the program's operation.
- The final section details the testing procedure.
+ The final section is a short programmers manual demonstrating the assembler's
+ features.
 \end_layout
 
 \begin_layout Standard
@@ -812,7 +1011,7 @@
 
 \end_inset
 
- function and Pythons 
+ function and Python's 
 \begin_inset listings
 lstparams "basicstyle={\ttfamily}"
 inline true
@@ -950,7 +1149,19 @@
 \end_layout
 
 \begin_layout Subsection
-first_pass()
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+first_pass
+\end_layout
+
+\end_inset
+
+
 \end_layout
 
 \begin_layout Standard
@@ -1161,7 +1372,19 @@
 \end_layout
 
 \begin_layout Subsection
-second_pass()
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+second_pass
+\end_layout
+
+\end_inset
+
+ 
 \end_layout
 
 \begin_layout Standard
@@ -1351,7 +1574,19 @@
 \end_layout
 
 \begin_layout Subsection
-tokenize()
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+tokenize
+\end_layout
+
+\end_inset
+
+
 \end_layout
 
 \begin_layout Standard
@@ -1373,7 +1608,7 @@
 \begin_layout Standard
 \begin_inset Graphics
 	filename /home/jmz/qm/ede/doc/images/assembler/tokenize.svg
-	scale 55
+	scale 57
 
 \end_inset
 
@@ -1388,7 +1623,19 @@
 \end_layout
 
 \begin_layout Subsection
-stoi()
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+stoi
+\end_layout
+
+\end_inset
+
+ 
 \end_layout
 
 \begin_layout Standard
@@ -1425,7 +1672,417 @@
 \end_layout
 
 \begin_layout Section
-Testing
+Assembly language manual
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage newpage
+\end_inset
+
+
+\end_layout
+
+\begin_layout Part
+Emulator
+\end_layout
+
+\begin_layout Section
+Core microprocessor emulation
+\end_layout
+
+\begin_layout Standard
+The core of the emulator is written in C using only standard libraries.
+ It executes the machine code output by the assembler according to the ELB816
+ specification.
+ It consists of the following files:
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+iset.c
+\end_layout
+
+\end_inset
+
+ and 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+iset.h
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+These files contain the emulator instruction functions and function look-up
+ table.
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+mem.c
+\end_layout
+
+\end_inset
+
+ and 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+mem.h
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+These files contain the emulators memory structure and memory access functions.
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+emu.c
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+This file contains the program's 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+main()
+\end_layout
+
+\end_inset
+
+ function.
+ It initializes the emulator and executes the programs fetch/decode/execute
+ cycle.
+ 
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Below is a high level description of the content of each of these files
+ which should demonstrate how the emulator works.
+ There is also a large amount of material relevant to the emulator's design
+ in the appendix, which will be referenced when applicable.
+\end_layout
+
+\begin_layout Subsection
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+iset.c
+\end_layout
+
+\end_inset
+
+ and 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+iset.h
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Each mnemonic in the ELB816 instruction set has a function defined in these
+ files.
+ Each function is responsible for execution of all the instructions that
+ use its corresponding mnemonic.
+ The function look-up table is an array of pointers to these functions,
+ where a pointer's position in the list corresponds to the opcode of the
+ instruction to be executed.
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage newpage
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+mem.c
+\end_layout
+
+\end_inset
+
+ and 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+mem.h
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+The figures bellow illustrate the emulator's memory layout as defined in
+ the 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+mem.h
+\end_layout
+
+\end_inset
+
+ header file.
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+mem.c
+\end_layout
+
+\end_inset
+
+ contains functions that can be used to access this memory from the rest
+ of the code.
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage newpage
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+emu.c
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+This file contains the emulator's set-up and control procedures.
+ It includes all of the projects header files and controls the execution
+ of the functions contained in them.
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+It first executes a number of initialization procedures and then passes
+ control over to the main fetch/decode/execute cycle.
+ This procedure is shown below as a flowchart.
+ To understand this it you must be familiar with C's function pointer syntax.
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+centerline{
+\end_layout
+
+\end_inset
+
+
+\begin_inset Graphics
+	filename /home/jmz/qm/ede/doc/images/emulator/fetch_decode_exe.svg
+	scale 70
+
+\end_inset
+
+
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+}
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage newpage
+\end_inset
+
+
+\end_layout
+
+\begin_layout Section
+Peripherals
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage newpage
+\end_inset
+
+
 \end_layout
 
 \end_body