You are provided with two implementations of a 4-bit sign-and-magnitude adder: (1) a SystemVerilog module found...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
You are provided with two implementations of a 4-bit sign-and-magnitude adder: (1) a SystemVerilog module found in sign_mag_add.svand (2) a corresponding ROM table found in truthtable4.txt. These operations can be tricky to interpret at first because you're so used to Two's Complement arithmetic. First interpret both inputs' values in sign-and-magnitude, add the two values together, and then attempt to encode the result back into sign-and-magnitude. If the result can't be properly represented, we call this arithmetic overflow. a) Complete the testbench in sign_mag_add. sv for an instance of sign_mag_add named dut1. Make sure that you include at least 8 different test cases that cover the situations listed below: Some number + 0 pos + neg > 0 pos + pos (valid) neg + neg (valid) b) Modify the following code (provided for you in sync_rom.sv) to instead work with the data found in truthtable4.txt (which you should open to view). If you open truthtable4.txt in Quartus, don't add the file to your project. module sync_rom (input input pos + neg = 0 pos + neg < 0 pos + pos (overflow) neg + neg (overflow) logic clk, logic [3:0] addr, output logic [6:0] data); // signal declaration logic [6:0] rom [0:15]; // load binary values from a dummy text file into ROM initial $readmemb ("data.txt", rom); // synchronously reads out data from requested addr always_ff @ (posedge clk) data The $readmemb argument shown ("data.txt") uses a relative path. If you encounter the following warning in ModelSim (memory will also show up as all x's and a red line): "#** Warning: (vsim-7) Failed to open readmem file "data.txt" in read mode." Solution: Replace the argument with the absolute path (e.g., "C:/371/hw2/data.txt"). c) Add an instance of sync_rom named dut2 in your testbench from Part A alongside dut1 and verify that they produce the same behavior in ModelSim. Submit your modified code files, but you do not need to include a screenshot of your simulation in hw2.pdf. d) Compare the resource usage of these two implementations. Synthesize in Quartus with sync_rom.sv and then sign_mag_add. sv as your top-level module. Find the "Resource Usage Summary" page in the Compilation Report and compare the number of ALMs and memory bits used (omission means 0). Include this comparison in your hw2.pdf. 0 1 2 3 4 5 6 7 8 9 A B C D E F 1 2 3 4 5 6 7 0 1 8 9 A B C D E 2 3 4 5 6 7 0 1 2 1 8 9 A B C D 3 4 5 6 7 0 1 2 3 2 1 89 A B C 4 5 6 7 0 1 2 3 4 3 2 18 9 A B 5 6 70 1 2 3 4 5 4 3 2 1 8 9 A 6 70 1 2 3 4 5 6 5 4 3 2 189 70 1 2 3 4 5 6 7 6 5 4 3 2 1 8 0 1 2 3 4 5 6 7 8 9 A B C D E F 9 0 1 2 3 4 5 6 9 A B C D E F 8 A 9 0 1 2 3 4 5 A B C D E F 89 BA 9 0 1 2 3 4 B C D E F 89 A C B A 9 0 1 2 3 C D E F 8 9 A B D C B A 9 0 1 2 D E F 8 9 A BC EDC BA 9 0 1 E F 8 9 A B C D FED CBA 9 0 F 8 9 A B C D E You are provided with two implementations of a 4-bit sign-and-magnitude adder: (1) a SystemVerilog module found in sign_mag_add.svand (2) a corresponding ROM table found in truthtable4.txt. These operations can be tricky to interpret at first because you're so used to Two's Complement arithmetic. First interpret both inputs' values in sign-and-magnitude, add the two values together, and then attempt to encode the result back into sign-and-magnitude. If the result can't be properly represented, we call this arithmetic overflow. a) Complete the testbench in sign_mag_add. sv for an instance of sign_mag_add named dut1. Make sure that you include at least 8 different test cases that cover the situations listed below: Some number + 0 pos + neg > 0 pos + pos (valid) neg + neg (valid) b) Modify the following code (provided for you in sync_rom.sv) to instead work with the data found in truthtable4.txt (which you should open to view). If you open truthtable4.txt in Quartus, don't add the file to your project. module sync_rom (input input pos + neg = 0 pos + neg < 0 pos + pos (overflow) neg + neg (overflow) logic clk, logic [3:0] addr, output logic [6:0] data); // signal declaration logic [6:0] rom [0:15]; // load binary values from a dummy text file into ROM initial $readmemb ("data.txt", rom); // synchronously reads out data from requested addr always_ff @ (posedge clk) data The $readmemb argument shown ("data.txt") uses a relative path. If you encounter the following warning in ModelSim (memory will also show up as all x's and a red line): "#** Warning: (vsim-7) Failed to open readmem file "data.txt" in read mode." Solution: Replace the argument with the absolute path (e.g., "C:/371/hw2/data.txt"). c) Add an instance of sync_rom named dut2 in your testbench from Part A alongside dut1 and verify that they produce the same behavior in ModelSim. Submit your modified code files, but you do not need to include a screenshot of your simulation in hw2.pdf. d) Compare the resource usage of these two implementations. Synthesize in Quartus with sync_rom.sv and then sign_mag_add. sv as your top-level module. Find the "Resource Usage Summary" page in the Compilation Report and compare the number of ALMs and memory bits used (omission means 0). Include this comparison in your hw2.pdf. 0 1 2 3 4 5 6 7 8 9 A B C D E F 1 2 3 4 5 6 7 0 1 8 9 A B C D E 2 3 4 5 6 7 0 1 2 1 8 9 A B C D 3 4 5 6 7 0 1 2 3 2 1 89 A B C 4 5 6 7 0 1 2 3 4 3 2 18 9 A B 5 6 70 1 2 3 4 5 4 3 2 1 8 9 A 6 70 1 2 3 4 5 6 5 4 3 2 189 70 1 2 3 4 5 6 7 6 5 4 3 2 1 8 0 1 2 3 4 5 6 7 8 9 A B C D E F 9 0 1 2 3 4 5 6 9 A B C D E F 8 A 9 0 1 2 3 4 5 A B C D E F 89 BA 9 0 1 2 3 4 B C D E F 89 A C B A 9 0 1 2 3 C D E F 8 9 A B D C B A 9 0 1 2 D E F 8 9 A BC EDC BA 9 0 1 E F 8 9 A B C D FED CBA 9 0 F 8 9 A B C D E
Expert Answer:
Related Book For
Accounting Principles
ISBN: 9781118566671
11th Edition
Authors: Jerry Weygandt, Paul Kimmel, Donald Kieso
Posted Date:
Students also viewed these algorithms questions
-
In this question assume that p and q are atomic formulae. (a) Compare and contrast path formulae and state formulae in temporal logic. [4 marks] (b) Describe and contrast the meanings of F(G p) and...
-
Define the contextual-equivalence relation ` M =ctx M0 : for pairs of PCF terms M, M0 , PCF types , and PCF type environments . [3 marks] (ii) For PCF terms M and N with respective typings ` M : and...
-
In Exercises find the extrema and the points of inflection (if any exist) of the function. Use a graphing utility to graph the function and confirm your results. f(x) = xe-x
-
Describe cost objects, cost drivers (activities), and cost pools and give an example of each that relates to the others. Include a discussion on cost hierarchies and how this relates to the other...
-
1. A measure of how scores scatter around the center of a distribution is a. Variance. b. Standard deviation. c. Range. d. All of the above. 2. Which of the following statements is most true about...
-
A wire has a resistance of \(0.010 \Omega\). What will the wire's resistance be if it is stretched to twice its original length without changing the volume of the wire?
-
The balance sheet accounts and amounts of the Baggett Company as of December 31, 2007 are shown in random order as follows: Required 1. Prepare a December 31, 2007 balance sheet for the Baggett...
-
You are given the following cash flows for two mutually exclusive projects If the required rate of return is 12%, which project would be chosen and why? Time Project X Project Y 0 -150,000 -150,000 1...
-
Belltown Athletic Supply (BAS) makes game jerseys for athletic teams. The F. C. Kitsap soccer club has offered to buy 100 jerseys for the teams in its league for $15 per jersey. The team price for...
-
Please prepare the report to Steve addressing the following: Illustrate the transfer of the assets to the corporation under Section 85 in Excel using the attached T2057 election form template, be...
-
When your firm hires a new employee this year, it is obligated to contribute $6,125 to a defined contribution plan for that employee, one year after the hire date. The contribution must be adjusted...
-
5. In the network of five nodes shown below, a one-on-one secure communication has to be established between every pair of nodes. That is, A and B have to securely communicate with each other; B and...
-
What information do you gain when you attend an annual conference of either the Mississippi Association of School Administrators, the Mississippi Association of High School Principals, the...
-
Q3) A grinding machine abrasive wheel has mass of 40 kg rotates at 2000 r.p.m. There is a sudden power outage. After 80 seconds later the wheel speed falls to 1200 r.p.m. The frictional resistive...
-
The chief accountant was hired by the CEO three years ago and they are close friends. The chief accountant keeps the CEO updated about the companys financial progress and discusses major accounting...
-
According to an old survey, 30% of graduate students from a bachelor program in the US register in a master program at the same university. We want to update this information using a 90% confidence...
-
What is the back work ratio? What are typical back work ratio values for gas-turbine engines?
-
What are the basic ownership rights of common stockholders in the absence of restrictive provisions?
-
At the beginning of the current season on April 1, the ledger of Kokott Pro Shop showed Cash $3,000; Inventory $4,000; and Owners Capital $7,000. These transactions occurred during April 2014. Apr. 5...
-
On May 1, R. C. Twining started RC Flying School, a company that provides flying lessons, by investing $40,000 cash in the business. Following are the assets and liabilities of the company on May 31,...
-
Using Mendels data from the experiment in Figure 2.8, conduct a chi square test to determine if the data agree with Mendels law of independent assortment. Mendels data: THE DATA P cross F1 generation...
-
How long did it take Mendel to complete the experiment in Figure 2.5? Figure 2.5 Experimental level P plants Tall Dwarf Note: The P cross produces seeds that are part of the Fi generation. Tall Self-...
-
On rare occasions, an organism may have three copies of a chromosome and therefore three copies of the genes on that chromosome (instead of the usual number of two copies). The alleles for each gene...
Study smarter with the SolutionInn App