网络系统代写 MCD4700 – Introduction to Computer Systems, Networks and Security

MCD4700 – Introduction to Computer Systems, Networks and Security
Assignment 1 – Trimester 3, 2018

Written By: Phillip Abramson & Haidar AL-Khalidi & Ammar Haider

Submission guidelines

This is an individual assignment, group work is not permitted

Deadline​​: ​November 29, 2018, 11:55pm

Submission format: A zip file containing docx for the written tasks, Logisim circuit files for task 1, MARIE assembly files for task 2 and 3. All files must be uploaded electronically via Moodle.

Late submission:

  • ●  By submitting a ​Special Consideration Form​ or visit this link: ​https://goo.gl/xtk6n2
  • ●  Or, without special consideration, you lose 5% of your mark per day that you submit

    late (including weekends). Submissions will not be accepted more than 10 days late.

    This means that if you got ​Y marks, only (0.95n​ ​)×​Y will be counted where ​n is the number of days you submit late.

    In-class interviews:​​ See instructions for Task 2 and 3 for details.
    Marks: This assignment will be marked out of 70 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 Colleges policies on plagiarism, collusion, and cheating are ​available here or see this link: https://goo.gl/bs1ndF

    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

1. Boolean Algebra and Logisim Task ​(25 marks)

A

B

C

D

Z1

Z2

0

0

0

0

0

0

0

0

0

1

0

0

0

0

1

0

0

1

0

0

1

1

0

1

0

1

0

0

1

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

1

0

1

0

1

0

0

0

1

0

1

1

0

1

1

1

0

0

0

1

1

1

0

1

0

1

1

1

1

0

0

1

1

1

1

1

0

1

Truth table for Z1 and Z2

Step 1: Boolean Algebra Expressions ​(8 marks)

Write the Boolean equation for your truth table in sum of products form. First, think about how to deal with the two outputs. Then, describe each single row in terms of Boolean algebra. Finally, combine the terms for single rows into larger terms. Briefly explain these steps for the truth table given.

Step 2: Logical Circuit in Logisim ​(8 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 it). You can use gates with more than two inputs.
Test your optimized circuit using values from the truth table.

To do this task you have to use a template Logisim file “task_1.2_and_1.3_template” that have been provided with this assignment. Do not forget to rename it.

2

