CIS 600 Computer Architecture, Fall 2022 Project 1 – MIPS Assembler

1.  Objectives

This project is designed to help students to understand the RISC architecture (MIPS) and its instruction set and assembly. Students will gain programming experience in C.

2.  Goals

Your team (2 persons) will build an MIPS assembler for a subset of MIPS instructions in C. This assembler will read a simple MIPS program and generate an MIPS machine code output file. Due dates for Project 1 is November 3.

3.  Specifications

  • Input

Your assembler will read and parse the contents of a simple MIPS program (program.asm). Each line of the program contains an MIPS instruction or a directive. A label will appear on a line by itself. Operands are comma-separated. No line is blank. No comment is allowed. There will be no white spaces between operands. All lines will begin with a tab except labels. Only decimal numbers are allowed. Lines containing instructions have the following format:

<tab>instruction<tab>comma- separated-operands

Lines containing directives have the following format:

<tab>directive[<tab>comma-separated-operand]

Lines containing labels have the following format: label:

The supported instructions are as follows. You may wish to consult additional MIPS references or the textbook to know the details of the instructions.

InstructionNameSyntaxSemantic
ADDAdditionadd $1,$2,$3$1 = $2 + $3
SUBSubtractsub $1,$2,$3$1 = $2 – $3
SLLShift left logicalsll $1,$2,5$1 = $2 << 5
SRLShift right logicalsrl $1,$2,5$1 = $2 >> 5
SLTSet less thanslt $1,$2,$3If $2<$3, $1=1; otherwise, $1=0
ADDIAddition immediateaddi $1,$2,45$1 = $2 + 45
LUILoad upper immediatelui $1,45Upper 16-bit of $1 = 45 (Lower 16-bit of $1 is set to 0)
ORIOr immediateori $1,$2,45$1 = $2 | 45 (bitwise OR)
LWLoad wordlw $1,100($2)$1 = Memory[$2+100]
SWStore wordsw $1,100($2)Memory[$2+100] = $1
BEQBranch on equalbeq $1,$2,LabelIf $1=$2, jump to Label
BNEBranch on not equalbne $1,$2,LabelIf $1≠$2, jump to Label
JJumpj LabelJump to Label
LA *Load addressla $1,Labellui $1, upper 16-bit of Label ori $1, $1, lower 16-bit of Label
  • LA is a pseudo-instruction. It is used to load the memory location (Label, 32 bits) into the destination register. The assembler replaces it with two instruction sequence, lui followed by ori.

The supported directives are as follows.

DirectiveNameSyntaxSemantic
.dataData segment.data (no operand)Data section in memory; it begins at 0 (0x0000 0000) by default
.textText segment.text (no operand)Program section in memory; it begins at 512 (0x0000 0200) by default
.space nAllocation of n words of memory.space 10Allocation of 10 words (40 bytes) of memory
.word wAllocation of a word and initialized to w. word 16Allocation of   a   word   (4   bytes)   and initialized to 16 (0x0001 0000).
  • The program may contain data section only or text section only. If both exist, the data section proceeds the text section.

The registers are denoted as $0, $1, $2, etc. instead of “$s0” or “r1”. $0 always takes the value of 0 and is not changeable.

3.2  Output

The assembler generates an output file (program.out) of size 1KB consisting of 512B of data segment (begins at 0x0000) and 512B of text segment (begins at 0x0200). Since each data and instruction is 4B long, there will be at maximum 128 word data and at maximum 128 instruction words. This file is a binary file. Do not try to open this file as it causes an error. The assembler does not detect syntax errors and assumes the assembly input is correctly formed. We assume big-endian.

For a sample assembly input file (test.asm):

.data print_data:

.word 0 add_result:

.word                        0 load_data:

.word    1

.word    2

.text

start:

la$1,load_data
lw$4,0($1)
lw$5,4($1)
add$4,$4,$5

la         $1,add_result

sw        $4,0 ($1)

