1. Homepage
  2. Programming
  3. COMPSCI 2000 Computer Systems - Practical Assignment 5: Hack Assembly - Add, Substract, Multiply and Assembler

COMPSCI 2000 Computer Systems - Practical Assignment 5: Hack Assembly - Add, Substract, Multiply and Assembler

Engage in a Conversation
AustraliaUniversity of AdelaideHack AssemblyAssemblerCOMPSCI 2000COMPSCI2000Computer Systems

Practical Assignment 5

CourseNana.COM

Assessment Overview CourseNana.COM

  CourseNana.COM

Task description:      CourseNana.COM

  CourseNana.COM

Write Assembly programs to complete the tasks described below and an Assembler to convert those programs to Machine code. Doing so should help you to: CourseNana.COM

Understand how programs run at a low level. CourseNana.COM

Understand how programs efficiency can be affected at a low level. CourseNana.COM

Please post your questions on Piazza or ask during your workshop. CourseNana.COM


CourseNana.COM

CourseNana.COM

Your Task
You've built the computer, now it's time to start programming it! CourseNana.COM

Your task for this practical assignment is to write assembly programs for the Hack machine you've built. CourseNana.COM

1. Download this zip file containing the template and test files for this assignment. CourseNana.COM

2. Complete the ASM files and Assembler as described and as outlined below. CourseNana.COM


CourseNana.COM


CourseNana.COM

Testing Requirement
To help you develop, understand, and debug your own code you'll also need to write several test cases for each task. CourseNana.COM

These test cases will be manually reviewed after the assignment due date.
Marks for each task may be
scaled down as much as 50% for poor/missing testing.
The Gradescope autograder will run your test cases and provide
some basic feedback.
The additional resources section below includes basic instructions and guides on writing test cases. We also recommend asking your workshop supervisors for advice on testing if you're unsure.
CourseNana.COM

Low level code can be especially prone to errors. CourseNana.COM

Part 1 - Basic Programs (4 points) CourseNana.COM

In this part you'll be familiarise yourself with Hack assembly by writing a basic arithmetic program. CourseNana.COM

You'll also need to write your own tests. Take a look at the sample test file provided to see how to write your own test cases. CourseNana.COM

Task 1.1 - Add and Subtract (4 points) CourseNana.COM

Write a program in Hack assembly to calculate Complete the code in AddSub.asm CourseNana.COM

Inputs: CourseNana.COM

R1 contains the value for R2 contains the value for R3 contains the value for CourseNana.COM

Outputs:
Write your final answer to
R0 CourseNana.COM

Part 2 - Conditionals & Loops (24 points) In this part you'll be writing more complex programs that involve jumps. CourseNana.COM

Task 2.1 - Absolute Value (8 points) CourseNana.COM

Write a program in Hack assembly to calculate the absolute value Complete the code in Abs.asm CourseNana.COM

Inputs:
R1 contains the number CourseNana.COM

Outputs:
Write your final answer to
R0 CourseNana.COM

Test Cases: CourseNana.COM