Step 3: Optimised Circuit ​(9 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 will 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 minimal circuit. Don’t use any other gates than ​NAND​​. Test your optimized circuit using values from the truth table.

Use the template Logisim file “task_1.2_and_1.3_template” that have been provided with this assignment. Do not forget to rename it.

2. MARIE Lists ​(35 marks)

This section will ask you to prepare a MARIE program which is capable of computing the range (difference between the minimum and maximum element) of a list of items. It is broken up into smaller steps for you below.

Most of the tasks require you to write code and test cases. The code must contain comments and should be submitted as .mas files together with the rest of your assignment. The test cases should also be working, self-contained MARIE assembly files.

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 for the part 2 and 3 of this assignment.

Background – Lists of data

In computer programming, quite often we have to deal with lists of numbers (or other types of data). There are different approaches to store lists in computer memory. The approach we will study here works like this: All data in the list is stored sequentially in memory, i.e. the list will occupy a contiguous block of memory. Other than list data, we also need to keep a record of list size. It will be useful whenever we have to process all the items in a list.

In a MARIE program, a list of four numbers can be defined as below. Note how we have to store size in a separate variable.

3

ListAddr, ADR List Size, Dec 4

List, Dec 2 Dec -4 Dec -1

Dec 7

Note that ​ADR ​is used to load the address of a label into another label. For example, assuming label ​List ends up in memory at address ​2A​. Now if we want to use indirect addressing instructions (e.g. ​LoadI​), we need to get the address of List (i.e., ​2A​). The ​ADR keyword will be helpful here. So the line ​ListAddr, ADR List ​will result in the value ​2A being placed at the label ​ListAddr​. So now we can use an instruction like LoadI ListAddr in order to indirectly load from the list. Try this out in the simulator to get an idea how it works.

2.1.1 Reading in a list of integers ​(7 marks)

Prepare a MARIE program which first reads in a positive integer, ​Size (representing the number of items which will be received) and then reads in a group of integers one item at a time until there are ​Size of them and stores these into memory sequentially, starting from an address which is referenced by ​ListAddr (add described in the background section). After entering all the value, display the list (use output).

2.1.2 ListInput Subroutine​ (4 marks)

Convert the above program into a ​subroutine called ​ListInput​. When the main program runs, it should call the subroutine to get size and list numbers as input from user. After entering all the values, display the list (use output).

2.2 Finding the minimum and maximum ​(14 marks)

Prepare a MARIE ​subroutine ​FindMinMax which takes the size and address of a list (​ListAddr​), and iterates over the list items to find (display) the minimum and maximum value.

As a hint, you may assume the first read item is the maximum (and minimum) and then update the maximum (or minimum) if you find any later elements exceed it (or smaller). A pseudo code of this method is given below

4

let min = first_item, max = first_item, count = size while count > 0

item = get_next_item_from_list if (item > max)

max = item if (item < min)

min = item count = count – 1

end_while

In the main program, call the ​FindMinMax subroutine and output the minimum and maximum values obtained respectively. For this task, hard code the list and the size of the list, the size should be greater than 3.

2.3 Finding the range ​(3 marks)
Prepare a MARIE program which takes the maximum and minimum of the list of items (as

determined by your code in parts 2.2) and computes the difference between them (maximum – minimum) and outputs them (minimum, maximum and range respectively). This is called range ​in statistics.

A pseudo code of this method is given below

range = max – min

2.4 Bringing it all together ​(7 marks)
Prepare a MARIE program that gives user a choice of reading in a list or compute the range of list. If user inputs ‘1’, you should call ​ListInput subroutine. When user inputs ‘2’ you should use the ​FindMinMax subroutine to find the minimum and maximum, and to calculate the range of the numbers. Display these 3 values on the output (minimum, maximum and range respectively). The program will continue in an infinite loop always asking user to enter a choice (1 or 2). If the user input ‘2’ before ‘1’, your program should include hard code list with minuman of 4 items to work with.

5

3. ROT-10 Cipher in MARIE ​(10 Marks)

In this task, you will implement a variation of classical ​Caesar Cipher​ in MARIE. In this method, a given piece of text in encrypted such that each letter is replaced by another letter some fixed number of positions down the alphabet. We will specifically work with ROT-10, i.e. letter ‘​a’​ is replaced by ‘​k’​ (which occurs 10 positions later) and so on, as shown below

Alphabet: abcdefghijklmnopqrstuvwxyz Substitution: k l m n o p q r s t u v w x y z a b c d e f g h i j

Your program should proceed as below

  • –  Receive the original text as input from the user letter by letter. You may wish to keep

    track of size of list (as done in 2.1)

  • –  User will indicate end of string by entering a ‘​0’​ character (as Unicode input)
  • –  Once all the input is complete, display the input data in the output (as Unicode)
  • –  Calculate ROT-10 encryption on the data
  • –  Only lower case letters should be encrypted. All other characters should be left as-is.
  • –  Display encrypted text in output in a new line
  • –  The ‘​0’​ character should not be displayed.

Note that you can switch the input box in the MARIE simulator into different modes: use the Unicode mode to enter and display the characters.

Below is an example of input text and encryption result. Note how capital letters and numbers remain unencrypted.
helloABC, world45 // This is the plain text (input) rovvyABC, gybvn45 // This is the Cipher text (output)

Hint: All lower case letters appear in a sequence in the Unicode/ASCII table from ​hex 61​ to hex 7A​.

6

Files to be submitted:

One folder named “YourFirstName_LastName_StudentID” containing the following files:

  1. Report for the written tasks (One Word file called YourFirstName_LastName_

    StudentID.doc / docx).

  2. Two Logisim files, one for task 1.2 and one for 1.3, name them ‘LogicalCircuit.circ’ and ‘OptimizedCircuit.circ’ respectively.
  3. Five MARIE files (*.mas) for tasks 2.1 to 2.4. Name them as below
    • ○  2.1.1 readIntegers.mas
    • ○  2.1.1 listInput.mas
    • ○  2.2 minmax.mas
    • ○  2.3 range.mas
    • ○  2.4 menu.mas
  4. One MARIE file for task 3, named ‘3 rot10.mas’

Zip the folder under the same name and submit it to moodle.

7