24/7 Customer Support
support@legitpapershub.com
info@legitpapershub.com
  • Home
  • How It Works
  • About Us
  • Our Services
  • Contact Us
  • Blog
  • Register
My Account
Order Now

24/7 Customer Support
support@legitpapershub.com
info@legitpapershub.com
  • Home
  • How It Works
  • About Us
  • Our Services
  • Contact Us
  • Blog
  • Register
My Account
Order Now

Address-based trace processing

QUESTION

 

Process the provided trace file (spice.din) and produce an output file (spice.dout) that reports each address’s number of accesses. While Haskell provides ways to convert hexadecimal to decimal (e.g., prepending 0x to each hex address in the file), you cannot use any of these approaches. If you do, you will get 0 for this part.

Instead, you need to choose between to following two options. They both require that you implement one or more specific functions (feel free to implement additional helper functions to support these required functions). You should use recursion in most of these functions.

=================================

Option 1:

hex2bin: takes each hexadecimal address and converts it to an equivalent binary value. You can extend the number of bits to 32 bits to simplify your conversion but this is not a requirement. As an example, if the hex input is “f429a”, the output of hex2bin would be “00000000000011110100001010011010”( with padding to 32-bit) or “11110100001010011010” (without padding).

To help you start this assignment, I am providing you with a starter code that has all the libraries that you can import (do not import any more libraries) and binLookup. Your hex2bin function should call binLookup to convert each hex digit to an equivalent binary value.

— copy the following code to your traceProcP1.hs
import System.IO
import Data.List
import System.Environment

binLookup :: Char -> String
binLookup ‘0’ = “0000”
binLookup ‘1’ = “0001”
binLookup ‘2’ = “0010”
binLookup ‘3’ = “0011”
binLookup ‘4’ = “0100”
binLookup ‘5’ = “0101”
binLookup ‘6’ = “0110”
binLookup ‘7’ = “0111”
binLookup ‘8’ = “1000”
binLookup ‘9’ = “1001”
binLookup ‘a’ = “1010”
binLookup ‘b’ = “1011”
binLookup ‘c’ = “1100”
binLookup ‘d’ = “1101”
binLookup ‘e’ = “1110”
binLookup ‘f’ = “1111”
binLookup j = error “Your input is not a hex digit”
— end your copy here

bin2dec: takes each output of hex2bin and converts it to a decimal value. For example, if the output of hex2bin is “00000000000011110100001010011010”, the output of bin2dec is “1000090”. Your function should calculate this value by: 2^1 + 2^3 + 2^4 + 2^7 + 2^9 + 2^14 +2^16 + 2^17 + 2^18 + 2^19 (these are the bit positions with the value of 1).

=================================

Option 2:

hex2dec: takes each hexadecimal address and converts it to an equivalent decimal value. You can modify the starter code in Option 1 to create a look-up function that converts hexadecimal to decimal.

=================================

Once you have the addresses in decimal values, you can compute the number of occurrences for each address. You need to store the information using the following type:

[(Int, Int)] -> a list of tuples where the first element of each tuple is the number of accesses and the second element is the address in decimal. Thus, the addresses should all be unique (since all duplicated addresses are accounted for in the number of accesses element).

genOutput: takes the list of tuples and produces the output file (spice.dout), where the first column contains the numbers of accesses to address; the second column contains the decimal addresses. A tab separates the two columns. Your output is sorted based on the addresses (from the lowest address to the highest address). The provided oracle file Download oracle fileillustrates the required format.

main: is the main body of the program. It invokes all the necessary functions to complete the trace processing requirements. Compare your output file (spice.dout) to the oracle file for this part using diff -w command; it should report no differences.

Sample Solutions

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus hendrerit. Pellentesque aliquet nibh nec urna. In nisi neque, aliquet vel, dapibus id, mattis vel, nisi. Sed pretium, ligula sollicitudin laoreet viverra, tortor libero sodales leo, eget blandit nunc tortor eu nibh. Nullam mollis. Ut justo. Suspendisse potenti.

Get sample solution

Order Now

Sed egestas, ante et vulputate volutpat, eros pede semper est, vitae luctus metus libero eu augue. Morbi purus libero, faucibus adipiscing, commodo quis, gravida id, est. Sed lectus. Praesent elementum hendrerit tortor. Sed semper lorem at felis. Vestibulum volutpat, lacus a ultrices sagittis, mi neque euismod dui, eu pulvinar nunc sapien ornare nisl. Phasellus pede arcu, dapibus eu, fermentum et, dapibus sed, urna.

Morbi interdum mollis sapien. Sed ac risus. Phasellus lacinia, magna a ullamcorper laoreet, lectus arcu pulvinar risus, vitae facilisis libero dolor a purus. Sed vel lacus. Mauris nibh felis, adipiscing varius, adipiscing in, lacinia vel, tellus. Suspendisse ac urna. Etiam pellentesque mauris ut lectus. Nunc tellus ante, mattis eget, gravida vitae, ultricies ac, leo. Integer leo pede, ornare a, lacinia eu, vulputate vel, nisl.

Suspendisse mauris. Fusce accumsan mollis eros. Pellentesque a diam sit amet mi ullamcorper vehicula. Integer adipiscing risus a sem. Nullam quis massa sit amet nibh viverra malesuada. Nunc sem lacus, accumsan quis, faucibus non, congue vel, arcu. Ut scelerisque hendrerit tellus. Integer sagittis. Vivamus a mauris eget arcu gravida tristique. Nunc iaculis mi in ante. Vivamus imperdiet nibh feugiat est.

Ut convallis, sem sit amet interdum consectetuer, odio augue aliquam leo, nec dapibus tortor nibh sed augue. Integer eu magna sit amet metus fermentum posuere. Morbi sit amet nulla sed dolor elementum imperdiet. Quisque fermentum. Cum sociis natoque penatibus et magnis xdis parturient montes, nascetur ridiculus mus. Pellentesque adipiscing eros ut libero. Ut condimentum mi vel tellus. Suspendisse laoreet. Fusce ut est sed dolor gravida convallis. Morbi vitae ante. Vivamus ultrices luctus nunc. Suspendisse et dolor. Etiam dignissim. Proin malesuada adipiscing lacus. Donec metus. Curabitur gravida

Share

What we also cover

Assignment writing Services

Essay writing Services

Thesis writing Services

Research Paper Services

Dissertation Services

PhD writing Services

Write My Paper
Manage Orders

Ready to order legit papers

Write My Paper

About Us

We are a solution for students. Students need to do well in school. They need to understand what they are taught and have this reflect in their grades.

Our Services

• Essay Writing Service
• Coursework Writing Service
• Report Writing
• Dissertation Writing Service
• Assignment Writing Service

 

• Essay Writing Service
• Coursework Writing Service
• Report Writing
• Dissertation Writing Service
• Assignment Writing Service

 

• Essay Writing Service
• Coursework Writing Service
• Report Writing
• Dissertation Writing Service
• Assignment Writing Service

We Accept

Contact Us

info@legitpapershub.com
support@legitpapershub.com

© 2021 legitpapershub.com. All Rights Reserved.
      WhatsApp us