(https://en.wikipedia.org/wiki/Absolute_value) of a given number. CourseNana.COM

CourseNana.COM

Write at least 3 test cases.
A sample test case is provided in
Abs00.tst
Each test case should be in a file named AbsXX.tst where XX is a number starting at 01 . You should also submit any supporting files such as CMP files.
Your mark for this task may be
scaled down for poor/missing testing. CourseNana.COM

  CourseNana.COM

Task 2.2 - Multiply (16 points) CourseNana.COM

Write a program in Hack assembly to multiply 2 numbers. Complete the code in Mult.asm CourseNana.COM

Inputs:
R1 contains the first number CourseNana.COM

R2 contains the second number Outputs: CourseNana.COM

Write your final answer to R0 CourseNana.COM

Test Cases: CourseNana.COM

Write at least 5 test cases.
A sample test case is provided in
Mult00.tst
Each test case should be in a file named MultXX.tst where XX is a number starting at 01 . You should also submit any supporting files such as CMP files.
Your mark for this task may be
scaled down for poor/missing testing. CourseNana.COM

CourseNana.COM

CourseNana.COM

Part 3 - Arrays (28 points) CourseNana.COM

It's time to apply your knowledge of Memory to work with array data structures. CourseNana.COM

Your solutions to this part will also be evaluated on efficiency; number of instructions used, with bonus points available. CourseNana.COM

Task 3.1 - Array Largest (12 points) CourseNana.COM

Write a program in Hack assembly to calculate the largest value in a given array. Complete the code in ArrMax.asm CourseNana.COM

Inputs:
R1 contains the RAM address of the first element in the array CourseNana.COM

R2 contains the length of the array Outputs: CourseNana.COM

Write your final answer to R0 CourseNana.COM

Efficiency: CourseNana.COM

Your code runs, but how efficient is it? Your code will be tested on a large data set to measure its performance compared to a basic solution. You will gain/lose as much as 2 points depending on the efficiency of your code.
Make sure you have a working solution before trying to optimise!
CourseNana.COM

Task 3.2 - Array Sort (16 points) CourseNana.COM

Write a program in Hack assembly to sort a given array in-place in descending order (largest to smallest). You may implement any sorting algorithm but should aim for a complexity of O(n2) or better.
Complete the code in
ArrSort.asm CourseNana.COM

Inputs:
R1 contains the RAM address of the first element in the array CourseNana.COM

R2 contains the length of the array Outputs: CourseNana.COM

Write your True (-1) to R0 when your program finishes.
The correctly sorted array should replace the original array in its location.
CourseNana.COM

Part 4 - Assembler (24 points) CourseNana.COM

We've written programs in assembly, but do we understand how to convert those to machine code? CourseNana.COM

Using your preferred programming language (Python, C++ or Java) implement an assembler as described below. Template files are provided for each of these programming languages. CourseNana.COM

Download the Python version HERE Download the Java version HERE Download the C++ version HERE CourseNana.COM

You will need to complete the methods provided. CourseNana.COM

Submit your completed source and test files in the same directory as your files from Parts 1-3. Only submit files for 1 programming language. CourseNana.COM

Task 4.1 - Basic Machine Code Translator (12 points) CourseNana.COM

Write code to implement the basic parsing and translation of A and C instructions. CourseNana.COM

Use the provided template files in your preferred programming language Complete the following methods: CourseNana.COM

        doSecondPass/generateMachineCode CourseNana.COM

        parseInstructionType CourseNana.COM

        parseInstructionDest CourseNana.COM

        parseInstructionJump CourseNana.COM

        parseInstructionComp CourseNana.COM

        parseSymbol CourseNana.COM

        translateDest CourseNana.COM

        translateJump CourseNana.COM

        translateComp CourseNana.COM

        translateSymbol CourseNana.COM

You may add methods, but do not modify the provided method signatures
You do not need to implement the Symbol Table or L-instructions
Submit your completed source and test files in the same directory as your files from Parts 1-3. Only submit files for 1 programming language.
CourseNana.COM

Task 4.2 - Full 2-Pass Assembler (12 points) CourseNana.COM

Write code to implement the first pass and Symbol Table. CourseNana.COM

Use the provided template files in your preferred programming language
Complete the
SymbolTable class and doFirstPass methods, as well as updating the translateSymbol method. You may add methods, but do not modify the provided method signatures
Submit your completed source and test files in the same directory as your files from Parts 1-3.
Only submit files for 1 programming language.
CourseNana.COM

Get in Touch with Our Experts

WeChat (微信) WeChat (微信)
Whatsapp WhatsApp
Australia代写,University of Adelaide代写,Hack Assembly代写,Assembler代写,COMPSCI 2000代写,COMPSCI2000代写,Computer Systems代写,Australia代编,University of Adelaide代编,Hack Assembly代编,Assembler代编,COMPSCI 2000代编,COMPSCI2000代编,Computer Systems代编,Australia代考,University of Adelaide代考,Hack Assembly代考,Assembler代考,COMPSCI 2000代考,COMPSCI2000代考,Computer Systems代考,Australiahelp,University of Adelaidehelp,Hack Assemblyhelp,Assemblerhelp,COMPSCI 2000help,COMPSCI2000help,Computer Systemshelp,Australia作业代写,University of Adelaide作业代写,Hack Assembly作业代写,Assembler作业代写,COMPSCI 2000作业代写,COMPSCI2000作业代写,Computer Systems作业代写,Australia编程代写,University of Adelaide编程代写,Hack Assembly编程代写,Assembler编程代写,COMPSCI 2000编程代写,COMPSCI2000编程代写,Computer Systems编程代写,Australiaprogramming help,University of Adelaideprogramming help,Hack Assemblyprogramming help,Assemblerprogramming help,COMPSCI 2000programming help,COMPSCI2000programming help,Computer Systemsprogramming help,Australiaassignment help,University of Adelaideassignment help,Hack Assemblyassignment help,Assemblerassignment help,COMPSCI 2000assignment help,COMPSCI2000assignment help,Computer Systemsassignment help,Australiasolution,University of Adelaidesolution,Hack Assemblysolution,Assemblersolution,COMPSCI 2000solution,COMPSCI2000solution,Computer Systemssolution,