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 (March 4, 2026) 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 - March 4, 2026, 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 March 4, 2026,<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 March 4, 2026]. 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 March 4, 2026. 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: March 4, 2026]

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

Assignment Quantitative CASP RCT Checklist

CASP Randomised Controlled Trial Standard Checklist:11 questions to help you make sense of a randomised controlled trial (RCT)Main issues for consideration: Several aspects need to be considered when appraising arandomised controlled trial:Is the basic study design valid for a randomisedcontrolled trial? (Section A)Was the study methodologically sound? (Section B)What are

Read More »

Assignment Qualitative CASP Qualitative Checklist

CASP Checklist: 10 questions to help you make sense of a Qualitative researchHow to use this appraisal tool: Three broad issues need to be considered when appraising a qualitative study:Are the results of the study valid? (Section A)What are the results? (Section B)Will the results help locally? (Section C) The

Read More »

Assignment Topics

PS3002 Assignment TopicsDear studentsPlease choose one of the topics below. Please note that if you are repeating this subject, you cannot choose the same topic that you did previously in this subject.patellar tendinopathyinstability of the lumbar spinehamstring strainperoneal tendinopathyhip – labral tear.hip osteoarthritispatellofemoral instabilityankylosing spondylitisanterior cruciate ligament rupture (conservative management)quadriceps

Read More »

Assessment 2 – Report

Assessment 2 – Report (1200 words, 30%)PurposeTo demonstrate an understanding of the purpose and application of evidence-based dietary advice and guidelinesLearning objectives1.Review and analyse the role and function of macronutrients, micronutrients and functional components of food in maintaining health2.Understand digestion, absorption and metabolism of food in the human body and

Read More »

Assessment 2 – Individual Case Study Analysis Report

Southern Cross Institute,Level 2, 1-3 Fitzwilliam Street, PARRAMATTA NSW 2150 & Level 1, 37 George Street PARRAMATTA NSW 2150Tel: +61 2 9066 6902 Website: www.sci.edu.auTEQSA Provider No: PRV14353 CRICOS Provider No: 04078ªPage 1 of 16HRM201 Human Resources ManagementSemester 1, 2026Assessment 2 – Individual Case Study Analysis ReportSubmission Deadline: This Week,

Read More »

ASSESSMENT 2 BRIEF HPSYSD101 The Evolution of Psychology

HPSYSD101_Assessment 2_20240603 Page 1 of 7ASSESSMENT 2 BRIEFSubject Code and TitleHPSYSD101 The Evolution of PsychologyAssessment TaskAnnotated BibliographyIndividual/GroupIndividualLength2,000 words (+/- 10%)Learning OutcomesThe Subject Learning Outcomes demonstrated by successful completion of the task below include:b) Examine the significant figures, events and ideas present in the history of psychology.c) Identify and relate the

Read More »

Assessment 1 – Individual Case Study Analysis Report

HOS203 Contemporary Accommodation ManagementSemester 1, 2026Assessment 1 – Individual Case Study Analysis Report (10%)Submission Deadline: This Week, at 11:59 pm (Week 4)Overview of this AssignmentFor this assessment, students are required to analyse an assigned case study about hospitality industry relevant regulations and/or operational and accreditation failures of a hospitality organisation.

Read More »

Assessment Brief PBHL1003FOUNDATIONS OF HEALTH AND HEALTH CARE SYSTEMS

Assessment BriefPBHL1003FOUNDATIONS OF HEALTH AND HEALTH CARE SYSTEMSTitleAssessment 2 TypeEssay Due DateWeek 6 Monday 14 April 2025, 11:59pm AEST Length1000 words Weighting60% Academic IntegrityNO AI SubmissionUse Word Document – submit to Blackboard / Assessments Tasks & Submission / Assessment 2 Unit Learning OutcomesThis assessment task maps to the following Unit

Read More »

Assignment 4 – Intersection Upgrades and Interchange Station Design

