Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Assembly Expert

1. Goals and Overview
1) Develop practical knowledge of x64 Assembly Language including Branches, Arithmetic and Logic Operations
2) Interface with C programs using the System V x6,4 calling convention
3) Optimize Assembly code using Conditional Moves to replace branches
4) Access unidimensional arrays using Assembly

2 Development Setup
For this programming assignment you must work individually. You will work in the CS Linux Lab located in FAB 88-09 and 88-10.

For this Homework you rr ust use x64 Assembly (AT & T Syntax) and Make. Please refrain from using C code, any language extensions or 3: party libraries. We will use the GNU Assembler (As), the GNU C Compiler (gcc) and Make already installed in the development machines in the lab.

Grading will be done in this setup so please make sure that your code works under this conditions.

3 Introduction

In this Homework we will implement a Cyclic Redundancy Check algorithm (CRC) in Assembly. CRC is an Error Detecting Algorithm based on cyclic codes. CRC is widely used in many systems including USEL Bluetooth, the Dallas 1-wire bus, Zlib and ESM and CDMA cellphone networks. It is very fast and efficient to implement in hardware and software.

CRC is computed as the polynomial division of the Message M divided by the CRC Polynomial C. The checksum takes the form of the reminder R resulting from dividing M/C. There are many variants based on different polynomials. The length of the resulting checksum depends on the length of the CRC Polynomial.

Our implementation will use CRC-8. This particular implementation of CRC output an 8-bit signature and it U5e50x5D as the CRC Polynomial,

4 Problem Description

4.1 Fast CRC Implementation
Our CRC-8 implementation will be based on the fact that the number of residues for a given CRC polynomial is fixed. So we can precompute even possible residue and use that table to compute the CRC for a given message. For the case of CRC-8 we have 256 possible residues, so the size of the precomputed CRC table i5 256 bytes.

4.2 Assembly Implementation
You are provided with a complete solution of the CRC-8 algorithm in C containing the Fast CRC-8 algorithm in crc.c and a main function that takes as parameter a string in the command line with the message and calls CRCInit0 and CRCFa5ta.

your job in this assignment: is to write a replacement of CRCInit() and CRCFast() in assembly (crca1.S). The main C function provided in hw3.c should be able to link to the new object file assembled (crca1.0). The resulting linked executable file should be named hw3al.

You must not make any changes to the structure or implementation of hw3.c and you must follow all the calling conventions necessary to interface with the provide hw3.c file.

4.3 Optimized Assembly Implementation
As mentioned in class If/Else blocks in which the outcome if difficult to predict are very impactful in the performance of modern micro architectures. To avoid this problems most modern ISA provide support of Conditional Moves in which the If/Else block can be replaced by a Conditional Move that involves no change in the Program Counter 14,.1P). As part of this Homework, you must also provide an optimized assembly version based on crcal.5 that removes the if condition in the CRCInit() function. You can identify this condition in line 30 of file crc.c. You must replace your original assembly code for this If condition with a Conditional Move and submit it as crca2.S. The main C function provided in hw3.c should be able to link to the new object file assembled (crca2.0). The resulting linked executable file should be named hw32.2.

4.3 makefile

As part of your program your solution you should augment the provided makefile so that it automatically compiles all the 3 variants of the code: Executable using C Version of CRC named hw3 (provided). Executable using Assembly Version of CRC with If/Else branches named hw3a1 and Executable using Optimized Assembly version with Conditional Move instructions named hw3a 2. Your makefile must also provide a cleanup entry (make clean) to delete all the files generated by the compilation process object files, executables, libraries, etc.)

5 Implementation Overview
You can start with the assembly 'Hello World" program discussed during class and remove the parts you do not need. These are a few key concepts you must address as part of your implementation:

1) You must create a Data segment to store global variables and a Text segment to write your code. Please consider using the following assembler directives.: .text and .data

2) You must allocate an array in the data segment to be able to hold the CRC Table. You must use an assembler directive. You might consider using .byte, .rep( and .endr

3) You must declare the names of both CRCInit and CRCFast as global symbols in your Assembly file 50 that the linker can find them and properly interface to then'. Notice that the names of these two labels in assembly need to match the names of the functions in C or the linking process will fail. Also note that the names are case sensitive. Please consider using the assembler directive .global

4) your functions must respect the System V calling conventions by preserving the values of the callee-saved registers as discussed in lecture.

5) your function must follow the System V calling Conventions for parameters passing arid function return so that your code can interface with the function caller (hw3..c).

6) Both of your assembly implementations must return the exact same values as the provided implementation in C.
6. Hand-In
For submission, you should provide only source code (*,S, *.c) and a Makefile script as outlined in

Section 4.3. More specifically you must provide the original unchanged crc.c file, the non-optimized assembly CRC version in crcla.5, the optimized assembly CRC version in crc 2a.S and the Makefile.

Please pack your files into a TAR file with the following filename structure Please replace "oclinid'' with your ODIN id.

Attachment:- hw.rar

Assembly, Programming

  • Category:- Assembly
  • Reference No.:- M92738906

Have any Question?


Related Questions in Assembly

Question a sequence string of one-byte ascii characters is

Question : A sequence (string) of one-byte ASCII characters is stored at memory location $600 onward. A second sequence of equal length is stored at memory location $700 onward. Each sequence ends with the character $0 ( ...

Really need to find a correct answer to this questionwrite

Really need to find a correct answer to this question: Write a MIPS assembly program that can search for a number that is entered by a user in an array with 20 integer number. Make sure it also prints the index of the ar ...

Task 1using masm sdk write an assembly language program

TASK 1 Using MASM SDK, write an assembly language program which converts an integer inputted via the console to binary. Your program should be well commented and well formatted. TASK 2 Using MASM SDK, write an assembly l ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As