Then, the contents of the output file (test.out) will be as follows. Again, this is a binary file and can only be seen with a special tool.

  • In Linux, you will have to use the command line command “od -Ax -t x4” (octal dump). To see the text segment (offset 0x0200), please use the command “od -Ax -t x4 -j512”.
  • In Windows, you can use “format-hex.” Click the Start menu button and type “powershell” (without the quotation marks). In the “Windows PowerShell” window, please use the command line command “format-hex”.
  • You can also view it online: https://hexed.it/

00000000 00000000 00000001 00000002

00000000 00000000 00000000 00000000

……………

3c010000 34210008 8c240000 8c250004

00852020 3c010000 34210004 ac240000

……………

Note that the file begins with the data segment (512 bytes) followed by the text segment. “3c010000 34210008” denotes the assembled output for the LA instruction (LUI and ORI). “8c240000” denotes the LW instruction. And so on.

Encoding of MIPS instructions is as follow. You may wish to consult additional MIPS references or the textbook to know the details of the instructions.

Instruc- tionSyntaxMIPS instruction encoding (32 bits)
(R-type)Opcode(6)Rs(5)Rt(5)Rd(5)Shamt(5)Func(6)
ADDadd $1,$2,$3000000   N/A100000
SUBsub $1,$2,$3000000   N/A100010
SLL *sll $1,$2,5000000N/A   000000
SRL **srl $1,$2,5000000N/A   000010
SLTslt $1,$2,$3000000    101010
(I-type)Opcode(6)Rs(5)Rt(5)Immediate (16)
ADDIaddi $1,$2,45001000   
LUIlui $1,45001111N/A  
ORIori $1,$2,45001101   
LWlw $1,100($2)100011   
SWsw $1,100($2)101011   
BEQbeq $1,$2,Label000100   
BNEbne $1,$2,Label000101   
(J-type)Opcode(6)Offset(26)
Jj Label000010 

Please note the use of labels in the branch (beq and bne) instructions. You will need to compute the appropriate immediate fields for the machine code based on the following relationship.

Addr(Label) = Addr(inst_after_branch) + immediate(16 bits)*4

First, the immediate field represents the distance, in instructions rather than in bytes, between the branching instruction and the destination instruction. This explains *4 at the end of the relationship. Second, typically PC-relative addressing is relative to PC+4, not PC. That is, it is relative to the next instruction, not the current instruction. This explains “Addr(inst_after_branch)” in the relationship.

The targaddr field of the jump instruction will be defined using pseudo-direct addressing where the address of the destination is defined as

Addr(Label) = Addr(inst_after_jump)[31-28] || immediate(26 bits) || 00

where Addr(inst_after_jump)[31-28] is the 4 most significant bits of PC+4, and || denotes concatenation.

3.3  Useful standard C library functions for this project

(ref: https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/rtref/stalib.htm)

You may want to use file-related C functions such as fopen(), fclose(), and fwrite() and string- related C functions such as strncmp(), strtok(), and atoi(). Please make yourself familiar with those functions first.

You may find another string-related C functions fgets() to be particularly useful for this assignment. The fgets function reads n characters from stream and writes them to the str buffer. On success, the function returns the same str parameter. If the end-of-file is encountered, a null pointer is returned. The following example shows the usage of fgets() function:

#include int main () { FILE *fp; char str[60]; /* opening file for reading */ fp = fopen(“file.txt” , “r”); if(fp == NULL) { perror(“Error opening file”); return(-1); } if( fgets (str, 60, fp)!=NULL ) { /* writing content to stdout */ puts(str); } fclose(fp); return(0); }

The sscanf function would be also useful. It scans the str buffer to try to match the format specifiers in the format string. Additional pointer arguments may be supplied to indicate variables that should be filled with elements found in the str buffer. The following example shows the usage of sscanf() function:

The fwrite function writes a raw data to a file. On success, the function returns the count of the number of items successfully written to the file. On error, it returns a number less than the specified number of items to be written. The following example shows the usage of fwrite() function:

#include int main () {

FILE *fp;

int year;

fp = fopen( “file.txt” , “w” );

if (fwrite(&year , size(int), 1, fp )!=1) {

perror(“Error writing file”);

return(-1); }

fclose(fp);

return(0); } 

You may also want to make use of some bitwise operators (&, |, <>) or the union construct to manage the instruction fields easily. Also, watch out for signed-ness.

3.4  Testing

A few sample test assembly files will also be provided about a week before the project is due. Make use of the sample executable to help verify your output.

You can test your design using your own programs. The quality of your assembler will be determined by how much and how varied the tests are. For example, testing if the assembler works for BNE for both the equal and not equal cases, and forward and backward branching, and all combinations of these, would get a better grade than just testing for one case of BNE.

To confirm your assembler generates the correct machine code, you can get some help from Internet, e.g., https://www.csfieldguide.org.nz/en/interactives/mips-assembler/ or https://alanhogan.com/asu/assembler.php. Just type your assembly program such as “add $s1, $s2,

$s3”, it will output machine code for you. (Note that this assembler recognizes $s1, $s2, etc. but does not recognize $1, $2, etc.)

4.  Submission and Grading

Each group submits via Blackboard the source code: assembler.c.

At the top of the source code, please list CLEARLY all the instructions and directives your program cannot handle and all known issues with your program (those that are not implemented, those that are implemented but not work correctly, etc.).

You must submit before 11:59 PM on November 3 to get full credit. Late submissions will be accepted for 10% off per day up to three additional days. Automatic plagiarism detection software will be used on all submissions. Any cases detected will result in a grade of 0, reduction of the overall grade by one letter grade, and a report will be sent to Academic Affairs.

Order Now

Get expert help for Computer Architecture and many more. 24X7 help, plag-free solution. Order online now!

Universal Assignment (September 16, 2025) CIS 600 Computer Architecture, Fall 2022 Project 1 – MIPS Assembler. Retrieved from https://universalassignment.com/cis-600-computer-architecture-fall-2022-project-1-mips-assembler/.
"CIS 600 Computer Architecture, Fall 2022 Project 1 – MIPS Assembler." Universal Assignment - September 16, 2025, https://universalassignment.com/cis-600-computer-architecture-fall-2022-project-1-mips-assembler/
Universal Assignment November 4, 2022 CIS 600 Computer Architecture, Fall 2022 Project 1 – MIPS Assembler., viewed September 16, 2025,<https://universalassignment.com/cis-600-computer-architecture-fall-2022-project-1-mips-assembler/>
Universal Assignment - CIS 600 Computer Architecture, Fall 2022 Project 1 – MIPS Assembler. [Internet]. [Accessed September 16, 2025]. Available from: https://universalassignment.com/cis-600-computer-architecture-fall-2022-project-1-mips-assembler/
"CIS 600 Computer Architecture, Fall 2022 Project 1 – MIPS Assembler." Universal Assignment - Accessed September 16, 2025. https://universalassignment.com/cis-600-computer-architecture-fall-2022-project-1-mips-assembler/
"CIS 600 Computer Architecture, Fall 2022 Project 1 – MIPS Assembler." Universal Assignment [Online]. Available: https://universalassignment.com/cis-600-computer-architecture-fall-2022-project-1-mips-assembler/. [Accessed: September 16, 2025]

Please note along with our service, we will provide you with the following deliverables:

Please do not hesitate to put forward any queries regarding the service provision.

We look forward to having you on board with us.

Most Frequent Questions & Answers

Universal Assignment Services is the best place to get help in your all kind of assignment help. We have 172+ experts available, who can help you to get HD+ grades. We also provide Free Plag report, Free Revisions,Best Price in the industry guaranteed.

