Difference between revisions of "IOP16 Assembler"

From Land Boards Wiki
Jump to navigation Jump to search
 
(9 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
* The CPU has an Assembler
 
* The CPU has an Assembler
 
* The Assembler is written in Python 3
 
* The Assembler is written in Python 3
** [https://github.com/douggilliland/Design_A_CPU/tree/main/Assembler Python code is located here]
+
** [https://github.com/douggilliland/IOP16/blob/main/IOP16_ASSEMBLER/pyAssemble_cpu_001.py Python code is located here]
 
* There's also a Windows executable if you don't have Python 3 installed on your computer
 
* There's also a Windows executable if you don't have Python 3 installed on your computer
** [https://github.com/douggilliland/Design_A_CPU/tree/main/Assembler/dist Executable located here]
+
** [https://github.com/douggilliland/IOP16/tree/main/IOP16_ASSEMBLER/dist Executable located here]
  
 
== Assembler - Windows executable ==
 
== Assembler - Windows executable ==
  
* Windows executable is [https://github.com/douggilliland/Design_A_CPU/tree/main/Assembler/dist in this folder]
+
* Windows executable is [https://github.com/douggilliland/IOP16/tree/main/IOP16_ASSEMBLER/dist in this folder]
 
* Useful for people who don't have Python 3 installed
 
* Useful for people who don't have Python 3 installed
* Compiled to executable using
+
 
 +
=== Compile Windows executable ===
 +
 
 +
* Compile to make executable using command in DOS window
 +
 
 
<pre>
 
<pre>
 
pyinstaller --onefile pyAssemble_cpu_001.py
 
pyinstaller --onefile pyAssemble_cpu_001.py
 
</pre>
 
</pre>
  
== Input fileName.csv ==
+
== Files ==
 +
 
 +
=== Input fileName.csv ===
  
 
* Input file is tightly constrained in CSV file
 
* Input file is tightly constrained in CSV file
Line 22: Line 28:
  
 
<pre>
 
<pre>
['LABEL', 'OPCODE', 'REG_LABEL', 'OFFSET_ADDR', 'COMMENT']
+
['LABEL', 'OPCODE', 'REG_LABEL', 'OFFSET_ADDR', 'COMMENT','V3.0.0']
 
</pre>
 
</pre>
  
== Memory Map File ==
+
=== Memory Map File ===
  
 
* Optional File named: fileName_MMAP.csv
 
* Optional File named: fileName_MMAP.csv
Line 37: Line 43:
 
** Ex: ['0X00','R','LED_RD']
 
** Ex: ['0X00','R','LED_RD']
  
== Constants file ==
+
=== Constants file ===
  
 +
* Useful for storing arrays of constants
 +
** Ex: print strings
 
* Optional File named: fileName_CONST.csv
 
* Optional File named: fileName_CONST.csv
 
* Constants file Header has to be -
 
* Constants file Header has to be -
Line 45: Line 53:
 
</pre>
 
</pre>
  
== Output files ==
+
=== Output files ===
  
 
* inFileName_ROM.mif file - Quartus II ROM Memory Initialization File
 
* inFileName_ROM.mif file - Quartus II ROM Memory Initialization File
 
* inFileName.lst file - Listing file (with addresses)
 
* inFileName.lst file - Listing file (with addresses)
 
* constFileName_const.mif - Quartus II Constants Memory Initialization File
 
* constFileName_const.mif - Quartus II Constants Memory Initialization File
 +
 +
== Error Messages ==
 +
 +
* Error messages are pretty rudimentary
 +
* Dialog box notes that error messages are printed to the command window
 +
* The line with the error is printed as a list of the line
 +
* Missing labels are presented as a message
 +
* Only one error at a time is presented
 +
* Set variable in source code to enable debugging messages
 +
<pre>
 +
verbose = True
 +
</pre>
 +
 +
== Assembler opcodes ==
 +
 +
[[file:Opcodes.PNG]]
  
 
== Assembler Psuedo-opcodes ==
 
== Assembler Psuedo-opcodes ==
Line 57: Line 81:
 
* BEQ - Branch if equal (same as BEZ)
 
* BEQ - Branch if equal (same as BEZ)
 
* BNE - Branch if not equal (Aame as BNZ)
 
* BNE - Branch if not equal (Aame as BNZ)
 
== Error Messages ==
 
 
* Error messages are pretty rudimentary.
 
* Dialog box notes that error messages are printed to the command window.
 
* The line with the error is printed as a list of the line.
 
* Missing labels are presented as a message.
 
* Only one error at a time is presented.
 
 
== Assembler opcodes ==
 
 
[[file:Opcodes.PNG]]
 
  
 
== Documentation ==
 
== Documentation ==

Latest revision as of 20:08, 16 April 2022

IOP16 Assembler

Assembler - Windows executable

  • Windows executable is in this folder
  • Useful for people who don't have Python 3 installed

Compile Windows executable

  • Compile to make executable using command in DOS window
pyinstaller --onefile pyAssemble_cpu_001.py

Files

Input fileName.csv

  • Input file is tightly constrained in CSV file
    • Input File Header has to be
['LABEL', 'OPCODE', 'REG_LABEL', 'OFFSET_ADDR', 'COMMENT','V3.0.0']

Memory Map File

  • Optional File named: fileName_MMAP.csv
    • Memory map file Header has to be
['IO_ADDR','DIR','MNEUMONIC']
  • IO_ADDR = 0XNN
  • DIR = R, W, or RW
    • Ex: ['0X00','R','LED_RD']

Constants file

  • Useful for storing arrays of constants
    • Ex: print strings
  • Optional File named: fileName_CONST.csv
  • Constants file Header has to be -
['LABEL','STRING']

Output files

  • inFileName_ROM.mif file - Quartus II ROM Memory Initialization File
  • inFileName.lst file - Listing file (with addresses)
  • constFileName_const.mif - Quartus II Constants Memory Initialization File

Error Messages

  • Error messages are pretty rudimentary
  • Dialog box notes that error messages are printed to the command window
  • The line with the error is printed as a list of the line
  • Missing labels are presented as a message
  • Only one error at a time is presented
  • Set variable in source code to enable debugging messages
verbose = True

Assembler opcodes

Opcodes.PNG

Assembler Psuedo-opcodes

  • NOP - No operation
  • HLT - Halt (Jump to self)
  • BEQ - Branch if equal (same as BEZ)
  • BNE - Branch if not equal (Aame as BNZ)

Documentation