CIVL5550: Civil Infrastructure DesignAssignment 4 – Intersection Upgrades and Interchange Station DesignDue: This WeekSubmission Instructions:1.Submit a report of approximately 10 pages, covering the following:Part 1: Intersection Upgrade Design•Propose upgrade schemes for two sign-controlled intersections and one signalized intersection•Use SIDRA to evaluate the performance of both the original and upgraded intersections•Use

Read More »

Assessment Brief 1

1 of 14Assessment Brief 1Assessment DetailsUnit Code Title NURS2018 Building Healthy Communities through Impactful PartnershipsAssessment Title A1: Foundations of Community Health Promotions ProjectAssessment Type ProjectDue Date Week 4, Monday, 22nd of September 2025, 11:59pm AESTWeight 40%Length / Duration 1200 wordsIndividual / Group IndividualUnit Learning Outcomes(ULOS)This assessment evaluates your achievement of

Read More »

Assignment 1 – Digital Stopwatch

Assignment 1 – Digital StopwatchThis assessment is an individual assignment. For this assignment, you are going to implement the functionality for a simple stopwatch interface as shown above. The interface itself is already provided as a Logisim file named main.circ . Your assignment must be built using this file as

Read More »

Assessment Background Country Profile

BackgroundCountry ProfileKiribati is an island nation situated in the central Pacific Ocean, consisting of 33 atolls2 and reef islands spread out over an area roughly the size of India (see Figure 1).i Yet, Kiribati is also one of the world’s smallest and most isolated country. A summary of Kiribati’s key

Read More »

Assessment 3: PHAR2001 INTRODUCTORY PHARMACOLOGY

PHAR2001 INTRODUCTORY PHARMACOLOGYAssessment 3: Case StudyASSESSMENT 1 BRIEFAssessment Summary Assessment titleAssessment 3: Case study Due DateThursday Week 6, 17 April at 11:59 Length•The suggested number of words (not a word limit) for the individual questions within the case study is as indicated at the end of each individual question. Weighting50%

Read More »

Assessment Module 1 Healthcare Systems Handout

Module 1Healthcare Systems HandoutGroup AgendasHealth Professionals: You got into health to help people. However, as an owner and operator of a multidisciplinary practice, you need to see many patients to cover the cost of equipment, technology, office and consumables, and pay your staff. The Medicare benefit doesn’t cover the rising

Read More »

Assessment 2 – Case study analysis 

Assessment 2 – Case study analysis  Description  Case study analysis  Value  40%  Length  1000 words  Learning Outcomes  1, 2, 3, 4, 5, 6, 7  Due Date  Sunday Week 9 by 23:59 (ACST)  Task Overview  In this assessment, you will choose ONE case study presenting a patient’s medical history, symptoms, and relevant test

Read More »

Assessment NURS2018: BUILDING HEALTH COMMUNITIES

NURS2018: BUILDING HEALTHCOMMUNITIES THROUGH IMPACTFULPARTNERSHIPSAssessment 1 Template: Foundation of Community Health Promotion projectOverall word count excluding the template wording (63 words) and reference list:Introduction to health issue:The case study, increase breast screening in Muslim women living in Broadmeadows,Melbourne, focuses on addressing the low participation rates in breast cancer screening amongMuslim

Read More »

Assessment EGB272: Traffic and Transport Engineering (2025-s1)

EGB272: Traffic and Transport Engineering (2025-s1)ashish.bhaskar@qut.edu.auPage 1 of 8Assessment 1A (15%) Cover PageIndividual component: 5%Group component: 10%You are expected to submit two separate submissions:Individual Submission (5%): Each student must submit their own individual report. Details of the individual report are provided in Section 3.1, and the marking rubric is in

Read More »

Assessment 3 – Essay: Assessment 3 Essay rubric