We provide all kinds of assignmednt help, Report writing, Essay Writing, Dissertations, Thesis writing, Research Proposal, Research Report, Home work help, Question Answers help, Case studies, mathematical and Statistical tasks, Website development, Android application, Resume/CV writing, SOP(Statement of Purpose) Writing, Blog/Article, Poster making and so on.

We are available round the clock, 24X7, 365 days. You can appach us to our Whatsapp number +1 (613)778 8542 or email to info@universalassignment.com . We provide Free revision policy, if you need and revisions to be done on the task, we will do the same for you as soon as possible.

We provide services mainly to all major institutes and Universities in Australia, Canada, China, Malaysia, India, South Africa, New Zealand, Singapore, the United Arab Emirates, the United Kingdom, and the United States.

We provide lucrative discounts from 28% to 70% as per the wordcount, Technicality, Deadline and the number of your previous assignments done with us.

After your assignment request our team will check and update you the best suitable service for you alongwith the charges for the task. After confirmation and payment team will start the work and provide the task as per the deadline.

Yes, we will provide Plagirism free task and a free turnitin report along with the task without any extra cost.

No, if the main requirement is same, you don’t have to pay any additional amount. But it there is a additional requirement, then you have to pay the balance amount in order to get the revised solution.

The Fees are as minimum as $10 per page(1 page=250 words) and in case of a big task, we provide huge discounts.

We accept all the major Credit and Debit Cards for the payment. We do accept Paypal also.

Popular Assignments

Project Development and Analysis in Emerging Technologies

Assessment Brief- Assessment 2 Unit Code/Description ICT305 – Topics in IT Course/Subject BIT Semester 2024- S1 Unit Learning Outcomes Addressed ULO 1, 2, and 3. Assessment Objective The primary objective of this assessment is to provide students with hands-on experience in designing, implementing, and analysing a project in one of

Read More »

EDUC1006 Interdisciplinary Studies: Crossing the line

ASSESSMENT 2: Report Summary Title Assessment 2 Type Report Due Date Thursday 17 April, 11.59 pm (end of Week 6) Length 1500 words or equivalent Weighting 50% Academic Integrity The use of GenAI is allowed but limited for this assessment task. Submission Word document or PDF submitted to Turnitin Unit

Read More »

Writing in Community Development

Assessment Overview Overview Length or Duration Worth Due This essay should demonstrate a coherent argument, which is backed up by evidence from relevant journal articles, books and websites. You are expected to make two direct quotations only; and the rest should be paraphrases. You should also list at least eight sources.   If you are unsure of

Read More »

Counselling Theory and Practice in Schools

Assignment 1 Requirements Word limit 2500 words; excluding references Referencing You’re required to follow APA Academic Integrity Please refer to the Guidelines Task Purpose 🎯 This assessment task is designed to develop and assess students’ critical thinking and reflective skills, essential for counselling professionals in educational contexts. By engaging in a literature

Read More »

PSY1040 Cultural Responsiveness Self-Assessment

PSY1040 Cultural Responsiveness Self-Assessment The below self-assessment tool has been adapted from the following resource: Bennett, B., & Morse, C. (2023). The Continuous Improvement Cultural Responsiveness Tools (CICRT): Creating more culturally responsive social workers. Australian Social Work, 76(3), 315–329. Bennett’s collection of Cultural Responsiveness Self-Assessment Tools is designed for social workers

Read More »

TEAC7094 Assessment 2 Report: Analysis of a Student Work Sample

TEAC7094 Assessment 2 Report: Analysis of a Student Work SampleRemember to include a completed Cover Sheet for this task. CONTEXT PROBLEM AND SOLUTION (approx. 600 – 800 words) RECOMMENDATIONS (approx. 400 words) CONCLUSION REFERENCES Appendix One: Annotated and coded interview transcript from working with the child Appendix Two: Annotated and

Read More »

Psychological Data Analysis Report

Written Assignment This page outlines the major written assignment and the steps involved in preparing for submission. This assignment will allow you to develop essential skills in analysing and interpreting a data set to address a psychological issue and report the results in APA style. Note that separate documents are

