+ Post New Thread
Results 1 to 17 of 17

12th June 2018, 12:40 #1
 Join Date
 Jun 2018
 Posts
 30
 Helped
 0 / 0
 Points
 166
 Level
 2
Build an Adder using VHDL
My project is 16 bits ALU using VHDL
I am requested to build an adder but not using builtin function, I have to use my own functions and library
How can I start up with codes

12th June 2018, 12:48 #2
Awards:
 Join Date
 Apr 2014
 Posts
 12,915
 Helped
 2979 / 2979
 Points
 63,172
 Level
 61
Re: Build an Adder using VHDL
Hi,
start with the theory.
* are the input values signed or unsigned?
* how does a 1+1 bit adder work?
* do you need to generate carry flag and satus flags?
* then use a pencil and paper and draw a circuit for your 16 bit adder.
* maybe do some optimizations on your circuit
* write code
* test the code. Usual random values but additionally extreme values to thest the extreme situations. Always first write down the expected results, then do the test.
KlausPlease don´t contact me via PM, because there is no time to respond to them. No friend requests. Thank you.
1 members found this post helpful.

12th June 2018, 12:53 #3
 Join Date
 Jun 2018
 Posts
 30
 Helped
 0 / 0
 Points
 166
 Level
 2
Re: Build an Adder using VHDL
can you help me with that if you have a time, please? Actually, I am run of time
Thanks in Advance

Advertisment

12th June 2018, 13:12 #4
Awards:
 Join Date
 Apr 2014
 Posts
 12,915
 Helped
 2979 / 2979
 Points
 63,172
 Level
 61
Re: Build an Adder using VHDL
Hi,
not "I", but "we", the forum.
And "help" means: You do the job, and we "help" to find mistakes.
A forum can not replace school and your own will to read documents.
> show what you have done and learned so far.
"time": We will help you to solve the technical problems, but the "time" probelm is yours. Remember: you get the informations for free.
KlausPlease don´t contact me via PM, because there is no time to respond to them. No friend requests. Thank you.

12th June 2018, 13:13 #5
 Join Date
 Jun 2010
 Posts
 6,638
 Helped
 1933 / 1933
 Points
 36,316
 Level
 46
Re: Build an Adder using VHDL
This code looks like an ALU, and it's your own post:
https://www.edaboard.com/showthread....quotquotquot

12th June 2018, 14:26 #6
 Join Date
 Jan 2008
 Location
 Bochum, Germany
 Posts
 42,844
 Helped
 13040 / 13040
 Points
 246,482
 Level
 100
Re: Build an Adder using VHDL
You can find some hints in the Altera Advanced Synthesis Cookbook https://www.altera.com/content/dam/a...x_cookbook.pdf

Advertisment

12th June 2018, 20:42 #7
 Join Date
 Jun 2018
 Posts
 30
 Helped
 0 / 0
 Points
 166
 Level
 2
Re: Build an Adder using VHDL
yes it is mine, but I want to built an adder

13th June 2018, 12:47 #8
 Join Date
 Dec 2017
 Location
 Bydgoszcz  Poland
 Posts
 53
 Helped
 8 / 8
 Points
 418
 Level
 4
Re: Build an Adder using VHDL
Hi,
try to use XOR and AND logic function to buil 1bit numbers adder with carry.
So you are trying to add: 0+0, 0+1, 1+0, 1+1
You have two outputs: bit position  after adding
carry bit  after adding
So now think how to use xor and and bool function for this purpose.
If yo have one bit adder with carry  you can build N bit adder to join 1bit adders (with carry) N times.
It is easy
Regards

Advertisment

13th June 2018, 14:24 #9
 Join Date
 May 2018
 Posts
 4
 Helped
 0 / 0
 Points
 37
 Level
 1
Re: Build an Adder using VHDL
Hi B21hasni, that may help you https://www.slideshare.net/zbhavyai/...aluusingvhdl
Best Regards

13th June 2018, 15:22 #10
 Join Date
 Jan 2008
 Location
 Germay
 Posts
 1,118
 Helped
 247 / 247
 Points
 7,582
 Level
 20
 Blog Entries
 1
Re: Build an Adder using VHDL
How can I start up with codes
Study that and then apply that concept in VHDL to model the adder (you have to use the structural coding style rather than behavioral style).
In the text book the eg might be a 4 bits adder example, but the concept can easily be extended to 16 bits. If you are a beginner, just build a 4bits adder first and completely understand how it works.
So write you code, show us what you have done and for sure further help will be available thereafter......yes, I do this for fun!

13th June 2018, 15:48 #11
 Join Date
 Sep 2013
 Location
 USA
 Posts
 6,754
 Helped
 1606 / 1606
 Points
 29,243
 Level
 41
Re: Build an Adder using VHDL
According to their other post, this is their graduation project.
FYI, they currently have 3 threads on various aspects of the same project.
At this point I'll assuming they focused on something else (Analog/RF?) and this is the first time they've done a digital design, makes me wonder why they would chose or be directed to work on a graduation project they know nothing about (digital design, VHDL, ALUs, etc). Why aren't they designing a RF power amplifier or an Analog notch filter or something equally more suited to their course work/speciality.

6th July 2018, 13:42 #12
 Join Date
 Jun 2018
 Posts
 30
 Helped
 0 / 0
 Points
 166
 Level
 2
Re: Build an Adder using VHDL
Code:library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity adder is port( a : in std_logic_vector (15 downto 0); b : in std_logic_vector (15 downto 0); s : out std_logic_vector (15 downto 0); cf : out std_logic; ovf : out std_logic ); end adder; architecture adder of adder is begin process (a,b) variable temp: std_logic_vector (16 downto 0); begin temp := ('0'& a) + ('0'& b); s<= temp(15 downto 0); cf<= temp(16); ovf<= temp(15) xor a(15) xor b(15) xor temp (16); end process; end adder;

6th July 2018, 14:51 #13
 Join Date
 Jun 2010
 Posts
 6,638
 Helped
 1933 / 1933
 Points
 36,316
 Level
 46
Re: Build an Adder using VHDL
Ovf is useless, as you have a cf output that covers the overflow. The Current OVF bit is just confusing and wrong:
x7FFF + x7FFF = cf=0, s=x"FFFE" and OVF = 1
xFFFF + xFFFF = cf = 1, s=x"FFFE" and OVF = 0
What are you trying to detect with the overflow?

6th July 2018, 18:05 #14
 Join Date
 Jun 2018
 Posts
 30
 Helped
 0 / 0
 Points
 166
 Level
 2
Re: Build an Adder using VHDL
can I say, this design is an adder??

7th July 2018, 07:05 #15
 Join Date
 Jun 2010
 Posts
 6,638
 Helped
 1933 / 1933
 Points
 36,316
 Level
 46

Advertisment

7th July 2018, 11:32 #16
 Join Date
 Jun 2018
 Posts
 30
 Helped
 0 / 0
 Points
 166
 Level
 2
Re: Build an Adder using VHDL
if I remove ovf what do I have to put instead of ovf<= temp(15) xor a(15) xor b(15) xor temp (16);

7th July 2018, 14:45 #17
 Join Date
 Jun 2010
 Posts
 6,638
 Helped
 1933 / 1933
 Points
 36,316
 Level
 46
Re: Build an Adder using VHDL
just delete it
+ Post New Thread
Please login