Unit: NUR5327 – Management and leadership in healthcare practice – S1 2025 | 27 May 2025Assessment 3 – Essay: Assessment 3 Essay rubricLearning Objective 5:Differentiate drivers forchange and proactively leadhealth professionalresponses to changing anddynamic environmentsFails toidentify aclear plannedchange ordoes not linkit to thestrategic plan.0 to 7 pointsIdentifies aplannedchange, butthe link

Read More »

Assessment 2 – Case study analysis 

Assessment 2 – Case study analysis  Description  Case study analysis  Value  40%  Length  1000 words  Learning Outcomes  1, 2, 3, 4, 5, 6, 7  Due Date  Sunday Week 9 by 23:59 (ACST)  Task Overview  In this assessment, you will choose ONE case study presenting a patient’s medical history, symptoms, and relevant test

Read More »

Assessment 1 PPMP20009 (Leading Lean Projects)

Term 1, 2025PPMP20009 (Leading Lean Projects)1Assessment 1 – DescriptionAssessment title Case study reportAssessment weight 40% of the unit marksReport length 3000 wordsMaximum 8 pages excluding references and appendicesReport format MS Word or PDFSubmission type IndividualSubmission due by Friday, Week 6Assessment objectiveThe purpose of this assessment item is to help you

Read More »

Assignment Maternity – Paramedic Management

Title-Maternity – Paramedic ManagementCase Study – Home Birth Learning outcomes1. Understand the pathophysiology and prehospital management of a specific obstetric condition.2. Develop a management plan for a maternity patient.3. Examine models of care available for maternity patients.4. interpret evidence that supports paramedic care of the maternity patient and neonate.5. Demonstrate

Read More »

Assignment Guidelines for Cabinet Submissions

Guidelines for Cabinet SubmissionsGENERALThe purpose of a Cabinet submission is to obtain Cabinet’s approval for a course of action. Ministers may not have extensive technical knowledge of the subject matter -and may have competing calls on their time. It is, therefore, important that Cabinet submissions are presented in a consistent

Read More »

Assignment Secondary research structure

Dissertation – Secondary Research – Possible Structure and Content GuideA front cover stating: student name, module title, module code, Title of project moduleleader, supervising tutor and word count.Abstract (optional and does not contribute to your word count)This should be an overview of the aim of the critical review, the methodology

Read More »

Assignment E-Business and E-Marketing

Module HandbookFaculty of Business, Computing and DigitalIndustriesSchool of Business(On-campus)E-Business and E-MarketingModule.2025-26􀀀Contents Module Handbook 1Contents 2Module Introduction 3Module Leader Welcome 3Module Guide 5Module Code and Title 5Module Leader Contact Details and Availability 5Module Team Tutors Contact Details and Availability 5Module Teaching 5Module Intended Learning Outcomes 5Summary of Content 6Assessment and Deadlines

Read More »

Assignment II: Computational Fluid Dynamics (CFD) Analysis of

CRICOS Provider 00025B • TEQSA PRV12080 1MECH3780: Computational MechanicsAssignment II: Computational Fluid Dynamics (CFD) Analysis ofGeneralised Cardiovascular Medical DevicesIntroduction:In this assignment, you will develop your CFD capability by analysing a benchmark casefrom a validation study sponsored by the U.S. Food & Drug Administration (FDA) and fundedby the FDA’s Critical Path

Read More »

LCRM301 Researching criminology

LCRM301 Researching criminology Worksheet 1 This worksheet will be disseminated to students in Week 3 and will assist them in the planning and development of the second assessment task: literature review. PART 1: Refining your topic The topic I am interested in is: I am interested in this topic because:

Read More »

ASSESSMENT TASK 2 – COURT APPLICATION

APPENDIX B: ASSESSMENT TASK 2 – COURT APPLICATION (30% OF FINAL MARK)General informationThis Assessment task is worth 30 marks of your final mark.The task is either making (Applicant) or opposing (Respondent) an application before the Supreme Court in your respective state based on a fact scenario, which will be uploaded

Read More »

Can't Find Your Assignment?