**Your cart is currently empty!**

$ 24.99

Computer Architecture and Assembly Language

Assignment 1

(Late submissions not accepted)

Programming environment

For this assignment you must ensure your work executes correctly on the simulator within Microchip Studio 7 as installed on workstations in ECS 249. If you have installed AVR Studio on your own then you are welcome to do much of the programming work on your machine. (The IDE is available at no charge from https://bit.ly/3llENk7 but comes only in the Microsoft Windows flavour.) You must allow enough time to ensure your solutions work on the lab machines. If your submission fails to work on a lab machine, the fault is very rarely that the lab workstations. โIt worked on my machine!โ will be treated as the equivalent of โThe dog ate my homework!โ

Individual work

Objectives of this assignment

โข Understand short problem descriptions for which an assembly-language solution is required.

โข Use AVR assembly language to write solutions to three such small problems.

โข Use AVR Studio to implement, simulate and test your solution. (We will not need to use the Arduino mega2560 boards for this assignment.)

โข Hand draw a flowchart corresponding to your solution to the first problem.

Part (a): Computing Hamming distance

Consider two different byte values, first:

0b10101100

and then:

0b11101010

In order to convert one of the byte values into the other, we could flip bits in specific positions, i.e., those positions where the bits are different between the two bytes. In our example, the bits in three positions are different: positions 6, 2 and 1 (i.e., recall that bit position 7 is the leftmost bit, while bit position 0 is always the rightmost bit). We can therefore state that the Hamming distance of these two byte values is equal to three.

Your task for part (a) is to complete the code in the file named

hamming-distance.asm in the project csc230-a1-part-a provided to you. Please read the ASM file for more detail on what is required. Amongst other AVR machine instructions, you will need to use bit shift, logical AND, arithmetic ADD, and branching. Do not use functions. You must also draw by hand the flowchart of your solution and submit a scan or smartphone photo of the diagram as part of your assignment submission; please ensure this is a JPEG or PDF named

โhamming-distance-flowchart.jpgโ or โhamming-distance-flowchart.pdfโ depending on the file format you have chosen.

Part (b): Reversing the order of bits in a word

Recall that in our course we define a word to be a 16-bit sequence (i.e., two consecutive bytes). For some algorithms it is useful to have a reversed version of that 16-bit sequence. (The deeply curious can read a brief description about such use in Fast Fourier Transform algorithm implementations by visiting Wikipedia at this link: http://bit.ly/2rnvwz6).

Your task for part (b) is to complete the code in reverse.asm in the project csc230-a1-part-b provided to you. Please read the ASM file for more detail on what is required. Amongst other AVR machine instructions, you will need to use bit shift, logical AND, arithmetic ADD, and branching. Do not use functions.

Part (c): Binary Coded Decimal

9) was encoded in a four-bit field. The BCD representation of 7210 is 0b01110010,

i.e., where the left nibble (0111) represents 7 and the right nibble (0010) represents 2. A larger decimal number would therefore require more groups of four bits, that is, four bits per decimal digit.

Although it would be fun write code that converts a binary number into its BCD equivalent, for this assignment you will instead implement the other direction (BCD into its binary equivalent) as it is a bit easier to code. That is, when given a BCD number such as 0b01110010, your program will produce the binary-number equivalent of 0b01001000.

What you must submit

โข Your completed work in the three source code files

(hamming-distance.asm, reverse.asm, bcd2binary.asm). Do not change the names of these files! Please do not submit any other AVR 7 Studio project files.

โข Your work must use the provided skeleton files. Any other kinds of solutions will not be accepted. (Do not submit ZIP files containing the Microchip projects!)

โข The scan / smartphone photo of your hand-drawn flowchart with the name of โhamming-distance-flowchart.jpgโ or

โhamming-distance-flowchart.pdfโ depending on the format you have chosen.

Evaluation

โข 3 marks: Hamming-distance solution is correct for a variety of byte pairs values (part a).

โข 1 mark: Hand-drawn flowchart for Hamming-distance solution is correctly prepared (part a).

โข 3 marks: Reverse solution is correct for different word values (part b).

โข 2 marks: BCD2binary solution is correct for different values BCD values (part c).

โข 1 mark: All submitted code is properly formatted (i.e., indenting and comments are suitably used), and files correctly named. Total marks: 10

## Reviews

There are no reviews yet.