程序代写代做代考 C graph data structure assembly MCD4700 – Introduction to Computer Systems, Networks and Security

MCD4700 – Introduction to Computer Systems, Networks and Security
Assignment 1 – Trimester 2, 2020
Submission guidelines
This is an individual assignment, group work is not permitted
Deadline: August 12, 2020, 11:55pm
Submission format: docx for the written tasks, LogiSim circuit files for task 1, MARIE assembly files for task 2. All files must be uploaded electronically via Moodle.
Late submission:
¡ñ By submitting a Special Consideration Form or visit this link: https://lms.monashcollege.edu.au/course/view.php?id=1331
¡ñ Or, without special consideration, you lose 5 marks of your mark per day that you submit late (including weekends). Submissions will not be accepted more than 5 days late.
This means that if you got Y marks, only Y-n*5 will be counted where n is the number of days you submit late.
In-class interviews: See instructions for Task 2 for details.
Marks: This assignment will be marked out of 100 points, and count for 20% of your
total unit marks.
Plagiarism: It is an academic requirement that the work you submit be original. If there is any evidence of copying (including from online sources without proper attribution), collaboration, pasting from websites or textbooks, Zero marks may be awarded for the whole assignment, the unit or you may be suspended or excluded from your course. Monash College¡¯s policies on plagiarism, collusion, and cheating are available here or see this link: https://www.monashcollege.edu.au/__data/assets/pdf_file/0010/17101/dip-assessment-policy.pdf
Further Note: When you are asked to use Internet resources to answer a question, this does not mean copy- pasting text from websites. Write answers in your own words such that your understanding of the answer is evident. Acknowledge any sources by citing them.

1. Boolean Algebra and Logisim Task (35 marks)
Input
Output
A
B
C
D
Z1
Z2
0
0
0
0
1
0
0
0
0
1
0
1
0
0
1
0
1
0
0
0
1
1
0
1
0
1
0
0
0
1
0
1
0
1
0
1
0
1
1
0
0
1
0
1
1
1
1
0
1
0
0
0
1
0
1
0
0
1
0
0
1
0
1
0
1
0
1
0
1
1
0
1
1
1
0
0
1
0
1
1
0
1
1
0
1
1
1
0
0
0
1
1
1
1
1
0
Truth table for Z1 and Z2
Step 1: Boolean Algebra Expressions (10 marks)
Write the Boolean equation for your truth table in sum of products form (your choice). First, think about how to deal with the two outputs. Then, describe each single row in terms of Boolean algebra. Finally, combine the boolean terms for each row into a larger term. Briefly explain these steps for the truth table given.
1

Step 2: Logical Circuit in Logisim (10 marks)
Model the resulting Boolean terms from Step 1 in a single Logisim circuit, using the basic gates AND, OR, NOT. Use the original boolean expression for drawing the circuit (do not simplify the expression). You can use logic gates with more than two inputs.
To do this task you have to use a template Logisim file ¡°task_1.2_template¡± that
have been provided with this assignment. Do not forget to rename the file before saving your circuit in it. And, ¡®2¡¯ marks will be deducted if you change the labels (or adding any extra label).
Step 3: Optimised Circuit (15 marks)
The goal of this task is to find a minimal circuit (using only universal NAND gates). Based on the truth table and Boolean algebra terms from Step 1, optimize the function using Karnaugh maps.
You need to create two Karnaugh maps, one for each output. Your documentation should show the maps as well as the groups found in the maps and how they relate to terms in the optimized Boolean function.
Then use Logisim to create a logic circuit. Don¡¯t use any other gates, other than NAND.
Use the template Logisim file ¡°task_1.3_template¡± that have been provided with this assignment. Do not forget to rename it.
2

2. MARIE (65 marks)
In this task you will develop a MARIE application that performs some manipulation of strings.
We will break it down into small steps for you.
Most of the tasks require you to write code, test cases and some small analysis. The code must contain comments, and you submit it as .mas files together with the rest of your assignment. The test cases should also be working, self-contained MARIE assembly files (without requiring much input from the user). The analysis needs to be submitted as part of the main PDF file you submit for this assignment.
Name as a String
This section introduces the concepts you need for the rest of the assignment. A string is a sequence of characters. It¡¯s the basic data structure for storing text in a computer. There are several different ways of representing a string in memory and how to deal with strings of arbitrary length.
For this assignment, we will use the following string representation:
¡ñ A string is represented in contiguous memory locations, with each address containing one character.
¡ñ The characters are encoded using the ASCII encoding.
¡ñ End of a string is marked by the ASCII character ¡®.¡¯ (i.e. dot or full-stop).
¡ñ A string can be of any arbitrary length, and will be terminated by a ¡¯.¡¯, and it may
contain any of the following: alphabets (A-Z, a-z), numbers (0-9) and ASCII Space Character (Hex 020).
Here is an example. A string ¡°John Nguyen.¡± will be represented in memory (written as hexadecimal numbers):
Note that, for a string with n characters, we need (n+2) words of MARIE memory in order to store all the characters belonging to that string (including a space and a ¡®.¡¯ characters).
In MARIE assembly language programming, we can make use of the ADR command, the HEX keyword and a label ¡°myString¡± to put this string into memory:
The codes must be accompanied by appropriate comments (as a paragraph before any block
of code or subroutine or as inline comments wherever appropriate).
In-Class interviews: You will be required to demonstrate your code to your tutor after the
submission deadline. Failure to demonstrate will lead to ¡°zero marks¡± being awarded to the
entire programming part of this assignment.
04A
06F
068
06E
020
04E
067
075
079
065
06E
02E
J
o
h
n
N
g
u
y
e
n
.
3

