Assembler Language Assignment Project
What is my assignment?
Getting Started (Items you have to review or learn to do for the project)
In order to get started on creating your assembler you must be able to have the program understand basic syntax of a text file containing a program. In this first part of the program you will deal with the basic functions of string processing and reading files. The following is a list of items to complete to help you do the project.
1) You will need to be able to read in arguments pass from the command line.
Ex: project1.exe inputfile.txt outputfile1.txt
2) You will need to be able to parse a string.
Ex: You will need to use the strtok() function in the string.h file.
3) You will need to convert all letters to lowercase letters.
4) You will need to compare a string to a list of know words.
(add, load, store, r0, r1, r2)
5) You will need to have a number in text 123 be converted to a number (integer) in the C program.
6) You will also need to be able to read and write files.
Project
Your assignment is to make a simple assembler for the DLX processor. We will simplify the assembler by only using the core instructions, we will not do the floating point instructions. The registers will be named as r0, r1, r2, ... r29, r30, r31. We will also not allow any advance naming for saving constant or memory locations the assembly source code we write will hard code any constant and memory location to read and write to. The only advance item we will do is use a label for branching and jumping in code.
Items to turn in: a report that tells how you created your program, source code, test files and a flow chart.
Tips
It is common to run an assembler in a two pass structure. The first pass goes through the source files and finds all the labels and addresses for each instruction. You can start your program by assuming the first line of code is at memory location 0. You will make a table of label and address. On the second pass you will then convert the assembly instruction into machine code and fill in any labels using your table.
What to turn in
The following is what needs to be turned in for project 1:
Report
The report is made up of the following 4 parts:
1) The first part tells me if the project was successful or unsuccessful. If unsuccessful tell me which parts work and which parts do not work.
2) I need a documentation of each function of your code. Give me the name of the function, the inputs/outputs, and a description of what the behavior of the function is.
3) Instead of a flow chart give me a written set of steps that occur in your code design, reference the names of function calls as needed. You will write is as
Step 1 - what is done in step 1
Step 2 - what is done in step 2. If you have decisions write if X occurs go to step Y.
4) Project output. I need you to write a test file that test one instruction of each type (Load, Store, Branch, ALU, ALUi, JR, J). Write out the instructions in the test file and give me a screenshot of the output. Show the output of the encoding done by hand and compare it to the encoding of your program.
Source Code
Test Files
(SubI r12,R20,255
start: lw r7,-16(R31)
SLT r3,r1,r9
BEQZ r1, STOP
SGTI r3,r7,-5
stop: sb 16(r11),r9
jalr r4
J start)
All of the files should be placed in one zip file. Name the file as P1_lastname.zip I do not want the files sent in an email. Post the file in blackboard under the Project 1 assignment. I will take off 20 points if I receive an email of your project.