Read More »

Principles of Economics

Principles of Economics Short-answer Assignment V1 (20% of final mark) The assignment consists of four questions.  You should allocate at least half a page (or 250 words) to each answer or 1000 words for all four answers depending on the nature of and/or marks allocated for the question/s. You may

Read More »

MRTY 5134 Laboratory Report Assignment

MRTY 5134 Laboratory Report Assignment Semester 1 2025Due 18th May 2025Answer TemplateEnter your name and student number below.Name:SID:Use this document to record your answers to the tasks described in the laboratoryreport assignment. When completed submit this document for marking via theassignment portal in Canvas.Things to note:

Read More »

Mind Map – Personal Philosophy

Mind Map – Personal Philosophy Assessment 2  Assessment Overview Overview Length or Duration Worth Due Part A – Annotated mind-map (equivalent to 350 words). Part B – 350 word personal reflection about your history, identity and values and link it with concepts explored in the unit. Part A – 350 words equivalent

Read More »

Consumer Partnerships in OT Practice

ASSESSMENT NUMBER 3 ASSESSMENT TYPE Written assignment DATE FOR SUBMISSION Refer to the Course Profile WEIGHTING 40% LENGTH   Part A – 500 words Part B – 500 words Part C – 500 words Notes This word allocation includes in-text references but excludes the reference list.There is no allowance for

Read More »

HPSYSD101 The Evolution of Psychology

ASSESSMENT 2 BRIEFSubject Code and Title HPSYSD101 The Evolution of Psychology Assessment Task Annotated BibliographyIndividual/Group IndividualLength 2,000 words (+/- 10%)Learning Outcomes The Subject Learning Outcomes demonstrated by successfulcompletion of the task below include:b) Examine the significant figures, events and ideas present inthe history of psychology.c) Identify and relate the key

Read More »

Literature Review and Reflection on Counselling in Education

Assessment Task SheetEDU6114 – Assessment 1 – Literature Review and Reflection Course Code and Name EDU6114 – Counselling in EducationAssessment Name Literature Review and Reflective EssayAssessment Item 1 Assessment Type EssayMarks/Weighting 50% Length 2500 words (excluding references)Assessed LearningOutcomesCLO 1, 3, 7 Due Date Please check Study Desk for Due DatesRationale

Read More »

NUTR1023 Health and Fitness through Diet and Exercise

Subject NUTR1023 Health and Fitness through Diet and Exercise Assessment Personal Diet and Exercise Plan Learning Objectives Apply the principles of training to develop a personal exercise program with appropriate mode/intensity/frequency to develop the students’ own health and fitness.Apply the current dietary guidelines to develop a personal diet plan for

Read More »

Behaviour Support Plan & Reflection

Overview Submit your support plan and reflective piece as one document. Description Part A: Support plan (1750 words) For a case study develop a support plan. This plan should aim to support an individual to reduce the need for a behaviour that challenges to occur. Collect and analyse data on a behaviour

Read More »

ASSESSMENT 2: Child Study Report

ASSESSMENT 2: Child Study Report Moderater very strict on  Rubric, its her bible, so please look into it Assignment – Written Assignment Due Date: 28th May, 23:59 (AEST) Weight: 60% Description (2500-3000 words): In this task, you are required to apply your knowledge of observational methods and child development to write

Read More »

Arts Assignment Help Australia

Introduction Arts is a broad and creative discipline that encompasses visual arts, performing arts, music, design, literature, and creative writing. Studying arts helps students explore creativity, cultural heritage, and expression through multiple mediums. In Australia, arts courses are offered at universities and TAFE institutes such as University of Melbourne, Monash

Read More »

Health Sciences Assignment Help Australia

Introduction Health Sciences is a multidisciplinary field that studies human health, disease prevention, treatment, and healthcare management. It encompasses areas such as nursing, public health, anatomy, physiology, medical research, and healthcare administration. In Australia, health sciences is a highly sought-after discipline offered at universities including Monash University, University of Melbourne,