addrMyString, ADR myString myString, HEX 04A /¡¯J¡¯ HEX 06F /¡¯o¡¯ HEX 068 /¡¯h¡¯ HEX 06E /¡¯n¡¯
HEX 020 /Space HEX 04E /¡¯N¡¯ HEX 067 /¡¯g¡¯ HEX 075 /¡¯u¡¯ HEX 079 /¡¯y¡¯ HEX 065 /¡¯e HEX 06E /¡¯n¡¯ HEX 02E /¡¯.¡¯
4

2.1 Your name as a MARIE string (5 marks)
The following example of a MARIE string ¡°nameID¡± encodes a name and an ID using ASCII characters. The ¡°name¡± is separated from the ID by an ASCII character ¡°Hex 00A¡± (New Line). Different parts of a name are separated by another ASCII character ¡°Hex 020¡± (Space). And the entire string, consisting of a name and an ID, is terminated by a dot ¡®.¡¯ character.
Please see the example below. The label ¡°addrNameID¡± holds the address of the first character of the string. You need to follow this MARIE string while solving the task given below.
addrNameID, ADR nameID
nameID, HEX 04A HEX 06F HEX 068 HEX 06E HEX 020 HEX 04E HEX 067 HEX 075 HEX 079 HEX 065 HEX 06E HEX 00A HEX 032 HEX 031 HEX 032 HEX 033 HEX 039 HEX 037 HEX 039 HEX 038 HEX 02E
/¡¯J¡¯
/¡¯o¡¯
/¡¯h¡¯
/¡¯n¡¯ /Space /¡¯N¡¯
/¡¯g¡¯
/¡¯u¡¯
/¡¯y¡¯
/¡¯e¡¯
/¡¯n¡¯
/NL(New Line) /¡¯2¡¯
/¡¯1¡¯ /¡¯2¡¯ /¡¯3¡¯ /¡¯9¡¯ /¡¯7¡¯ /¡¯9¡¯ /¡¯8¡¯ /¡¯.¡¯
Prepare a MARIE program to encode a string that includes your full name (first name and last name) and your student ID using ASCII characters. Following the above example, you need to use two labels, one label (e.g. ¡°nameID¡±) to store the first character of the string, and another label (e.g. ¡°addrNameID¡±) to store the address of the first character of the same string.
You need to submit a MARIE file that contains codes, using the ADR command and HEX keywords (like the above example), so that after assembling, your name, ID and the address (of the first character of the string) is stored in MARIE memory. The codes must be accompanied by appropriate comments (as a paragraph before any block of code or subroutine or as inline comments wherever appropriate).
5

2.2 A subroutine for printing a string (10 marks)
Prepare a MARIE subroutine called subPrintString that can print the ASCII ¡®.¡¯ terminated string of your name and your student ID that you have implemented in task 2.1. You may use the ¡°Output¡± instruction to print characters in the MARIE output space.
To receive full marks, your code needs to be in the form of a subroutine that can be called using the JnS instruction. You need to write a MARIE main program to call this subroutine. Document at least two test cases using screenshots of what the output screen (in MARIE) looks like after printing a string (one test for your name and your ID and the other test for any name and ID). The document should be written into the report.
Hint: In your main program, you need to use a label ¡°StringAdd¡± that holds the start address of the string (like, addrNameID) that you want to print. Then, you should call the subroutine subPrintString. In the subroutine, the codes should then load a character from the address ¡°StringAdd¡±, print the character, then increment the address by one, and keep doing that upto the character loaded from the address is a ¡®.¡¯ (which signals the end of the string). The output may look similar to the output below. The codes must be accompanied by appropriate comments (as a paragraph before any block of code or subroutine or as inline comments wherever appropriate).
2.3 A subroutine to accept user input (10 marks)
The next step is to implement a subroutine called subInputString that reads a string, character by character, using the Input instruction. The subroutine takes a MARIE memory
address as its argument and stores the string starting from that address. Your subroutine needs to input a character, store it at the given address, then increment the address by 1 and loop back to the input. Once a user enters a ¡®.¡¯, the subroutine returns to the main program.
Note that you can switch the input box in the MARIE simulator into different modes: use the ASCII mode to enter the characters. The subroutine also needs to print this string.
John Nguyen
21239798
6

