Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Simple VHDL design- carry flag defign

Status
Not open for further replies.

laiza

Advanced Member level 4
Joined
Oct 24, 2005
Messages
115
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,296
Location
Asia
Activity points
1,995
Simple VHDL design

Hi can anyone help me with this? How can I have a code that would compare the result of 2 (16Bits) added together? I mean if I add 16 bits to another 16bits the answer should be 16 bits and if it is over 16 like 17 then it will give me "1".How am i supposed to do that on VHDL? Appreciate your brilliant logical ideas....
 

Re: Simple VHDL design

I do not know the exact VHDL syntax but I could list out the steps involved:
1. declare a 17-bit vector 'sum' and a single bit variable 'flag'.
2. Your input would be you two 16-bit numbers, lets say 'A' and 'B'.
3. After this declaration assign 'sum = A +B'.
4. Use an if statement to check your 17th bit of your variable 'sum'.
5. If sum[17] == 1 , then assert 'flag = 1' else 'flag=0'.
I hope this answers your question.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top