cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
sraza
Explorer
Explorer
28,528 Views
Registered: ‎03-13-2012

2 compliment adder and divisor...need comments or correction

Dear all,

 

Please consider my following design

 

1) I have 14 bit 2' compliment input and then input 10 frames of such input and add up which means sum_width = 18 bit. 9no issue)

2) Then I use divider core and have this sum is divide by a number through this divider core.

3) Divider has both Integer and fraction part as output.

 

My question is : What should I consider for the fraction part since it is 2' compiment System/Operation?

Hence I need some sugegstion. Till now I consider that I should treat the fraction normally since to my understanding

it is no different that normal number( only difference is in dealing and this is then done inside PC with software)

 

What do you guys suggest for the fraction part, even if ignoring the software part...

Do you see any thing wrong with this...?

 

Please do comment..

 

Best Reagrds,

Shan

Tags (1)
0 Kudos
4 Replies
rcingham
Teacher
Teacher
28,523 Views
Registered: ‎09-09-2010

It's "2's complement".

It is a System Design decision as to whether you need to keep the fractional part. Ask the person who designed the overall algorithm.

------------------------------------------
"If it don't work in simulation, it won't work on the board."
0 Kudos
sraza
Explorer
Explorer
28,518 Views
Registered: ‎03-13-2012

Thank you for your reply.

 

 

Well it is me who is the algorithm designer...hehehe

 

Well I do need the fractional part, the question is not "needing or not needing"

 

I mean to ask is that should I consider the fraction part as like I consider the normal division fraction part.

Since it is the 2' compliment and not the normal number

 

But U guess I got the answer since the High Radix division algo of the divider core 3.0 from XIlinx COre Generator gives two compliments' answer (both fraction and Integer).

 

Is my guess all right. Just want an experts' opinion now...:)

 

Bests and Thanks

 

0 Kudos
eteam00
Professor
Professor
28,515 Views
Registered: ‎07-21-2009

Well it is me who is the algorithm designer...hehehe

 

Well I do need the fractional part, the question is not "needing or not needing"

 

I mean to ask is that should I consider the fraction part as like I consider the normal division fraction part.

Since it is the 2' compliment and not the normal number

 

It appears you are choosing an implementation (signed vs. unsigned partial result) before you have settled on a working algorithm.  This would be an example of putting the proverbial cart before the proverbial horse.

 

On basic principle, almost any representation of the 'fraction' can be made to work if it is used properly.  Conversely, any representation of the 'fraction' can be improperly applied, and this is quite easily demonstrated.  Design and verify the algorithm first, then choose one of the many possible implementations for the algorithm.

 

-- 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
ywu
Xilinx Employee
Xilinx Employee
28,488 Views
Registered: ‎11-28-2007

Yes, both integer and fractional results are in 2's complement format.

 


@sraza wrote:

Thank you for your reply.

 

 

Well it is me who is the algorithm designer...hehehe

 

Well I do need the fractional part, the question is not "needing or not needing"

 

I mean to ask is that should I consider the fraction part as like I consider the normal division fraction part.

Since it is the 2' compliment and not the normal number

 

But U guess I got the answer since the High Radix division algo of the divider core 3.0 from XIlinx COre Generator gives two compliments' answer (both fraction and Integer).

 

Is my guess all right. Just want an experts' opinion now...:)

 

Bests and Thanks

 




Cheers,
Jim
0 Kudos