To receive full marks, your code needs to be in the form of a subroutine that can be called using the JnS instruction. You need to write a MARIE main program to call this subroutine. Document at least two test cases using screenshots of what the memory looks like after entering a string (one test for your name and your ID and the other test for any name and ID). The codes must be accompanied by appropriate comments (as a paragraph before any block of code or subroutine or as inline comments wherever appropriate).
2.4 A Calculator (Basic) in MARIE (2.5+2.5+5+10+10=30 marks)
In this task you will develop a MARIE program that implements five basic functions of a calculator [addition (+), subtraction (-), multiplication (*), division (/) and remainder (%). The program should perform the user selected tasks (one of the mentioned mathematical operations) after the user enters one of the selection inputs, ¡®+¡¯, ¡®-¡¯, ¡®*¡¯, ¡®/¡¯, and ¡®%¡¯. Here, input ¡®+¡¯ selects addition process, ¡®-¡¯ selects subtraction process, ¡®*¡¯ selects multiplication process, ¡®/¡¯ selects division process, ¡®%¡¯ selects remainder process (you don¡¯t need to validate your input). User enters ¡®q¡¯ to quit the program. After performing the selection of tasks (+, -, *, / or %), the program will select two positive values that have been hardcoded into the memory (numA and numB) and apply the operation on them. You have to display the results in the MARIE output space. The value of numA and numB should be stored into the memory as a ¡°DEC¡± value at the end of the program (they should be the last two lines of your program).
You are required to write subroutines to perform these tasks (addition, subtraction, multiplication, division, remainder) and write a main program to process user inputs and call the appropriate subroutine. The codes must be accompanied by appropriate comments (as a paragraph before any block of code or subroutine or as inline comments wherever appropriate). Document at least one test case for each of the mathematical operations using screenshots of the output screen (in MARIE) after successful operation of these tasks (addition, subtraction, multiplication, division, remainder). You should submit the ¡°*.mas¡± file together with the rest of your assignment. Please see the screenshot in 2.5.
7

2.5 Extending the Calculator (Advance) in MARIE (10 marks) [For HD
students but everyone should do it]
In this task you will extend the ¡°Basic Calculator¡± developed in the section 2.4 by adding one more function – exponential (^). The user will enter ¡®e¡¯ to select the exponential process. The selection input should be done in ¡°Unicode¡± mode and the numbers (x and y) are hardcoded (same as 2.4). The remaining functionalities of the program stay the same as they are in section 2.4.
You are required to write an extra subroutine called (exponential) to perform the task and write a main program to process user inputs and call the appropriate subroutine. The codes
must be accompanied by appropriate comments (as a paragraph before any block of code or subroutine or as inline comments wherever appropriate). Document at least one test case for the mathematical operation using screenshots of the output screen (in MARIE) after successful operation of the task. You should submit the ¡°*.mas¡± file together with the rest of your assignment.
To get full mark for this task you should:
1- The advance calculator should include the six operations (+, -, *, /, % and ^).
2- The exponential subroutine should call the multiplication subroutine. As a fact that multiplication of two numbers A and B ( A * B) is actually summing up B, A times (or vice versa). Also, it is a fact that the exponential of two numbers A and B ( A ^ B) is actually multiplying up A, B times. Your program should call multiplication subroutine B times. Below is the screenshot of the output after entering (+, -, * , / , % and ^) respectively.
Files to be submitted:
One folder named ¡°YourFirstNameLastNameStudentID¡± containing the following files:
8

1. Report for the written tasks (One Word file called YourFirstNameLastName StudentID.doc / docx). The report should include your Full name, your student ID, your class number and your tutor¡¯s name.
2. Two Logisim files, one for task 1.2 and one for 1.3, name them LogicalCircuit.circ and OptimizedCircuit.circ respectively.
3. MARIE files for tasks 2.1 to 2.5 name them as below:
¡ñ 2_1_NameIDString.mas ¡ñ 2_2_PrintNameID.mas ¡ñ 2_3_UserInput.mas
¡ñ 2_4_Calculator.mas
¡ñ 2_5_ExtensionCalculator.mas
Zip the folder under the same name and submit it to moodle. You need to make sure there are no spaces in any of the filenames.
NOTE! Your submitted files must be correctly identified (as described above).
Any submission that does not comply will receive an automatic 10 marks penalty
(applied after marking).
9