Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You will now be creating the necessary set of modules to decode a twos complement binary input value and display it on the seven segment



You will now be creating the necessary set of modules to decode a twos complement binary input value and display it on the seven segment displays.

Twos Complement Background - Signed values in binary are signified by the leading bit or most significant bit (MSB) in both ones and twos complement. Negative values are represented with a leading 1 and positive values are represented by a leading 0. To represent a negative value first the binary value is determined with a minimum of one leading zero placed in front. Then the bits are complemented, each 0 becomes a 1 and each 1 becomes a 0. Once this step is complete the process in representing negative values deviates for ones complement and twos complement. In twos complement there is a final step, you add 1 to the value. To perform signed addition, the first component is to determine what version is implemented. This will be demonstrated with an example, given twos complement and 5 bits, Resul t = A + B. The leading MSB, bit 4, tells the sign of the number. The remaining bits 0-3 are for the value. Maintain the 5 bits at all times. By capping the number of bits to five it means your result may not be algebraically correct but will be correct for the implementation of the operation. The reason the result may not be correct is due to a carry into the sign bit. For example if you have A = 01000 and B = 01000 to add positive 8 plus positive 8, 3 the result should be 16, Resul t = 10000. Since the leading bit is 1, the result is negative. Converting to decimal using 2s complement the result is negative 16, which is not algebraically correct but is the correct result for the restricted signed addition. An extension further is used in subtraction. To implement subtraction in binary, we use signed addition instead. Instead of the operation F = A + B, we would implement F = A + (B). This is done through changing the sign of B and then adding it to A.

Implementation - Use switches 0-7 as the input value, containing the twos complement numbers signed 8-bit value. Display the value on HEX1 and HEX0 in hexadecimal. Display a negative sign on HEX2 if the number is negative, if the number is positive HEX2 should have all segments turned off.

Positive Values - If the number is positive, the value is displayed as is in hexadecimal form on HEX1 and HEX0.

Negative Values - To display the number if it is negative, then you will need to determine the absolute value so that you can display the correct value next to the sign. In finding the absolute value, use twos complement. The use of XOR and a ripple carry adder is one approach you may use to perform twos complement. Alternative approaches you can consider includes using multiplexers or tasks.

Demonstrate implementation on the DE2-115.





Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Research Methods For Business Students

Authors: Mark Saunders, Philip Lewis, Adrian Thornhill

8th Edition

1292208783, 978-1292208787

Students also viewed these General Management questions