cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Visitor
Visitor
5,630 Views
Registered: ‎08-17-2011

About Schematic

Why in the schematic library i have addsub with cin out and overflow and also not to be able to synthesis as well? In xst book on hdl coding for adders sub.., i didn't find any overflow, (xst makes the adder only with cin out but no overflow is added)?

0 Kudos
Reply
3 Replies
Highlighted
Historian
Historian
5,618 Views
Registered: ‎02-25-2008


@etti411g wrote:

Why in the schematic library i have addsub with cin out and overflow and also not to be able to synthesis as well? In xst book on hdl coding for adders sub.., i didn't find any overflow, (xst makes the adder only with cin out but no overflow is added)?


If you are adding two 8-bit vectors, the result is a nine-bit vector. The MSb is the carry. You'll need to size-extend the input vectors (use the VHDL resize() function in numeric_std for that).

----------------------------Yes, I do this for a living.
0 Kudos
Reply
Highlighted
Teacher
Teacher
5,615 Views
Registered: ‎08-14-2007

Hi,

the symbols in the schematic library are created for high versatility.

So they are often offering features that you won't need in your design, while other designers use them for their designs.

 

Unused outputs can be left open.

Unused inputs have to be tied to some signal level (GND or VCC) depending on your design goals.

(e.g. if you are not using Cin of an adder, tie it to GND)

With this your synthesis should work, unless you still have other errors in your design.

 

HDL books often only explain the simple cases.

The overflow signal is only needed when working with signed numbers which are rarely covered in HDL textbooks.

It indicates when the numerical range for signed numbers has been violated, which is different from a carry.

See the schematic library documentation for details.

 

Have a nice synthesis

  Eilert

0 Kudos
Reply
Highlighted
Instructor
Instructor
5,610 Views
Registered: ‎07-21-2009

This is little more than paraphrasing what Eilert and Bassman have alread written in this thread:

 

  • When performing 8-bit signed adds and subtracts (where Bit[7], the MSB, is the sign bit), use 9-bit signed numbers instead.
  • Use 9-bit operands, sign-extend signed 8-bit numbers to 9 bits, and generate 9-bit results.
  • When assigning values to such 9-bit numbers, Bits [8] and [7] should be assigned the same value, representing the sign bit.
  • In all results and operands, Bits [7:0] represent the 8-bit signed number, with Bit[7] representing the sign bit.
  • Bits [8] and [7] should be matching copies of the sign bit.  If they do not match, an overflow (or underflow) has occurred.

The definition of overflow is where the sign bits (of a number sign-extended to infinity) are not all the same value.  This means that an arithmetic operation affected some -- but not all -- sign bits.

 

For 2-operand adds and subtracts, performing the calculation with a single extra sign bit is enough to detect overflow.

 

-- Bob Elkind

SIGNATURE:
README for newbies is here: http://forums.xilinx.com/t5/New-Users-Forum/README-first-Help-for-new-users/td-p/219369

Summary:
1. Read the manual or user guide. Have you read the manual? Can you find the manual?
2. Search the forums (and search the web) for similar topics.
3. Do not post the same question on multiple forums.
4. Do not post a new topic or question on someone else's thread, start a new thread!
5. Students: Copying code is not the same as learning to design.
6 "It does not work" is not a question which can be answered. Provide useful details (with webpage, datasheet links, please).
7. You are not charged extra fees for comments in your code.
8. I am not paid for forum posts. If I write a good post, then I have been good for nothing.
0 Kudos
Reply