Read More »

Literature Assignment Help Australia

Introduction Literature is the study of written works, encompassing poetry, prose, drama, fiction, and non-fiction, with a focus on understanding themes, symbolism, and cultural context. It is an essential discipline for students studying English, humanities, or creative writing at universities like University of Melbourne, Monash University, University of Sydney, and

Read More »

Humanities Assignment Help Australia

Introduction Humanities is the study of human culture, society, and history, encompassing disciplines such as history, philosophy, literature, sociology, linguistics, and cultural studies. It plays a crucial role in understanding human behaviour, values, and creativity. In Australia, humanities courses are offered at leading universities including University of Melbourne, Monash University,

Read More »

Environmental Science Assignment Help Australia

Introduction Environmental Science is an interdisciplinary field that studies the relationship between humans and the natural environment. It covers topics such as ecology, climate change, sustainability, pollution control, and environmental management. In Australia, environmental science is a popular field of study due to the country’s rich biodiversity and focus on

Read More »

Biology Assignment Help Australia

Introduction Biology is the science of life, exploring everything from molecular structures to ecosystems. It is a core subject in disciplines such as medicine, nursing, biotechnology, environmental science, and genetics. Students in Australia pursuing biology at universities like Monash University, University of Melbourne, University of Sydney, and Deakin University often

Read More »

Education Assignment Help Australia

Introduction Education is one of the most impactful fields of study, focusing on teaching methods, pedagogy, curriculum development, and learning strategies. Students pursuing education degrees in Australia at institutions such as the University of Melbourne, Monash University, University of Sydney, and Deakin University aim to become skilled teachers, administrators, and

Read More »

Economics Assignment Help Australia

Introduction Economics is the study of how societies allocate scarce resources, focusing on production, consumption, and decision-making. As one of the most popular academic fields in Australia, economics is taught at leading universities including the University of Melbourne, Monash University, University of Sydney, and ANU. Students pursuing economics often face

Read More »

Psychology Assignment Help Australia

Introduction Psychology is the scientific study of the human mind and behaviour, covering areas like cognition, emotions, mental health, and social interactions. In Australia, psychology is one of the most popular disciplines, with thousands of students enrolling at universities such as the University of Melbourne, Monash University, University of Sydney,

Read More »

Marketing Assignment Help Australia

Introduction Marketing is a dynamic and ever-evolving discipline that plays a critical role in the success of any business. From branding and market research to digital campaigns and consumer psychology, marketing requires both creativity and analytical thinking. In Australia, marketing students studying at top institutions like the University of Melbourne,

Read More »

Finance Assignment Help Australia

Introduction Finance is one of the most essential fields of study, forming the backbone of global business, economics, and investment. In Australia, students pursuing degrees in finance, accounting, economics, and business management at top institutions such as Monash University, University of Melbourne, University of Sydney, and RMIT face an intense

Read More »

Computer Science Assignment Help

Introduction Computer Science is one of the fastest-growing and most demanding academic disciplines worldwide. Students in Australia, the UK, and beyond pursue computer science degrees to build careers in software engineering, artificial intelligence (AI), cybersecurity, data science, and web development. However, the field is highly technical and requires extensive practical

Read More »

Law Assignment Help Australia

Introduction Law is one of the most intellectually challenging and competitive fields of study in Australia. Students pursuing law degrees at prestigious institutions such as Monash University, University of Melbourne, University of Sydney, and Australian National University face an intense academic workload. From legal case studies and essays to research

Read More »

Nursing Assignment Help Australia

Introduction Nursing is one of the most respected and challenging professions in Australia. Students pursuing nursing courses at top institutions such as Deakin University, Monash University, University of Melbourne, University of Sydney, and TAFE colleges face a demanding academic workload. From care plans and reflective essays to case studies and

Read More »

Can't Find Your Assignment?